]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
config.gcc: Support "goldmont-plus".
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2018 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2018 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included in the gfdl(7) man page.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43 Only the most useful options are listed here; see below for the
44 remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), dbx(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
76
77 Other options are passed on to one or more stages of processing. Some options
78 control the preprocessor and others the compiler itself. Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
81
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly. If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
88
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++}
98 instead. @xref{Invoking G++,,Compiling C++ Programs},
99 for information about the differences in behavior between @command{gcc}
100 and @code{g++} when compiling C++ programs.
101
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands. Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
108
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments. For the most part, the order
112 you use doesn't matter. Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified. Also,
115 the placement of the @option{-l} option is significant.
116
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}. This manual documents
122 only one of these two forms, whichever one is not the default.
123
124 @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
8842 @item -ftree-loop-im
8843 @opindex ftree-loop-im
8844 Perform loop invariant motion on trees. This pass moves only invariants that
8845 are hard to handle at RTL level (function calls, operations that expand to
8846 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8847 operands of conditions that are invariant out of the loop, so that we can use
8848 just trivial invariantness analysis in loop unswitching. The pass also includes
8849 store motion.
8850
8851 @item -ftree-loop-ivcanon
8852 @opindex ftree-loop-ivcanon
8853 Create a canonical counter for number of iterations in loops for which
8854 determining number of iterations requires complicated analysis. Later
8855 optimizations then may determine the number easily. Useful especially
8856 in connection with unrolling.
8857
8858 @item -fivopts
8859 @opindex fivopts
8860 Perform induction variable optimizations (strength reduction, induction
8861 variable merging and induction variable elimination) on trees.
8862
8863 @item -ftree-parallelize-loops=n
8864 @opindex ftree-parallelize-loops
8865 Parallelize loops, i.e., split their iteration space to run in n threads.
8866 This is only possible for loops whose iterations are independent
8867 and can be arbitrarily reordered. The optimization is only
8868 profitable on multiprocessor machines, for loops that are CPU-intensive,
8869 rather than constrained e.g.@: by memory bandwidth. This option
8870 implies @option{-pthread}, and thus is only supported on targets
8871 that have support for @option{-pthread}.
8872
8873 @item -ftree-pta
8874 @opindex ftree-pta
8875 Perform function-local points-to analysis on trees. This flag is
8876 enabled by default at @option{-O} and higher.
8877
8878 @item -ftree-sra
8879 @opindex ftree-sra
8880 Perform scalar replacement of aggregates. This pass replaces structure
8881 references with scalars to prevent committing structures to memory too
8882 early. This flag is enabled by default at @option{-O} and higher.
8883
8884 @item -fstore-merging
8885 @opindex fstore-merging
8886 Perform merging of narrow stores to consecutive memory addresses. This pass
8887 merges contiguous stores of immediate values narrower than a word into fewer
8888 wider stores to reduce the number of instructions. This is enabled by default
8889 at @option{-O2} and higher as well as @option{-Os}.
8890
8891 @item -ftree-ter
8892 @opindex ftree-ter
8893 Perform temporary expression replacement during the SSA->normal phase. Single
8894 use/single def temporaries are replaced at their use location with their
8895 defining expression. This results in non-GIMPLE code, but gives the expanders
8896 much more complex trees to work on resulting in better RTL generation. This is
8897 enabled by default at @option{-O} and higher.
8898
8899 @item -ftree-slsr
8900 @opindex ftree-slsr
8901 Perform straight-line strength reduction on trees. This recognizes related
8902 expressions involving multiplications and replaces them by less expensive
8903 calculations when possible. This is enabled by default at @option{-O} and
8904 higher.
8905
8906 @item -ftree-vectorize
8907 @opindex ftree-vectorize
8908 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8909 and @option{-ftree-slp-vectorize} if not explicitly specified.
8910
8911 @item -ftree-loop-vectorize
8912 @opindex ftree-loop-vectorize
8913 Perform loop vectorization on trees. This flag is enabled by default at
8914 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8915
8916 @item -ftree-slp-vectorize
8917 @opindex ftree-slp-vectorize
8918 Perform basic block vectorization on trees. This flag is enabled by default at
8919 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8920
8921 @item -fvect-cost-model=@var{model}
8922 @opindex fvect-cost-model
8923 Alter the cost model used for vectorization. The @var{model} argument
8924 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
8925 With the @samp{unlimited} model the vectorized code-path is assumed
8926 to be profitable while with the @samp{dynamic} model a runtime check
8927 guards the vectorized code-path to enable it only for iteration
8928 counts that will likely execute faster than when executing the original
8929 scalar loop. The @samp{cheap} model disables vectorization of
8930 loops where doing so would be cost prohibitive for example due to
8931 required runtime checks for data dependence or alignment but otherwise
8932 is equal to the @samp{dynamic} model.
8933 The default cost model depends on other optimization flags and is
8934 either @samp{dynamic} or @samp{cheap}.
8935
8936 @item -fsimd-cost-model=@var{model}
8937 @opindex fsimd-cost-model
8938 Alter the cost model used for vectorization of loops marked with the OpenMP
8939 simd directive. The @var{model} argument should be one of
8940 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
8941 have the same meaning as described in @option{-fvect-cost-model} and by
8942 default a cost model defined with @option{-fvect-cost-model} is used.
8943
8944 @item -ftree-vrp
8945 @opindex ftree-vrp
8946 Perform Value Range Propagation on trees. This is similar to the
8947 constant propagation pass, but instead of values, ranges of values are
8948 propagated. This allows the optimizers to remove unnecessary range
8949 checks like array bound checks and null pointer checks. This is
8950 enabled by default at @option{-O2} and higher. Null pointer check
8951 elimination is only done if @option{-fdelete-null-pointer-checks} is
8952 enabled.
8953
8954 @item -fsplit-paths
8955 @opindex fsplit-paths
8956 Split paths leading to loop backedges. This can improve dead code
8957 elimination and common subexpression elimination. This is enabled by
8958 default at @option{-O2} and above.
8959
8960 @item -fsplit-ivs-in-unroller
8961 @opindex fsplit-ivs-in-unroller
8962 Enables expression of values of induction variables in later iterations
8963 of the unrolled loop using the value in the first iteration. This breaks
8964 long dependency chains, thus improving efficiency of the scheduling passes.
8965
8966 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8967 same effect. However, that is not reliable in cases where the loop body
8968 is more complicated than a single basic block. It also does not work at all
8969 on some architectures due to restrictions in the CSE pass.
8970
8971 This optimization is enabled by default.
8972
8973 @item -fvariable-expansion-in-unroller
8974 @opindex fvariable-expansion-in-unroller
8975 With this option, the compiler creates multiple copies of some
8976 local variables when unrolling a loop, which can result in superior code.
8977
8978 @item -fpartial-inlining
8979 @opindex fpartial-inlining
8980 Inline parts of functions. This option has any effect only
8981 when inlining itself is turned on by the @option{-finline-functions}
8982 or @option{-finline-small-functions} options.
8983
8984 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8985
8986 @item -fpredictive-commoning
8987 @opindex fpredictive-commoning
8988 Perform predictive commoning optimization, i.e., reusing computations
8989 (especially memory loads and stores) performed in previous
8990 iterations of loops.
8991
8992 This option is enabled at level @option{-O3}.
8993
8994 @item -fprefetch-loop-arrays
8995 @opindex fprefetch-loop-arrays
8996 If supported by the target machine, generate instructions to prefetch
8997 memory to improve the performance of loops that access large arrays.
8998
8999 This option may generate better or worse code; results are highly
9000 dependent on the structure of loops within the source code.
9001
9002 Disabled at level @option{-Os}.
9003
9004 @item -fno-printf-return-value
9005 @opindex fno-printf-return-value
9006 Do not substitute constants for known return value of formatted output
9007 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9008 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9009 transformation allows GCC to optimize or even eliminate branches based
9010 on the known return value of these functions called with arguments that
9011 are either constant, or whose values are known to be in a range that
9012 makes determining the exact return value possible. For example, when
9013 @option{-fprintf-return-value} is in effect, both the branch and the
9014 body of the @code{if} statement (but not the call to @code{snprint})
9015 can be optimized away when @code{i} is a 32-bit or smaller integer
9016 because the return value is guaranteed to be at most 8.
9017
9018 @smallexample
9019 char buf[9];
9020 if (snprintf (buf, "%08x", i) >= sizeof buf)
9021 @dots{}
9022 @end smallexample
9023
9024 The @option{-fprintf-return-value} option relies on other optimizations
9025 and yields best results with @option{-O2} and above. It works in tandem
9026 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9027 options. The @option{-fprintf-return-value} option is enabled by default.
9028
9029 @item -fno-peephole
9030 @itemx -fno-peephole2
9031 @opindex fno-peephole
9032 @opindex fno-peephole2
9033 Disable any machine-specific peephole optimizations. The difference
9034 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9035 are implemented in the compiler; some targets use one, some use the
9036 other, a few use both.
9037
9038 @option{-fpeephole} is enabled by default.
9039 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9040
9041 @item -fno-guess-branch-probability
9042 @opindex fno-guess-branch-probability
9043 Do not guess branch probabilities using heuristics.
9044
9045 GCC uses heuristics to guess branch probabilities if they are
9046 not provided by profiling feedback (@option{-fprofile-arcs}). These
9047 heuristics are based on the control flow graph. If some branch probabilities
9048 are specified by @code{__builtin_expect}, then the heuristics are
9049 used to guess branch probabilities for the rest of the control flow graph,
9050 taking the @code{__builtin_expect} info into account. The interactions
9051 between the heuristics and @code{__builtin_expect} can be complex, and in
9052 some cases, it may be useful to disable the heuristics so that the effects
9053 of @code{__builtin_expect} are easier to understand.
9054
9055 The default is @option{-fguess-branch-probability} at levels
9056 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9057
9058 @item -freorder-blocks
9059 @opindex freorder-blocks
9060 Reorder basic blocks in the compiled function in order to reduce number of
9061 taken branches and improve code locality.
9062
9063 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9064
9065 @item -freorder-blocks-algorithm=@var{algorithm}
9066 @opindex freorder-blocks-algorithm
9067 Use the specified algorithm for basic block reordering. The
9068 @var{algorithm} argument can be @samp{simple}, which does not increase
9069 code size (except sometimes due to secondary effects like alignment),
9070 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9071 put all often executed code together, minimizing the number of branches
9072 executed by making extra copies of code.
9073
9074 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9075 @samp{stc} at levels @option{-O2}, @option{-O3}.
9076
9077 @item -freorder-blocks-and-partition
9078 @opindex freorder-blocks-and-partition
9079 In addition to reordering basic blocks in the compiled function, in order
9080 to reduce number of taken branches, partitions hot and cold basic blocks
9081 into separate sections of the assembly and @file{.o} files, to improve
9082 paging and cache locality performance.
9083
9084 This optimization is automatically turned off in the presence of
9085 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9086 section attribute and on any architecture that does not support named
9087 sections. When @option{-fsplit-stack} is used this option is not
9088 enabled by default (to avoid linker errors), but may be enabled
9089 explicitly (if using a working linker).
9090
9091 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9092
9093 @item -freorder-functions
9094 @opindex freorder-functions
9095 Reorder functions in the object file in order to
9096 improve code locality. This is implemented by using special
9097 subsections @code{.text.hot} for most frequently executed functions and
9098 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9099 the linker so object file format must support named sections and linker must
9100 place them in a reasonable way.
9101
9102 Also profile feedback must be available to make this option effective. See
9103 @option{-fprofile-arcs} for details.
9104
9105 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9106
9107 @item -fstrict-aliasing
9108 @opindex fstrict-aliasing
9109 Allow the compiler to assume the strictest aliasing rules applicable to
9110 the language being compiled. For C (and C++), this activates
9111 optimizations based on the type of expressions. In particular, an
9112 object of one type is assumed never to reside at the same address as an
9113 object of a different type, unless the types are almost the same. For
9114 example, an @code{unsigned int} can alias an @code{int}, but not a
9115 @code{void*} or a @code{double}. A character type may alias any other
9116 type.
9117
9118 @anchor{Type-punning}Pay special attention to code like this:
9119 @smallexample
9120 union a_union @{
9121 int i;
9122 double d;
9123 @};
9124
9125 int f() @{
9126 union a_union t;
9127 t.d = 3.0;
9128 return t.i;
9129 @}
9130 @end smallexample
9131 The practice of reading from a different union member than the one most
9132 recently written to (called ``type-punning'') is common. Even with
9133 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9134 is accessed through the union type. So, the code above works as
9135 expected. @xref{Structures unions enumerations and bit-fields
9136 implementation}. However, this code might not:
9137 @smallexample
9138 int f() @{
9139 union a_union t;
9140 int* ip;
9141 t.d = 3.0;
9142 ip = &t.i;
9143 return *ip;
9144 @}
9145 @end smallexample
9146
9147 Similarly, access by taking the address, casting the resulting pointer
9148 and dereferencing the result has undefined behavior, even if the cast
9149 uses a union type, e.g.:
9150 @smallexample
9151 int f() @{
9152 double d = 3.0;
9153 return ((union a_union *) &d)->i;
9154 @}
9155 @end smallexample
9156
9157 The @option{-fstrict-aliasing} option is enabled at levels
9158 @option{-O2}, @option{-O3}, @option{-Os}.
9159
9160 @item -falign-functions
9161 @itemx -falign-functions=@var{n}
9162 @opindex falign-functions
9163 Align the start of functions to the next power-of-two greater than
9164 @var{n}, skipping up to @var{n} bytes. For instance,
9165 @option{-falign-functions=32} aligns functions to the next 32-byte
9166 boundary, but @option{-falign-functions=24} aligns to the next
9167 32-byte boundary only if this can be done by skipping 23 bytes or less.
9168
9169 @option{-fno-align-functions} and @option{-falign-functions=1} are
9170 equivalent and mean that functions are not aligned.
9171
9172 Some assemblers only support this flag when @var{n} is a power of two;
9173 in that case, it is rounded up.
9174
9175 If @var{n} is not specified or is zero, use a machine-dependent default.
9176 The maximum allowed @var{n} option value is 65536.
9177
9178 Enabled at levels @option{-O2}, @option{-O3}.
9179
9180 @item -flimit-function-alignment
9181 If this option is enabled, the compiler tries to avoid unnecessarily
9182 overaligning functions. It attempts to instruct the assembler to align
9183 by the amount specified by @option{-falign-functions}, but not to
9184 skip more bytes than the size of the function.
9185
9186 @item -falign-labels
9187 @itemx -falign-labels=@var{n}
9188 @opindex falign-labels
9189 Align all branch targets to a power-of-two boundary, skipping up to
9190 @var{n} bytes like @option{-falign-functions}. This option can easily
9191 make code slower, because it must insert dummy operations for when the
9192 branch target is reached in the usual flow of the code.
9193
9194 @option{-fno-align-labels} and @option{-falign-labels=1} are
9195 equivalent and mean that labels are not aligned.
9196
9197 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9198 are greater than this value, then their values are used instead.
9199
9200 If @var{n} is not specified or is zero, use a machine-dependent default
9201 which is very likely to be @samp{1}, meaning no alignment.
9202 The maximum allowed @var{n} option value is 65536.
9203
9204 Enabled at levels @option{-O2}, @option{-O3}.
9205
9206 @item -falign-loops
9207 @itemx -falign-loops=@var{n}
9208 @opindex falign-loops
9209 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
9210 like @option{-falign-functions}. If the loops are
9211 executed many times, this makes up for any execution of the dummy
9212 operations.
9213
9214 @option{-fno-align-loops} and @option{-falign-loops=1} are
9215 equivalent and mean that loops are not aligned.
9216 The maximum allowed @var{n} option value is 65536.
9217
9218 If @var{n} is not specified or is zero, use a machine-dependent default.
9219
9220 Enabled at levels @option{-O2}, @option{-O3}.
9221
9222 @item -falign-jumps
9223 @itemx -falign-jumps=@var{n}
9224 @opindex falign-jumps
9225 Align branch targets to a power-of-two boundary, for branch targets
9226 where the targets can only be reached by jumping, skipping up to @var{n}
9227 bytes like @option{-falign-functions}. In this case, no dummy operations
9228 need be executed.
9229
9230 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9231 equivalent and mean that loops are not aligned.
9232
9233 If @var{n} is not specified or is zero, use a machine-dependent default.
9234 The maximum allowed @var{n} option value is 65536.
9235
9236 Enabled at levels @option{-O2}, @option{-O3}.
9237
9238 @item -funit-at-a-time
9239 @opindex funit-at-a-time
9240 This option is left for compatibility reasons. @option{-funit-at-a-time}
9241 has no effect, while @option{-fno-unit-at-a-time} implies
9242 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9243
9244 Enabled by default.
9245
9246 @item -fno-toplevel-reorder
9247 @opindex fno-toplevel-reorder
9248 Do not reorder top-level functions, variables, and @code{asm}
9249 statements. Output them in the same order that they appear in the
9250 input file. When this option is used, unreferenced static variables
9251 are not removed. This option is intended to support existing code
9252 that relies on a particular ordering. For new code, it is better to
9253 use attributes when possible.
9254
9255 Enabled at level @option{-O0}. When disabled explicitly, it also implies
9256 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
9257 targets.
9258
9259 @item -fweb
9260 @opindex fweb
9261 Constructs webs as commonly used for register allocation purposes and assign
9262 each web individual pseudo register. This allows the register allocation pass
9263 to operate on pseudos directly, but also strengthens several other optimization
9264 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9265 however, make debugging impossible, since variables no longer stay in a
9266 ``home register''.
9267
9268 Enabled by default with @option{-funroll-loops}.
9269
9270 @item -fwhole-program
9271 @opindex fwhole-program
9272 Assume that the current compilation unit represents the whole program being
9273 compiled. All public functions and variables with the exception of @code{main}
9274 and those merged by attribute @code{externally_visible} become static functions
9275 and in effect are optimized more aggressively by interprocedural optimizers.
9276
9277 This option should not be used in combination with @option{-flto}.
9278 Instead relying on a linker plugin should provide safer and more precise
9279 information.
9280
9281 @item -flto[=@var{n}]
9282 @opindex flto
9283 This option runs the standard link-time optimizer. When invoked
9284 with source code, it generates GIMPLE (one of GCC's internal
9285 representations) and writes it to special ELF sections in the object
9286 file. When the object files are linked together, all the function
9287 bodies are read from these ELF sections and instantiated as if they
9288 had been part of the same translation unit.
9289
9290 To use the link-time optimizer, @option{-flto} and optimization
9291 options should be specified at compile time and during the final link.
9292 It is recommended that you compile all the files participating in the
9293 same link with the same options and also specify those options at
9294 link time.
9295 For example:
9296
9297 @smallexample
9298 gcc -c -O2 -flto foo.c
9299 gcc -c -O2 -flto bar.c
9300 gcc -o myprog -flto -O2 foo.o bar.o
9301 @end smallexample
9302
9303 The first two invocations to GCC save a bytecode representation
9304 of GIMPLE into special ELF sections inside @file{foo.o} and
9305 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9306 @file{foo.o} and @file{bar.o}, merges the two files into a single
9307 internal image, and compiles the result as usual. Since both
9308 @file{foo.o} and @file{bar.o} are merged into a single image, this
9309 causes all the interprocedural analyses and optimizations in GCC to
9310 work across the two files as if they were a single one. This means,
9311 for example, that the inliner is able to inline functions in
9312 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9313
9314 Another (simpler) way to enable link-time optimization is:
9315
9316 @smallexample
9317 gcc -o myprog -flto -O2 foo.c bar.c
9318 @end smallexample
9319
9320 The above generates bytecode for @file{foo.c} and @file{bar.c},
9321 merges them together into a single GIMPLE representation and optimizes
9322 them as usual to produce @file{myprog}.
9323
9324 The only important thing to keep in mind is that to enable link-time
9325 optimizations you need to use the GCC driver to perform the link step.
9326 GCC then automatically performs link-time optimization if any of the
9327 objects involved were compiled with the @option{-flto} command-line option.
9328 You generally
9329 should specify the optimization options to be used for link-time
9330 optimization though GCC tries to be clever at guessing an
9331 optimization level to use from the options used at compile time
9332 if you fail to specify one at link time. You can always override
9333 the automatic decision to do link-time optimization
9334 by passing @option{-fno-lto} to the link command.
9335
9336 To make whole program optimization effective, it is necessary to make
9337 certain whole program assumptions. The compiler needs to know
9338 what functions and variables can be accessed by libraries and runtime
9339 outside of the link-time optimized unit. When supported by the linker,
9340 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9341 to the compiler about used and externally visible symbols. When
9342 the linker plugin is not available, @option{-fwhole-program} should be
9343 used to allow the compiler to make these assumptions, which leads
9344 to more aggressive optimization decisions.
9345
9346 When @option{-fuse-linker-plugin} is not enabled, when a file is
9347 compiled with @option{-flto}, the generated object file is larger than
9348 a regular object file because it contains GIMPLE bytecodes and the usual
9349 final code (see @option{-ffat-lto-objects}. This means that
9350 object files with LTO information can be linked as normal object
9351 files; if @option{-fno-lto} is passed to the linker, no
9352 interprocedural optimizations are applied. Note that when
9353 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9354 but you cannot perform a regular, non-LTO link on them.
9355
9356 Additionally, the optimization flags used to compile individual files
9357 are not necessarily related to those used at link time. For instance,
9358
9359 @smallexample
9360 gcc -c -O0 -ffat-lto-objects -flto foo.c
9361 gcc -c -O0 -ffat-lto-objects -flto bar.c
9362 gcc -o myprog -O3 foo.o bar.o
9363 @end smallexample
9364
9365 This produces individual object files with unoptimized assembler
9366 code, but the resulting binary @file{myprog} is optimized at
9367 @option{-O3}. If, instead, the final binary is generated with
9368 @option{-fno-lto}, then @file{myprog} is not optimized.
9369
9370 When producing the final binary, GCC only
9371 applies link-time optimizations to those files that contain bytecode.
9372 Therefore, you can mix and match object files and libraries with
9373 GIMPLE bytecodes and final object code. GCC automatically selects
9374 which files to optimize in LTO mode and which files to link without
9375 further processing.
9376
9377 There are some code generation flags preserved by GCC when
9378 generating bytecodes, as they need to be used during the final link
9379 stage. Generally options specified at link time override those
9380 specified at compile time.
9381
9382 If you do not specify an optimization level option @option{-O} at
9383 link time, then GCC uses the highest optimization level
9384 used when compiling the object files.
9385
9386 Currently, the following options and their settings are taken from
9387 the first object file that explicitly specifies them:
9388 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9389 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9390 and all the @option{-m} target flags.
9391
9392 Certain ABI-changing flags are required to match in all compilation units,
9393 and trying to override this at link time with a conflicting value
9394 is ignored. This includes options such as @option{-freg-struct-return}
9395 and @option{-fpcc-struct-return}.
9396
9397 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9398 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9399 are passed through to the link stage and merged conservatively for
9400 conflicting translation units. Specifically
9401 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9402 precedence; and for example @option{-ffp-contract=off} takes precedence
9403 over @option{-ffp-contract=fast}. You can override them at link time.
9404
9405 If LTO encounters objects with C linkage declared with incompatible
9406 types in separate translation units to be linked together (undefined
9407 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9408 issued. The behavior is still undefined at run time. Similar
9409 diagnostics may be raised for other languages.
9410
9411 Another feature of LTO is that it is possible to apply interprocedural
9412 optimizations on files written in different languages:
9413
9414 @smallexample
9415 gcc -c -flto foo.c
9416 g++ -c -flto bar.cc
9417 gfortran -c -flto baz.f90
9418 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9419 @end smallexample
9420
9421 Notice that the final link is done with @command{g++} to get the C++
9422 runtime libraries and @option{-lgfortran} is added to get the Fortran
9423 runtime libraries. In general, when mixing languages in LTO mode, you
9424 should use the same link command options as when mixing languages in a
9425 regular (non-LTO) compilation.
9426
9427 If object files containing GIMPLE bytecode are stored in a library archive, say
9428 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9429 are using a linker with plugin support. To create static libraries suitable
9430 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9431 and @command{ranlib};
9432 to show the symbols of object files with GIMPLE bytecode, use
9433 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9434 and @command{nm} have been compiled with plugin support. At link time, use the the
9435 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9436 the LTO optimization process:
9437
9438 @smallexample
9439 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9440 @end smallexample
9441
9442 With the linker plugin enabled, the linker extracts the needed
9443 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9444 to make them part of the aggregated GIMPLE image to be optimized.
9445
9446 If you are not using a linker with plugin support and/or do not
9447 enable the linker plugin, then the objects inside @file{libfoo.a}
9448 are extracted and linked as usual, but they do not participate
9449 in the LTO optimization process. In order to make a static library suitable
9450 for both LTO optimization and usual linkage, compile its object files with
9451 @option{-flto} @option{-ffat-lto-objects}.
9452
9453 Link-time optimizations do not require the presence of the whole program to
9454 operate. If the program does not require any symbols to be exported, it is
9455 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9456 the interprocedural optimizers to use more aggressive assumptions which may
9457 lead to improved optimization opportunities.
9458 Use of @option{-fwhole-program} is not needed when linker plugin is
9459 active (see @option{-fuse-linker-plugin}).
9460
9461 The current implementation of LTO makes no
9462 attempt to generate bytecode that is portable between different
9463 types of hosts. The bytecode files are versioned and there is a
9464 strict version check, so bytecode files generated in one version of
9465 GCC do not work with an older or newer version of GCC.
9466
9467 Link-time optimization does not work well with generation of debugging
9468 information on systems other than those using a combination of ELF and
9469 DWARF.
9470
9471 If you specify the optional @var{n}, the optimization and code
9472 generation done at link time is executed in parallel using @var{n}
9473 parallel jobs by utilizing an installed @command{make} program. The
9474 environment variable @env{MAKE} may be used to override the program
9475 used. The default value for @var{n} is 1.
9476
9477 You can also specify @option{-flto=jobserver} to use GNU make's
9478 job server mode to determine the number of parallel jobs. This
9479 is useful when the Makefile calling GCC is already executing in parallel.
9480 You must prepend a @samp{+} to the command recipe in the parent Makefile
9481 for this to work. This option likely only works if @env{MAKE} is
9482 GNU make.
9483
9484 @item -flto-partition=@var{alg}
9485 @opindex flto-partition
9486 Specify the partitioning algorithm used by the link-time optimizer.
9487 The value is either @samp{1to1} to specify a partitioning mirroring
9488 the original source files or @samp{balanced} to specify partitioning
9489 into equally sized chunks (whenever possible) or @samp{max} to create
9490 new partition for every symbol where possible. Specifying @samp{none}
9491 as an algorithm disables partitioning and streaming completely.
9492 The default value is @samp{balanced}. While @samp{1to1} can be used
9493 as an workaround for various code ordering issues, the @samp{max}
9494 partitioning is intended for internal testing only.
9495 The value @samp{one} specifies that exactly one partition should be
9496 used while the value @samp{none} bypasses partitioning and executes
9497 the link-time optimization step directly from the WPA phase.
9498
9499 @item -flto-odr-type-merging
9500 @opindex flto-odr-type-merging
9501 Enable streaming of mangled types names of C++ types and their unification
9502 at link time. This increases size of LTO object files, but enables
9503 diagnostics about One Definition Rule violations.
9504
9505 @item -flto-compression-level=@var{n}
9506 @opindex flto-compression-level
9507 This option specifies the level of compression used for intermediate
9508 language written to LTO object files, and is only meaningful in
9509 conjunction with LTO mode (@option{-flto}). Valid
9510 values are 0 (no compression) to 9 (maximum compression). Values
9511 outside this range are clamped to either 0 or 9. If the option is not
9512 given, a default balanced compression setting is used.
9513
9514 @item -fuse-linker-plugin
9515 @opindex fuse-linker-plugin
9516 Enables the use of a linker plugin during link-time optimization. This
9517 option relies on plugin support in the linker, which is available in gold
9518 or in GNU ld 2.21 or newer.
9519
9520 This option enables the extraction of object files with GIMPLE bytecode out
9521 of library archives. This improves the quality of optimization by exposing
9522 more code to the link-time optimizer. This information specifies what
9523 symbols can be accessed externally (by non-LTO object or during dynamic
9524 linking). Resulting code quality improvements on binaries (and shared
9525 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9526 See @option{-flto} for a description of the effect of this flag and how to
9527 use it.
9528
9529 This option is enabled by default when LTO support in GCC is enabled
9530 and GCC was configured for use with
9531 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9532
9533 @item -ffat-lto-objects
9534 @opindex ffat-lto-objects
9535 Fat LTO objects are object files that contain both the intermediate language
9536 and the object code. This makes them usable for both LTO linking and normal
9537 linking. This option is effective only when compiling with @option{-flto}
9538 and is ignored at link time.
9539
9540 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9541 requires the complete toolchain to be aware of LTO. It requires a linker with
9542 linker plugin support for basic functionality. Additionally,
9543 @command{nm}, @command{ar} and @command{ranlib}
9544 need to support linker plugins to allow a full-featured build environment
9545 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9546 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9547 to these tools. With non fat LTO makefiles need to be modified to use them.
9548
9549 Note that modern binutils provide plugin auto-load mechanism.
9550 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
9551 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
9552 @command{gcc-ranlib}).
9553
9554 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9555 support.
9556
9557 @item -fcompare-elim
9558 @opindex fcompare-elim
9559 After register allocation and post-register allocation instruction splitting,
9560 identify arithmetic instructions that compute processor flags similar to a
9561 comparison operation based on that arithmetic. If possible, eliminate the
9562 explicit comparison operation.
9563
9564 This pass only applies to certain targets that cannot explicitly represent
9565 the comparison operation before register allocation is complete.
9566
9567 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9568
9569 @item -fcprop-registers
9570 @opindex fcprop-registers
9571 After register allocation and post-register allocation instruction splitting,
9572 perform a copy-propagation pass to try to reduce scheduling dependencies
9573 and occasionally eliminate the copy.
9574
9575 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9576
9577 @item -fprofile-correction
9578 @opindex fprofile-correction
9579 Profiles collected using an instrumented binary for multi-threaded programs may
9580 be inconsistent due to missed counter updates. When this option is specified,
9581 GCC uses heuristics to correct or smooth out such inconsistencies. By
9582 default, GCC emits an error message when an inconsistent profile is detected.
9583
9584 @item -fprofile-use
9585 @itemx -fprofile-use=@var{path}
9586 @opindex fprofile-use
9587 Enable profile feedback-directed optimizations,
9588 and the following optimizations
9589 which are generally profitable only with profile feedback available:
9590 @option{-fbranch-probabilities}, @option{-fvpt},
9591 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9592 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9593
9594 Before you can use this option, you must first generate profiling information.
9595 @xref{Instrumentation Options}, for information about the
9596 @option{-fprofile-generate} option.
9597
9598 By default, GCC emits an error message if the feedback profiles do not
9599 match the source code. This error can be turned into a warning by using
9600 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9601 code.
9602
9603 If @var{path} is specified, GCC looks at the @var{path} to find
9604 the profile feedback data files. See @option{-fprofile-dir}.
9605
9606 @item -fauto-profile
9607 @itemx -fauto-profile=@var{path}
9608 @opindex fauto-profile
9609 Enable sampling-based feedback-directed optimizations,
9610 and the following optimizations
9611 which are generally profitable only with profile feedback available:
9612 @option{-fbranch-probabilities}, @option{-fvpt},
9613 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9614 @option{-ftree-vectorize},
9615 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9616 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9617 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9618
9619 @var{path} is the name of a file containing AutoFDO profile information.
9620 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9621
9622 Producing an AutoFDO profile data file requires running your program
9623 with the @command{perf} utility on a supported GNU/Linux target system.
9624 For more information, see @uref{https://perf.wiki.kernel.org/}.
9625
9626 E.g.
9627 @smallexample
9628 perf record -e br_inst_retired:near_taken -b -o perf.data \
9629 -- your_program
9630 @end smallexample
9631
9632 Then use the @command{create_gcov} tool to convert the raw profile data
9633 to a format that can be used by GCC.@ You must also supply the
9634 unstripped binary for your program to this tool.
9635 See @uref{https://github.com/google/autofdo}.
9636
9637 E.g.
9638 @smallexample
9639 create_gcov --binary=your_program.unstripped --profile=perf.data \
9640 --gcov=profile.afdo
9641 @end smallexample
9642 @end table
9643
9644 The following options control compiler behavior regarding floating-point
9645 arithmetic. These options trade off between speed and
9646 correctness. All must be specifically enabled.
9647
9648 @table @gcctabopt
9649 @item -ffloat-store
9650 @opindex ffloat-store
9651 Do not store floating-point variables in registers, and inhibit other
9652 options that might change whether a floating-point value is taken from a
9653 register or memory.
9654
9655 @cindex floating-point precision
9656 This option prevents undesirable excess precision on machines such as
9657 the 68000 where the floating registers (of the 68881) keep more
9658 precision than a @code{double} is supposed to have. Similarly for the
9659 x86 architecture. For most programs, the excess precision does only
9660 good, but a few programs rely on the precise definition of IEEE floating
9661 point. Use @option{-ffloat-store} for such programs, after modifying
9662 them to store all pertinent intermediate computations into variables.
9663
9664 @item -fexcess-precision=@var{style}
9665 @opindex fexcess-precision
9666 This option allows further control over excess precision on machines
9667 where floating-point operations occur in a format with more precision or
9668 range than the IEEE standard and interchange floating-point types. By
9669 default, @option{-fexcess-precision=fast} is in effect; this means that
9670 operations may be carried out in a wider precision than the types specified
9671 in the source if that would result in faster code, and it is unpredictable
9672 when rounding to the types specified in the source code takes place.
9673 When compiling C, if @option{-fexcess-precision=standard} is specified then
9674 excess precision follows the rules specified in ISO C99; in particular,
9675 both casts and assignments cause values to be rounded to their
9676 semantic types (whereas @option{-ffloat-store} only affects
9677 assignments). This option is enabled by default for C if a strict
9678 conformance option such as @option{-std=c99} is used.
9679 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
9680 regardless of whether a strict conformance option is used.
9681
9682 @opindex mfpmath
9683 @option{-fexcess-precision=standard} is not implemented for languages
9684 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
9685 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9686 semantics apply without excess precision, and in the latter, rounding
9687 is unpredictable.
9688
9689 @item -ffast-math
9690 @opindex ffast-math
9691 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9692 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9693 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
9694 @option{-fexcess-precision=fast}.
9695
9696 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9697
9698 This option is not turned on by any @option{-O} option besides
9699 @option{-Ofast} since it can result in incorrect output for programs
9700 that depend on an exact implementation of IEEE or ISO rules/specifications
9701 for math functions. It may, however, yield faster code for programs
9702 that do not require the guarantees of these specifications.
9703
9704 @item -fno-math-errno
9705 @opindex fno-math-errno
9706 Do not set @code{errno} after calling math functions that are executed
9707 with a single instruction, e.g., @code{sqrt}. A program that relies on
9708 IEEE exceptions for math error handling may want to use this flag
9709 for speed while maintaining IEEE arithmetic compatibility.
9710
9711 This option is not turned on by any @option{-O} option since
9712 it can result in incorrect output for programs that depend on
9713 an exact implementation of IEEE or ISO rules/specifications for
9714 math functions. It may, however, yield faster code for programs
9715 that do not require the guarantees of these specifications.
9716
9717 The default is @option{-fmath-errno}.
9718
9719 On Darwin systems, the math library never sets @code{errno}. There is
9720 therefore no reason for the compiler to consider the possibility that
9721 it might, and @option{-fno-math-errno} is the default.
9722
9723 @item -funsafe-math-optimizations
9724 @opindex funsafe-math-optimizations
9725
9726 Allow optimizations for floating-point arithmetic that (a) assume
9727 that arguments and results are valid and (b) may violate IEEE or
9728 ANSI standards. When used at link time, it may include libraries
9729 or startup files that change the default FPU control word or other
9730 similar optimizations.
9731
9732 This option is not turned on by any @option{-O} option since
9733 it can result in incorrect output for programs that depend on
9734 an exact implementation of IEEE or ISO rules/specifications for
9735 math functions. It may, however, yield faster code for programs
9736 that do not require the guarantees of these specifications.
9737 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9738 @option{-fassociative-math} and @option{-freciprocal-math}.
9739
9740 The default is @option{-fno-unsafe-math-optimizations}.
9741
9742 @item -fassociative-math
9743 @opindex fassociative-math
9744
9745 Allow re-association of operands in series of floating-point operations.
9746 This violates the ISO C and C++ language standard by possibly changing
9747 computation result. NOTE: re-ordering may change the sign of zero as
9748 well as ignore NaNs and inhibit or create underflow or overflow (and
9749 thus cannot be used on code that relies on rounding behavior like
9750 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9751 and thus may not be used when ordered comparisons are required.
9752 This option requires that both @option{-fno-signed-zeros} and
9753 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9754 much sense with @option{-frounding-math}. For Fortran the option
9755 is automatically enabled when both @option{-fno-signed-zeros} and
9756 @option{-fno-trapping-math} are in effect.
9757
9758 The default is @option{-fno-associative-math}.
9759
9760 @item -freciprocal-math
9761 @opindex freciprocal-math
9762
9763 Allow the reciprocal of a value to be used instead of dividing by
9764 the value if this enables optimizations. For example @code{x / y}
9765 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9766 is subject to common subexpression elimination. Note that this loses
9767 precision and increases the number of flops operating on the value.
9768
9769 The default is @option{-fno-reciprocal-math}.
9770
9771 @item -ffinite-math-only
9772 @opindex ffinite-math-only
9773 Allow optimizations for floating-point arithmetic that assume
9774 that arguments and results are not NaNs or +-Infs.
9775
9776 This option is not turned on by any @option{-O} option since
9777 it can result in incorrect output for programs that depend on
9778 an exact implementation of IEEE or ISO rules/specifications for
9779 math functions. It may, however, yield faster code for programs
9780 that do not require the guarantees of these specifications.
9781
9782 The default is @option{-fno-finite-math-only}.
9783
9784 @item -fno-signed-zeros
9785 @opindex fno-signed-zeros
9786 Allow optimizations for floating-point arithmetic that ignore the
9787 signedness of zero. IEEE arithmetic specifies the behavior of
9788 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9789 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9790 This option implies that the sign of a zero result isn't significant.
9791
9792 The default is @option{-fsigned-zeros}.
9793
9794 @item -fno-trapping-math
9795 @opindex fno-trapping-math
9796 Compile code assuming that floating-point operations cannot generate
9797 user-visible traps. These traps include division by zero, overflow,
9798 underflow, inexact result and invalid operation. This option requires
9799 that @option{-fno-signaling-nans} be in effect. Setting this option may
9800 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9801
9802 This option should never be turned on by any @option{-O} option since
9803 it can result in incorrect output for programs that depend on
9804 an exact implementation of IEEE or ISO rules/specifications for
9805 math functions.
9806
9807 The default is @option{-ftrapping-math}.
9808
9809 @item -frounding-math
9810 @opindex frounding-math
9811 Disable transformations and optimizations that assume default floating-point
9812 rounding behavior. This is round-to-zero for all floating point
9813 to integer conversions, and round-to-nearest for all other arithmetic
9814 truncations. This option should be specified for programs that change
9815 the FP rounding mode dynamically, or that may be executed with a
9816 non-default rounding mode. This option disables constant folding of
9817 floating-point expressions at compile time (which may be affected by
9818 rounding mode) and arithmetic transformations that are unsafe in the
9819 presence of sign-dependent rounding modes.
9820
9821 The default is @option{-fno-rounding-math}.
9822
9823 This option is experimental and does not currently guarantee to
9824 disable all GCC optimizations that are affected by rounding mode.
9825 Future versions of GCC may provide finer control of this setting
9826 using C99's @code{FENV_ACCESS} pragma. This command-line option
9827 will be used to specify the default state for @code{FENV_ACCESS}.
9828
9829 @item -fsignaling-nans
9830 @opindex fsignaling-nans
9831 Compile code assuming that IEEE signaling NaNs may generate user-visible
9832 traps during floating-point operations. Setting this option disables
9833 optimizations that may change the number of exceptions visible with
9834 signaling NaNs. This option implies @option{-ftrapping-math}.
9835
9836 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9837 be defined.
9838
9839 The default is @option{-fno-signaling-nans}.
9840
9841 This option is experimental and does not currently guarantee to
9842 disable all GCC optimizations that affect signaling NaN behavior.
9843
9844 @item -fno-fp-int-builtin-inexact
9845 @opindex fno-fp-int-builtin-inexact
9846 Do not allow the built-in functions @code{ceil}, @code{floor},
9847 @code{round} and @code{trunc}, and their @code{float} and @code{long
9848 double} variants, to generate code that raises the ``inexact''
9849 floating-point exception for noninteger arguments. ISO C99 and C11
9850 allow these functions to raise the ``inexact'' exception, but ISO/IEC
9851 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
9852 functions to do so.
9853
9854 The default is @option{-ffp-int-builtin-inexact}, allowing the
9855 exception to be raised. This option does nothing unless
9856 @option{-ftrapping-math} is in effect.
9857
9858 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
9859 generate a call to a library function then the ``inexact'' exception
9860 may be raised if the library implementation does not follow TS 18661.
9861
9862 @item -fsingle-precision-constant
9863 @opindex fsingle-precision-constant
9864 Treat floating-point constants as single precision instead of
9865 implicitly converting them to double-precision constants.
9866
9867 @item -fcx-limited-range
9868 @opindex fcx-limited-range
9869 When enabled, this option states that a range reduction step is not
9870 needed when performing complex division. Also, there is no checking
9871 whether the result of a complex multiplication or division is @code{NaN
9872 + I*NaN}, with an attempt to rescue the situation in that case. The
9873 default is @option{-fno-cx-limited-range}, but is enabled by
9874 @option{-ffast-math}.
9875
9876 This option controls the default setting of the ISO C99
9877 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9878 all languages.
9879
9880 @item -fcx-fortran-rules
9881 @opindex fcx-fortran-rules
9882 Complex multiplication and division follow Fortran rules. Range
9883 reduction is done as part of complex division, but there is no checking
9884 whether the result of a complex multiplication or division is @code{NaN
9885 + I*NaN}, with an attempt to rescue the situation in that case.
9886
9887 The default is @option{-fno-cx-fortran-rules}.
9888
9889 @end table
9890
9891 The following options control optimizations that may improve
9892 performance, but are not enabled by any @option{-O} options. This
9893 section includes experimental options that may produce broken code.
9894
9895 @table @gcctabopt
9896 @item -fbranch-probabilities
9897 @opindex fbranch-probabilities
9898 After running a program compiled with @option{-fprofile-arcs}
9899 (@pxref{Instrumentation Options}),
9900 you can compile it a second time using
9901 @option{-fbranch-probabilities}, to improve optimizations based on
9902 the number of times each branch was taken. When a program
9903 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9904 counts to a file called @file{@var{sourcename}.gcda} for each source
9905 file. The information in this data file is very dependent on the
9906 structure of the generated code, so you must use the same source code
9907 and the same optimization options for both compilations.
9908
9909 With @option{-fbranch-probabilities}, GCC puts a
9910 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9911 These can be used to improve optimization. Currently, they are only
9912 used in one place: in @file{reorg.c}, instead of guessing which path a
9913 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9914 exactly determine which path is taken more often.
9915
9916 @item -fprofile-values
9917 @opindex fprofile-values
9918 If combined with @option{-fprofile-arcs}, it adds code so that some
9919 data about values of expressions in the program is gathered.
9920
9921 With @option{-fbranch-probabilities}, it reads back the data gathered
9922 from profiling values of expressions for usage in optimizations.
9923
9924 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9925
9926 @item -fprofile-reorder-functions
9927 @opindex fprofile-reorder-functions
9928 Function reordering based on profile instrumentation collects
9929 first time of execution of a function and orders these functions
9930 in ascending order.
9931
9932 Enabled with @option{-fprofile-use}.
9933
9934 @item -fvpt
9935 @opindex fvpt
9936 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9937 to add code to gather information about values of expressions.
9938
9939 With @option{-fbranch-probabilities}, it reads back the data gathered
9940 and actually performs the optimizations based on them.
9941 Currently the optimizations include specialization of division operations
9942 using the knowledge about the value of the denominator.
9943
9944 @item -frename-registers
9945 @opindex frename-registers
9946 Attempt to avoid false dependencies in scheduled code by making use
9947 of registers left over after register allocation. This optimization
9948 most benefits processors with lots of registers. Depending on the
9949 debug information format adopted by the target, however, it can
9950 make debugging impossible, since variables no longer stay in
9951 a ``home register''.
9952
9953 Enabled by default with @option{-funroll-loops}.
9954
9955 @item -fschedule-fusion
9956 @opindex fschedule-fusion
9957 Performs a target dependent pass over the instruction stream to schedule
9958 instructions of same type together because target machine can execute them
9959 more efficiently if they are adjacent to each other in the instruction flow.
9960
9961 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9962
9963 @item -ftracer
9964 @opindex ftracer
9965 Perform tail duplication to enlarge superblock size. This transformation
9966 simplifies the control flow of the function allowing other optimizations to do
9967 a better job.
9968
9969 Enabled with @option{-fprofile-use}.
9970
9971 @item -funroll-loops
9972 @opindex funroll-loops
9973 Unroll loops whose number of iterations can be determined at compile time or
9974 upon entry to the loop. @option{-funroll-loops} implies
9975 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9976 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9977 a small constant number of iterations). This option makes code larger, and may
9978 or may not make it run faster.
9979
9980 Enabled with @option{-fprofile-use}.
9981
9982 @item -funroll-all-loops
9983 @opindex funroll-all-loops
9984 Unroll all loops, even if their number of iterations is uncertain when
9985 the loop is entered. This usually makes programs run more slowly.
9986 @option{-funroll-all-loops} implies the same options as
9987 @option{-funroll-loops}.
9988
9989 @item -fpeel-loops
9990 @opindex fpeel-loops
9991 Peels loops for which there is enough information that they do not
9992 roll much (from profile feedback or static analysis). It also turns on
9993 complete loop peeling (i.e.@: complete removal of loops with small constant
9994 number of iterations).
9995
9996 Enabled with @option{-O3} and/or @option{-fprofile-use}.
9997
9998 @item -fmove-loop-invariants
9999 @opindex fmove-loop-invariants
10000 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10001 at level @option{-O1}
10002
10003 @item -fsplit-loops
10004 @opindex fsplit-loops
10005 Split a loop into two if it contains a condition that's always true
10006 for one side of the iteration space and false for the other.
10007
10008 @item -funswitch-loops
10009 @opindex funswitch-loops
10010 Move branches with loop invariant conditions out of the loop, with duplicates
10011 of the loop on both branches (modified according to result of the condition).
10012
10013 @item -floop-unroll-and-jam
10014 @opindex floop-unroll-and-jam
10015 Apply unroll and jam transformations on feasible loops. In a loop
10016 nest this unrolls the outer loop by some factor and fuses the resulting
10017 multiple inner loops.
10018
10019 @item -ffunction-sections
10020 @itemx -fdata-sections
10021 @opindex ffunction-sections
10022 @opindex fdata-sections
10023 Place each function or data item into its own section in the output
10024 file if the target supports arbitrary sections. The name of the
10025 function or the name of the data item determines the section's name
10026 in the output file.
10027
10028 Use these options on systems where the linker can perform optimizations to
10029 improve locality of reference in the instruction space. Most systems using the
10030 ELF object format have linkers with such optimizations. On AIX, the linker
10031 rearranges sections (CSECTs) based on the call graph. The performance impact
10032 varies.
10033
10034 Together with a linker garbage collection (linker @option{--gc-sections}
10035 option) these options may lead to smaller statically-linked executables (after
10036 stripping).
10037
10038 On ELF/DWARF systems these options do not degenerate the quality of the debug
10039 information. There could be issues with other object files/debug info formats.
10040
10041 Only use these options when there are significant benefits from doing so. When
10042 you specify these options, the assembler and linker create larger object and
10043 executable files and are also slower. These options affect code generation.
10044 They prevent optimizations by the compiler and assembler using relative
10045 locations inside a translation unit since the locations are unknown until
10046 link time. An example of such an optimization is relaxing calls to short call
10047 instructions.
10048
10049 @item -fbranch-target-load-optimize
10050 @opindex fbranch-target-load-optimize
10051 Perform branch target register load optimization before prologue / epilogue
10052 threading.
10053 The use of target registers can typically be exposed only during reload,
10054 thus hoisting loads out of loops and doing inter-block scheduling needs
10055 a separate optimization pass.
10056
10057 @item -fbranch-target-load-optimize2
10058 @opindex fbranch-target-load-optimize2
10059 Perform branch target register load optimization after prologue / epilogue
10060 threading.
10061
10062 @item -fbtr-bb-exclusive
10063 @opindex fbtr-bb-exclusive
10064 When performing branch target register load optimization, don't reuse
10065 branch target registers within any basic block.
10066
10067 @item -fstdarg-opt
10068 @opindex fstdarg-opt
10069 Optimize the prologue of variadic argument functions with respect to usage of
10070 those arguments.
10071
10072 @item -fsection-anchors
10073 @opindex fsection-anchors
10074 Try to reduce the number of symbolic address calculations by using
10075 shared ``anchor'' symbols to address nearby objects. This transformation
10076 can help to reduce the number of GOT entries and GOT accesses on some
10077 targets.
10078
10079 For example, the implementation of the following function @code{foo}:
10080
10081 @smallexample
10082 static int a, b, c;
10083 int foo (void) @{ return a + b + c; @}
10084 @end smallexample
10085
10086 @noindent
10087 usually calculates the addresses of all three variables, but if you
10088 compile it with @option{-fsection-anchors}, it accesses the variables
10089 from a common anchor point instead. The effect is similar to the
10090 following pseudocode (which isn't valid C):
10091
10092 @smallexample
10093 int foo (void)
10094 @{
10095 register int *xr = &x;
10096 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10097 @}
10098 @end smallexample
10099
10100 Not all targets support this option.
10101
10102 @item --param @var{name}=@var{value}
10103 @opindex param
10104 In some places, GCC uses various constants to control the amount of
10105 optimization that is done. For example, GCC does not inline functions
10106 that contain more than a certain number of instructions. You can
10107 control some of these constants on the command line using the
10108 @option{--param} option.
10109
10110 The names of specific parameters, and the meaning of the values, are
10111 tied to the internals of the compiler, and are subject to change
10112 without notice in future releases.
10113
10114 In each case, the @var{value} is an integer. The allowable choices for
10115 @var{name} are:
10116
10117 @table @gcctabopt
10118 @item predictable-branch-outcome
10119 When branch is predicted to be taken with probability lower than this threshold
10120 (in percent), then it is considered well predictable. The default is 10.
10121
10122 @item max-rtl-if-conversion-insns
10123 RTL if-conversion tries to remove conditional branches around a block and
10124 replace them with conditionally executed instructions. This parameter
10125 gives the maximum number of instructions in a block which should be
10126 considered for if-conversion. The default is 10, though the compiler will
10127 also use other heuristics to decide whether if-conversion is likely to be
10128 profitable.
10129
10130 @item max-rtl-if-conversion-predictable-cost
10131 @itemx max-rtl-if-conversion-unpredictable-cost
10132 RTL if-conversion will try to remove conditional branches around a block
10133 and replace them with conditionally executed instructions. These parameters
10134 give the maximum permissible cost for the sequence that would be generated
10135 by if-conversion depending on whether the branch is statically determined
10136 to be predictable or not. The units for this parameter are the same as
10137 those for the GCC internal seq_cost metric. The compiler will try to
10138 provide a reasonable default for this parameter using the BRANCH_COST
10139 target macro.
10140
10141 @item max-crossjump-edges
10142 The maximum number of incoming edges to consider for cross-jumping.
10143 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10144 the number of edges incoming to each block. Increasing values mean
10145 more aggressive optimization, making the compilation time increase with
10146 probably small improvement in executable size.
10147
10148 @item min-crossjump-insns
10149 The minimum number of instructions that must be matched at the end
10150 of two blocks before cross-jumping is performed on them. This
10151 value is ignored in the case where all instructions in the block being
10152 cross-jumped from are matched. The default value is 5.
10153
10154 @item max-grow-copy-bb-insns
10155 The maximum code size expansion factor when copying basic blocks
10156 instead of jumping. The expansion is relative to a jump instruction.
10157 The default value is 8.
10158
10159 @item max-goto-duplication-insns
10160 The maximum number of instructions to duplicate to a block that jumps
10161 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10162 passes, GCC factors computed gotos early in the compilation process,
10163 and unfactors them as late as possible. Only computed jumps at the
10164 end of a basic blocks with no more than max-goto-duplication-insns are
10165 unfactored. The default value is 8.
10166
10167 @item max-delay-slot-insn-search
10168 The maximum number of instructions to consider when looking for an
10169 instruction to fill a delay slot. If more than this arbitrary number of
10170 instructions are searched, the time savings from filling the delay slot
10171 are minimal, so stop searching. Increasing values mean more
10172 aggressive optimization, making the compilation time increase with probably
10173 small improvement in execution time.
10174
10175 @item max-delay-slot-live-search
10176 When trying to fill delay slots, the maximum number of instructions to
10177 consider when searching for a block with valid live register
10178 information. Increasing this arbitrarily chosen value means more
10179 aggressive optimization, increasing the compilation time. This parameter
10180 should be removed when the delay slot code is rewritten to maintain the
10181 control-flow graph.
10182
10183 @item max-gcse-memory
10184 The approximate maximum amount of memory that can be allocated in
10185 order to perform the global common subexpression elimination
10186 optimization. If more memory than specified is required, the
10187 optimization is not done.
10188
10189 @item max-gcse-insertion-ratio
10190 If the ratio of expression insertions to deletions is larger than this value
10191 for any expression, then RTL PRE inserts or removes the expression and thus
10192 leaves partially redundant computations in the instruction stream. The default value is 20.
10193
10194 @item max-pending-list-length
10195 The maximum number of pending dependencies scheduling allows
10196 before flushing the current state and starting over. Large functions
10197 with few branches or calls can create excessively large lists which
10198 needlessly consume memory and resources.
10199
10200 @item max-modulo-backtrack-attempts
10201 The maximum number of backtrack attempts the scheduler should make
10202 when modulo scheduling a loop. Larger values can exponentially increase
10203 compilation time.
10204
10205 @item max-inline-insns-single
10206 Several parameters control the tree inliner used in GCC@.
10207 This number sets the maximum number of instructions (counted in GCC's
10208 internal representation) in a single function that the tree inliner
10209 considers for inlining. This only affects functions declared
10210 inline and methods implemented in a class declaration (C++).
10211 The default value is 400.
10212
10213 @item max-inline-insns-auto
10214 When you use @option{-finline-functions} (included in @option{-O3}),
10215 a lot of functions that would otherwise not be considered for inlining
10216 by the compiler are investigated. To those functions, a different
10217 (more restrictive) limit compared to functions declared inline can
10218 be applied.
10219 The default value is 30.
10220
10221 @item inline-min-speedup
10222 When estimated performance improvement of caller + callee runtime exceeds this
10223 threshold (in percent), the function can be inlined regardless of the limit on
10224 @option{--param max-inline-insns-single} and @option{--param
10225 max-inline-insns-auto}.
10226 The default value is 15.
10227
10228 @item large-function-insns
10229 The limit specifying really large functions. For functions larger than this
10230 limit after inlining, inlining is constrained by
10231 @option{--param large-function-growth}. This parameter is useful primarily
10232 to avoid extreme compilation time caused by non-linear algorithms used by the
10233 back end.
10234 The default value is 2700.
10235
10236 @item large-function-growth
10237 Specifies maximal growth of large function caused by inlining in percents.
10238 The default value is 100 which limits large function growth to 2.0 times
10239 the original size.
10240
10241 @item large-unit-insns
10242 The limit specifying large translation unit. Growth caused by inlining of
10243 units larger than this limit is limited by @option{--param inline-unit-growth}.
10244 For small units this might be too tight.
10245 For example, consider a unit consisting of function A
10246 that is inline and B that just calls A three times. If B is small relative to
10247 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10248 large units consisting of small inlineable functions, however, the overall unit
10249 growth limit is needed to avoid exponential explosion of code size. Thus for
10250 smaller units, the size is increased to @option{--param large-unit-insns}
10251 before applying @option{--param inline-unit-growth}. The default is 10000.
10252
10253 @item inline-unit-growth
10254 Specifies maximal overall growth of the compilation unit caused by inlining.
10255 The default value is 20 which limits unit growth to 1.2 times the original
10256 size. Cold functions (either marked cold via an attribute or by profile
10257 feedback) are not accounted into the unit size.
10258
10259 @item ipcp-unit-growth
10260 Specifies maximal overall growth of the compilation unit caused by
10261 interprocedural constant propagation. The default value is 10 which limits
10262 unit growth to 1.1 times the original size.
10263
10264 @item large-stack-frame
10265 The limit specifying large stack frames. While inlining the algorithm is trying
10266 to not grow past this limit too much. The default value is 256 bytes.
10267
10268 @item large-stack-frame-growth
10269 Specifies maximal growth of large stack frames caused by inlining in percents.
10270 The default value is 1000 which limits large stack frame growth to 11 times
10271 the original size.
10272
10273 @item max-inline-insns-recursive
10274 @itemx max-inline-insns-recursive-auto
10275 Specifies the maximum number of instructions an out-of-line copy of a
10276 self-recursive inline
10277 function can grow into by performing recursive inlining.
10278
10279 @option{--param max-inline-insns-recursive} applies to functions
10280 declared inline.
10281 For functions not declared inline, recursive inlining
10282 happens only when @option{-finline-functions} (included in @option{-O3}) is
10283 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
10284 default value is 450.
10285
10286 @item max-inline-recursive-depth
10287 @itemx max-inline-recursive-depth-auto
10288 Specifies the maximum recursion depth used for recursive inlining.
10289
10290 @option{--param max-inline-recursive-depth} applies to functions
10291 declared inline. For functions not declared inline, recursive inlining
10292 happens only when @option{-finline-functions} (included in @option{-O3}) is
10293 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
10294 default value is 8.
10295
10296 @item min-inline-recursive-probability
10297 Recursive inlining is profitable only for function having deep recursion
10298 in average and can hurt for function having little recursion depth by
10299 increasing the prologue size or complexity of function body to other
10300 optimizers.
10301
10302 When profile feedback is available (see @option{-fprofile-generate}) the actual
10303 recursion depth can be guessed from the probability that function recurses
10304 via a given call expression. This parameter limits inlining only to call
10305 expressions whose probability exceeds the given threshold (in percents).
10306 The default value is 10.
10307
10308 @item early-inlining-insns
10309 Specify growth that the early inliner can make. In effect it increases
10310 the amount of inlining for code having a large abstraction penalty.
10311 The default value is 14.
10312
10313 @item max-early-inliner-iterations
10314 Limit of iterations of the early inliner. This basically bounds
10315 the number of nested indirect calls the early inliner can resolve.
10316 Deeper chains are still handled by late inlining.
10317
10318 @item comdat-sharing-probability
10319 Probability (in percent) that C++ inline function with comdat visibility
10320 are shared across multiple compilation units. The default value is 20.
10321
10322 @item profile-func-internal-id
10323 A parameter to control whether to use function internal id in profile
10324 database lookup. If the value is 0, the compiler uses an id that
10325 is based on function assembler name and filename, which makes old profile
10326 data more tolerant to source changes such as function reordering etc.
10327 The default value is 0.
10328
10329 @item min-vect-loop-bound
10330 The minimum number of iterations under which loops are not vectorized
10331 when @option{-ftree-vectorize} is used. The number of iterations after
10332 vectorization needs to be greater than the value specified by this option
10333 to allow vectorization. The default value is 0.
10334
10335 @item gcse-cost-distance-ratio
10336 Scaling factor in calculation of maximum distance an expression
10337 can be moved by GCSE optimizations. This is currently supported only in the
10338 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10339 is with simple expressions, i.e., the expressions that have cost
10340 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10341 hoisting of simple expressions. The default value is 10.
10342
10343 @item gcse-unrestricted-cost
10344 Cost, roughly measured as the cost of a single typical machine
10345 instruction, at which GCSE optimizations do not constrain
10346 the distance an expression can travel. This is currently
10347 supported only in the code hoisting pass. The lesser the cost,
10348 the more aggressive code hoisting is. Specifying 0
10349 allows all expressions to travel unrestricted distances.
10350 The default value is 3.
10351
10352 @item max-hoist-depth
10353 The depth of search in the dominator tree for expressions to hoist.
10354 This is used to avoid quadratic behavior in hoisting algorithm.
10355 The value of 0 does not limit on the search, but may slow down compilation
10356 of huge functions. The default value is 30.
10357
10358 @item max-tail-merge-comparisons
10359 The maximum amount of similar bbs to compare a bb with. This is used to
10360 avoid quadratic behavior in tree tail merging. The default value is 10.
10361
10362 @item max-tail-merge-iterations
10363 The maximum amount of iterations of the pass over the function. This is used to
10364 limit compilation time in tree tail merging. The default value is 2.
10365
10366 @item store-merging-allow-unaligned
10367 Allow the store merging pass to introduce unaligned stores if it is legal to
10368 do so. The default value is 1.
10369
10370 @item max-stores-to-merge
10371 The maximum number of stores to attempt to merge into wider stores in the store
10372 merging pass. The minimum value is 2 and the default is 64.
10373
10374 @item max-unrolled-insns
10375 The maximum number of instructions that a loop may have to be unrolled.
10376 If a loop is unrolled, this parameter also determines how many times
10377 the loop code is unrolled.
10378
10379 @item max-average-unrolled-insns
10380 The maximum number of instructions biased by probabilities of their execution
10381 that a loop may have to be unrolled. If a loop is unrolled,
10382 this parameter also determines how many times the loop code is unrolled.
10383
10384 @item max-unroll-times
10385 The maximum number of unrollings of a single loop.
10386
10387 @item max-peeled-insns
10388 The maximum number of instructions that a loop may have to be peeled.
10389 If a loop is peeled, this parameter also determines how many times
10390 the loop code is peeled.
10391
10392 @item max-peel-times
10393 The maximum number of peelings of a single loop.
10394
10395 @item max-peel-branches
10396 The maximum number of branches on the hot path through the peeled sequence.
10397
10398 @item max-completely-peeled-insns
10399 The maximum number of insns of a completely peeled loop.
10400
10401 @item max-completely-peel-times
10402 The maximum number of iterations of a loop to be suitable for complete peeling.
10403
10404 @item max-completely-peel-loop-nest-depth
10405 The maximum depth of a loop nest suitable for complete peeling.
10406
10407 @item max-unswitch-insns
10408 The maximum number of insns of an unswitched loop.
10409
10410 @item max-unswitch-level
10411 The maximum number of branches unswitched in a single loop.
10412
10413 @item max-loop-headers-insns
10414 The maximum number of insns in loop header duplicated by the copy loop headers
10415 pass.
10416
10417 @item lim-expensive
10418 The minimum cost of an expensive expression in the loop invariant motion.
10419
10420 @item iv-consider-all-candidates-bound
10421 Bound on number of candidates for induction variables, below which
10422 all candidates are considered for each use in induction variable
10423 optimizations. If there are more candidates than this,
10424 only the most relevant ones are considered to avoid quadratic time complexity.
10425
10426 @item iv-max-considered-uses
10427 The induction variable optimizations give up on loops that contain more
10428 induction variable uses.
10429
10430 @item iv-always-prune-cand-set-bound
10431 If the number of candidates in the set is smaller than this value,
10432 always try to remove unnecessary ivs from the set
10433 when adding a new one.
10434
10435 @item avg-loop-niter
10436 Average number of iterations of a loop.
10437
10438 @item dse-max-object-size
10439 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10440 Larger values may result in larger compilation times.
10441
10442 @item dse-max-alias-queries-per-store
10443 Maximum number of queries into the alias oracle per store.
10444 Larger values result in larger compilation times and may result in more
10445 removed dead stores.
10446
10447 @item scev-max-expr-size
10448 Bound on size of expressions used in the scalar evolutions analyzer.
10449 Large expressions slow the analyzer.
10450
10451 @item scev-max-expr-complexity
10452 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10453 Complex expressions slow the analyzer.
10454
10455 @item max-tree-if-conversion-phi-args
10456 Maximum number of arguments in a PHI supported by TREE if conversion
10457 unless the loop is marked with simd pragma.
10458
10459 @item vect-max-version-for-alignment-checks
10460 The maximum number of run-time checks that can be performed when
10461 doing loop versioning for alignment in the vectorizer.
10462
10463 @item vect-max-version-for-alias-checks
10464 The maximum number of run-time checks that can be performed when
10465 doing loop versioning for alias in the vectorizer.
10466
10467 @item vect-max-peeling-for-alignment
10468 The maximum number of loop peels to enhance access alignment
10469 for vectorizer. Value -1 means no limit.
10470
10471 @item max-iterations-to-track
10472 The maximum number of iterations of a loop the brute-force algorithm
10473 for analysis of the number of iterations of the loop tries to evaluate.
10474
10475 @item hot-bb-count-ws-permille
10476 A basic block profile count is considered hot if it contributes to
10477 the given permillage (i.e. 0...1000) of the entire profiled execution.
10478
10479 @item hot-bb-frequency-fraction
10480 Select fraction of the entry block frequency of executions of basic block in
10481 function given basic block needs to have to be considered hot.
10482
10483 @item max-predicted-iterations
10484 The maximum number of loop iterations we predict statically. This is useful
10485 in cases where a function contains a single loop with known bound and
10486 another loop with unknown bound.
10487 The known number of iterations is predicted correctly, while
10488 the unknown number of iterations average to roughly 10. This means that the
10489 loop without bounds appears artificially cold relative to the other one.
10490
10491 @item builtin-expect-probability
10492 Control the probability of the expression having the specified value. This
10493 parameter takes a percentage (i.e. 0 ... 100) as input.
10494 The default probability of 90 is obtained empirically.
10495
10496 @item align-threshold
10497
10498 Select fraction of the maximal frequency of executions of a basic block in
10499 a function to align the basic block.
10500
10501 @item align-loop-iterations
10502
10503 A loop expected to iterate at least the selected number of iterations is
10504 aligned.
10505
10506 @item tracer-dynamic-coverage
10507 @itemx tracer-dynamic-coverage-feedback
10508
10509 This value is used to limit superblock formation once the given percentage of
10510 executed instructions is covered. This limits unnecessary code size
10511 expansion.
10512
10513 The @option{tracer-dynamic-coverage-feedback} parameter
10514 is used only when profile
10515 feedback is available. The real profiles (as opposed to statically estimated
10516 ones) are much less balanced allowing the threshold to be larger value.
10517
10518 @item tracer-max-code-growth
10519 Stop tail duplication once code growth has reached given percentage. This is
10520 a rather artificial limit, as most of the duplicates are eliminated later in
10521 cross jumping, so it may be set to much higher values than is the desired code
10522 growth.
10523
10524 @item tracer-min-branch-ratio
10525
10526 Stop reverse growth when the reverse probability of best edge is less than this
10527 threshold (in percent).
10528
10529 @item tracer-min-branch-probability
10530 @itemx tracer-min-branch-probability-feedback
10531
10532 Stop forward growth if the best edge has probability lower than this
10533 threshold.
10534
10535 Similarly to @option{tracer-dynamic-coverage} two parameters are
10536 provided. @option{tracer-min-branch-probability-feedback} is used for
10537 compilation with profile feedback and @option{tracer-min-branch-probability}
10538 compilation without. The value for compilation with profile feedback
10539 needs to be more conservative (higher) in order to make tracer
10540 effective.
10541
10542 @item stack-clash-protection-guard-size
10543 Specify the size of the operating system provided stack guard as
10544 2 raised to @var{num} bytes. The default value is 12 (4096 bytes).
10545 Acceptable values are between 12 and 30. Higher values may reduce the
10546 number of explicit probes, but a value larger than the operating system
10547 provided guard will leave code vulnerable to stack clash style attacks.
10548
10549 @item stack-clash-protection-probe-interval
10550 Stack clash protection involves probing stack space as it is allocated. This
10551 param controls the maximum distance between probes into the stack as 2 raised
10552 to @var{num} bytes. Acceptable values are between 10 and 16 and defaults to
10553 12. Higher values may reduce the number of explicit probes, but a value
10554 larger than the operating system provided guard will leave code vulnerable to
10555 stack clash style attacks.
10556
10557 @item max-cse-path-length
10558
10559 The maximum number of basic blocks on path that CSE considers.
10560 The default is 10.
10561
10562 @item max-cse-insns
10563 The maximum number of instructions CSE processes before flushing.
10564 The default is 1000.
10565
10566 @item ggc-min-expand
10567
10568 GCC uses a garbage collector to manage its own memory allocation. This
10569 parameter specifies the minimum percentage by which the garbage
10570 collector's heap should be allowed to expand between collections.
10571 Tuning this may improve compilation speed; it has no effect on code
10572 generation.
10573
10574 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10575 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10576 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10577 GCC is not able to calculate RAM on a particular platform, the lower
10578 bound of 30% is used. Setting this parameter and
10579 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10580 every opportunity. This is extremely slow, but can be useful for
10581 debugging.
10582
10583 @item ggc-min-heapsize
10584
10585 Minimum size of the garbage collector's heap before it begins bothering
10586 to collect garbage. The first collection occurs after the heap expands
10587 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10588 tuning this may improve compilation speed, and has no effect on code
10589 generation.
10590
10591 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10592 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10593 with a lower bound of 4096 (four megabytes) and an upper bound of
10594 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10595 particular platform, the lower bound is used. Setting this parameter
10596 very large effectively disables garbage collection. Setting this
10597 parameter and @option{ggc-min-expand} to zero causes a full collection
10598 to occur at every opportunity.
10599
10600 @item max-reload-search-insns
10601 The maximum number of instruction reload should look backward for equivalent
10602 register. Increasing values mean more aggressive optimization, making the
10603 compilation time increase with probably slightly better performance.
10604 The default value is 100.
10605
10606 @item max-cselib-memory-locations
10607 The maximum number of memory locations cselib should take into account.
10608 Increasing values mean more aggressive optimization, making the compilation time
10609 increase with probably slightly better performance. The default value is 500.
10610
10611 @item max-sched-ready-insns
10612 The maximum number of instructions ready to be issued the scheduler should
10613 consider at any given time during the first scheduling pass. Increasing
10614 values mean more thorough searches, making the compilation time increase
10615 with probably little benefit. The default value is 100.
10616
10617 @item max-sched-region-blocks
10618 The maximum number of blocks in a region to be considered for
10619 interblock scheduling. The default value is 10.
10620
10621 @item max-pipeline-region-blocks
10622 The maximum number of blocks in a region to be considered for
10623 pipelining in the selective scheduler. The default value is 15.
10624
10625 @item max-sched-region-insns
10626 The maximum number of insns in a region to be considered for
10627 interblock scheduling. The default value is 100.
10628
10629 @item max-pipeline-region-insns
10630 The maximum number of insns in a region to be considered for
10631 pipelining in the selective scheduler. The default value is 200.
10632
10633 @item min-spec-prob
10634 The minimum probability (in percents) of reaching a source block
10635 for interblock speculative scheduling. The default value is 40.
10636
10637 @item max-sched-extend-regions-iters
10638 The maximum number of iterations through CFG to extend regions.
10639 A value of 0 (the default) disables region extensions.
10640
10641 @item max-sched-insn-conflict-delay
10642 The maximum conflict delay for an insn to be considered for speculative motion.
10643 The default value is 3.
10644
10645 @item sched-spec-prob-cutoff
10646 The minimal probability of speculation success (in percents), so that
10647 speculative insns are scheduled.
10648 The default value is 40.
10649
10650 @item sched-state-edge-prob-cutoff
10651 The minimum probability an edge must have for the scheduler to save its
10652 state across it.
10653 The default value is 10.
10654
10655 @item sched-mem-true-dep-cost
10656 Minimal distance (in CPU cycles) between store and load targeting same
10657 memory locations. The default value is 1.
10658
10659 @item selsched-max-lookahead
10660 The maximum size of the lookahead window of selective scheduling. It is a
10661 depth of search for available instructions.
10662 The default value is 50.
10663
10664 @item selsched-max-sched-times
10665 The maximum number of times that an instruction is scheduled during
10666 selective scheduling. This is the limit on the number of iterations
10667 through which the instruction may be pipelined. The default value is 2.
10668
10669 @item selsched-insns-to-rename
10670 The maximum number of best instructions in the ready list that are considered
10671 for renaming in the selective scheduler. The default value is 2.
10672
10673 @item sms-min-sc
10674 The minimum value of stage count that swing modulo scheduler
10675 generates. The default value is 2.
10676
10677 @item max-last-value-rtl
10678 The maximum size measured as number of RTLs that can be recorded in an expression
10679 in combiner for a pseudo register as last known value of that register. The default
10680 is 10000.
10681
10682 @item max-combine-insns
10683 The maximum number of instructions the RTL combiner tries to combine.
10684 The default value is 2 at @option{-Og} and 4 otherwise.
10685
10686 @item integer-share-limit
10687 Small integer constants can use a shared data structure, reducing the
10688 compiler's memory usage and increasing its speed. This sets the maximum
10689 value of a shared integer constant. The default value is 256.
10690
10691 @item ssp-buffer-size
10692 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10693 protection when @option{-fstack-protection} is used.
10694
10695 @item min-size-for-stack-sharing
10696 The minimum size of variables taking part in stack slot sharing when not
10697 optimizing. The default value is 32.
10698
10699 @item max-jump-thread-duplication-stmts
10700 Maximum number of statements allowed in a block that needs to be
10701 duplicated when threading jumps.
10702
10703 @item max-fields-for-field-sensitive
10704 Maximum number of fields in a structure treated in
10705 a field sensitive manner during pointer analysis. The default is zero
10706 for @option{-O0} and @option{-O1},
10707 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10708
10709 @item prefetch-latency
10710 Estimate on average number of instructions that are executed before
10711 prefetch finishes. The distance prefetched ahead is proportional
10712 to this constant. Increasing this number may also lead to less
10713 streams being prefetched (see @option{simultaneous-prefetches}).
10714
10715 @item simultaneous-prefetches
10716 Maximum number of prefetches that can run at the same time.
10717
10718 @item l1-cache-line-size
10719 The size of cache line in L1 cache, in bytes.
10720
10721 @item l1-cache-size
10722 The size of L1 cache, in kilobytes.
10723
10724 @item l2-cache-size
10725 The size of L2 cache, in kilobytes.
10726
10727 @item loop-interchange-max-num-stmts
10728 The maximum number of stmts in a loop to be interchanged.
10729
10730 @item loop-interchange-stride-ratio
10731 The minimum ratio between stride of two loops for interchange to be profitable.
10732
10733 @item min-insn-to-prefetch-ratio
10734 The minimum ratio between the number of instructions and the
10735 number of prefetches to enable prefetching in a loop.
10736
10737 @item prefetch-min-insn-to-mem-ratio
10738 The minimum ratio between the number of instructions and the
10739 number of memory references to enable prefetching in a loop.
10740
10741 @item use-canonical-types
10742 Whether the compiler should use the ``canonical'' type system. By
10743 default, this should always be 1, which uses a more efficient internal
10744 mechanism for comparing types in C++ and Objective-C++. However, if
10745 bugs in the canonical type system are causing compilation failures,
10746 set this value to 0 to disable canonical types.
10747
10748 @item switch-conversion-max-branch-ratio
10749 Switch initialization conversion refuses to create arrays that are
10750 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10751 branches in the switch.
10752
10753 @item max-partial-antic-length
10754 Maximum length of the partial antic set computed during the tree
10755 partial redundancy elimination optimization (@option{-ftree-pre}) when
10756 optimizing at @option{-O3} and above. For some sorts of source code
10757 the enhanced partial redundancy elimination optimization can run away,
10758 consuming all of the memory available on the host machine. This
10759 parameter sets a limit on the length of the sets that are computed,
10760 which prevents the runaway behavior. Setting a value of 0 for
10761 this parameter allows an unlimited set length.
10762
10763 @item sccvn-max-scc-size
10764 Maximum size of a strongly connected component (SCC) during SCCVN
10765 processing. If this limit is hit, SCCVN processing for the whole
10766 function is not done and optimizations depending on it are
10767 disabled. The default maximum SCC size is 10000.
10768
10769 @item sccvn-max-alias-queries-per-access
10770 Maximum number of alias-oracle queries we perform when looking for
10771 redundancies for loads and stores. If this limit is hit the search
10772 is aborted and the load or store is not considered redundant. The
10773 number of queries is algorithmically limited to the number of
10774 stores on all paths from the load to the function entry.
10775 The default maximum number of queries is 1000.
10776
10777 @item ira-max-loops-num
10778 IRA uses regional register allocation by default. If a function
10779 contains more loops than the number given by this parameter, only at most
10780 the given number of the most frequently-executed loops form regions
10781 for regional register allocation. The default value of the
10782 parameter is 100.
10783
10784 @item ira-max-conflict-table-size
10785 Although IRA uses a sophisticated algorithm to compress the conflict
10786 table, the table can still require excessive amounts of memory for
10787 huge functions. If the conflict table for a function could be more
10788 than the size in MB given by this parameter, the register allocator
10789 instead uses a faster, simpler, and lower-quality
10790 algorithm that does not require building a pseudo-register conflict table.
10791 The default value of the parameter is 2000.
10792
10793 @item ira-loop-reserved-regs
10794 IRA can be used to evaluate more accurate register pressure in loops
10795 for decisions to move loop invariants (see @option{-O3}). The number
10796 of available registers reserved for some other purposes is given
10797 by this parameter. The default value of the parameter is 2, which is
10798 the minimal number of registers needed by typical instructions.
10799 This value is the best found from numerous experiments.
10800
10801 @item lra-inheritance-ebb-probability-cutoff
10802 LRA tries to reuse values reloaded in registers in subsequent insns.
10803 This optimization is called inheritance. EBB is used as a region to
10804 do this optimization. The parameter defines a minimal fall-through
10805 edge probability in percentage used to add BB to inheritance EBB in
10806 LRA. The default value of the parameter is 40. The value was chosen
10807 from numerous runs of SPEC2000 on x86-64.
10808
10809 @item loop-invariant-max-bbs-in-loop
10810 Loop invariant motion can be very expensive, both in compilation time and
10811 in amount of needed compile-time memory, with very large loops. Loops
10812 with more basic blocks than this parameter won't have loop invariant
10813 motion optimization performed on them. The default value of the
10814 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10815
10816 @item loop-max-datarefs-for-datadeps
10817 Building data dependencies is expensive for very large loops. This
10818 parameter limits the number of data references in loops that are
10819 considered for data dependence analysis. These large loops are no
10820 handled by the optimizations using loop data dependencies.
10821 The default value is 1000.
10822
10823 @item max-vartrack-size
10824 Sets a maximum number of hash table slots to use during variable
10825 tracking dataflow analysis of any function. If this limit is exceeded
10826 with variable tracking at assignments enabled, analysis for that
10827 function is retried without it, after removing all debug insns from
10828 the function. If the limit is exceeded even without debug insns, var
10829 tracking analysis is completely disabled for the function. Setting
10830 the parameter to zero makes it unlimited.
10831
10832 @item max-vartrack-expr-depth
10833 Sets a maximum number of recursion levels when attempting to map
10834 variable names or debug temporaries to value expressions. This trades
10835 compilation time for more complete debug information. If this is set too
10836 low, value expressions that are available and could be represented in
10837 debug information may end up not being used; setting this higher may
10838 enable the compiler to find more complex debug expressions, but compile
10839 time and memory use may grow. The default is 12.
10840
10841 @item max-debug-marker-count
10842 Sets a threshold on the number of debug markers (e.g. begin stmt
10843 markers) to avoid complexity explosion at inlining or expanding to RTL.
10844 If a function has more such gimple stmts than the set limit, such stmts
10845 will be dropped from the inlined copy of a function, and from its RTL
10846 expansion. The default is 100000.
10847
10848 @item min-nondebug-insn-uid
10849 Use uids starting at this parameter for nondebug insns. The range below
10850 the parameter is reserved exclusively for debug insns created by
10851 @option{-fvar-tracking-assignments}, but debug insns may get
10852 (non-overlapping) uids above it if the reserved range is exhausted.
10853
10854 @item ipa-sra-ptr-growth-factor
10855 IPA-SRA replaces a pointer to an aggregate with one or more new
10856 parameters only when their cumulative size is less or equal to
10857 @option{ipa-sra-ptr-growth-factor} times the size of the original
10858 pointer parameter.
10859
10860 @item sra-max-scalarization-size-Ospeed
10861 @itemx sra-max-scalarization-size-Osize
10862 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10863 replace scalar parts of aggregates with uses of independent scalar
10864 variables. These parameters control the maximum size, in storage units,
10865 of aggregate which is considered for replacement when compiling for
10866 speed
10867 (@option{sra-max-scalarization-size-Ospeed}) or size
10868 (@option{sra-max-scalarization-size-Osize}) respectively.
10869
10870 @item tm-max-aggregate-size
10871 When making copies of thread-local variables in a transaction, this
10872 parameter specifies the size in bytes after which variables are
10873 saved with the logging functions as opposed to save/restore code
10874 sequence pairs. This option only applies when using
10875 @option{-fgnu-tm}.
10876
10877 @item graphite-max-nb-scop-params
10878 To avoid exponential effects in the Graphite loop transforms, the
10879 number of parameters in a Static Control Part (SCoP) is bounded. The
10880 default value is 10 parameters, a value of zero can be used to lift
10881 the bound. A variable whose value is unknown at compilation time and
10882 defined outside a SCoP is a parameter of the SCoP.
10883
10884 @item loop-block-tile-size
10885 Loop blocking or strip mining transforms, enabled with
10886 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10887 loop in the loop nest by a given number of iterations. The strip
10888 length can be changed using the @option{loop-block-tile-size}
10889 parameter. The default value is 51 iterations.
10890
10891 @item loop-unroll-jam-size
10892 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
10893 default value is 4.
10894
10895 @item loop-unroll-jam-depth
10896 Specify the dimension to be unrolled (counting from the most inner loop)
10897 for the @option{-floop-unroll-and-jam}. The default value is 2.
10898
10899 @item ipa-cp-value-list-size
10900 IPA-CP attempts to track all possible values and types passed to a function's
10901 parameter in order to propagate them and perform devirtualization.
10902 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10903 stores per one formal parameter of a function.
10904
10905 @item ipa-cp-eval-threshold
10906 IPA-CP calculates its own score of cloning profitability heuristics
10907 and performs those cloning opportunities with scores that exceed
10908 @option{ipa-cp-eval-threshold}.
10909
10910 @item ipa-cp-recursion-penalty
10911 Percentage penalty the recursive functions will receive when they
10912 are evaluated for cloning.
10913
10914 @item ipa-cp-single-call-penalty
10915 Percentage penalty functions containing a single call to another
10916 function will receive when they are evaluated for cloning.
10917
10918
10919 @item ipa-max-agg-items
10920 IPA-CP is also capable to propagate a number of scalar values passed
10921 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10922 number of such values per one parameter.
10923
10924 @item ipa-cp-loop-hint-bonus
10925 When IPA-CP determines that a cloning candidate would make the number
10926 of iterations of a loop known, it adds a bonus of
10927 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10928 the candidate.
10929
10930 @item ipa-cp-array-index-hint-bonus
10931 When IPA-CP determines that a cloning candidate would make the index of
10932 an array access known, it adds a bonus of
10933 @option{ipa-cp-array-index-hint-bonus} to the profitability
10934 score of the candidate.
10935
10936 @item ipa-max-aa-steps
10937 During its analysis of function bodies, IPA-CP employs alias analysis
10938 in order to track values pointed to by function parameters. In order
10939 not spend too much time analyzing huge functions, it gives up and
10940 consider all memory clobbered after examining
10941 @option{ipa-max-aa-steps} statements modifying memory.
10942
10943 @item lto-partitions
10944 Specify desired number of partitions produced during WHOPR compilation.
10945 The number of partitions should exceed the number of CPUs used for compilation.
10946 The default value is 32.
10947
10948 @item lto-min-partition
10949 Size of minimal partition for WHOPR (in estimated instructions).
10950 This prevents expenses of splitting very small programs into too many
10951 partitions.
10952
10953 @item lto-max-partition
10954 Size of max partition for WHOPR (in estimated instructions).
10955 to provide an upper bound for individual size of partition.
10956 Meant to be used only with balanced partitioning.
10957
10958 @item cxx-max-namespaces-for-diagnostic-help
10959 The maximum number of namespaces to consult for suggestions when C++
10960 name lookup fails for an identifier. The default is 1000.
10961
10962 @item sink-frequency-threshold
10963 The maximum relative execution frequency (in percents) of the target block
10964 relative to a statement's original block to allow statement sinking of a
10965 statement. Larger numbers result in more aggressive statement sinking.
10966 The default value is 75. A small positive adjustment is applied for
10967 statements with memory operands as those are even more profitable so sink.
10968
10969 @item max-stores-to-sink
10970 The maximum number of conditional store pairs that can be sunk. Set to 0
10971 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10972 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10973
10974 @item allow-store-data-races
10975 Allow optimizers to introduce new data races on stores.
10976 Set to 1 to allow, otherwise to 0. This option is enabled by default
10977 at optimization level @option{-Ofast}.
10978
10979 @item case-values-threshold
10980 The smallest number of different values for which it is best to use a
10981 jump-table instead of a tree of conditional branches. If the value is
10982 0, use the default for the machine. The default is 0.
10983
10984 @item tree-reassoc-width
10985 Set the maximum number of instructions executed in parallel in
10986 reassociated tree. This parameter overrides target dependent
10987 heuristics used by default if has non zero value.
10988
10989 @item sched-pressure-algorithm
10990 Choose between the two available implementations of
10991 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10992 and is the more likely to prevent instructions from being reordered.
10993 Algorithm 2 was designed to be a compromise between the relatively
10994 conservative approach taken by algorithm 1 and the rather aggressive
10995 approach taken by the default scheduler. It relies more heavily on
10996 having a regular register file and accurate register pressure classes.
10997 See @file{haifa-sched.c} in the GCC sources for more details.
10998
10999 The default choice depends on the target.
11000
11001 @item max-slsr-cand-scan
11002 Set the maximum number of existing candidates that are considered when
11003 seeking a basis for a new straight-line strength reduction candidate.
11004
11005 @item asan-globals
11006 Enable buffer overflow detection for global objects. This kind
11007 of protection is enabled by default if you are using
11008 @option{-fsanitize=address} option.
11009 To disable global objects protection use @option{--param asan-globals=0}.
11010
11011 @item asan-stack
11012 Enable buffer overflow detection for stack objects. This kind of
11013 protection is enabled by default when using @option{-fsanitize=address}.
11014 To disable stack protection use @option{--param asan-stack=0} option.
11015
11016 @item asan-instrument-reads
11017 Enable buffer overflow detection for memory reads. This kind of
11018 protection is enabled by default when using @option{-fsanitize=address}.
11019 To disable memory reads protection use
11020 @option{--param asan-instrument-reads=0}.
11021
11022 @item asan-instrument-writes
11023 Enable buffer overflow detection for memory writes. This kind of
11024 protection is enabled by default when using @option{-fsanitize=address}.
11025 To disable memory writes protection use
11026 @option{--param asan-instrument-writes=0} option.
11027
11028 @item asan-memintrin
11029 Enable detection for built-in functions. This kind of protection
11030 is enabled by default when using @option{-fsanitize=address}.
11031 To disable built-in functions protection use
11032 @option{--param asan-memintrin=0}.
11033
11034 @item asan-use-after-return
11035 Enable detection of use-after-return. This kind of protection
11036 is enabled by default when using the @option{-fsanitize=address} option.
11037 To disable it use @option{--param asan-use-after-return=0}.
11038
11039 Note: By default the check is disabled at run time. To enable it,
11040 add @code{detect_stack_use_after_return=1} to the environment variable
11041 @env{ASAN_OPTIONS}.
11042
11043 @item asan-instrumentation-with-call-threshold
11044 If number of memory accesses in function being instrumented
11045 is greater or equal to this number, use callbacks instead of inline checks.
11046 E.g. to disable inline code use
11047 @option{--param asan-instrumentation-with-call-threshold=0}.
11048
11049 @item use-after-scope-direct-emission-threshold
11050 If the size of a local variable in bytes is smaller or equal to this
11051 number, directly poison (or unpoison) shadow memory instead of using
11052 run-time callbacks. The default value is 256.
11053
11054 @item chkp-max-ctor-size
11055 Static constructors generated by Pointer Bounds Checker may become very
11056 large and significantly increase compile time at optimization level
11057 @option{-O1} and higher. This parameter is a maximum number of statements
11058 in a single generated constructor. Default value is 5000.
11059
11060 @item max-fsm-thread-path-insns
11061 Maximum number of instructions to copy when duplicating blocks on a
11062 finite state automaton jump thread path. The default is 100.
11063
11064 @item max-fsm-thread-length
11065 Maximum number of basic blocks on a finite state automaton jump thread
11066 path. The default is 10.
11067
11068 @item max-fsm-thread-paths
11069 Maximum number of new jump thread paths to create for a finite state
11070 automaton. The default is 50.
11071
11072 @item parloops-chunk-size
11073 Chunk size of omp schedule for loops parallelized by parloops. The default
11074 is 0.
11075
11076 @item parloops-schedule
11077 Schedule type of omp schedule for loops parallelized by parloops (static,
11078 dynamic, guided, auto, runtime). The default is static.
11079
11080 @item parloops-min-per-thread
11081 The minimum number of iterations per thread of an innermost parallelized
11082 loop for which the parallelized variant is prefered over the single threaded
11083 one. The default is 100. Note that for a parallelized loop nest the
11084 minimum number of iterations of the outermost loop per thread is two.
11085
11086 @item max-ssa-name-query-depth
11087 Maximum depth of recursion when querying properties of SSA names in things
11088 like fold routines. One level of recursion corresponds to following a
11089 use-def chain.
11090
11091 @item hsa-gen-debug-stores
11092 Enable emission of special debug stores within HSA kernels which are
11093 then read and reported by libgomp plugin. Generation of these stores
11094 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11095 enable it.
11096
11097 @item max-speculative-devirt-maydefs
11098 The maximum number of may-defs we analyze when looking for a must-def
11099 specifying the dynamic type of an object that invokes a virtual call
11100 we may be able to devirtualize speculatively.
11101
11102 @item max-vrp-switch-assertions
11103 The maximum number of assertions to add along the default edge of a switch
11104 statement during VRP. The default is 10.
11105
11106 @item unroll-jam-min-percent
11107 The minimum percentage of memory references that must be optimized
11108 away for the unroll-and-jam transformation to be considered profitable.
11109
11110 @item unroll-jam-max-unroll
11111 The maximum number of times the outer loop should be unrolled by
11112 the unroll-and-jam transformation.
11113 @end table
11114 @end table
11115
11116 @node Instrumentation Options
11117 @section Program Instrumentation Options
11118 @cindex instrumentation options
11119 @cindex program instrumentation options
11120 @cindex run-time error checking options
11121 @cindex profiling options
11122 @cindex options, program instrumentation
11123 @cindex options, run-time error checking
11124 @cindex options, profiling
11125
11126 GCC supports a number of command-line options that control adding
11127 run-time instrumentation to the code it normally generates.
11128 For example, one purpose of instrumentation is collect profiling
11129 statistics for use in finding program hot spots, code coverage
11130 analysis, or profile-guided optimizations.
11131 Another class of program instrumentation is adding run-time checking
11132 to detect programming errors like invalid pointer
11133 dereferences or out-of-bounds array accesses, as well as deliberately
11134 hostile attacks such as stack smashing or C++ vtable hijacking.
11135 There is also a general hook which can be used to implement other
11136 forms of tracing or function-level instrumentation for debug or
11137 program analysis purposes.
11138
11139 @table @gcctabopt
11140 @cindex @command{prof}
11141 @item -p
11142 @opindex p
11143 Generate extra code to write profile information suitable for the
11144 analysis program @command{prof}. You must use this option when compiling
11145 the source files you want data about, and you must also use it when
11146 linking.
11147
11148 @cindex @command{gprof}
11149 @item -pg
11150 @opindex pg
11151 Generate extra code to write profile information suitable for the
11152 analysis program @command{gprof}. You must use this option when compiling
11153 the source files you want data about, and you must also use it when
11154 linking.
11155
11156 @item -fprofile-arcs
11157 @opindex fprofile-arcs
11158 Add code so that program flow @dfn{arcs} are instrumented. During
11159 execution the program records how many times each branch and call is
11160 executed and how many times it is taken or returns. On targets that support
11161 constructors with priority support, profiling properly handles constructors,
11162 destructors and C++ constructors (and destructors) of classes which are used
11163 as a type of a global variable.
11164
11165 When the compiled
11166 program exits it saves this data to a file called
11167 @file{@var{auxname}.gcda} for each source file. The data may be used for
11168 profile-directed optimizations (@option{-fbranch-probabilities}), or for
11169 test coverage analysis (@option{-ftest-coverage}). Each object file's
11170 @var{auxname} is generated from the name of the output file, if
11171 explicitly specified and it is not the final executable, otherwise it is
11172 the basename of the source file. In both cases any suffix is removed
11173 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
11174 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
11175 @xref{Cross-profiling}.
11176
11177 @cindex @command{gcov}
11178 @item --coverage
11179 @opindex coverage
11180
11181 This option is used to compile and link code instrumented for coverage
11182 analysis. The option is a synonym for @option{-fprofile-arcs}
11183 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
11184 linking). See the documentation for those options for more details.
11185
11186 @itemize
11187
11188 @item
11189 Compile the source files with @option{-fprofile-arcs} plus optimization
11190 and code generation options. For test coverage analysis, use the
11191 additional @option{-ftest-coverage} option. You do not need to profile
11192 every source file in a program.
11193
11194 @item
11195 Compile the source files additionally with @option{-fprofile-abs-path}
11196 to create absolute path names in the @file{.gcno} files. This allows
11197 @command{gcov} to find the correct sources in projects where compilations
11198 occur with different working directories.
11199
11200 @item
11201 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
11202 (the latter implies the former).
11203
11204 @item
11205 Run the program on a representative workload to generate the arc profile
11206 information. This may be repeated any number of times. You can run
11207 concurrent instances of your program, and provided that the file system
11208 supports locking, the data files will be correctly updated. Unless
11209 a strict ISO C dialect option is in effect, @code{fork} calls are
11210 detected and correctly handled without double counting.
11211
11212 @item
11213 For profile-directed optimizations, compile the source files again with
11214 the same optimization and code generation options plus
11215 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
11216 Control Optimization}).
11217
11218 @item
11219 For test coverage analysis, use @command{gcov} to produce human readable
11220 information from the @file{.gcno} and @file{.gcda} files. Refer to the
11221 @command{gcov} documentation for further information.
11222
11223 @end itemize
11224
11225 With @option{-fprofile-arcs}, for each function of your program GCC
11226 creates a program flow graph, then finds a spanning tree for the graph.
11227 Only arcs that are not on the spanning tree have to be instrumented: the
11228 compiler adds code to count the number of times that these arcs are
11229 executed. When an arc is the only exit or only entrance to a block, the
11230 instrumentation code can be added to the block; otherwise, a new basic
11231 block must be created to hold the instrumentation code.
11232
11233 @need 2000
11234 @item -ftest-coverage
11235 @opindex ftest-coverage
11236 Produce a notes file that the @command{gcov} code-coverage utility
11237 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
11238 show program coverage. Each source file's note file is called
11239 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
11240 above for a description of @var{auxname} and instructions on how to
11241 generate test coverage data. Coverage data matches the source files
11242 more closely if you do not optimize.
11243
11244 @item -fprofile-abs-path
11245 @opindex fprofile-abs-path
11246 Automatically convert relative source file names to absolute path names
11247 in the @file{.gcno} files. This allows @command{gcov} to find the correct
11248 sources in projects where compilations occur with different working
11249 directories.
11250
11251 @item -fprofile-dir=@var{path}
11252 @opindex fprofile-dir
11253
11254 Set the directory to search for the profile data files in to @var{path}.
11255 This option affects only the profile data generated by
11256 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
11257 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
11258 and its related options. Both absolute and relative paths can be used.
11259 By default, GCC uses the current directory as @var{path}, thus the
11260 profile data file appears in the same directory as the object file.
11261
11262 @item -fprofile-generate
11263 @itemx -fprofile-generate=@var{path}
11264 @opindex fprofile-generate
11265
11266 Enable options usually used for instrumenting application to produce
11267 profile useful for later recompilation with profile feedback based
11268 optimization. You must use @option{-fprofile-generate} both when
11269 compiling and when linking your program.
11270
11271 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
11272
11273 If @var{path} is specified, GCC looks at the @var{path} to find
11274 the profile feedback data files. See @option{-fprofile-dir}.
11275
11276 To optimize the program based on the collected profile information, use
11277 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
11278
11279 @item -fprofile-update=@var{method}
11280 @opindex fprofile-update
11281
11282 Alter the update method for an application instrumented for profile
11283 feedback based optimization. The @var{method} argument should be one of
11284 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
11285 The first one is useful for single-threaded applications,
11286 while the second one prevents profile corruption by emitting thread-safe code.
11287
11288 @strong{Warning:} When an application does not properly join all threads
11289 (or creates an detached thread), a profile file can be still corrupted.
11290
11291 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
11292 when supported by a target, or to @samp{single} otherwise. The GCC driver
11293 automatically selects @samp{prefer-atomic} when @option{-pthread}
11294 is present in the command line.
11295
11296 @item -fsanitize=address
11297 @opindex fsanitize=address
11298 Enable AddressSanitizer, a fast memory error detector.
11299 Memory access instructions are instrumented to detect
11300 out-of-bounds and use-after-free bugs.
11301 The option enables @option{-fsanitize-address-use-after-scope}.
11302 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
11303 more details. The run-time behavior can be influenced using the
11304 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
11305 the available options are shown at startup of the instrumented program. See
11306 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
11307 for a list of supported options.
11308 The option cannot be combined with @option{-fsanitize=thread}
11309 and/or @option{-fcheck-pointer-bounds}.
11310
11311 @item -fsanitize=kernel-address
11312 @opindex fsanitize=kernel-address
11313 Enable AddressSanitizer for Linux kernel.
11314 See @uref{https://github.com/google/kasan/wiki} for more details.
11315 The option cannot be combined with @option{-fcheck-pointer-bounds}.
11316
11317 @item -fsanitize=pointer-compare
11318 @opindex fsanitize=pointer-compare
11319 Instrument comparison operation (<, <=, >, >=) with pointer operands.
11320 The option must be combined with either @option{-fsanitize=kernel-address} or
11321 @option{-fsanitize=address}
11322 The option cannot be combined with @option{-fsanitize=thread}
11323 and/or @option{-fcheck-pointer-bounds}.
11324 Note: By default the check is disabled at run time. To enable it,
11325 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11326 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11327 invalid operation only when both pointers are non-null.
11328
11329 @item -fsanitize=pointer-subtract
11330 @opindex fsanitize=pointer-subtract
11331 Instrument subtraction with pointer operands.
11332 The option must be combined with either @option{-fsanitize=kernel-address} or
11333 @option{-fsanitize=address}
11334 The option cannot be combined with @option{-fsanitize=thread}
11335 and/or @option{-fcheck-pointer-bounds}.
11336 Note: By default the check is disabled at run time. To enable it,
11337 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11338 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11339 invalid operation only when both pointers are non-null.
11340
11341 @item -fsanitize=thread
11342 @opindex fsanitize=thread
11343 Enable ThreadSanitizer, a fast data race detector.
11344 Memory access instructions are instrumented to detect
11345 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
11346 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
11347 environment variable; see
11348 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
11349 supported options.
11350 The option cannot be combined with @option{-fsanitize=address},
11351 @option{-fsanitize=leak} and/or @option{-fcheck-pointer-bounds}.
11352
11353 Note that sanitized atomic builtins cannot throw exceptions when
11354 operating on invalid memory addresses with non-call exceptions
11355 (@option{-fnon-call-exceptions}).
11356
11357 @item -fsanitize=leak
11358 @opindex fsanitize=leak
11359 Enable LeakSanitizer, a memory leak detector.
11360 This option only matters for linking of executables and
11361 the executable is linked against a library that overrides @code{malloc}
11362 and other allocator functions. See
11363 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
11364 details. The run-time behavior can be influenced using the
11365 @env{LSAN_OPTIONS} environment variable.
11366 The option cannot be combined with @option{-fsanitize=thread}.
11367
11368 @item -fsanitize=undefined
11369 @opindex fsanitize=undefined
11370 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
11371 Various computations are instrumented to detect undefined behavior
11372 at runtime. Current suboptions are:
11373
11374 @table @gcctabopt
11375
11376 @item -fsanitize=shift
11377 @opindex fsanitize=shift
11378 This option enables checking that the result of a shift operation is
11379 not undefined. Note that what exactly is considered undefined differs
11380 slightly between C and C++, as well as between ISO C90 and C99, etc.
11381 This option has two suboptions, @option{-fsanitize=shift-base} and
11382 @option{-fsanitize=shift-exponent}.
11383
11384 @item -fsanitize=shift-exponent
11385 @opindex fsanitize=shift-exponent
11386 This option enables checking that the second argument of a shift operation
11387 is not negative and is smaller than the precision of the promoted first
11388 argument.
11389
11390 @item -fsanitize=shift-base
11391 @opindex fsanitize=shift-base
11392 If the second argument of a shift operation is within range, check that the
11393 result of a shift operation is not undefined. Note that what exactly is
11394 considered undefined differs slightly between C and C++, as well as between
11395 ISO C90 and C99, etc.
11396
11397 @item -fsanitize=integer-divide-by-zero
11398 @opindex fsanitize=integer-divide-by-zero
11399 Detect integer division by zero as well as @code{INT_MIN / -1} division.
11400
11401 @item -fsanitize=unreachable
11402 @opindex fsanitize=unreachable
11403 With this option, the compiler turns the @code{__builtin_unreachable}
11404 call into a diagnostics message call instead. When reaching the
11405 @code{__builtin_unreachable} call, the behavior is undefined.
11406
11407 @item -fsanitize=vla-bound
11408 @opindex fsanitize=vla-bound
11409 This option instructs the compiler to check that the size of a variable
11410 length array is positive.
11411
11412 @item -fsanitize=null
11413 @opindex fsanitize=null
11414 This option enables pointer checking. Particularly, the application
11415 built with this option turned on will issue an error message when it
11416 tries to dereference a NULL pointer, or if a reference (possibly an
11417 rvalue reference) is bound to a NULL pointer, or if a method is invoked
11418 on an object pointed by a NULL pointer.
11419
11420 @item -fsanitize=return
11421 @opindex fsanitize=return
11422 This option enables return statement checking. Programs
11423 built with this option turned on will issue an error message
11424 when the end of a non-void function is reached without actually
11425 returning a value. This option works in C++ only.
11426
11427 @item -fsanitize=signed-integer-overflow
11428 @opindex fsanitize=signed-integer-overflow
11429 This option enables signed integer overflow checking. We check that
11430 the result of @code{+}, @code{*}, and both unary and binary @code{-}
11431 does not overflow in the signed arithmetics. Note, integer promotion
11432 rules must be taken into account. That is, the following is not an
11433 overflow:
11434 @smallexample
11435 signed char a = SCHAR_MAX;
11436 a++;
11437 @end smallexample
11438
11439 @item -fsanitize=bounds
11440 @opindex fsanitize=bounds
11441 This option enables instrumentation of array bounds. Various out of bounds
11442 accesses are detected. Flexible array members, flexible array member-like
11443 arrays, and initializers of variables with static storage are not instrumented.
11444 The option cannot be combined with @option{-fcheck-pointer-bounds}.
11445
11446 @item -fsanitize=bounds-strict
11447 @opindex fsanitize=bounds-strict
11448 This option enables strict instrumentation of array bounds. Most out of bounds
11449 accesses are detected, including flexible array members and flexible array
11450 member-like arrays. Initializers of variables with static storage are not
11451 instrumented. The option cannot be combined
11452 with @option{-fcheck-pointer-bounds}.
11453
11454 @item -fsanitize=alignment
11455 @opindex fsanitize=alignment
11456
11457 This option enables checking of alignment of pointers when they are
11458 dereferenced, or when a reference is bound to insufficiently aligned target,
11459 or when a method or constructor is invoked on insufficiently aligned object.
11460
11461 @item -fsanitize=object-size
11462 @opindex fsanitize=object-size
11463 This option enables instrumentation of memory references using the
11464 @code{__builtin_object_size} function. Various out of bounds pointer
11465 accesses are detected.
11466
11467 @item -fsanitize=float-divide-by-zero
11468 @opindex fsanitize=float-divide-by-zero
11469 Detect floating-point division by zero. Unlike other similar options,
11470 @option{-fsanitize=float-divide-by-zero} is not enabled by
11471 @option{-fsanitize=undefined}, since floating-point division by zero can
11472 be a legitimate way of obtaining infinities and NaNs.
11473
11474 @item -fsanitize=float-cast-overflow
11475 @opindex fsanitize=float-cast-overflow
11476 This option enables floating-point type to integer conversion checking.
11477 We check that the result of the conversion does not overflow.
11478 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
11479 not enabled by @option{-fsanitize=undefined}.
11480 This option does not work well with @code{FE_INVALID} exceptions enabled.
11481
11482 @item -fsanitize=nonnull-attribute
11483 @opindex fsanitize=nonnull-attribute
11484
11485 This option enables instrumentation of calls, checking whether null values
11486 are not passed to arguments marked as requiring a non-null value by the
11487 @code{nonnull} function attribute.
11488
11489 @item -fsanitize=returns-nonnull-attribute
11490 @opindex fsanitize=returns-nonnull-attribute
11491
11492 This option enables instrumentation of return statements in functions
11493 marked with @code{returns_nonnull} function attribute, to detect returning
11494 of null values from such functions.
11495
11496 @item -fsanitize=bool
11497 @opindex fsanitize=bool
11498
11499 This option enables instrumentation of loads from bool. If a value other
11500 than 0/1 is loaded, a run-time error is issued.
11501
11502 @item -fsanitize=enum
11503 @opindex fsanitize=enum
11504
11505 This option enables instrumentation of loads from an enum type. If
11506 a value outside the range of values for the enum type is loaded,
11507 a run-time error is issued.
11508
11509 @item -fsanitize=vptr
11510 @opindex fsanitize=vptr
11511
11512 This option enables instrumentation of C++ member function calls, member
11513 accesses and some conversions between pointers to base and derived classes,
11514 to verify the referenced object has the correct dynamic type.
11515
11516 @item -fsanitize=pointer-overflow
11517 @opindex fsanitize=pointer-overflow
11518
11519 This option enables instrumentation of pointer arithmetics. If the pointer
11520 arithmetics overflows, a run-time error is issued.
11521
11522 @item -fsanitize=builtin
11523 @opindex fsanitize=builtin
11524
11525 This option enables instrumentation of arguments to selected builtin
11526 functions. If an invalid value is passed to such arguments, a run-time
11527 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
11528 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
11529 by this option.
11530
11531 @end table
11532
11533 While @option{-ftrapv} causes traps for signed overflows to be emitted,
11534 @option{-fsanitize=undefined} gives a diagnostic message.
11535 This currently works only for the C family of languages.
11536
11537 @item -fno-sanitize=all
11538 @opindex fno-sanitize=all
11539
11540 This option disables all previously enabled sanitizers.
11541 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
11542 together.
11543
11544 @item -fasan-shadow-offset=@var{number}
11545 @opindex fasan-shadow-offset
11546 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
11547 It is useful for experimenting with different shadow memory layouts in
11548 Kernel AddressSanitizer.
11549
11550 @item -fsanitize-sections=@var{s1},@var{s2},...
11551 @opindex fsanitize-sections
11552 Sanitize global variables in selected user-defined sections. @var{si} may
11553 contain wildcards.
11554
11555 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
11556 @opindex fsanitize-recover
11557 @opindex fno-sanitize-recover
11558 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
11559 mentioned in comma-separated list of @var{opts}. Enabling this option
11560 for a sanitizer component causes it to attempt to continue
11561 running the program as if no error happened. This means multiple
11562 runtime errors can be reported in a single program run, and the exit
11563 code of the program may indicate success even when errors
11564 have been reported. The @option{-fno-sanitize-recover=} option
11565 can be used to alter
11566 this behavior: only the first detected error is reported
11567 and program then exits with a non-zero exit code.
11568
11569 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
11570 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
11571 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
11572 @option{-fsanitize=bounds-strict},
11573 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
11574 For these sanitizers error recovery is turned on by default,
11575 except @option{-fsanitize=address}, for which this feature is experimental.
11576 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
11577 accepted, the former enables recovery for all sanitizers that support it,
11578 the latter disables recovery for all sanitizers that support it.
11579
11580 Even if a recovery mode is turned on the compiler side, it needs to be also
11581 enabled on the runtime library side, otherwise the failures are still fatal.
11582 The runtime library defaults to @code{halt_on_error=0} for
11583 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
11584 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
11585 setting the @code{halt_on_error} flag in the corresponding environment variable.
11586
11587 Syntax without an explicit @var{opts} parameter is deprecated. It is
11588 equivalent to specifying an @var{opts} list of:
11589
11590 @smallexample
11591 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11592 @end smallexample
11593
11594 @item -fsanitize-address-use-after-scope
11595 @opindex fsanitize-address-use-after-scope
11596 Enable sanitization of local variables to detect use-after-scope bugs.
11597 The option sets @option{-fstack-reuse} to @samp{none}.
11598
11599 @item -fsanitize-undefined-trap-on-error
11600 @opindex fsanitize-undefined-trap-on-error
11601 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
11602 report undefined behavior using @code{__builtin_trap} rather than
11603 a @code{libubsan} library routine. The advantage of this is that the
11604 @code{libubsan} library is not needed and is not linked in, so this
11605 is usable even in freestanding environments.
11606
11607 @item -fsanitize-coverage=trace-pc
11608 @opindex fsanitize-coverage=trace-pc
11609 Enable coverage-guided fuzzing code instrumentation.
11610 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
11611
11612 @item -fsanitize-coverage=trace-cmp
11613 @opindex fsanitize-coverage=trace-cmp
11614 Enable dataflow guided fuzzing code instrumentation.
11615 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
11616 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
11617 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
11618 variable or @code{__sanitizer_cov_trace_const_cmp1},
11619 @code{__sanitizer_cov_trace_const_cmp2},
11620 @code{__sanitizer_cov_trace_const_cmp4} or
11621 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
11622 operand constant, @code{__sanitizer_cov_trace_cmpf} or
11623 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
11624 @code{__sanitizer_cov_trace_switch} for switch statements.
11625
11626 @item -fbounds-check
11627 @opindex fbounds-check
11628 For front ends that support it, generate additional code to check that
11629 indices used to access arrays are within the declared range. This is
11630 currently only supported by the Fortran front end, where this option
11631 defaults to false.
11632
11633 @item -fcheck-pointer-bounds
11634 @opindex fcheck-pointer-bounds
11635 @opindex fno-check-pointer-bounds
11636 @cindex Pointer Bounds Checker options
11637 Enable Pointer Bounds Checker instrumentation. Each memory reference
11638 is instrumented with checks of the pointer used for memory access against
11639 bounds associated with that pointer.
11640
11641 Currently there
11642 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
11643 and @option{-mmpx} are required to enable this feature.
11644 MPX-based instrumentation requires
11645 a runtime library to enable MPX in hardware and handle bounds
11646 violation signals. By default when @option{-fcheck-pointer-bounds}
11647 and @option{-mmpx} options are used to link a program, the GCC driver
11648 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
11649 Bounds checking on calls to dynamic libraries requires a linker
11650 with @option{-z bndplt} support; if GCC was configured with a linker
11651 without support for this option (including the Gold linker and older
11652 versions of ld), a warning is given if you link with @option{-mmpx}
11653 without also specifying @option{-static}, since the overall effectiveness
11654 of the bounds checking protection is reduced.
11655 See also @option{-static-libmpxwrappers}.
11656
11657 MPX-based instrumentation
11658 may be used for debugging and also may be included in production code
11659 to increase program security. Depending on usage, you may
11660 have different requirements for the runtime library. The current version
11661 of the MPX runtime library is more oriented for use as a debugging
11662 tool. MPX runtime library usage implies @option{-lpthread}. See
11663 also @option{-static-libmpx}. The runtime library behavior can be
11664 influenced using various @env{CHKP_RT_*} environment variables. See
11665 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
11666 for more details.
11667
11668 Generated instrumentation may be controlled by various
11669 @option{-fchkp-*} options and by the @code{bnd_variable_size}
11670 structure field attribute (@pxref{Type Attributes}) and
11671 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
11672 (@pxref{Function Attributes}). GCC also provides a number of built-in
11673 functions for controlling the Pointer Bounds Checker. @xref{Pointer
11674 Bounds Checker builtins}, for more information.
11675
11676 @item -fchkp-check-incomplete-type
11677 @opindex fchkp-check-incomplete-type
11678 @opindex fno-chkp-check-incomplete-type
11679 Generate pointer bounds checks for variables with incomplete type.
11680 Enabled by default.
11681
11682 @item -fchkp-narrow-bounds
11683 @opindex fchkp-narrow-bounds
11684 @opindex fno-chkp-narrow-bounds
11685 Controls bounds used by Pointer Bounds Checker for pointers to object
11686 fields. If narrowing is enabled then field bounds are used. Otherwise
11687 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
11688 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
11689
11690 @item -fchkp-first-field-has-own-bounds
11691 @opindex fchkp-first-field-has-own-bounds
11692 @opindex fno-chkp-first-field-has-own-bounds
11693 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
11694 first field in the structure. By default a pointer to the first field has
11695 the same bounds as a pointer to the whole structure.
11696
11697 @item -fchkp-flexible-struct-trailing-arrays
11698 @opindex fchkp-flexible-struct-trailing-arrays
11699 @opindex fno-chkp-flexible-struct-trailing-arrays
11700 Forces Pointer Bounds Checker to treat all trailing arrays in structures as
11701 possibly flexible. By default only array fields with zero length or that are
11702 marked with attribute bnd_variable_size are treated as flexible.
11703
11704 @item -fchkp-narrow-to-innermost-array
11705 @opindex fchkp-narrow-to-innermost-array
11706 @opindex fno-chkp-narrow-to-innermost-array
11707 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
11708 case of nested static array access. By default this option is disabled and
11709 bounds of the outermost array are used.
11710
11711 @item -fchkp-optimize
11712 @opindex fchkp-optimize
11713 @opindex fno-chkp-optimize
11714 Enables Pointer Bounds Checker optimizations. Enabled by default at
11715 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
11716
11717 @item -fchkp-use-fast-string-functions
11718 @opindex fchkp-use-fast-string-functions
11719 @opindex fno-chkp-use-fast-string-functions
11720 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
11721 by Pointer Bounds Checker. Disabled by default.
11722
11723 @item -fchkp-use-nochk-string-functions
11724 @opindex fchkp-use-nochk-string-functions
11725 @opindex fno-chkp-use-nochk-string-functions
11726 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
11727 by Pointer Bounds Checker. Disabled by default.
11728
11729 @item -fchkp-use-static-bounds
11730 @opindex fchkp-use-static-bounds
11731 @opindex fno-chkp-use-static-bounds
11732 Allow Pointer Bounds Checker to generate static bounds holding
11733 bounds of static variables. Enabled by default.
11734
11735 @item -fchkp-use-static-const-bounds
11736 @opindex fchkp-use-static-const-bounds
11737 @opindex fno-chkp-use-static-const-bounds
11738 Use statically-initialized bounds for constant bounds instead of
11739 generating them each time they are required. By default enabled when
11740 @option{-fchkp-use-static-bounds} is enabled.
11741
11742 @item -fchkp-treat-zero-dynamic-size-as-infinite
11743 @opindex fchkp-treat-zero-dynamic-size-as-infinite
11744 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
11745 With this option, objects with incomplete type whose
11746 dynamically-obtained size is zero are treated as having infinite size
11747 instead by Pointer Bounds
11748 Checker. This option may be helpful if a program is linked with a library
11749 missing size information for some symbols. Disabled by default.
11750
11751 @item -fchkp-check-read
11752 @opindex fchkp-check-read
11753 @opindex fno-chkp-check-read
11754 Instructs Pointer Bounds Checker to generate checks for all read
11755 accesses to memory. Enabled by default.
11756
11757 @item -fchkp-check-write
11758 @opindex fchkp-check-write
11759 @opindex fno-chkp-check-write
11760 Instructs Pointer Bounds Checker to generate checks for all write
11761 accesses to memory. Enabled by default.
11762
11763 @item -fchkp-store-bounds
11764 @opindex fchkp-store-bounds
11765 @opindex fno-chkp-store-bounds
11766 Instructs Pointer Bounds Checker to generate bounds stores for
11767 pointer writes. Enabled by default.
11768
11769 @item -fchkp-instrument-calls
11770 @opindex fchkp-instrument-calls
11771 @opindex fno-chkp-instrument-calls
11772 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
11773 Enabled by default.
11774
11775 @item -fchkp-instrument-marked-only
11776 @opindex fchkp-instrument-marked-only
11777 @opindex fno-chkp-instrument-marked-only
11778 Instructs Pointer Bounds Checker to instrument only functions
11779 marked with the @code{bnd_instrument} attribute
11780 (@pxref{Function Attributes}). Disabled by default.
11781
11782 @item -fchkp-use-wrappers
11783 @opindex fchkp-use-wrappers
11784 @opindex fno-chkp-use-wrappers
11785 Allows Pointer Bounds Checker to replace calls to built-in functions
11786 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
11787 is used to link a program, the GCC driver automatically links
11788 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
11789 Enabled by default.
11790
11791 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
11792 @opindex fcf-protection
11793 Enable code instrumentation of control-flow transfers to increase
11794 program security by checking that target addresses of control-flow
11795 transfer instructions (such as indirect function call, function return,
11796 indirect jump) are valid. This prevents diverting the flow of control
11797 to an unexpected target. This is intended to protect against such
11798 threats as Return-oriented Programming (ROP), and similarly
11799 call/jmp-oriented programming (COP/JOP).
11800
11801 The value @code{branch} tells the compiler to implement checking of
11802 validity of control-flow transfer at the point of indirect branch
11803 instructions, i.e. call/jmp instructions. The value @code{return}
11804 implements checking of validity at the point of returning from a
11805 function. The value @code{full} is an alias for specifying both
11806 @code{branch} and @code{return}. The value @code{none} turns off
11807 instrumentation.
11808
11809 The macro @code{__CET__} is defined when @option{-fcf-protection} is
11810 used. The first bit of @code{__CET__} is set to 1 for the value
11811 @code{branch} and the second bit of @code{__CET__} is set to 1 for
11812 the @code{return}.
11813
11814 You can also use the @code{nocf_check} attribute to identify
11815 which functions and calls should be skipped from instrumentation
11816 (@pxref{Function Attributes}).
11817
11818 Currently the x86 GNU/Linux target provides an implementation based
11819 on Intel Control-flow Enforcement Technology (CET).
11820
11821 @item -fstack-protector
11822 @opindex fstack-protector
11823 Emit extra code to check for buffer overflows, such as stack smashing
11824 attacks. This is done by adding a guard variable to functions with
11825 vulnerable objects. This includes functions that call @code{alloca}, and
11826 functions with buffers larger than 8 bytes. The guards are initialized
11827 when a function is entered and then checked when the function exits.
11828 If a guard check fails, an error message is printed and the program exits.
11829
11830 @item -fstack-protector-all
11831 @opindex fstack-protector-all
11832 Like @option{-fstack-protector} except that all functions are protected.
11833
11834 @item -fstack-protector-strong
11835 @opindex fstack-protector-strong
11836 Like @option{-fstack-protector} but includes additional functions to
11837 be protected --- those that have local array definitions, or have
11838 references to local frame addresses.
11839
11840 @item -fstack-protector-explicit
11841 @opindex fstack-protector-explicit
11842 Like @option{-fstack-protector} but only protects those functions which
11843 have the @code{stack_protect} attribute.
11844
11845 @item -fstack-check
11846 @opindex fstack-check
11847 Generate code to verify that you do not go beyond the boundary of the
11848 stack. You should specify this flag if you are running in an
11849 environment with multiple threads, but you only rarely need to specify it in
11850 a single-threaded environment since stack overflow is automatically
11851 detected on nearly all systems if there is only one stack.
11852
11853 Note that this switch does not actually cause checking to be done; the
11854 operating system or the language runtime must do that. The switch causes
11855 generation of code to ensure that they see the stack being extended.
11856
11857 You can additionally specify a string parameter: @samp{no} means no
11858 checking, @samp{generic} means force the use of old-style checking,
11859 @samp{specific} means use the best checking method and is equivalent
11860 to bare @option{-fstack-check}.
11861
11862 Old-style checking is a generic mechanism that requires no specific
11863 target support in the compiler but comes with the following drawbacks:
11864
11865 @enumerate
11866 @item
11867 Modified allocation strategy for large objects: they are always
11868 allocated dynamically if their size exceeds a fixed threshold. Note this
11869 may change the semantics of some code.
11870
11871 @item
11872 Fixed limit on the size of the static frame of functions: when it is
11873 topped by a particular function, stack checking is not reliable and
11874 a warning is issued by the compiler.
11875
11876 @item
11877 Inefficiency: because of both the modified allocation strategy and the
11878 generic implementation, code performance is hampered.
11879 @end enumerate
11880
11881 Note that old-style stack checking is also the fallback method for
11882 @samp{specific} if no target support has been added in the compiler.
11883
11884 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
11885 and stack overflows. @samp{specific} is an excellent choice when compiling
11886 Ada code. It is not generally sufficient to protect against stack-clash
11887 attacks. To protect against those you want @samp{-fstack-clash-protection}.
11888
11889 @item -fstack-clash-protection
11890 @opindex fstack-clash-protection
11891 Generate code to prevent stack clash style attacks. When this option is
11892 enabled, the compiler will only allocate one page of stack space at a time
11893 and each page is accessed immediately after allocation. Thus, it prevents
11894 allocations from jumping over any stack guard page provided by the
11895 operating system.
11896
11897 Most targets do not fully support stack clash protection. However, on
11898 those targets @option{-fstack-clash-protection} will protect dynamic stack
11899 allocations. @option{-fstack-clash-protection} may also provide limited
11900 protection for static stack allocations if the target supports
11901 @option{-fstack-check=specific}.
11902
11903 @item -fstack-limit-register=@var{reg}
11904 @itemx -fstack-limit-symbol=@var{sym}
11905 @itemx -fno-stack-limit
11906 @opindex fstack-limit-register
11907 @opindex fstack-limit-symbol
11908 @opindex fno-stack-limit
11909 Generate code to ensure that the stack does not grow beyond a certain value,
11910 either the value of a register or the address of a symbol. If a larger
11911 stack is required, a signal is raised at run time. For most targets,
11912 the signal is raised before the stack overruns the boundary, so
11913 it is possible to catch the signal without taking special precautions.
11914
11915 For instance, if the stack starts at absolute address @samp{0x80000000}
11916 and grows downwards, you can use the flags
11917 @option{-fstack-limit-symbol=__stack_limit} and
11918 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11919 of 128KB@. Note that this may only work with the GNU linker.
11920
11921 You can locally override stack limit checking by using the
11922 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11923
11924 @item -fsplit-stack
11925 @opindex fsplit-stack
11926 Generate code to automatically split the stack before it overflows.
11927 The resulting program has a discontiguous stack which can only
11928 overflow if the program is unable to allocate any more memory. This
11929 is most useful when running threaded programs, as it is no longer
11930 necessary to calculate a good stack size to use for each thread. This
11931 is currently only implemented for the x86 targets running
11932 GNU/Linux.
11933
11934 When code compiled with @option{-fsplit-stack} calls code compiled
11935 without @option{-fsplit-stack}, there may not be much stack space
11936 available for the latter code to run. If compiling all code,
11937 including library code, with @option{-fsplit-stack} is not an option,
11938 then the linker can fix up these calls so that the code compiled
11939 without @option{-fsplit-stack} always has a large stack. Support for
11940 this is implemented in the gold linker in GNU binutils release 2.21
11941 and later.
11942
11943 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
11944 @opindex fvtable-verify
11945 This option is only available when compiling C++ code.
11946 It turns on (or off, if using @option{-fvtable-verify=none}) the security
11947 feature that verifies at run time, for every virtual call, that
11948 the vtable pointer through which the call is made is valid for the type of
11949 the object, and has not been corrupted or overwritten. If an invalid vtable
11950 pointer is detected at run time, an error is reported and execution of the
11951 program is immediately halted.
11952
11953 This option causes run-time data structures to be built at program startup,
11954 which are used for verifying the vtable pointers.
11955 The options @samp{std} and @samp{preinit}
11956 control the timing of when these data structures are built. In both cases the
11957 data structures are built before execution reaches @code{main}. Using
11958 @option{-fvtable-verify=std} causes the data structures to be built after
11959 shared libraries have been loaded and initialized.
11960 @option{-fvtable-verify=preinit} causes them to be built before shared
11961 libraries have been loaded and initialized.
11962
11963 If this option appears multiple times in the command line with different
11964 values specified, @samp{none} takes highest priority over both @samp{std} and
11965 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
11966
11967 @item -fvtv-debug
11968 @opindex fvtv-debug
11969 When used in conjunction with @option{-fvtable-verify=std} or
11970 @option{-fvtable-verify=preinit}, causes debug versions of the
11971 runtime functions for the vtable verification feature to be called.
11972 This flag also causes the compiler to log information about which
11973 vtable pointers it finds for each class.
11974 This information is written to a file named @file{vtv_set_ptr_data.log}
11975 in the directory named by the environment variable @env{VTV_LOGS_DIR}
11976 if that is defined or the current working directory otherwise.
11977
11978 Note: This feature @emph{appends} data to the log file. If you want a fresh log
11979 file, be sure to delete any existing one.
11980
11981 @item -fvtv-counts
11982 @opindex fvtv-counts
11983 This is a debugging flag. When used in conjunction with
11984 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
11985 causes the compiler to keep track of the total number of virtual calls
11986 it encounters and the number of verifications it inserts. It also
11987 counts the number of calls to certain run-time library functions
11988 that it inserts and logs this information for each compilation unit.
11989 The compiler writes this information to a file named
11990 @file{vtv_count_data.log} in the directory named by the environment
11991 variable @env{VTV_LOGS_DIR} if that is defined or the current working
11992 directory otherwise. It also counts the size of the vtable pointer sets
11993 for each class, and writes this information to @file{vtv_class_set_sizes.log}
11994 in the same directory.
11995
11996 Note: This feature @emph{appends} data to the log files. To get fresh log
11997 files, be sure to delete any existing ones.
11998
11999 @item -finstrument-functions
12000 @opindex finstrument-functions
12001 Generate instrumentation calls for entry and exit to functions. Just
12002 after function entry and just before function exit, the following
12003 profiling functions are called with the address of the current
12004 function and its call site. (On some platforms,
12005 @code{__builtin_return_address} does not work beyond the current
12006 function, so the call site information may not be available to the
12007 profiling functions otherwise.)
12008
12009 @smallexample
12010 void __cyg_profile_func_enter (void *this_fn,
12011 void *call_site);
12012 void __cyg_profile_func_exit (void *this_fn,
12013 void *call_site);
12014 @end smallexample
12015
12016 The first argument is the address of the start of the current function,
12017 which may be looked up exactly in the symbol table.
12018
12019 This instrumentation is also done for functions expanded inline in other
12020 functions. The profiling calls indicate where, conceptually, the
12021 inline function is entered and exited. This means that addressable
12022 versions of such functions must be available. If all your uses of a
12023 function are expanded inline, this may mean an additional expansion of
12024 code size. If you use @code{extern inline} in your C code, an
12025 addressable version of such functions must be provided. (This is
12026 normally the case anyway, but if you get lucky and the optimizer always
12027 expands the functions inline, you might have gotten away without
12028 providing static copies.)
12029
12030 A function may be given the attribute @code{no_instrument_function}, in
12031 which case this instrumentation is not done. This can be used, for
12032 example, for the profiling functions listed above, high-priority
12033 interrupt routines, and any functions from which the profiling functions
12034 cannot safely be called (perhaps signal handlers, if the profiling
12035 routines generate output or allocate memory).
12036
12037 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12038 @opindex finstrument-functions-exclude-file-list
12039
12040 Set the list of functions that are excluded from instrumentation (see
12041 the description of @option{-finstrument-functions}). If the file that
12042 contains a function definition matches with one of @var{file}, then
12043 that function is not instrumented. The match is done on substrings:
12044 if the @var{file} parameter is a substring of the file name, it is
12045 considered to be a match.
12046
12047 For example:
12048
12049 @smallexample
12050 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12051 @end smallexample
12052
12053 @noindent
12054 excludes any inline function defined in files whose pathnames
12055 contain @file{/bits/stl} or @file{include/sys}.
12056
12057 If, for some reason, you want to include letter @samp{,} in one of
12058 @var{sym}, write @samp{\,}. For example,
12059 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12060 (note the single quote surrounding the option).
12061
12062 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12063 @opindex finstrument-functions-exclude-function-list
12064
12065 This is similar to @option{-finstrument-functions-exclude-file-list},
12066 but this option sets the list of function names to be excluded from
12067 instrumentation. The function name to be matched is its user-visible
12068 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12069 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12070 match is done on substrings: if the @var{sym} parameter is a substring
12071 of the function name, it is considered to be a match. For C99 and C++
12072 extended identifiers, the function name must be given in UTF-8, not
12073 using universal character names.
12074
12075 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12076 @opindex fpatchable-function-entry
12077 Generate @var{N} NOPs right at the beginning
12078 of each function, with the function entry point before the @var{M}th NOP.
12079 If @var{M} is omitted, it defaults to @code{0} so the
12080 function entry points to the address just at the first NOP.
12081 The NOP instructions reserve extra space which can be used to patch in
12082 any desired instrumentation at run time, provided that the code segment
12083 is writable. The amount of space is controllable indirectly via
12084 the number of NOPs; the NOP instruction used corresponds to the instruction
12085 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12086 is target-specific and may also depend on the architecture variant and/or
12087 other compilation options.
12088
12089 For run-time identification, the starting addresses of these areas,
12090 which correspond to their respective function entries minus @var{M},
12091 are additionally collected in the @code{__patchable_function_entries}
12092 section of the resulting binary.
12093
12094 Note that the value of @code{__attribute__ ((patchable_function_entry
12095 (N,M)))} takes precedence over command-line option
12096 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12097 the area size or to remove it completely on a single function.
12098 If @code{N=0}, no pad location is recorded.
12099
12100 The NOP instructions are inserted at---and maybe before, depending on
12101 @var{M}---the function entry address, even before the prologue.
12102
12103 @end table
12104
12105
12106 @node Preprocessor Options
12107 @section Options Controlling the Preprocessor
12108 @cindex preprocessor options
12109 @cindex options, preprocessor
12110
12111 These options control the C preprocessor, which is run on each C source
12112 file before actual compilation.
12113
12114 If you use the @option{-E} option, nothing is done except preprocessing.
12115 Some of these options make sense only together with @option{-E} because
12116 they cause the preprocessor output to be unsuitable for actual
12117 compilation.
12118
12119 In addition to the options listed here, there are a number of options
12120 to control search paths for include files documented in
12121 @ref{Directory Options}.
12122 Options to control preprocessor diagnostics are listed in
12123 @ref{Warning Options}.
12124
12125 @table @gcctabopt
12126 @include cppopts.texi
12127
12128 @item -Wp,@var{option}
12129 @opindex Wp
12130 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12131 and pass @var{option} directly through to the preprocessor. If
12132 @var{option} contains commas, it is split into multiple options at the
12133 commas. However, many options are modified, translated or interpreted
12134 by the compiler driver before being passed to the preprocessor, and
12135 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12136 interface is undocumented and subject to change, so whenever possible
12137 you should avoid using @option{-Wp} and let the driver handle the
12138 options instead.
12139
12140 @item -Xpreprocessor @var{option}
12141 @opindex Xpreprocessor
12142 Pass @var{option} as an option to the preprocessor. You can use this to
12143 supply system-specific preprocessor options that GCC does not
12144 recognize.
12145
12146 If you want to pass an option that takes an argument, you must use
12147 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12148
12149 @item -no-integrated-cpp
12150 @opindex no-integrated-cpp
12151 Perform preprocessing as a separate pass before compilation.
12152 By default, GCC performs preprocessing as an integrated part of
12153 input tokenization and parsing.
12154 If this option is provided, the appropriate language front end
12155 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12156 and Objective-C, respectively) is instead invoked twice,
12157 once for preprocessing only and once for actual compilation
12158 of the preprocessed input.
12159 This option may be useful in conjunction with the @option{-B} or
12160 @option{-wrapper} options to specify an alternate preprocessor or
12161 perform additional processing of the program source between
12162 normal preprocessing and compilation.
12163
12164 @end table
12165
12166 @node Assembler Options
12167 @section Passing Options to the Assembler
12168
12169 @c prevent bad page break with this line
12170 You can pass options to the assembler.
12171
12172 @table @gcctabopt
12173 @item -Wa,@var{option}
12174 @opindex Wa
12175 Pass @var{option} as an option to the assembler. If @var{option}
12176 contains commas, it is split into multiple options at the commas.
12177
12178 @item -Xassembler @var{option}
12179 @opindex Xassembler
12180 Pass @var{option} as an option to the assembler. You can use this to
12181 supply system-specific assembler options that GCC does not
12182 recognize.
12183
12184 If you want to pass an option that takes an argument, you must use
12185 @option{-Xassembler} twice, once for the option and once for the argument.
12186
12187 @end table
12188
12189 @node Link Options
12190 @section Options for Linking
12191 @cindex link options
12192 @cindex options, linking
12193
12194 These options come into play when the compiler links object files into
12195 an executable output file. They are meaningless if the compiler is
12196 not doing a link step.
12197
12198 @table @gcctabopt
12199 @cindex file names
12200 @item @var{object-file-name}
12201 A file name that does not end in a special recognized suffix is
12202 considered to name an object file or library. (Object files are
12203 distinguished from libraries by the linker according to the file
12204 contents.) If linking is done, these object files are used as input
12205 to the linker.
12206
12207 @item -c
12208 @itemx -S
12209 @itemx -E
12210 @opindex c
12211 @opindex S
12212 @opindex E
12213 If any of these options is used, then the linker is not run, and
12214 object file names should not be used as arguments. @xref{Overall
12215 Options}.
12216
12217 @item -fuse-ld=bfd
12218 @opindex fuse-ld=bfd
12219 Use the @command{bfd} linker instead of the default linker.
12220
12221 @item -fuse-ld=gold
12222 @opindex fuse-ld=gold
12223 Use the @command{gold} linker instead of the default linker.
12224
12225 @cindex Libraries
12226 @item -l@var{library}
12227 @itemx -l @var{library}
12228 @opindex l
12229 Search the library named @var{library} when linking. (The second
12230 alternative with the library as a separate argument is only for
12231 POSIX compliance and is not recommended.)
12232
12233 It makes a difference where in the command you write this option; the
12234 linker searches and processes libraries and object files in the order they
12235 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
12236 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
12237 to functions in @samp{z}, those functions may not be loaded.
12238
12239 The linker searches a standard list of directories for the library,
12240 which is actually a file named @file{lib@var{library}.a}. The linker
12241 then uses this file as if it had been specified precisely by name.
12242
12243 The directories searched include several standard system directories
12244 plus any that you specify with @option{-L}.
12245
12246 Normally the files found this way are library files---archive files
12247 whose members are object files. The linker handles an archive file by
12248 scanning through it for members which define symbols that have so far
12249 been referenced but not defined. But if the file that is found is an
12250 ordinary object file, it is linked in the usual fashion. The only
12251 difference between using an @option{-l} option and specifying a file name
12252 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
12253 and searches several directories.
12254
12255 @item -lobjc
12256 @opindex lobjc
12257 You need this special case of the @option{-l} option in order to
12258 link an Objective-C or Objective-C++ program.
12259
12260 @item -nostartfiles
12261 @opindex nostartfiles
12262 Do not use the standard system startup files when linking.
12263 The standard system libraries are used normally, unless @option{-nostdlib}
12264 or @option{-nodefaultlibs} is used.
12265
12266 @item -nodefaultlibs
12267 @opindex nodefaultlibs
12268 Do not use the standard system libraries when linking.
12269 Only the libraries you specify are passed to the linker, and options
12270 specifying linkage of the system libraries, such as @option{-static-libgcc}
12271 or @option{-shared-libgcc}, are ignored.
12272 The standard startup files are used normally, unless @option{-nostartfiles}
12273 is used.
12274
12275 The compiler may generate calls to @code{memcmp},
12276 @code{memset}, @code{memcpy} and @code{memmove}.
12277 These entries are usually resolved by entries in
12278 libc. These entry points should be supplied through some other
12279 mechanism when this option is specified.
12280
12281 @item -nostdlib
12282 @opindex nostdlib
12283 Do not use the standard system startup files or libraries when linking.
12284 No startup files and only the libraries you specify are passed to
12285 the linker, and options specifying linkage of the system libraries, such as
12286 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
12287
12288 The compiler may generate calls to @code{memcmp}, @code{memset},
12289 @code{memcpy} and @code{memmove}.
12290 These entries are usually resolved by entries in
12291 libc. These entry points should be supplied through some other
12292 mechanism when this option is specified.
12293
12294 @cindex @option{-lgcc}, use with @option{-nostdlib}
12295 @cindex @option{-nostdlib} and unresolved references
12296 @cindex unresolved references and @option{-nostdlib}
12297 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
12298 @cindex @option{-nodefaultlibs} and unresolved references
12299 @cindex unresolved references and @option{-nodefaultlibs}
12300 One of the standard libraries bypassed by @option{-nostdlib} and
12301 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
12302 which GCC uses to overcome shortcomings of particular machines, or special
12303 needs for some languages.
12304 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
12305 Collection (GCC) Internals},
12306 for more discussion of @file{libgcc.a}.)
12307 In most cases, you need @file{libgcc.a} even when you want to avoid
12308 other standard libraries. In other words, when you specify @option{-nostdlib}
12309 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
12310 This ensures that you have no unresolved references to internal GCC
12311 library subroutines.
12312 (An example of such an internal subroutine is @code{__main}, used to ensure C++
12313 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
12314 GNU Compiler Collection (GCC) Internals}.)
12315
12316 @item -pie
12317 @opindex pie
12318 Produce a dynamically linked position independent executable on targets
12319 that support it. For predictable results, you must also specify the same
12320 set of options used for compilation (@option{-fpie}, @option{-fPIE},
12321 or model suboptions) when you specify this linker option.
12322
12323 @item -no-pie
12324 @opindex no-pie
12325 Don't produce a dynamically linked position independent executable.
12326
12327 @item -static-pie
12328 @opindex static-pie
12329 Produce a static position independent executable on targets that support
12330 it. A static position independent executable is similar to a static
12331 executable, but can be loaded at any address without a dynamic linker.
12332 For predictable results, you must also specify the same set of options
12333 used for compilation (@option{-fpie}, @option{-fPIE}, or model
12334 suboptions) when you specify this linker option.
12335
12336 @item -pthread
12337 @opindex pthread
12338 Link with the POSIX threads library. This option is supported on
12339 GNU/Linux targets, most other Unix derivatives, and also on
12340 x86 Cygwin and MinGW targets. On some targets this option also sets
12341 flags for the preprocessor, so it should be used consistently for both
12342 compilation and linking.
12343
12344 @item -rdynamic
12345 @opindex rdynamic
12346 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
12347 that support it. This instructs the linker to add all symbols, not
12348 only used ones, to the dynamic symbol table. This option is needed
12349 for some uses of @code{dlopen} or to allow obtaining backtraces
12350 from within a program.
12351
12352 @item -s
12353 @opindex s
12354 Remove all symbol table and relocation information from the executable.
12355
12356 @item -static
12357 @opindex static
12358 On systems that support dynamic linking, this overrides @option{-pie}
12359 and prevents linking with the shared libraries. On other systems, this
12360 option has no effect.
12361
12362 @item -shared
12363 @opindex shared
12364 Produce a shared object which can then be linked with other objects to
12365 form an executable. Not all systems support this option. For predictable
12366 results, you must also specify the same set of options used for compilation
12367 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
12368 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
12369 needs to build supplementary stub code for constructors to work. On
12370 multi-libbed systems, @samp{gcc -shared} must select the correct support
12371 libraries to link against. Failing to supply the correct flags may lead
12372 to subtle defects. Supplying them in cases where they are not necessary
12373 is innocuous.}
12374
12375 @item -shared-libgcc
12376 @itemx -static-libgcc
12377 @opindex shared-libgcc
12378 @opindex static-libgcc
12379 On systems that provide @file{libgcc} as a shared library, these options
12380 force the use of either the shared or static version, respectively.
12381 If no shared version of @file{libgcc} was built when the compiler was
12382 configured, these options have no effect.
12383
12384 There are several situations in which an application should use the
12385 shared @file{libgcc} instead of the static version. The most common
12386 of these is when the application wishes to throw and catch exceptions
12387 across different shared libraries. In that case, each of the libraries
12388 as well as the application itself should use the shared @file{libgcc}.
12389
12390 Therefore, the G++ and driver automatically adds @option{-shared-libgcc}
12391 whenever you build a shared library or a main executable, because C++
12392 programs typically use exceptions, so this is the right thing to do.
12393
12394 If, instead, you use the GCC driver to create shared libraries, you may
12395 find that they are not always linked with the shared @file{libgcc}.
12396 If GCC finds, at its configuration time, that you have a non-GNU linker
12397 or a GNU linker that does not support option @option{--eh-frame-hdr},
12398 it links the shared version of @file{libgcc} into shared libraries
12399 by default. Otherwise, it takes advantage of the linker and optimizes
12400 away the linking with the shared version of @file{libgcc}, linking with
12401 the static version of libgcc by default. This allows exceptions to
12402 propagate through such shared libraries, without incurring relocation
12403 costs at library load time.
12404
12405 However, if a library or main executable is supposed to throw or catch
12406 exceptions, you must link it using the G++ driver, as appropriate
12407 for the languages used in the program, or using the option
12408 @option{-shared-libgcc}, such that it is linked with the shared
12409 @file{libgcc}.
12410
12411 @item -static-libasan
12412 @opindex static-libasan
12413 When the @option{-fsanitize=address} option is used to link a program,
12414 the GCC driver automatically links against @option{libasan}. If
12415 @file{libasan} is available as a shared library, and the @option{-static}
12416 option is not used, then this links against the shared version of
12417 @file{libasan}. The @option{-static-libasan} option directs the GCC
12418 driver to link @file{libasan} statically, without necessarily linking
12419 other libraries statically.
12420
12421 @item -static-libtsan
12422 @opindex static-libtsan
12423 When the @option{-fsanitize=thread} option is used to link a program,
12424 the GCC driver automatically links against @option{libtsan}. If
12425 @file{libtsan} is available as a shared library, and the @option{-static}
12426 option is not used, then this links against the shared version of
12427 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
12428 driver to link @file{libtsan} statically, without necessarily linking
12429 other libraries statically.
12430
12431 @item -static-liblsan
12432 @opindex static-liblsan
12433 When the @option{-fsanitize=leak} option is used to link a program,
12434 the GCC driver automatically links against @option{liblsan}. If
12435 @file{liblsan} is available as a shared library, and the @option{-static}
12436 option is not used, then this links against the shared version of
12437 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
12438 driver to link @file{liblsan} statically, without necessarily linking
12439 other libraries statically.
12440
12441 @item -static-libubsan
12442 @opindex static-libubsan
12443 When the @option{-fsanitize=undefined} option is used to link a program,
12444 the GCC driver automatically links against @option{libubsan}. If
12445 @file{libubsan} is available as a shared library, and the @option{-static}
12446 option is not used, then this links against the shared version of
12447 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
12448 driver to link @file{libubsan} statically, without necessarily linking
12449 other libraries statically.
12450
12451 @item -static-libmpx
12452 @opindex static-libmpx
12453 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
12454 used to link a program, the GCC driver automatically links against
12455 @file{libmpx}. If @file{libmpx} is available as a shared library,
12456 and the @option{-static} option is not used, then this links against
12457 the shared version of @file{libmpx}. The @option{-static-libmpx}
12458 option directs the GCC driver to link @file{libmpx} statically,
12459 without necessarily linking other libraries statically.
12460
12461 @item -static-libmpxwrappers
12462 @opindex static-libmpxwrappers
12463 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
12464 to link a program without also using @option{-fno-chkp-use-wrappers}, the
12465 GCC driver automatically links against @file{libmpxwrappers}. If
12466 @file{libmpxwrappers} is available as a shared library, and the
12467 @option{-static} option is not used, then this links against the shared
12468 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
12469 option directs the GCC driver to link @file{libmpxwrappers} statically,
12470 without necessarily linking other libraries statically.
12471
12472 @item -static-libstdc++
12473 @opindex static-libstdc++
12474 When the @command{g++} program is used to link a C++ program, it
12475 normally automatically links against @option{libstdc++}. If
12476 @file{libstdc++} is available as a shared library, and the
12477 @option{-static} option is not used, then this links against the
12478 shared version of @file{libstdc++}. That is normally fine. However, it
12479 is sometimes useful to freeze the version of @file{libstdc++} used by
12480 the program without going all the way to a fully static link. The
12481 @option{-static-libstdc++} option directs the @command{g++} driver to
12482 link @file{libstdc++} statically, without necessarily linking other
12483 libraries statically.
12484
12485 @item -symbolic
12486 @opindex symbolic
12487 Bind references to global symbols when building a shared object. Warn
12488 about any unresolved references (unless overridden by the link editor
12489 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
12490 this option.
12491
12492 @item -T @var{script}
12493 @opindex T
12494 @cindex linker script
12495 Use @var{script} as the linker script. This option is supported by most
12496 systems using the GNU linker. On some targets, such as bare-board
12497 targets without an operating system, the @option{-T} option may be required
12498 when linking to avoid references to undefined symbols.
12499
12500 @item -Xlinker @var{option}
12501 @opindex Xlinker
12502 Pass @var{option} as an option to the linker. You can use this to
12503 supply system-specific linker options that GCC does not recognize.
12504
12505 If you want to pass an option that takes a separate argument, you must use
12506 @option{-Xlinker} twice, once for the option and once for the argument.
12507 For example, to pass @option{-assert definitions}, you must write
12508 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
12509 @option{-Xlinker "-assert definitions"}, because this passes the entire
12510 string as a single argument, which is not what the linker expects.
12511
12512 When using the GNU linker, it is usually more convenient to pass
12513 arguments to linker options using the @option{@var{option}=@var{value}}
12514 syntax than as separate arguments. For example, you can specify
12515 @option{-Xlinker -Map=output.map} rather than
12516 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
12517 this syntax for command-line options.
12518
12519 @item -Wl,@var{option}
12520 @opindex Wl
12521 Pass @var{option} as an option to the linker. If @var{option} contains
12522 commas, it is split into multiple options at the commas. You can use this
12523 syntax to pass an argument to the option.
12524 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
12525 linker. When using the GNU linker, you can also get the same effect with
12526 @option{-Wl,-Map=output.map}.
12527
12528 @item -u @var{symbol}
12529 @opindex u
12530 Pretend the symbol @var{symbol} is undefined, to force linking of
12531 library modules to define it. You can use @option{-u} multiple times with
12532 different symbols to force loading of additional library modules.
12533
12534 @item -z @var{keyword}
12535 @opindex z
12536 @option{-z} is passed directly on to the linker along with the keyword
12537 @var{keyword}. See the section in the documentation of your linker for
12538 permitted values and their meanings.
12539 @end table
12540
12541 @node Directory Options
12542 @section Options for Directory Search
12543 @cindex directory options
12544 @cindex options, directory search
12545 @cindex search path
12546
12547 These options specify directories to search for header files, for
12548 libraries and for parts of the compiler:
12549
12550 @table @gcctabopt
12551 @include cppdiropts.texi
12552
12553 @item -iplugindir=@var{dir}
12554 @opindex iplugindir=
12555 Set the directory to search for plugins that are passed
12556 by @option{-fplugin=@var{name}} instead of
12557 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
12558 to be used by the user, but only passed by the driver.
12559
12560 @item -L@var{dir}
12561 @opindex L
12562 Add directory @var{dir} to the list of directories to be searched
12563 for @option{-l}.
12564
12565 @item -B@var{prefix}
12566 @opindex B
12567 This option specifies where to find the executables, libraries,
12568 include files, and data files of the compiler itself.
12569
12570 The compiler driver program runs one or more of the subprograms
12571 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
12572 @var{prefix} as a prefix for each program it tries to run, both with and
12573 without @samp{@var{machine}/@var{version}/} for the corresponding target
12574 machine and compiler version.
12575
12576 For each subprogram to be run, the compiler driver first tries the
12577 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
12578 is not specified, the driver tries two standard prefixes,
12579 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
12580 those results in a file name that is found, the unmodified program
12581 name is searched for using the directories specified in your
12582 @env{PATH} environment variable.
12583
12584 The compiler checks to see if the path provided by @option{-B}
12585 refers to a directory, and if necessary it adds a directory
12586 separator character at the end of the path.
12587
12588 @option{-B} prefixes that effectively specify directory names also apply
12589 to libraries in the linker, because the compiler translates these
12590 options into @option{-L} options for the linker. They also apply to
12591 include files in the preprocessor, because the compiler translates these
12592 options into @option{-isystem} options for the preprocessor. In this case,
12593 the compiler appends @samp{include} to the prefix.
12594
12595 The runtime support file @file{libgcc.a} can also be searched for using
12596 the @option{-B} prefix, if needed. If it is not found there, the two
12597 standard prefixes above are tried, and that is all. The file is left
12598 out of the link if it is not found by those means.
12599
12600 Another way to specify a prefix much like the @option{-B} prefix is to use
12601 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
12602 Variables}.
12603
12604 As a special kludge, if the path provided by @option{-B} is
12605 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
12606 9, then it is replaced by @file{[dir/]include}. This is to help
12607 with boot-strapping the compiler.
12608
12609 @item -no-canonical-prefixes
12610 @opindex no-canonical-prefixes
12611 Do not expand any symbolic links, resolve references to @samp{/../}
12612 or @samp{/./}, or make the path absolute when generating a relative
12613 prefix.
12614
12615 @item --sysroot=@var{dir}
12616 @opindex sysroot
12617 Use @var{dir} as the logical root directory for headers and libraries.
12618 For example, if the compiler normally searches for headers in
12619 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
12620 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
12621
12622 If you use both this option and the @option{-isysroot} option, then
12623 the @option{--sysroot} option applies to libraries, but the
12624 @option{-isysroot} option applies to header files.
12625
12626 The GNU linker (beginning with version 2.16) has the necessary support
12627 for this option. If your linker does not support this option, the
12628 header file aspect of @option{--sysroot} still works, but the
12629 library aspect does not.
12630
12631 @item --no-sysroot-suffix
12632 @opindex no-sysroot-suffix
12633 For some targets, a suffix is added to the root directory specified
12634 with @option{--sysroot}, depending on the other options used, so that
12635 headers may for example be found in
12636 @file{@var{dir}/@var{suffix}/usr/include} instead of
12637 @file{@var{dir}/usr/include}. This option disables the addition of
12638 such a suffix.
12639
12640 @end table
12641
12642 @node Code Gen Options
12643 @section Options for Code Generation Conventions
12644 @cindex code generation conventions
12645 @cindex options, code generation
12646 @cindex run-time options
12647
12648 These machine-independent options control the interface conventions
12649 used in code generation.
12650
12651 Most of them have both positive and negative forms; the negative form
12652 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
12653 one of the forms is listed---the one that is not the default. You
12654 can figure out the other form by either removing @samp{no-} or adding
12655 it.
12656
12657 @table @gcctabopt
12658 @item -fstack-reuse=@var{reuse-level}
12659 @opindex fstack_reuse
12660 This option controls stack space reuse for user declared local/auto variables
12661 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
12662 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
12663 local variables and temporaries, @samp{named_vars} enables the reuse only for
12664 user defined local variables with names, and @samp{none} disables stack reuse
12665 completely. The default value is @samp{all}. The option is needed when the
12666 program extends the lifetime of a scoped local variable or a compiler generated
12667 temporary beyond the end point defined by the language. When a lifetime of
12668 a variable ends, and if the variable lives in memory, the optimizing compiler
12669 has the freedom to reuse its stack space with other temporaries or scoped
12670 local variables whose live range does not overlap with it. Legacy code extending
12671 local lifetime is likely to break with the stack reuse optimization.
12672
12673 For example,
12674
12675 @smallexample
12676 int *p;
12677 @{
12678 int local1;
12679
12680 p = &local1;
12681 local1 = 10;
12682 ....
12683 @}
12684 @{
12685 int local2;
12686 local2 = 20;
12687 ...
12688 @}
12689
12690 if (*p == 10) // out of scope use of local1
12691 @{
12692
12693 @}
12694 @end smallexample
12695
12696 Another example:
12697 @smallexample
12698
12699 struct A
12700 @{
12701 A(int k) : i(k), j(k) @{ @}
12702 int i;
12703 int j;
12704 @};
12705
12706 A *ap;
12707
12708 void foo(const A& ar)
12709 @{
12710 ap = &ar;
12711 @}
12712
12713 void bar()
12714 @{
12715 foo(A(10)); // temp object's lifetime ends when foo returns
12716
12717 @{
12718 A a(20);
12719 ....
12720 @}
12721 ap->i+= 10; // ap references out of scope temp whose space
12722 // is reused with a. What is the value of ap->i?
12723 @}
12724
12725 @end smallexample
12726
12727 The lifetime of a compiler generated temporary is well defined by the C++
12728 standard. When a lifetime of a temporary ends, and if the temporary lives
12729 in memory, the optimizing compiler has the freedom to reuse its stack
12730 space with other temporaries or scoped local variables whose live range
12731 does not overlap with it. However some of the legacy code relies on
12732 the behavior of older compilers in which temporaries' stack space is
12733 not reused, the aggressive stack reuse can lead to runtime errors. This
12734 option is used to control the temporary stack reuse optimization.
12735
12736 @item -ftrapv
12737 @opindex ftrapv
12738 This option generates traps for signed overflow on addition, subtraction,
12739 multiplication operations.
12740 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12741 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12742 @option{-fwrapv} being effective. Note that only active options override, so
12743 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12744 results in @option{-ftrapv} being effective.
12745
12746 @item -fwrapv
12747 @opindex fwrapv
12748 This option instructs the compiler to assume that signed arithmetic
12749 overflow of addition, subtraction and multiplication wraps around
12750 using twos-complement representation. This flag enables some optimizations
12751 and disables others.
12752 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12753 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12754 @option{-fwrapv} being effective. Note that only active options override, so
12755 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12756 results in @option{-ftrapv} being effective.
12757
12758 @item -fwrapv-pointer
12759 @opindex fwrapv-pointer
12760 This option instructs the compiler to assume that pointer arithmetic
12761 overflow on addition and subtraction wraps around using twos-complement
12762 representation. This flag disables some optimizations which assume
12763 pointer overflow is invalid.
12764
12765 @item -fstrict-overflow
12766 @opindex fstrict-overflow
12767 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
12768 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
12769
12770 @item -fexceptions
12771 @opindex fexceptions
12772 Enable exception handling. Generates extra code needed to propagate
12773 exceptions. For some targets, this implies GCC generates frame
12774 unwind information for all functions, which can produce significant data
12775 size overhead, although it does not affect execution. If you do not
12776 specify this option, GCC enables it by default for languages like
12777 C++ that normally require exception handling, and disables it for
12778 languages like C that do not normally require it. However, you may need
12779 to enable this option when compiling C code that needs to interoperate
12780 properly with exception handlers written in C++. You may also wish to
12781 disable this option if you are compiling older C++ programs that don't
12782 use exception handling.
12783
12784 @item -fnon-call-exceptions
12785 @opindex fnon-call-exceptions
12786 Generate code that allows trapping instructions to throw exceptions.
12787 Note that this requires platform-specific runtime support that does
12788 not exist everywhere. Moreover, it only allows @emph{trapping}
12789 instructions to throw exceptions, i.e.@: memory references or floating-point
12790 instructions. It does not allow exceptions to be thrown from
12791 arbitrary signal handlers such as @code{SIGALRM}.
12792
12793 @item -fdelete-dead-exceptions
12794 @opindex fdelete-dead-exceptions
12795 Consider that instructions that may throw exceptions but don't otherwise
12796 contribute to the execution of the program can be optimized away.
12797 This option is enabled by default for the Ada front end, as permitted by
12798 the Ada language specification.
12799 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
12800
12801 @item -funwind-tables
12802 @opindex funwind-tables
12803 Similar to @option{-fexceptions}, except that it just generates any needed
12804 static data, but does not affect the generated code in any other way.
12805 You normally do not need to enable this option; instead, a language processor
12806 that needs this handling enables it on your behalf.
12807
12808 @item -fasynchronous-unwind-tables
12809 @opindex fasynchronous-unwind-tables
12810 Generate unwind table in DWARF format, if supported by target machine. The
12811 table is exact at each instruction boundary, so it can be used for stack
12812 unwinding from asynchronous events (such as debugger or garbage collector).
12813
12814 @item -fno-gnu-unique
12815 @opindex fno-gnu-unique
12816 On systems with recent GNU assembler and C library, the C++ compiler
12817 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
12818 of template static data members and static local variables in inline
12819 functions are unique even in the presence of @code{RTLD_LOCAL}; this
12820 is necessary to avoid problems with a library used by two different
12821 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
12822 therefore disagreeing with the other one about the binding of the
12823 symbol. But this causes @code{dlclose} to be ignored for affected
12824 DSOs; if your program relies on reinitialization of a DSO via
12825 @code{dlclose} and @code{dlopen}, you can use
12826 @option{-fno-gnu-unique}.
12827
12828 @item -fpcc-struct-return
12829 @opindex fpcc-struct-return
12830 Return ``short'' @code{struct} and @code{union} values in memory like
12831 longer ones, rather than in registers. This convention is less
12832 efficient, but it has the advantage of allowing intercallability between
12833 GCC-compiled files and files compiled with other compilers, particularly
12834 the Portable C Compiler (pcc).
12835
12836 The precise convention for returning structures in memory depends
12837 on the target configuration macros.
12838
12839 Short structures and unions are those whose size and alignment match
12840 that of some integer type.
12841
12842 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
12843 switch is not binary compatible with code compiled with the
12844 @option{-freg-struct-return} switch.
12845 Use it to conform to a non-default application binary interface.
12846
12847 @item -freg-struct-return
12848 @opindex freg-struct-return
12849 Return @code{struct} and @code{union} values in registers when possible.
12850 This is more efficient for small structures than
12851 @option{-fpcc-struct-return}.
12852
12853 If you specify neither @option{-fpcc-struct-return} nor
12854 @option{-freg-struct-return}, GCC defaults to whichever convention is
12855 standard for the target. If there is no standard convention, GCC
12856 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
12857 the principal compiler. In those cases, we can choose the standard, and
12858 we chose the more efficient register return alternative.
12859
12860 @strong{Warning:} code compiled with the @option{-freg-struct-return}
12861 switch is not binary compatible with code compiled with the
12862 @option{-fpcc-struct-return} switch.
12863 Use it to conform to a non-default application binary interface.
12864
12865 @item -fshort-enums
12866 @opindex fshort-enums
12867 Allocate to an @code{enum} type only as many bytes as it needs for the
12868 declared range of possible values. Specifically, the @code{enum} type
12869 is equivalent to the smallest integer type that has enough room.
12870
12871 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
12872 code that is not binary compatible with code generated without that switch.
12873 Use it to conform to a non-default application binary interface.
12874
12875 @item -fshort-wchar
12876 @opindex fshort-wchar
12877 Override the underlying type for @code{wchar_t} to be @code{short
12878 unsigned int} instead of the default for the target. This option is
12879 useful for building programs to run under WINE@.
12880
12881 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
12882 code that is not binary compatible with code generated without that switch.
12883 Use it to conform to a non-default application binary interface.
12884
12885 @item -fno-common
12886 @opindex fno-common
12887 @cindex tentative definitions
12888 In C code, this option controls the placement of global variables
12889 defined without an initializer, known as @dfn{tentative definitions}
12890 in the C standard. Tentative definitions are distinct from declarations
12891 of a variable with the @code{extern} keyword, which do not allocate storage.
12892
12893 Unix C compilers have traditionally allocated storage for
12894 uninitialized global variables in a common block. This allows the
12895 linker to resolve all tentative definitions of the same variable
12896 in different compilation units to the same object, or to a non-tentative
12897 definition.
12898 This is the behavior specified by @option{-fcommon}, and is the default for
12899 GCC on most targets.
12900 On the other hand, this behavior is not required by ISO
12901 C, and on some targets may carry a speed or code size penalty on
12902 variable references.
12903
12904 The @option{-fno-common} option specifies that the compiler should instead
12905 place uninitialized global variables in the data section of the object file.
12906 This inhibits the merging of tentative definitions by the linker so
12907 you get a multiple-definition error if the same
12908 variable is defined in more than one compilation unit.
12909 Compiling with @option{-fno-common} is useful on targets for which
12910 it provides better performance, or if you wish to verify that the
12911 program will work on other systems that always treat uninitialized
12912 variable definitions this way.
12913
12914 @item -fno-ident
12915 @opindex fno-ident
12916 Ignore the @code{#ident} directive.
12917
12918 @item -finhibit-size-directive
12919 @opindex finhibit-size-directive
12920 Don't output a @code{.size} assembler directive, or anything else that
12921 would cause trouble if the function is split in the middle, and the
12922 two halves are placed at locations far apart in memory. This option is
12923 used when compiling @file{crtstuff.c}; you should not need to use it
12924 for anything else.
12925
12926 @item -fverbose-asm
12927 @opindex fverbose-asm
12928 Put extra commentary information in the generated assembly code to
12929 make it more readable. This option is generally only of use to those
12930 who actually need to read the generated assembly code (perhaps while
12931 debugging the compiler itself).
12932
12933 @option{-fno-verbose-asm}, the default, causes the
12934 extra information to be omitted and is useful when comparing two assembler
12935 files.
12936
12937 The added comments include:
12938
12939 @itemize @bullet
12940
12941 @item
12942 information on the compiler version and command-line options,
12943
12944 @item
12945 the source code lines associated with the assembly instructions,
12946 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12947
12948 @item
12949 hints on which high-level expressions correspond to
12950 the various assembly instruction operands.
12951
12952 @end itemize
12953
12954 For example, given this C source file:
12955
12956 @smallexample
12957 int test (int n)
12958 @{
12959 int i;
12960 int total = 0;
12961
12962 for (i = 0; i < n; i++)
12963 total += i * i;
12964
12965 return total;
12966 @}
12967 @end smallexample
12968
12969 compiling to (x86_64) assembly via @option{-S} and emitting the result
12970 direct to stdout via @option{-o} @option{-}
12971
12972 @smallexample
12973 gcc -S test.c -fverbose-asm -Os -o -
12974 @end smallexample
12975
12976 gives output similar to this:
12977
12978 @smallexample
12979 .file "test.c"
12980 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12981 [...snip...]
12982 # options passed:
12983 [...snip...]
12984
12985 .text
12986 .globl test
12987 .type test, @@function
12988 test:
12989 .LFB0:
12990 .cfi_startproc
12991 # test.c:4: int total = 0;
12992 xorl %eax, %eax # <retval>
12993 # test.c:6: for (i = 0; i < n; i++)
12994 xorl %edx, %edx # i
12995 .L2:
12996 # test.c:6: for (i = 0; i < n; i++)
12997 cmpl %edi, %edx # n, i
12998 jge .L5 #,
12999 # test.c:7: total += i * i;
13000 movl %edx, %ecx # i, tmp92
13001 imull %edx, %ecx # i, tmp92
13002 # test.c:6: for (i = 0; i < n; i++)
13003 incl %edx # i
13004 # test.c:7: total += i * i;
13005 addl %ecx, %eax # tmp92, <retval>
13006 jmp .L2 #
13007 .L5:
13008 # test.c:10: @}
13009 ret
13010 .cfi_endproc
13011 .LFE0:
13012 .size test, .-test
13013 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13014 .section .note.GNU-stack,"",@@progbits
13015 @end smallexample
13016
13017 The comments are intended for humans rather than machines and hence the
13018 precise format of the comments is subject to change.
13019
13020 @item -frecord-gcc-switches
13021 @opindex frecord-gcc-switches
13022 This switch causes the command line used to invoke the
13023 compiler to be recorded into the object file that is being created.
13024 This switch is only implemented on some targets and the exact format
13025 of the recording is target and binary file format dependent, but it
13026 usually takes the form of a section containing ASCII text. This
13027 switch is related to the @option{-fverbose-asm} switch, but that
13028 switch only records information in the assembler output file as
13029 comments, so it never reaches the object file.
13030 See also @option{-grecord-gcc-switches} for another
13031 way of storing compiler options into the object file.
13032
13033 @item -fpic
13034 @opindex fpic
13035 @cindex global offset table
13036 @cindex PIC
13037 Generate position-independent code (PIC) suitable for use in a shared
13038 library, if supported for the target machine. Such code accesses all
13039 constant addresses through a global offset table (GOT)@. The dynamic
13040 loader resolves the GOT entries when the program starts (the dynamic
13041 loader is not part of GCC; it is part of the operating system). If
13042 the GOT size for the linked executable exceeds a machine-specific
13043 maximum size, you get an error message from the linker indicating that
13044 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13045 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13046 on the m68k and RS/6000. The x86 has no such limit.)
13047
13048 Position-independent code requires special support, and therefore works
13049 only on certain machines. For the x86, GCC supports PIC for System V
13050 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13051 position-independent.
13052
13053 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13054 are defined to 1.
13055
13056 @item -fPIC
13057 @opindex fPIC
13058 If supported for the target machine, emit position-independent code,
13059 suitable for dynamic linking and avoiding any limit on the size of the
13060 global offset table. This option makes a difference on AArch64, m68k,
13061 PowerPC and SPARC@.
13062
13063 Position-independent code requires special support, and therefore works
13064 only on certain machines.
13065
13066 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13067 are defined to 2.
13068
13069 @item -fpie
13070 @itemx -fPIE
13071 @opindex fpie
13072 @opindex fPIE
13073 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13074 generated position-independent code can be only linked into executables.
13075 Usually these options are used to compile code that will be linked using
13076 the @option{-pie} GCC option.
13077
13078 @option{-fpie} and @option{-fPIE} both define the macros
13079 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13080 for @option{-fpie} and 2 for @option{-fPIE}.
13081
13082 @item -fno-plt
13083 @opindex fno-plt
13084 Do not use the PLT for external function calls in position-independent code.
13085 Instead, load the callee address at call sites from the GOT and branch to it.
13086 This leads to more efficient code by eliminating PLT stubs and exposing
13087 GOT loads to optimizations. On architectures such as 32-bit x86 where
13088 PLT stubs expect the GOT pointer in a specific register, this gives more
13089 register allocation freedom to the compiler.
13090 Lazy binding requires use of the PLT;
13091 with @option{-fno-plt} all external symbols are resolved at load time.
13092
13093 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13094 through the PLT for specific external functions.
13095
13096 In position-dependent code, a few targets also convert calls to
13097 functions that are marked to not use the PLT to use the GOT instead.
13098
13099 @item -fno-jump-tables
13100 @opindex fno-jump-tables
13101 Do not use jump tables for switch statements even where it would be
13102 more efficient than other code generation strategies. This option is
13103 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13104 building code that forms part of a dynamic linker and cannot
13105 reference the address of a jump table. On some targets, jump tables
13106 do not require a GOT and this option is not needed.
13107
13108 @item -ffixed-@var{reg}
13109 @opindex ffixed
13110 Treat the register named @var{reg} as a fixed register; generated code
13111 should never refer to it (except perhaps as a stack pointer, frame
13112 pointer or in some other fixed role).
13113
13114 @var{reg} must be the name of a register. The register names accepted
13115 are machine-specific and are defined in the @code{REGISTER_NAMES}
13116 macro in the machine description macro file.
13117
13118 This flag does not have a negative form, because it specifies a
13119 three-way choice.
13120
13121 @item -fcall-used-@var{reg}
13122 @opindex fcall-used
13123 Treat the register named @var{reg} as an allocable register that is
13124 clobbered by function calls. It may be allocated for temporaries or
13125 variables that do not live across a call. Functions compiled this way
13126 do not save and restore the register @var{reg}.
13127
13128 It is an error to use this flag with the frame pointer or stack pointer.
13129 Use of this flag for other registers that have fixed pervasive roles in
13130 the machine's execution model produces disastrous results.
13131
13132 This flag does not have a negative form, because it specifies a
13133 three-way choice.
13134
13135 @item -fcall-saved-@var{reg}
13136 @opindex fcall-saved
13137 Treat the register named @var{reg} as an allocable register saved by
13138 functions. It may be allocated even for temporaries or variables that
13139 live across a call. Functions compiled this way save and restore
13140 the register @var{reg} if they use it.
13141
13142 It is an error to use this flag with the frame pointer or stack pointer.
13143 Use of this flag for other registers that have fixed pervasive roles in
13144 the machine's execution model produces disastrous results.
13145
13146 A different sort of disaster results from the use of this flag for
13147 a register in which function values may be returned.
13148
13149 This flag does not have a negative form, because it specifies a
13150 three-way choice.
13151
13152 @item -fpack-struct[=@var{n}]
13153 @opindex fpack-struct
13154 Without a value specified, pack all structure members together without
13155 holes. When a value is specified (which must be a small power of two), pack
13156 structure members according to this value, representing the maximum
13157 alignment (that is, objects with default alignment requirements larger than
13158 this are output potentially unaligned at the next fitting location.
13159
13160 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13161 code that is not binary compatible with code generated without that switch.
13162 Additionally, it makes the code suboptimal.
13163 Use it to conform to a non-default application binary interface.
13164
13165 @item -fleading-underscore
13166 @opindex fleading-underscore
13167 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13168 change the way C symbols are represented in the object file. One use
13169 is to help link with legacy assembly code.
13170
13171 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13172 generate code that is not binary compatible with code generated without that
13173 switch. Use it to conform to a non-default application binary interface.
13174 Not all targets provide complete support for this switch.
13175
13176 @item -ftls-model=@var{model}
13177 @opindex ftls-model
13178 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13179 The @var{model} argument should be one of @samp{global-dynamic},
13180 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
13181 Note that the choice is subject to optimization: the compiler may use
13182 a more efficient model for symbols not visible outside of the translation
13183 unit, or if @option{-fpic} is not given on the command line.
13184
13185 The default without @option{-fpic} is @samp{initial-exec}; with
13186 @option{-fpic} the default is @samp{global-dynamic}.
13187
13188 @item -ftrampolines
13189 @opindex ftrampolines
13190 For targets that normally need trampolines for nested functions, always
13191 generate them instead of using descriptors. Otherwise, for targets that
13192 do not need them, like for example HP-PA or IA-64, do nothing.
13193
13194 A trampoline is a small piece of code that is created at run time on the
13195 stack when the address of a nested function is taken, and is used to call
13196 the nested function indirectly. Therefore, it requires the stack to be
13197 made executable in order for the program to work properly.
13198
13199 @option{-fno-trampolines} is enabled by default on a language by language
13200 basis to let the compiler avoid generating them, if it computes that this
13201 is safe, and replace them with descriptors. Descriptors are made up of data
13202 only, but the generated code must be prepared to deal with them. As of this
13203 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13204
13205 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13206 @option{-fno-trampolines} are not binary compatible if nested functions are
13207 present. This option must therefore be used on a program-wide basis and be
13208 manipulated with extreme care.
13209
13210 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13211 @opindex fvisibility
13212 Set the default ELF image symbol visibility to the specified option---all
13213 symbols are marked with this unless overridden within the code.
13214 Using this feature can very substantially improve linking and
13215 load times of shared object libraries, produce more optimized
13216 code, provide near-perfect API export and prevent symbol clashes.
13217 It is @strong{strongly} recommended that you use this in any shared objects
13218 you distribute.
13219
13220 Despite the nomenclature, @samp{default} always means public; i.e.,
13221 available to be linked against from outside the shared object.
13222 @samp{protected} and @samp{internal} are pretty useless in real-world
13223 usage so the only other commonly used option is @samp{hidden}.
13224 The default if @option{-fvisibility} isn't specified is
13225 @samp{default}, i.e., make every symbol public.
13226
13227 A good explanation of the benefits offered by ensuring ELF
13228 symbols have the correct visibility is given by ``How To Write
13229 Shared Libraries'' by Ulrich Drepper (which can be found at
13230 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
13231 solution made possible by this option to marking things hidden when
13232 the default is public is to make the default hidden and mark things
13233 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
13234 and @code{__attribute__ ((visibility("default")))} instead of
13235 @code{__declspec(dllexport)} you get almost identical semantics with
13236 identical syntax. This is a great boon to those working with
13237 cross-platform projects.
13238
13239 For those adding visibility support to existing code, you may find
13240 @code{#pragma GCC visibility} of use. This works by you enclosing
13241 the declarations you wish to set visibility for with (for example)
13242 @code{#pragma GCC visibility push(hidden)} and
13243 @code{#pragma GCC visibility pop}.
13244 Bear in mind that symbol visibility should be viewed @strong{as
13245 part of the API interface contract} and thus all new code should
13246 always specify visibility when it is not the default; i.e., declarations
13247 only for use within the local DSO should @strong{always} be marked explicitly
13248 as hidden as so to avoid PLT indirection overheads---making this
13249 abundantly clear also aids readability and self-documentation of the code.
13250 Note that due to ISO C++ specification requirements, @code{operator new} and
13251 @code{operator delete} must always be of default visibility.
13252
13253 Be aware that headers from outside your project, in particular system
13254 headers and headers from any other library you use, may not be
13255 expecting to be compiled with visibility other than the default. You
13256 may need to explicitly say @code{#pragma GCC visibility push(default)}
13257 before including any such headers.
13258
13259 @code{extern} declarations are not affected by @option{-fvisibility}, so
13260 a lot of code can be recompiled with @option{-fvisibility=hidden} with
13261 no modifications. However, this means that calls to @code{extern}
13262 functions with no explicit visibility use the PLT, so it is more
13263 effective to use @code{__attribute ((visibility))} and/or
13264 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
13265 declarations should be treated as hidden.
13266
13267 Note that @option{-fvisibility} does affect C++ vague linkage
13268 entities. This means that, for instance, an exception class that is
13269 be thrown between DSOs must be explicitly marked with default
13270 visibility so that the @samp{type_info} nodes are unified between
13271 the DSOs.
13272
13273 An overview of these techniques, their benefits and how to use them
13274 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
13275
13276 @item -fstrict-volatile-bitfields
13277 @opindex fstrict-volatile-bitfields
13278 This option should be used if accesses to volatile bit-fields (or other
13279 structure fields, although the compiler usually honors those types
13280 anyway) should use a single access of the width of the
13281 field's type, aligned to a natural alignment if possible. For
13282 example, targets with memory-mapped peripheral registers might require
13283 all such accesses to be 16 bits wide; with this flag you can
13284 declare all peripheral bit-fields as @code{unsigned short} (assuming short
13285 is 16 bits on these targets) to force GCC to use 16-bit accesses
13286 instead of, perhaps, a more efficient 32-bit access.
13287
13288 If this option is disabled, the compiler uses the most efficient
13289 instruction. In the previous example, that might be a 32-bit load
13290 instruction, even though that accesses bytes that do not contain
13291 any portion of the bit-field, or memory-mapped registers unrelated to
13292 the one being updated.
13293
13294 In some cases, such as when the @code{packed} attribute is applied to a
13295 structure field, it may not be possible to access the field with a single
13296 read or write that is correctly aligned for the target machine. In this
13297 case GCC falls back to generating multiple accesses rather than code that
13298 will fault or truncate the result at run time.
13299
13300 Note: Due to restrictions of the C/C++11 memory model, write accesses are
13301 not allowed to touch non bit-field members. It is therefore recommended
13302 to define all bits of the field's type as bit-field members.
13303
13304 The default value of this option is determined by the application binary
13305 interface for the target processor.
13306
13307 @item -fsync-libcalls
13308 @opindex fsync-libcalls
13309 This option controls whether any out-of-line instance of the @code{__sync}
13310 family of functions may be used to implement the C++11 @code{__atomic}
13311 family of functions.
13312
13313 The default value of this option is enabled, thus the only useful form
13314 of the option is @option{-fno-sync-libcalls}. This option is used in
13315 the implementation of the @file{libatomic} runtime library.
13316
13317 @end table
13318
13319 @node Developer Options
13320 @section GCC Developer Options
13321 @cindex developer options
13322 @cindex debugging GCC
13323 @cindex debug dump options
13324 @cindex dump options
13325 @cindex compilation statistics
13326
13327 This section describes command-line options that are primarily of
13328 interest to GCC developers, including options to support compiler
13329 testing and investigation of compiler bugs and compile-time
13330 performance problems. This includes options that produce debug dumps
13331 at various points in the compilation; that print statistics such as
13332 memory use and execution time; and that print information about GCC's
13333 configuration, such as where it searches for libraries. You should
13334 rarely need to use any of these options for ordinary compilation and
13335 linking tasks.
13336
13337 Many developer options that cause GCC to dump output to a file take an
13338 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
13339 or @samp{-} to dump to standard output, and @samp{stderr} for standard
13340 error.
13341
13342 If @samp{=@var{filename}} is omitted, a default dump file name is
13343 constructed by concatenating the base dump file name, a pass number,
13344 phase letter, and pass name. The base dump file name is the name of
13345 output file produced by the compiler if explicitly specified and not
13346 an executable; otherwise it is the source file name.
13347 The pass number is determined by the order passes are registered with
13348 the compiler's pass manager.
13349 This is generally the same as the order of execution, but passes
13350 registered by plugins, target-specific passes, or passes that are
13351 otherwise registered late are numbered higher than the pass named
13352 @samp{final}, even if they are executed earlier. The phase letter is
13353 one of @samp{i} (inter-procedural analysis), @samp{l}
13354 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
13355 The files are created in the directory of the output file.
13356
13357 @table @gcctabopt
13358
13359 @item -d@var{letters}
13360 @itemx -fdump-rtl-@var{pass}
13361 @itemx -fdump-rtl-@var{pass}=@var{filename}
13362 @opindex d
13363 @opindex fdump-rtl-@var{pass}
13364 Says to make debugging dumps during compilation at times specified by
13365 @var{letters}. This is used for debugging the RTL-based passes of the
13366 compiler.
13367
13368 Some @option{-d@var{letters}} switches have different meaning when
13369 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
13370 for information about preprocessor-specific dump options.
13371
13372 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
13373 @option{-d} option @var{letters}. Here are the possible
13374 letters for use in @var{pass} and @var{letters}, and their meanings:
13375
13376 @table @gcctabopt
13377
13378 @item -fdump-rtl-alignments
13379 @opindex fdump-rtl-alignments
13380 Dump after branch alignments have been computed.
13381
13382 @item -fdump-rtl-asmcons
13383 @opindex fdump-rtl-asmcons
13384 Dump after fixing rtl statements that have unsatisfied in/out constraints.
13385
13386 @item -fdump-rtl-auto_inc_dec
13387 @opindex fdump-rtl-auto_inc_dec
13388 Dump after auto-inc-dec discovery. This pass is only run on
13389 architectures that have auto inc or auto dec instructions.
13390
13391 @item -fdump-rtl-barriers
13392 @opindex fdump-rtl-barriers
13393 Dump after cleaning up the barrier instructions.
13394
13395 @item -fdump-rtl-bbpart
13396 @opindex fdump-rtl-bbpart
13397 Dump after partitioning hot and cold basic blocks.
13398
13399 @item -fdump-rtl-bbro
13400 @opindex fdump-rtl-bbro
13401 Dump after block reordering.
13402
13403 @item -fdump-rtl-btl1
13404 @itemx -fdump-rtl-btl2
13405 @opindex fdump-rtl-btl2
13406 @opindex fdump-rtl-btl2
13407 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
13408 after the two branch
13409 target load optimization passes.
13410
13411 @item -fdump-rtl-bypass
13412 @opindex fdump-rtl-bypass
13413 Dump after jump bypassing and control flow optimizations.
13414
13415 @item -fdump-rtl-combine
13416 @opindex fdump-rtl-combine
13417 Dump after the RTL instruction combination pass.
13418
13419 @item -fdump-rtl-compgotos
13420 @opindex fdump-rtl-compgotos
13421 Dump after duplicating the computed gotos.
13422
13423 @item -fdump-rtl-ce1
13424 @itemx -fdump-rtl-ce2
13425 @itemx -fdump-rtl-ce3
13426 @opindex fdump-rtl-ce1
13427 @opindex fdump-rtl-ce2
13428 @opindex fdump-rtl-ce3
13429 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
13430 @option{-fdump-rtl-ce3} enable dumping after the three
13431 if conversion passes.
13432
13433 @item -fdump-rtl-cprop_hardreg
13434 @opindex fdump-rtl-cprop_hardreg
13435 Dump after hard register copy propagation.
13436
13437 @item -fdump-rtl-csa
13438 @opindex fdump-rtl-csa
13439 Dump after combining stack adjustments.
13440
13441 @item -fdump-rtl-cse1
13442 @itemx -fdump-rtl-cse2
13443 @opindex fdump-rtl-cse1
13444 @opindex fdump-rtl-cse2
13445 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
13446 the two common subexpression elimination passes.
13447
13448 @item -fdump-rtl-dce
13449 @opindex fdump-rtl-dce
13450 Dump after the standalone dead code elimination passes.
13451
13452 @item -fdump-rtl-dbr
13453 @opindex fdump-rtl-dbr
13454 Dump after delayed branch scheduling.
13455
13456 @item -fdump-rtl-dce1
13457 @itemx -fdump-rtl-dce2
13458 @opindex fdump-rtl-dce1
13459 @opindex fdump-rtl-dce2
13460 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
13461 the two dead store elimination passes.
13462
13463 @item -fdump-rtl-eh
13464 @opindex fdump-rtl-eh
13465 Dump after finalization of EH handling code.
13466
13467 @item -fdump-rtl-eh_ranges
13468 @opindex fdump-rtl-eh_ranges
13469 Dump after conversion of EH handling range regions.
13470
13471 @item -fdump-rtl-expand
13472 @opindex fdump-rtl-expand
13473 Dump after RTL generation.
13474
13475 @item -fdump-rtl-fwprop1
13476 @itemx -fdump-rtl-fwprop2
13477 @opindex fdump-rtl-fwprop1
13478 @opindex fdump-rtl-fwprop2
13479 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
13480 dumping after the two forward propagation passes.
13481
13482 @item -fdump-rtl-gcse1
13483 @itemx -fdump-rtl-gcse2
13484 @opindex fdump-rtl-gcse1
13485 @opindex fdump-rtl-gcse2
13486 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
13487 after global common subexpression elimination.
13488
13489 @item -fdump-rtl-init-regs
13490 @opindex fdump-rtl-init-regs
13491 Dump after the initialization of the registers.
13492
13493 @item -fdump-rtl-initvals
13494 @opindex fdump-rtl-initvals
13495 Dump after the computation of the initial value sets.
13496
13497 @item -fdump-rtl-into_cfglayout
13498 @opindex fdump-rtl-into_cfglayout
13499 Dump after converting to cfglayout mode.
13500
13501 @item -fdump-rtl-ira
13502 @opindex fdump-rtl-ira
13503 Dump after iterated register allocation.
13504
13505 @item -fdump-rtl-jump
13506 @opindex fdump-rtl-jump
13507 Dump after the second jump optimization.
13508
13509 @item -fdump-rtl-loop2
13510 @opindex fdump-rtl-loop2
13511 @option{-fdump-rtl-loop2} enables dumping after the rtl
13512 loop optimization passes.
13513
13514 @item -fdump-rtl-mach
13515 @opindex fdump-rtl-mach
13516 Dump after performing the machine dependent reorganization pass, if that
13517 pass exists.
13518
13519 @item -fdump-rtl-mode_sw
13520 @opindex fdump-rtl-mode_sw
13521 Dump after removing redundant mode switches.
13522
13523 @item -fdump-rtl-rnreg
13524 @opindex fdump-rtl-rnreg
13525 Dump after register renumbering.
13526
13527 @item -fdump-rtl-outof_cfglayout
13528 @opindex fdump-rtl-outof_cfglayout
13529 Dump after converting from cfglayout mode.
13530
13531 @item -fdump-rtl-peephole2
13532 @opindex fdump-rtl-peephole2
13533 Dump after the peephole pass.
13534
13535 @item -fdump-rtl-postreload
13536 @opindex fdump-rtl-postreload
13537 Dump after post-reload optimizations.
13538
13539 @item -fdump-rtl-pro_and_epilogue
13540 @opindex fdump-rtl-pro_and_epilogue
13541 Dump after generating the function prologues and epilogues.
13542
13543 @item -fdump-rtl-sched1
13544 @itemx -fdump-rtl-sched2
13545 @opindex fdump-rtl-sched1
13546 @opindex fdump-rtl-sched2
13547 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
13548 after the basic block scheduling passes.
13549
13550 @item -fdump-rtl-ree
13551 @opindex fdump-rtl-ree
13552 Dump after sign/zero extension elimination.
13553
13554 @item -fdump-rtl-seqabstr
13555 @opindex fdump-rtl-seqabstr
13556 Dump after common sequence discovery.
13557
13558 @item -fdump-rtl-shorten
13559 @opindex fdump-rtl-shorten
13560 Dump after shortening branches.
13561
13562 @item -fdump-rtl-sibling
13563 @opindex fdump-rtl-sibling
13564 Dump after sibling call optimizations.
13565
13566 @item -fdump-rtl-split1
13567 @itemx -fdump-rtl-split2
13568 @itemx -fdump-rtl-split3
13569 @itemx -fdump-rtl-split4
13570 @itemx -fdump-rtl-split5
13571 @opindex fdump-rtl-split1
13572 @opindex fdump-rtl-split2
13573 @opindex fdump-rtl-split3
13574 @opindex fdump-rtl-split4
13575 @opindex fdump-rtl-split5
13576 These options enable dumping after five rounds of
13577 instruction splitting.
13578
13579 @item -fdump-rtl-sms
13580 @opindex fdump-rtl-sms
13581 Dump after modulo scheduling. This pass is only run on some
13582 architectures.
13583
13584 @item -fdump-rtl-stack
13585 @opindex fdump-rtl-stack
13586 Dump after conversion from GCC's ``flat register file'' registers to the
13587 x87's stack-like registers. This pass is only run on x86 variants.
13588
13589 @item -fdump-rtl-subreg1
13590 @itemx -fdump-rtl-subreg2
13591 @opindex fdump-rtl-subreg1
13592 @opindex fdump-rtl-subreg2
13593 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
13594 the two subreg expansion passes.
13595
13596 @item -fdump-rtl-unshare
13597 @opindex fdump-rtl-unshare
13598 Dump after all rtl has been unshared.
13599
13600 @item -fdump-rtl-vartrack
13601 @opindex fdump-rtl-vartrack
13602 Dump after variable tracking.
13603
13604 @item -fdump-rtl-vregs
13605 @opindex fdump-rtl-vregs
13606 Dump after converting virtual registers to hard registers.
13607
13608 @item -fdump-rtl-web
13609 @opindex fdump-rtl-web
13610 Dump after live range splitting.
13611
13612 @item -fdump-rtl-regclass
13613 @itemx -fdump-rtl-subregs_of_mode_init
13614 @itemx -fdump-rtl-subregs_of_mode_finish
13615 @itemx -fdump-rtl-dfinit
13616 @itemx -fdump-rtl-dfinish
13617 @opindex fdump-rtl-regclass
13618 @opindex fdump-rtl-subregs_of_mode_init
13619 @opindex fdump-rtl-subregs_of_mode_finish
13620 @opindex fdump-rtl-dfinit
13621 @opindex fdump-rtl-dfinish
13622 These dumps are defined but always produce empty files.
13623
13624 @item -da
13625 @itemx -fdump-rtl-all
13626 @opindex da
13627 @opindex fdump-rtl-all
13628 Produce all the dumps listed above.
13629
13630 @item -dA
13631 @opindex dA
13632 Annotate the assembler output with miscellaneous debugging information.
13633
13634 @item -dD
13635 @opindex dD
13636 Dump all macro definitions, at the end of preprocessing, in addition to
13637 normal output.
13638
13639 @item -dH
13640 @opindex dH
13641 Produce a core dump whenever an error occurs.
13642
13643 @item -dp
13644 @opindex dp
13645 Annotate the assembler output with a comment indicating which
13646 pattern and alternative is used. The length and cost of each instruction are
13647 also printed.
13648
13649 @item -dP
13650 @opindex dP
13651 Dump the RTL in the assembler output as a comment before each instruction.
13652 Also turns on @option{-dp} annotation.
13653
13654 @item -dx
13655 @opindex dx
13656 Just generate RTL for a function instead of compiling it. Usually used
13657 with @option{-fdump-rtl-expand}.
13658 @end table
13659
13660 @item -fdump-noaddr
13661 @opindex fdump-noaddr
13662 When doing debugging dumps, suppress address output. This makes it more
13663 feasible to use diff on debugging dumps for compiler invocations with
13664 different compiler binaries and/or different
13665 text / bss / data / heap / stack / dso start locations.
13666
13667 @item -freport-bug
13668 @opindex freport-bug
13669 Collect and dump debug information into a temporary file if an
13670 internal compiler error (ICE) occurs.
13671
13672 @item -fdump-unnumbered
13673 @opindex fdump-unnumbered
13674 When doing debugging dumps, suppress instruction numbers and address output.
13675 This makes it more feasible to use diff on debugging dumps for compiler
13676 invocations with different options, in particular with and without
13677 @option{-g}.
13678
13679 @item -fdump-unnumbered-links
13680 @opindex fdump-unnumbered-links
13681 When doing debugging dumps (see @option{-d} option above), suppress
13682 instruction numbers for the links to the previous and next instructions
13683 in a sequence.
13684
13685 @item -fdump-ipa-@var{switch}
13686 @opindex fdump-ipa
13687 Control the dumping at various stages of inter-procedural analysis
13688 language tree to a file. The file name is generated by appending a
13689 switch specific suffix to the source file name, and the file is created
13690 in the same directory as the output file. The following dumps are
13691 possible:
13692
13693 @table @samp
13694 @item all
13695 Enables all inter-procedural analysis dumps.
13696
13697 @item cgraph
13698 Dumps information about call-graph optimization, unused function removal,
13699 and inlining decisions.
13700
13701 @item inline
13702 Dump after function inlining.
13703
13704 @end table
13705
13706 @item -fdump-lang-all
13707 @itemx -fdump-lang-@var{switch}
13708 @itemx -fdump-lang-@var{switch}-@var{options}
13709 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
13710 @opindex fdump-lang-all
13711 @opindex fdump-lang
13712 Control the dumping of language-specific information. The @var{options}
13713 and @var{filename} portions behave as described in the
13714 @option{-fdump-tree} option. The following @var{switch} values are
13715 accepted:
13716
13717 @table @samp
13718 @item all
13719
13720 Enable all language-specific dumps.
13721
13722 @item class
13723 Dump class hierarchy information. Virtual table information is emitted
13724 unless '@option{slim}' is specified. This option is applicable to C++ only.
13725
13726 @item raw
13727 Dump the raw internal tree data. This option is applicable to C++ only.
13728
13729 @end table
13730
13731 @item -fdump-passes
13732 @opindex fdump-passes
13733 Print on @file{stderr} the list of optimization passes that are turned
13734 on and off by the current command-line options.
13735
13736 @item -fdump-statistics-@var{option}
13737 @opindex fdump-statistics
13738 Enable and control dumping of pass statistics in a separate file. The
13739 file name is generated by appending a suffix ending in
13740 @samp{.statistics} to the source file name, and the file is created in
13741 the same directory as the output file. If the @samp{-@var{option}}
13742 form is used, @samp{-stats} causes counters to be summed over the
13743 whole compilation unit while @samp{-details} dumps every event as
13744 the passes generate them. The default with no option is to sum
13745 counters for each function compiled.
13746
13747 @item -fdump-tree-all
13748 @itemx -fdump-tree-@var{switch}
13749 @itemx -fdump-tree-@var{switch}-@var{options}
13750 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
13751 @opindex fdump-tree-all
13752 @opindex fdump-tree
13753 Control the dumping at various stages of processing the intermediate
13754 language tree to a file. If the @samp{-@var{options}}
13755 form is used, @var{options} is a list of @samp{-} separated options
13756 which control the details of the dump. Not all options are applicable
13757 to all dumps; those that are not meaningful are ignored. The
13758 following options are available
13759
13760 @table @samp
13761 @item address
13762 Print the address of each node. Usually this is not meaningful as it
13763 changes according to the environment and source file. Its primary use
13764 is for tying up a dump file with a debug environment.
13765 @item asmname
13766 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
13767 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
13768 use working backward from mangled names in the assembly file.
13769 @item slim
13770 When dumping front-end intermediate representations, inhibit dumping
13771 of members of a scope or body of a function merely because that scope
13772 has been reached. Only dump such items when they are directly reachable
13773 by some other path.
13774
13775 When dumping pretty-printed trees, this option inhibits dumping the
13776 bodies of control structures.
13777
13778 When dumping RTL, print the RTL in slim (condensed) form instead of
13779 the default LISP-like representation.
13780 @item raw
13781 Print a raw representation of the tree. By default, trees are
13782 pretty-printed into a C-like representation.
13783 @item details
13784 Enable more detailed dumps (not honored by every dump option). Also
13785 include information from the optimization passes.
13786 @item stats
13787 Enable dumping various statistics about the pass (not honored by every dump
13788 option).
13789 @item blocks
13790 Enable showing basic block boundaries (disabled in raw dumps).
13791 @item graph
13792 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
13793 dump a representation of the control flow graph suitable for viewing with
13794 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
13795 the file is pretty-printed as a subgraph, so that GraphViz can render them
13796 all in a single plot.
13797
13798 This option currently only works for RTL dumps, and the RTL is always
13799 dumped in slim form.
13800 @item vops
13801 Enable showing virtual operands for every statement.
13802 @item lineno
13803 Enable showing line numbers for statements.
13804 @item uid
13805 Enable showing the unique ID (@code{DECL_UID}) for each variable.
13806 @item verbose
13807 Enable showing the tree dump for each statement.
13808 @item eh
13809 Enable showing the EH region number holding each statement.
13810 @item scev
13811 Enable showing scalar evolution analysis details.
13812 @item optimized
13813 Enable showing optimization information (only available in certain
13814 passes).
13815 @item missed
13816 Enable showing missed optimization information (only available in certain
13817 passes).
13818 @item note
13819 Enable other detailed optimization information (only available in
13820 certain passes).
13821 @item all
13822 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
13823 and @option{lineno}.
13824 @item optall
13825 Turn on all optimization options, i.e., @option{optimized},
13826 @option{missed}, and @option{note}.
13827 @end table
13828
13829 To determine what tree dumps are available or find the dump for a pass
13830 of interest follow the steps below.
13831
13832 @enumerate
13833 @item
13834 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
13835 look for a code that corresponds to the pass you are interested in.
13836 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
13837 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
13838 The number at the end distinguishes distinct invocations of the same pass.
13839 @item
13840 To enable the creation of the dump file, append the pass code to
13841 the @option{-fdump-} option prefix and invoke GCC with it. For example,
13842 to enable the dump from the Early Value Range Propagation pass, invoke
13843 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
13844 specify the name of the dump file. If you don't specify one, GCC
13845 creates as described below.
13846 @item
13847 Find the pass dump in a file whose name is composed of three components
13848 separated by a period: the name of the source file GCC was invoked to
13849 compile, a numeric suffix indicating the pass number followed by the
13850 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
13851 and finally the pass code. For example, the Early VRP pass dump might
13852 be in a file named @file{myfile.c.038t.evrp} in the current working
13853 directory. Note that the numeric codes are not stable and may change
13854 from one version of GCC to another.
13855 @end enumerate
13856
13857 @item -fopt-info
13858 @itemx -fopt-info-@var{options}
13859 @itemx -fopt-info-@var{options}=@var{filename}
13860 @opindex fopt-info
13861 Controls optimization dumps from various optimization passes. If the
13862 @samp{-@var{options}} form is used, @var{options} is a list of
13863 @samp{-} separated option keywords to select the dump details and
13864 optimizations.
13865
13866 The @var{options} can be divided into two groups: options describing the
13867 verbosity of the dump, and options describing which optimizations
13868 should be included. The options from both the groups can be freely
13869 mixed as they are non-overlapping. However, in case of any conflicts,
13870 the later options override the earlier options on the command
13871 line.
13872
13873 The following options control the dump verbosity:
13874
13875 @table @samp
13876 @item optimized
13877 Print information when an optimization is successfully applied. It is
13878 up to a pass to decide which information is relevant. For example, the
13879 vectorizer passes print the source location of loops which are
13880 successfully vectorized.
13881 @item missed
13882 Print information about missed optimizations. Individual passes
13883 control which information to include in the output.
13884 @item note
13885 Print verbose information about optimizations, such as certain
13886 transformations, more detailed messages about decisions etc.
13887 @item all
13888 Print detailed optimization information. This includes
13889 @samp{optimized}, @samp{missed}, and @samp{note}.
13890 @end table
13891
13892 One or more of the following option keywords can be used to describe a
13893 group of optimizations:
13894
13895 @table @samp
13896 @item ipa
13897 Enable dumps from all interprocedural optimizations.
13898 @item loop
13899 Enable dumps from all loop optimizations.
13900 @item inline
13901 Enable dumps from all inlining optimizations.
13902 @item omp
13903 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
13904 @item vec
13905 Enable dumps from all vectorization optimizations.
13906 @item optall
13907 Enable dumps from all optimizations. This is a superset of
13908 the optimization groups listed above.
13909 @end table
13910
13911 If @var{options} is
13912 omitted, it defaults to @samp{optimized-optall}, which means to dump all
13913 info about successful optimizations from all the passes.
13914
13915 If the @var{filename} is provided, then the dumps from all the
13916 applicable optimizations are concatenated into the @var{filename}.
13917 Otherwise the dump is output onto @file{stderr}. Though multiple
13918 @option{-fopt-info} options are accepted, only one of them can include
13919 a @var{filename}. If other filenames are provided then all but the
13920 first such option are ignored.
13921
13922 Note that the output @var{filename} is overwritten
13923 in case of multiple translation units. If a combined output from
13924 multiple translation units is desired, @file{stderr} should be used
13925 instead.
13926
13927 In the following example, the optimization info is output to
13928 @file{stderr}:
13929
13930 @smallexample
13931 gcc -O3 -fopt-info
13932 @end smallexample
13933
13934 This example:
13935 @smallexample
13936 gcc -O3 -fopt-info-missed=missed.all
13937 @end smallexample
13938
13939 @noindent
13940 outputs missed optimization report from all the passes into
13941 @file{missed.all}, and this one:
13942
13943 @smallexample
13944 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13945 @end smallexample
13946
13947 @noindent
13948 prints information about missed optimization opportunities from
13949 vectorization passes on @file{stderr}.
13950 Note that @option{-fopt-info-vec-missed} is equivalent to
13951 @option{-fopt-info-missed-vec}. The order of the optimization group
13952 names and message types listed after @option{-fopt-info} does not matter.
13953
13954 As another example,
13955 @smallexample
13956 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13957 @end smallexample
13958
13959 @noindent
13960 outputs information about missed optimizations as well as
13961 optimized locations from all the inlining passes into
13962 @file{inline.txt}.
13963
13964 Finally, consider:
13965
13966 @smallexample
13967 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13968 @end smallexample
13969
13970 @noindent
13971 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
13972 in conflict since only one output file is allowed. In this case, only
13973 the first option takes effect and the subsequent options are
13974 ignored. Thus only @file{vec.miss} is produced which contains
13975 dumps from the vectorizer about missed opportunities.
13976
13977 @item -fsched-verbose=@var{n}
13978 @opindex fsched-verbose
13979 On targets that use instruction scheduling, this option controls the
13980 amount of debugging output the scheduler prints to the dump files.
13981
13982 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
13983 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
13984 For @var{n} greater than one, it also output basic block probabilities,
13985 detailed ready list information and unit/insn info. For @var{n} greater
13986 than two, it includes RTL at abort point, control-flow and regions info.
13987 And for @var{n} over four, @option{-fsched-verbose} also includes
13988 dependence info.
13989
13990
13991
13992 @item -fenable-@var{kind}-@var{pass}
13993 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
13994 @opindex fdisable-
13995 @opindex fenable-
13996
13997 This is a set of options that are used to explicitly disable/enable
13998 optimization passes. These options are intended for use for debugging GCC.
13999 Compiler users should use regular options for enabling/disabling
14000 passes instead.
14001
14002 @table @gcctabopt
14003
14004 @item -fdisable-ipa-@var{pass}
14005 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14006 statically invoked in the compiler multiple times, the pass name should be
14007 appended with a sequential number starting from 1.
14008
14009 @item -fdisable-rtl-@var{pass}
14010 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14011 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14012 statically invoked in the compiler multiple times, the pass name should be
14013 appended with a sequential number starting from 1. @var{range-list} is a
14014 comma-separated list of function ranges or assembler names. Each range is a number
14015 pair separated by a colon. The range is inclusive in both ends. If the range
14016 is trivial, the number pair can be simplified as a single number. If the
14017 function's call graph node's @var{uid} falls within one of the specified ranges,
14018 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14019 function header of a dump file, and the pass names can be dumped by using
14020 option @option{-fdump-passes}.
14021
14022 @item -fdisable-tree-@var{pass}
14023 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14024 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14025 option arguments.
14026
14027 @item -fenable-ipa-@var{pass}
14028 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14029 statically invoked in the compiler multiple times, the pass name should be
14030 appended with a sequential number starting from 1.
14031
14032 @item -fenable-rtl-@var{pass}
14033 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14034 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14035 description and examples.
14036
14037 @item -fenable-tree-@var{pass}
14038 @itemx -fenable-tree-@var{pass}=@var{range-list}
14039 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14040 of option arguments.
14041
14042 @end table
14043
14044 Here are some examples showing uses of these options.
14045
14046 @smallexample
14047
14048 # disable ccp1 for all functions
14049 -fdisable-tree-ccp1
14050 # disable complete unroll for function whose cgraph node uid is 1
14051 -fenable-tree-cunroll=1
14052 # disable gcse2 for functions at the following ranges [1,1],
14053 # [300,400], and [400,1000]
14054 # disable gcse2 for functions foo and foo2
14055 -fdisable-rtl-gcse2=foo,foo2
14056 # disable early inlining
14057 -fdisable-tree-einline
14058 # disable ipa inlining
14059 -fdisable-ipa-inline
14060 # enable tree full unroll
14061 -fenable-tree-unroll
14062
14063 @end smallexample
14064
14065 @item -fchecking
14066 @itemx -fchecking=@var{n}
14067 @opindex fchecking
14068 @opindex fno-checking
14069 Enable internal consistency checking. The default depends on
14070 the compiler configuration. @option{-fchecking=2} enables further
14071 internal consistency checking that might affect code generation.
14072
14073 @item -frandom-seed=@var{string}
14074 @opindex frandom-seed
14075 This option provides a seed that GCC uses in place of
14076 random numbers in generating certain symbol names
14077 that have to be different in every compiled file. It is also used to
14078 place unique stamps in coverage data files and the object files that
14079 produce them. You can use the @option{-frandom-seed} option to produce
14080 reproducibly identical object files.
14081
14082 The @var{string} can either be a number (decimal, octal or hex) or an
14083 arbitrary string (in which case it's converted to a number by
14084 computing CRC32).
14085
14086 The @var{string} should be different for every file you compile.
14087
14088 @item -save-temps
14089 @itemx -save-temps=cwd
14090 @opindex save-temps
14091 Store the usual ``temporary'' intermediate files permanently; place them
14092 in the current directory and name them based on the source file. Thus,
14093 compiling @file{foo.c} with @option{-c -save-temps} produces files
14094 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
14095 preprocessed @file{foo.i} output file even though the compiler now
14096 normally uses an integrated preprocessor.
14097
14098 When used in combination with the @option{-x} command-line option,
14099 @option{-save-temps} is sensible enough to avoid over writing an
14100 input source file with the same extension as an intermediate file.
14101 The corresponding intermediate file may be obtained by renaming the
14102 source file before using @option{-save-temps}.
14103
14104 If you invoke GCC in parallel, compiling several different source
14105 files that share a common base name in different subdirectories or the
14106 same source file compiled for multiple output destinations, it is
14107 likely that the different parallel compilers will interfere with each
14108 other, and overwrite the temporary files. For instance:
14109
14110 @smallexample
14111 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14112 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14113 @end smallexample
14114
14115 may result in @file{foo.i} and @file{foo.o} being written to
14116 simultaneously by both compilers.
14117
14118 @item -save-temps=obj
14119 @opindex save-temps=obj
14120 Store the usual ``temporary'' intermediate files permanently. If the
14121 @option{-o} option is used, the temporary files are based on the
14122 object file. If the @option{-o} option is not used, the
14123 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
14124
14125 For example:
14126
14127 @smallexample
14128 gcc -save-temps=obj -c foo.c
14129 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14130 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14131 @end smallexample
14132
14133 @noindent
14134 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
14135 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
14136 @file{dir2/yfoobar.o}.
14137
14138 @item -time@r{[}=@var{file}@r{]}
14139 @opindex time
14140 Report the CPU time taken by each subprocess in the compilation
14141 sequence. For C source files, this is the compiler proper and assembler
14142 (plus the linker if linking is done).
14143
14144 Without the specification of an output file, the output looks like this:
14145
14146 @smallexample
14147 # cc1 0.12 0.01
14148 # as 0.00 0.01
14149 @end smallexample
14150
14151 The first number on each line is the ``user time'', that is time spent
14152 executing the program itself. The second number is ``system time'',
14153 time spent executing operating system routines on behalf of the program.
14154 Both numbers are in seconds.
14155
14156 With the specification of an output file, the output is appended to the
14157 named file, and it looks like this:
14158
14159 @smallexample
14160 0.12 0.01 cc1 @var{options}
14161 0.00 0.01 as @var{options}
14162 @end smallexample
14163
14164 The ``user time'' and the ``system time'' are moved before the program
14165 name, and the options passed to the program are displayed, so that one
14166 can later tell what file was being compiled, and with which options.
14167
14168 @item -fdump-final-insns@r{[}=@var{file}@r{]}
14169 @opindex fdump-final-insns
14170 Dump the final internal representation (RTL) to @var{file}. If the
14171 optional argument is omitted (or if @var{file} is @code{.}), the name
14172 of the dump file is determined by appending @code{.gkd} to the
14173 compilation output file name.
14174
14175 @item -fcompare-debug@r{[}=@var{opts}@r{]}
14176 @opindex fcompare-debug
14177 @opindex fno-compare-debug
14178 If no error occurs during compilation, run the compiler a second time,
14179 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
14180 passed to the second compilation. Dump the final internal
14181 representation in both compilations, and print an error if they differ.
14182
14183 If the equal sign is omitted, the default @option{-gtoggle} is used.
14184
14185 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
14186 and nonzero, implicitly enables @option{-fcompare-debug}. If
14187 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
14188 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
14189 is used.
14190
14191 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
14192 is equivalent to @option{-fno-compare-debug}, which disables the dumping
14193 of the final representation and the second compilation, preventing even
14194 @env{GCC_COMPARE_DEBUG} from taking effect.
14195
14196 To verify full coverage during @option{-fcompare-debug} testing, set
14197 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
14198 which GCC rejects as an invalid option in any actual compilation
14199 (rather than preprocessing, assembly or linking). To get just a
14200 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
14201 not overridden} will do.
14202
14203 @item -fcompare-debug-second
14204 @opindex fcompare-debug-second
14205 This option is implicitly passed to the compiler for the second
14206 compilation requested by @option{-fcompare-debug}, along with options to
14207 silence warnings, and omitting other options that would cause the compiler
14208 to produce output to files or to standard output as a side effect. Dump
14209 files and preserved temporary files are renamed so as to contain the
14210 @code{.gk} additional extension during the second compilation, to avoid
14211 overwriting those generated by the first.
14212
14213 When this option is passed to the compiler driver, it causes the
14214 @emph{first} compilation to be skipped, which makes it useful for little
14215 other than debugging the compiler proper.
14216
14217 @item -gtoggle
14218 @opindex gtoggle
14219 Turn off generation of debug info, if leaving out this option
14220 generates it, or turn it on at level 2 otherwise. The position of this
14221 argument in the command line does not matter; it takes effect after all
14222 other options are processed, and it does so only once, no matter how
14223 many times it is given. This is mainly intended to be used with
14224 @option{-fcompare-debug}.
14225
14226 @item -fvar-tracking-assignments-toggle
14227 @opindex fvar-tracking-assignments-toggle
14228 @opindex fno-var-tracking-assignments-toggle
14229 Toggle @option{-fvar-tracking-assignments}, in the same way that
14230 @option{-gtoggle} toggles @option{-g}.
14231
14232 @item -Q
14233 @opindex Q
14234 Makes the compiler print out each function name as it is compiled, and
14235 print some statistics about each pass when it finishes.
14236
14237 @item -ftime-report
14238 @opindex ftime-report
14239 Makes the compiler print some statistics about the time consumed by each
14240 pass when it finishes.
14241
14242 @item -ftime-report-details
14243 @opindex ftime-report-details
14244 Record the time consumed by infrastructure parts separately for each pass.
14245
14246 @item -fira-verbose=@var{n}
14247 @opindex fira-verbose
14248 Control the verbosity of the dump file for the integrated register allocator.
14249 The default value is 5. If the value @var{n} is greater or equal to 10,
14250 the dump output is sent to stderr using the same format as @var{n} minus 10.
14251
14252 @item -flto-report
14253 @opindex flto-report
14254 Prints a report with internal details on the workings of the link-time
14255 optimizer. The contents of this report vary from version to version.
14256 It is meant to be useful to GCC developers when processing object
14257 files in LTO mode (via @option{-flto}).
14258
14259 Disabled by default.
14260
14261 @item -flto-report-wpa
14262 @opindex flto-report-wpa
14263 Like @option{-flto-report}, but only print for the WPA phase of Link
14264 Time Optimization.
14265
14266 @item -fmem-report
14267 @opindex fmem-report
14268 Makes the compiler print some statistics about permanent memory
14269 allocation when it finishes.
14270
14271 @item -fmem-report-wpa
14272 @opindex fmem-report-wpa
14273 Makes the compiler print some statistics about permanent memory
14274 allocation for the WPA phase only.
14275
14276 @item -fpre-ipa-mem-report
14277 @opindex fpre-ipa-mem-report
14278 @item -fpost-ipa-mem-report
14279 @opindex fpost-ipa-mem-report
14280 Makes the compiler print some statistics about permanent memory
14281 allocation before or after interprocedural optimization.
14282
14283 @item -fprofile-report
14284 @opindex fprofile-report
14285 Makes the compiler print some statistics about consistency of the
14286 (estimated) profile and effect of individual passes.
14287
14288 @item -fstack-usage
14289 @opindex fstack-usage
14290 Makes the compiler output stack usage information for the program, on a
14291 per-function basis. The filename for the dump is made by appending
14292 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
14293 the output file, if explicitly specified and it is not an executable,
14294 otherwise it is the basename of the source file. An entry is made up
14295 of three fields:
14296
14297 @itemize
14298 @item
14299 The name of the function.
14300 @item
14301 A number of bytes.
14302 @item
14303 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
14304 @end itemize
14305
14306 The qualifier @code{static} means that the function manipulates the stack
14307 statically: a fixed number of bytes are allocated for the frame on function
14308 entry and released on function exit; no stack adjustments are otherwise made
14309 in the function. The second field is this fixed number of bytes.
14310
14311 The qualifier @code{dynamic} means that the function manipulates the stack
14312 dynamically: in addition to the static allocation described above, stack
14313 adjustments are made in the body of the function, for example to push/pop
14314 arguments around function calls. If the qualifier @code{bounded} is also
14315 present, the amount of these adjustments is bounded at compile time and
14316 the second field is an upper bound of the total amount of stack used by
14317 the function. If it is not present, the amount of these adjustments is
14318 not bounded at compile time and the second field only represents the
14319 bounded part.
14320
14321 @item -fstats
14322 @opindex fstats
14323 Emit statistics about front-end processing at the end of the compilation.
14324 This option is supported only by the C++ front end, and
14325 the information is generally only useful to the G++ development team.
14326
14327 @item -fdbg-cnt-list
14328 @opindex fdbg-cnt-list
14329 Print the name and the counter upper bound for all debug counters.
14330
14331
14332 @item -fdbg-cnt=@var{counter-value-list}
14333 @opindex fdbg-cnt
14334 Set the internal debug counter upper bound. @var{counter-value-list}
14335 is a comma-separated list of @var{name}:@var{value} pairs
14336 which sets the upper bound of each debug counter @var{name} to @var{value}.
14337 All debug counters have the initial upper bound of @code{UINT_MAX};
14338 thus @code{dbg_cnt} returns true always unless the upper bound
14339 is set by this option.
14340 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
14341 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
14342
14343 @item -print-file-name=@var{library}
14344 @opindex print-file-name
14345 Print the full absolute name of the library file @var{library} that
14346 would be used when linking---and don't do anything else. With this
14347 option, GCC does not compile or link anything; it just prints the
14348 file name.
14349
14350 @item -print-multi-directory
14351 @opindex print-multi-directory
14352 Print the directory name corresponding to the multilib selected by any
14353 other switches present in the command line. This directory is supposed
14354 to exist in @env{GCC_EXEC_PREFIX}.
14355
14356 @item -print-multi-lib
14357 @opindex print-multi-lib
14358 Print the mapping from multilib directory names to compiler switches
14359 that enable them. The directory name is separated from the switches by
14360 @samp{;}, and each switch starts with an @samp{@@} instead of the
14361 @samp{-}, without spaces between multiple switches. This is supposed to
14362 ease shell processing.
14363
14364 @item -print-multi-os-directory
14365 @opindex print-multi-os-directory
14366 Print the path to OS libraries for the selected
14367 multilib, relative to some @file{lib} subdirectory. If OS libraries are
14368 present in the @file{lib} subdirectory and no multilibs are used, this is
14369 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
14370 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
14371 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
14372 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
14373
14374 @item -print-multiarch
14375 @opindex print-multiarch
14376 Print the path to OS libraries for the selected multiarch,
14377 relative to some @file{lib} subdirectory.
14378
14379 @item -print-prog-name=@var{program}
14380 @opindex print-prog-name
14381 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
14382
14383 @item -print-libgcc-file-name
14384 @opindex print-libgcc-file-name
14385 Same as @option{-print-file-name=libgcc.a}.
14386
14387 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
14388 but you do want to link with @file{libgcc.a}. You can do:
14389
14390 @smallexample
14391 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
14392 @end smallexample
14393
14394 @item -print-search-dirs
14395 @opindex print-search-dirs
14396 Print the name of the configured installation directory and a list of
14397 program and library directories @command{gcc} searches---and don't do anything else.
14398
14399 This is useful when @command{gcc} prints the error message
14400 @samp{installation problem, cannot exec cpp0: No such file or directory}.
14401 To resolve this you either need to put @file{cpp0} and the other compiler
14402 components where @command{gcc} expects to find them, or you can set the environment
14403 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
14404 Don't forget the trailing @samp{/}.
14405 @xref{Environment Variables}.
14406
14407 @item -print-sysroot
14408 @opindex print-sysroot
14409 Print the target sysroot directory that is used during
14410 compilation. This is the target sysroot specified either at configure
14411 time or using the @option{--sysroot} option, possibly with an extra
14412 suffix that depends on compilation options. If no target sysroot is
14413 specified, the option prints nothing.
14414
14415 @item -print-sysroot-headers-suffix
14416 @opindex print-sysroot-headers-suffix
14417 Print the suffix added to the target sysroot when searching for
14418 headers, or give an error if the compiler is not configured with such
14419 a suffix---and don't do anything else.
14420
14421 @item -dumpmachine
14422 @opindex dumpmachine
14423 Print the compiler's target machine (for example,
14424 @samp{i686-pc-linux-gnu})---and don't do anything else.
14425
14426 @item -dumpversion
14427 @opindex dumpversion
14428 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
14429 anything else. This is the compiler version used in filesystem paths,
14430 specs, can be depending on how the compiler has been configured just
14431 a single number (major version), two numbers separated by dot (major and
14432 minor version) or three numbers separated by dots (major, minor and patchlevel
14433 version).
14434
14435 @item -dumpfullversion
14436 @opindex dumpfullversion
14437 Print the full compiler version, always 3 numbers separated by dots,
14438 major, minor and patchlevel version.
14439
14440 @item -dumpspecs
14441 @opindex dumpspecs
14442 Print the compiler's built-in specs---and don't do anything else. (This
14443 is used when GCC itself is being built.) @xref{Spec Files}.
14444 @end table
14445
14446 @node Submodel Options
14447 @section Machine-Dependent Options
14448 @cindex submodel options
14449 @cindex specifying hardware config
14450 @cindex hardware models and configurations, specifying
14451 @cindex target-dependent options
14452 @cindex machine-dependent options
14453
14454 Each target machine supported by GCC can have its own options---for
14455 example, to allow you to compile for a particular processor variant or
14456 ABI, or to control optimizations specific to that machine. By
14457 convention, the names of machine-specific options start with
14458 @samp{-m}.
14459
14460 Some configurations of the compiler also support additional target-specific
14461 options, usually for compatibility with other compilers on the same
14462 platform.
14463
14464 @c This list is ordered alphanumerically by subsection name.
14465 @c It should be the same order and spelling as these options are listed
14466 @c in Machine Dependent Options
14467
14468 @menu
14469 * AArch64 Options::
14470 * Adapteva Epiphany Options::
14471 * ARC Options::
14472 * ARM Options::
14473 * AVR Options::
14474 * Blackfin Options::
14475 * C6X Options::
14476 * CRIS Options::
14477 * CR16 Options::
14478 * Darwin Options::
14479 * DEC Alpha Options::
14480 * FR30 Options::
14481 * FT32 Options::
14482 * FRV Options::
14483 * GNU/Linux Options::
14484 * H8/300 Options::
14485 * HPPA Options::
14486 * IA-64 Options::
14487 * LM32 Options::
14488 * M32C Options::
14489 * M32R/D Options::
14490 * M680x0 Options::
14491 * MCore Options::
14492 * MeP Options::
14493 * MicroBlaze Options::
14494 * MIPS Options::
14495 * MMIX Options::
14496 * MN10300 Options::
14497 * Moxie Options::
14498 * MSP430 Options::
14499 * NDS32 Options::
14500 * Nios II Options::
14501 * Nvidia PTX Options::
14502 * PDP-11 Options::
14503 * picoChip Options::
14504 * PowerPC Options::
14505 * PowerPC SPE Options::
14506 * RISC-V Options::
14507 * RL78 Options::
14508 * RS/6000 and PowerPC Options::
14509 * RX Options::
14510 * S/390 and zSeries Options::
14511 * Score Options::
14512 * SH Options::
14513 * Solaris 2 Options::
14514 * SPARC Options::
14515 * SPU Options::
14516 * System V Options::
14517 * TILE-Gx Options::
14518 * TILEPro Options::
14519 * V850 Options::
14520 * VAX Options::
14521 * Visium Options::
14522 * VMS Options::
14523 * VxWorks Options::
14524 * x86 Options::
14525 * x86 Windows Options::
14526 * Xstormy16 Options::
14527 * Xtensa Options::
14528 * zSeries Options::
14529 @end menu
14530
14531 @node AArch64 Options
14532 @subsection AArch64 Options
14533 @cindex AArch64 Options
14534
14535 These options are defined for AArch64 implementations:
14536
14537 @table @gcctabopt
14538
14539 @item -mabi=@var{name}
14540 @opindex mabi
14541 Generate code for the specified data model. Permissible values
14542 are @samp{ilp32} for SysV-like data model where int, long int and pointers
14543 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
14544 but long int and pointers are 64 bits.
14545
14546 The default depends on the specific target configuration. Note that
14547 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
14548 entire program with the same ABI, and link with a compatible set of libraries.
14549
14550 @item -mbig-endian
14551 @opindex mbig-endian
14552 Generate big-endian code. This is the default when GCC is configured for an
14553 @samp{aarch64_be-*-*} target.
14554
14555 @item -mgeneral-regs-only
14556 @opindex mgeneral-regs-only
14557 Generate code which uses only the general-purpose registers. This will prevent
14558 the compiler from using floating-point and Advanced SIMD registers but will not
14559 impose any restrictions on the assembler.
14560
14561 @item -mlittle-endian
14562 @opindex mlittle-endian
14563 Generate little-endian code. This is the default when GCC is configured for an
14564 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
14565
14566 @item -mcmodel=tiny
14567 @opindex mcmodel=tiny
14568 Generate code for the tiny code model. The program and its statically defined
14569 symbols must be within 1MB of each other. Programs can be statically or
14570 dynamically linked.
14571
14572 @item -mcmodel=small
14573 @opindex mcmodel=small
14574 Generate code for the small code model. The program and its statically defined
14575 symbols must be within 4GB of each other. Programs can be statically or
14576 dynamically linked. This is the default code model.
14577
14578 @item -mcmodel=large
14579 @opindex mcmodel=large
14580 Generate code for the large code model. This makes no assumptions about
14581 addresses and sizes of sections. Programs can be statically linked only.
14582
14583 @item -mstrict-align
14584 @opindex mstrict-align
14585 Avoid generating memory accesses that may not be aligned on a natural object
14586 boundary as described in the architecture specification.
14587
14588 @item -momit-leaf-frame-pointer
14589 @itemx -mno-omit-leaf-frame-pointer
14590 @opindex momit-leaf-frame-pointer
14591 @opindex mno-omit-leaf-frame-pointer
14592 Omit or keep the frame pointer in leaf functions. The former behavior is the
14593 default.
14594
14595 @item -mtls-dialect=desc
14596 @opindex mtls-dialect=desc
14597 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
14598 of TLS variables. This is the default.
14599
14600 @item -mtls-dialect=traditional
14601 @opindex mtls-dialect=traditional
14602 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
14603 of TLS variables.
14604
14605 @item -mtls-size=@var{size}
14606 @opindex mtls-size
14607 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
14608 This option requires binutils 2.26 or newer.
14609
14610 @item -mfix-cortex-a53-835769
14611 @itemx -mno-fix-cortex-a53-835769
14612 @opindex mfix-cortex-a53-835769
14613 @opindex mno-fix-cortex-a53-835769
14614 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
14615 This involves inserting a NOP instruction between memory instructions and
14616 64-bit integer multiply-accumulate instructions.
14617
14618 @item -mfix-cortex-a53-843419
14619 @itemx -mno-fix-cortex-a53-843419
14620 @opindex mfix-cortex-a53-843419
14621 @opindex mno-fix-cortex-a53-843419
14622 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
14623 This erratum workaround is made at link time and this will only pass the
14624 corresponding flag to the linker.
14625
14626 @item -mlow-precision-recip-sqrt
14627 @itemx -mno-low-precision-recip-sqrt
14628 @opindex mlow-precision-recip-sqrt
14629 @opindex mno-low-precision-recip-sqrt
14630 Enable or disable the reciprocal square root approximation.
14631 This option only has an effect if @option{-ffast-math} or
14632 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14633 precision of reciprocal square root results to about 16 bits for
14634 single precision and to 32 bits for double precision.
14635
14636 @item -mlow-precision-sqrt
14637 @itemx -mno-low-precision-sqrt
14638 @opindex -mlow-precision-sqrt
14639 @opindex -mno-low-precision-sqrt
14640 Enable or disable the square root approximation.
14641 This option only has an effect if @option{-ffast-math} or
14642 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14643 precision of square root results to about 16 bits for
14644 single precision and to 32 bits for double precision.
14645 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
14646
14647 @item -mlow-precision-div
14648 @itemx -mno-low-precision-div
14649 @opindex -mlow-precision-div
14650 @opindex -mno-low-precision-div
14651 Enable or disable the division approximation.
14652 This option only has an effect if @option{-ffast-math} or
14653 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14654 precision of division results to about 16 bits for
14655 single precision and to 32 bits for double precision.
14656
14657 @item -march=@var{name}
14658 @opindex march
14659 Specify the name of the target architecture and, optionally, one or
14660 more feature modifiers. This option has the form
14661 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
14662
14663 The permissible values for @var{arch} are @samp{armv8-a},
14664 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
14665 or @var{native}.
14666
14667 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
14668 support for the ARMv8.4-A architecture extensions.
14669
14670 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
14671 support for the ARMv8.3-A architecture extensions.
14672
14673 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
14674 support for the ARMv8.2-A architecture extensions.
14675
14676 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
14677 support for the ARMv8.1-A architecture extension. In particular, it
14678 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
14679
14680 The value @samp{native} is available on native AArch64 GNU/Linux and
14681 causes the compiler to pick the architecture of the host system. This
14682 option has no effect if the compiler is unable to recognize the
14683 architecture of the host system,
14684
14685 The permissible values for @var{feature} are listed in the sub-section
14686 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14687 Feature Modifiers}. Where conflicting feature modifiers are
14688 specified, the right-most feature is used.
14689
14690 GCC uses @var{name} to determine what kind of instructions it can emit
14691 when generating assembly code. If @option{-march} is specified
14692 without either of @option{-mtune} or @option{-mcpu} also being
14693 specified, the code is tuned to perform well across a range of target
14694 processors implementing the target architecture.
14695
14696 @item -mtune=@var{name}
14697 @opindex mtune
14698 Specify the name of the target processor for which GCC should tune the
14699 performance of the code. Permissible values for this option are:
14700 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
14701 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
14702 @samp{exynos-m1}, @samp{falkor}, @samp{qdf24xx}, @samp{saphira},
14703 @samp{xgene1}, @samp{vulcan}, @samp{thunderx},
14704 @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
14705 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53},
14706 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
14707 @samp{cortex-a73.cortex-a53}, @samp{cortex-a75.cortex-a55},
14708 @samp{native}.
14709
14710 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14711 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
14712 @samp{cortex-a75.cortex-a55} specify that GCC should tune for a
14713 big.LITTLE system.
14714
14715 Additionally on native AArch64 GNU/Linux systems the value
14716 @samp{native} tunes performance to the host system. This option has no effect
14717 if the compiler is unable to recognize the processor of the host system.
14718
14719 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
14720 are specified, the code is tuned to perform well across a range
14721 of target processors.
14722
14723 This option cannot be suffixed by feature modifiers.
14724
14725 @item -mcpu=@var{name}
14726 @opindex mcpu
14727 Specify the name of the target processor, optionally suffixed by one
14728 or more feature modifiers. This option has the form
14729 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
14730 the permissible values for @var{cpu} are the same as those available
14731 for @option{-mtune}. The permissible values for @var{feature} are
14732 documented in the sub-section on
14733 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14734 Feature Modifiers}. Where conflicting feature modifiers are
14735 specified, the right-most feature is used.
14736
14737 GCC uses @var{name} to determine what kind of instructions it can emit when
14738 generating assembly code (as if by @option{-march}) and to determine
14739 the target processor for which to tune for performance (as if
14740 by @option{-mtune}). Where this option is used in conjunction
14741 with @option{-march} or @option{-mtune}, those options take precedence
14742 over the appropriate part of this option.
14743
14744 @item -moverride=@var{string}
14745 @opindex moverride
14746 Override tuning decisions made by the back-end in response to a
14747 @option{-mtune=} switch. The syntax, semantics, and accepted values
14748 for @var{string} in this option are not guaranteed to be consistent
14749 across releases.
14750
14751 This option is only intended to be useful when developing GCC.
14752
14753 @item -mverbose-cost-dump
14754 @opindex mverbose-cost-dump
14755 Enable verbose cost model dumping in the debug dump files. This option is
14756 provided for use in debugging the compiler.
14757
14758 @item -mpc-relative-literal-loads
14759 @itemx -mno-pc-relative-literal-loads
14760 @opindex mpc-relative-literal-loads
14761 @opindex mno-pc-relative-literal-loads
14762 Enable or disable PC-relative literal loads. With this option literal pools are
14763 accessed using a single instruction and emitted after each function. This
14764 limits the maximum size of functions to 1MB. This is enabled by default for
14765 @option{-mcmodel=tiny}.
14766
14767 @item -msign-return-address=@var{scope}
14768 @opindex msign-return-address
14769 Select the function scope on which return address signing will be applied.
14770 Permissible values are @samp{none}, which disables return address signing,
14771 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
14772 functions, and @samp{all}, which enables pointer signing for all functions. The
14773 default value is @samp{none}.
14774
14775 @item -msve-vector-bits=@var{bits}
14776 @opindex msve-vector-bits
14777 Specify the number of bits in an SVE vector register. This option only has
14778 an effect when SVE is enabled.
14779
14780 GCC supports two forms of SVE code generation: ``vector-length
14781 agnostic'' output that works with any size of vector register and
14782 ``vector-length specific'' output that only works when the vector
14783 registers are a particular size. Replacing @var{bits} with
14784 @samp{scalable} selects vector-length agnostic output while
14785 replacing it with a number selects vector-length specific output.
14786 The possible lengths in the latter case are: 128, 256, 512, 1024
14787 and 2048. @samp{scalable} is the default.
14788
14789 At present, @samp{-msve-vector-bits=128} produces the same output
14790 as @samp{-msve-vector-bits=scalable}.
14791
14792 @end table
14793
14794 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
14795 @anchor{aarch64-feature-modifiers}
14796 @cindex @option{-march} feature modifiers
14797 @cindex @option{-mcpu} feature modifiers
14798 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
14799 the following and their inverses @option{no@var{feature}}:
14800
14801 @table @samp
14802 @item crc
14803 Enable CRC extension. This is on by default for
14804 @option{-march=armv8.1-a}.
14805 @item crypto
14806 Enable Crypto extension. This also enables Advanced SIMD and floating-point
14807 instructions.
14808 @item fp
14809 Enable floating-point instructions. This is on by default for all possible
14810 values for options @option{-march} and @option{-mcpu}.
14811 @item simd
14812 Enable Advanced SIMD instructions. This also enables floating-point
14813 instructions. This is on by default for all possible values for options
14814 @option{-march} and @option{-mcpu}.
14815 @item sve
14816 Enable Scalable Vector Extension instructions. This also enables Advanced
14817 SIMD and floating-point instructions.
14818 @item lse
14819 Enable Large System Extension instructions. This is on by default for
14820 @option{-march=armv8.1-a}.
14821 @item rdma
14822 Enable Round Double Multiply Accumulate instructions. This is on by default
14823 for @option{-march=armv8.1-a}.
14824 @item fp16
14825 Enable FP16 extension. This also enables floating-point instructions.
14826 @item fp16fml
14827 Enable FP16 fmla extension. This also enables FP16 extensions and
14828 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.
14829
14830 @item rcpc
14831 Enable the RcPc extension. This does not change code generation from GCC,
14832 but is passed on to the assembler, enabling inline asm statements to use
14833 instructions from the RcPc extension.
14834 @item dotprod
14835 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
14836 @item aes
14837 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
14838 SIMD instructions.
14839 @item sha2
14840 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
14841 @item sha3
14842 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
14843 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
14844 @item sm4
14845 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
14846 Use of this option with architectures prior to Armv8.2-A is not supported.
14847
14848 @end table
14849
14850 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
14851 which implies @option{fp}.
14852 Conversely, @option{nofp} implies @option{nosimd}, which implies
14853 @option{nocrypto}, @option{noaes} and @option{nosha2}.
14854
14855 @node Adapteva Epiphany Options
14856 @subsection Adapteva Epiphany Options
14857
14858 These @samp{-m} options are defined for Adapteva Epiphany:
14859
14860 @table @gcctabopt
14861 @item -mhalf-reg-file
14862 @opindex mhalf-reg-file
14863 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
14864 That allows code to run on hardware variants that lack these registers.
14865
14866 @item -mprefer-short-insn-regs
14867 @opindex mprefer-short-insn-regs
14868 Preferentially allocate registers that allow short instruction generation.
14869 This can result in increased instruction count, so this may either reduce or
14870 increase overall code size.
14871
14872 @item -mbranch-cost=@var{num}
14873 @opindex mbranch-cost
14874 Set the cost of branches to roughly @var{num} ``simple'' instructions.
14875 This cost is only a heuristic and is not guaranteed to produce
14876 consistent results across releases.
14877
14878 @item -mcmove
14879 @opindex mcmove
14880 Enable the generation of conditional moves.
14881
14882 @item -mnops=@var{num}
14883 @opindex mnops
14884 Emit @var{num} NOPs before every other generated instruction.
14885
14886 @item -mno-soft-cmpsf
14887 @opindex mno-soft-cmpsf
14888 For single-precision floating-point comparisons, emit an @code{fsub} instruction
14889 and test the flags. This is faster than a software comparison, but can
14890 get incorrect results in the presence of NaNs, or when two different small
14891 numbers are compared such that their difference is calculated as zero.
14892 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
14893 software comparisons.
14894
14895 @item -mstack-offset=@var{num}
14896 @opindex mstack-offset
14897 Set the offset between the top of the stack and the stack pointer.
14898 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
14899 can be used by leaf functions without stack allocation.
14900 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
14901 Note also that this option changes the ABI; compiling a program with a
14902 different stack offset than the libraries have been compiled with
14903 generally does not work.
14904 This option can be useful if you want to evaluate if a different stack
14905 offset would give you better code, but to actually use a different stack
14906 offset to build working programs, it is recommended to configure the
14907 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
14908
14909 @item -mno-round-nearest
14910 @opindex mno-round-nearest
14911 Make the scheduler assume that the rounding mode has been set to
14912 truncating. The default is @option{-mround-nearest}.
14913
14914 @item -mlong-calls
14915 @opindex mlong-calls
14916 If not otherwise specified by an attribute, assume all calls might be beyond
14917 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
14918 function address into a register before performing a (otherwise direct) call.
14919 This is the default.
14920
14921 @item -mshort-calls
14922 @opindex short-calls
14923 If not otherwise specified by an attribute, assume all direct calls are
14924 in the range of the @code{b} / @code{bl} instructions, so use these instructions
14925 for direct calls. The default is @option{-mlong-calls}.
14926
14927 @item -msmall16
14928 @opindex msmall16
14929 Assume addresses can be loaded as 16-bit unsigned values. This does not
14930 apply to function addresses for which @option{-mlong-calls} semantics
14931 are in effect.
14932
14933 @item -mfp-mode=@var{mode}
14934 @opindex mfp-mode
14935 Set the prevailing mode of the floating-point unit.
14936 This determines the floating-point mode that is provided and expected
14937 at function call and return time. Making this mode match the mode you
14938 predominantly need at function start can make your programs smaller and
14939 faster by avoiding unnecessary mode switches.
14940
14941 @var{mode} can be set to one the following values:
14942
14943 @table @samp
14944 @item caller
14945 Any mode at function entry is valid, and retained or restored when
14946 the function returns, and when it calls other functions.
14947 This mode is useful for compiling libraries or other compilation units
14948 you might want to incorporate into different programs with different
14949 prevailing FPU modes, and the convenience of being able to use a single
14950 object file outweighs the size and speed overhead for any extra
14951 mode switching that might be needed, compared with what would be needed
14952 with a more specific choice of prevailing FPU mode.
14953
14954 @item truncate
14955 This is the mode used for floating-point calculations with
14956 truncating (i.e.@: round towards zero) rounding mode. That includes
14957 conversion from floating point to integer.
14958
14959 @item round-nearest
14960 This is the mode used for floating-point calculations with
14961 round-to-nearest-or-even rounding mode.
14962
14963 @item int
14964 This is the mode used to perform integer calculations in the FPU, e.g.@:
14965 integer multiply, or integer multiply-and-accumulate.
14966 @end table
14967
14968 The default is @option{-mfp-mode=caller}
14969
14970 @item -mnosplit-lohi
14971 @itemx -mno-postinc
14972 @itemx -mno-postmodify
14973 @opindex mnosplit-lohi
14974 @opindex mno-postinc
14975 @opindex mno-postmodify
14976 Code generation tweaks that disable, respectively, splitting of 32-bit
14977 loads, generation of post-increment addresses, and generation of
14978 post-modify addresses. The defaults are @option{msplit-lohi},
14979 @option{-mpost-inc}, and @option{-mpost-modify}.
14980
14981 @item -mnovect-double
14982 @opindex mno-vect-double
14983 Change the preferred SIMD mode to SImode. The default is
14984 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
14985
14986 @item -max-vect-align=@var{num}
14987 @opindex max-vect-align
14988 The maximum alignment for SIMD vector mode types.
14989 @var{num} may be 4 or 8. The default is 8.
14990 Note that this is an ABI change, even though many library function
14991 interfaces are unaffected if they don't use SIMD vector modes
14992 in places that affect size and/or alignment of relevant types.
14993
14994 @item -msplit-vecmove-early
14995 @opindex msplit-vecmove-early
14996 Split vector moves into single word moves before reload. In theory this
14997 can give better register allocation, but so far the reverse seems to be
14998 generally the case.
14999
15000 @item -m1reg-@var{reg}
15001 @opindex m1reg-
15002 Specify a register to hold the constant @minus{}1, which makes loading small negative
15003 constants and certain bitmasks faster.
15004 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15005 which specify use of that register as a fixed register,
15006 and @samp{none}, which means that no register is used for this
15007 purpose. The default is @option{-m1reg-none}.
15008
15009 @end table
15010
15011 @node ARC Options
15012 @subsection ARC Options
15013 @cindex ARC options
15014
15015 The following options control the architecture variant for which code
15016 is being compiled:
15017
15018 @c architecture variants
15019 @table @gcctabopt
15020
15021 @item -mbarrel-shifter
15022 @opindex mbarrel-shifter
15023 Generate instructions supported by barrel shifter. This is the default
15024 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15025
15026 @item -mjli-always
15027 @opindex mjli-alawys
15028 Force to call a function using jli_s instruction. This option is
15029 valid only for ARCv2 architecture.
15030
15031 @item -mcpu=@var{cpu}
15032 @opindex mcpu
15033 Set architecture type, register usage, and instruction scheduling
15034 parameters for @var{cpu}. There are also shortcut alias options
15035 available for backward compatibility and convenience. Supported
15036 values for @var{cpu} are
15037
15038 @table @samp
15039 @opindex mA6
15040 @opindex mARC600
15041 @item arc600
15042 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15043
15044 @item arc601
15045 @opindex mARC601
15046 Compile for ARC601. Alias: @option{-mARC601}.
15047
15048 @item arc700
15049 @opindex mA7
15050 @opindex mARC700
15051 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
15052 This is the default when configured with @option{--with-cpu=arc700}@.
15053
15054 @item arcem
15055 Compile for ARC EM.
15056
15057 @item archs
15058 Compile for ARC HS.
15059
15060 @item em
15061 Compile for ARC EM CPU with no hardware extensions.
15062
15063 @item em4
15064 Compile for ARC EM4 CPU.
15065
15066 @item em4_dmips
15067 Compile for ARC EM4 DMIPS CPU.
15068
15069 @item em4_fpus
15070 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
15071 extension.
15072
15073 @item em4_fpuda
15074 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
15075 double assist instructions.
15076
15077 @item hs
15078 Compile for ARC HS CPU with no hardware extensions except the atomic
15079 instructions.
15080
15081 @item hs34
15082 Compile for ARC HS34 CPU.
15083
15084 @item hs38
15085 Compile for ARC HS38 CPU.
15086
15087 @item hs38_linux
15088 Compile for ARC HS38 CPU with all hardware extensions on.
15089
15090 @item arc600_norm
15091 Compile for ARC 600 CPU with @code{norm} instructions enabled.
15092
15093 @item arc600_mul32x16
15094 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
15095 instructions enabled.
15096
15097 @item arc600_mul64
15098 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
15099 instructions enabled.
15100
15101 @item arc601_norm
15102 Compile for ARC 601 CPU with @code{norm} instructions enabled.
15103
15104 @item arc601_mul32x16
15105 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
15106 instructions enabled.
15107
15108 @item arc601_mul64
15109 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
15110 instructions enabled.
15111
15112 @item nps400
15113 Compile for ARC 700 on NPS400 chip.
15114
15115 @item em_mini
15116 Compile for ARC EM minimalist configuration featuring reduced register
15117 set.
15118
15119 @end table
15120
15121 @item -mdpfp
15122 @opindex mdpfp
15123 @itemx -mdpfp-compact
15124 @opindex mdpfp-compact
15125 Generate double-precision FPX instructions, tuned for the compact
15126 implementation.
15127
15128 @item -mdpfp-fast
15129 @opindex mdpfp-fast
15130 Generate double-precision FPX instructions, tuned for the fast
15131 implementation.
15132
15133 @item -mno-dpfp-lrsr
15134 @opindex mno-dpfp-lrsr
15135 Disable @code{lr} and @code{sr} instructions from using FPX extension
15136 aux registers.
15137
15138 @item -mea
15139 @opindex mea
15140 Generate extended arithmetic instructions. Currently only
15141 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
15142 supported. This is always enabled for @option{-mcpu=ARC700}.
15143
15144 @item -mno-mpy
15145 @opindex mno-mpy
15146 Do not generate @code{mpy}-family instructions for ARC700. This option is
15147 deprecated.
15148
15149 @item -mmul32x16
15150 @opindex mmul32x16
15151 Generate 32x16-bit multiply and multiply-accumulate instructions.
15152
15153 @item -mmul64
15154 @opindex mmul64
15155 Generate @code{mul64} and @code{mulu64} instructions.
15156 Only valid for @option{-mcpu=ARC600}.
15157
15158 @item -mnorm
15159 @opindex mnorm
15160 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
15161 is in effect.
15162
15163 @item -mspfp
15164 @opindex mspfp
15165 @itemx -mspfp-compact
15166 @opindex mspfp-compact
15167 Generate single-precision FPX instructions, tuned for the compact
15168 implementation.
15169
15170 @item -mspfp-fast
15171 @opindex mspfp-fast
15172 Generate single-precision FPX instructions, tuned for the fast
15173 implementation.
15174
15175 @item -msimd
15176 @opindex msimd
15177 Enable generation of ARC SIMD instructions via target-specific
15178 builtins. Only valid for @option{-mcpu=ARC700}.
15179
15180 @item -msoft-float
15181 @opindex msoft-float
15182 This option ignored; it is provided for compatibility purposes only.
15183 Software floating-point code is emitted by default, and this default
15184 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
15185 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
15186 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
15187
15188 @item -mswap
15189 @opindex mswap
15190 Generate @code{swap} instructions.
15191
15192 @item -matomic
15193 @opindex matomic
15194 This enables use of the locked load/store conditional extension to implement
15195 atomic memory built-in functions. Not available for ARC 6xx or ARC
15196 EM cores.
15197
15198 @item -mdiv-rem
15199 @opindex mdiv-rem
15200 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
15201
15202 @item -mcode-density
15203 @opindex mcode-density
15204 Enable code density instructions for ARC EM.
15205 This option is on by default for ARC HS.
15206
15207 @item -mll64
15208 @opindex mll64
15209 Enable double load/store operations for ARC HS cores.
15210
15211 @item -mtp-regno=@var{regno}
15212 @opindex mtp-regno
15213 Specify thread pointer register number.
15214
15215 @item -mmpy-option=@var{multo}
15216 @opindex mmpy-option
15217 Compile ARCv2 code with a multiplier design option. You can specify
15218 the option using either a string or numeric value for @var{multo}.
15219 @samp{wlh1} is the default value. The recognized values are:
15220
15221 @table @samp
15222 @item 0
15223 @itemx none
15224 No multiplier available.
15225
15226 @item 1
15227 @itemx w
15228 16x16 multiplier, fully pipelined.
15229 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
15230
15231 @item 2
15232 @itemx wlh1
15233 32x32 multiplier, fully
15234 pipelined (1 stage). The following instructions are additionally
15235 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15236
15237 @item 3
15238 @itemx wlh2
15239 32x32 multiplier, fully pipelined
15240 (2 stages). The following instructions are additionally enabled: @code{mpy},
15241 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15242
15243 @item 4
15244 @itemx wlh3
15245 Two 16x16 multipliers, blocking,
15246 sequential. The following instructions are additionally enabled: @code{mpy},
15247 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15248
15249 @item 5
15250 @itemx wlh4
15251 One 16x16 multiplier, blocking,
15252 sequential. The following instructions are additionally enabled: @code{mpy},
15253 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15254
15255 @item 6
15256 @itemx wlh5
15257 One 32x4 multiplier, blocking,
15258 sequential. The following instructions are additionally enabled: @code{mpy},
15259 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15260
15261 @item 7
15262 @itemx plus_dmpy
15263 ARC HS SIMD support.
15264
15265 @item 8
15266 @itemx plus_macd
15267 ARC HS SIMD support.
15268
15269 @item 9
15270 @itemx plus_qmacw
15271 ARC HS SIMD support.
15272
15273 @end table
15274
15275 This option is only available for ARCv2 cores@.
15276
15277 @item -mfpu=@var{fpu}
15278 @opindex mfpu
15279 Enables support for specific floating-point hardware extensions for ARCv2
15280 cores. Supported values for @var{fpu} are:
15281
15282 @table @samp
15283
15284 @item fpus
15285 Enables support for single-precision floating-point hardware
15286 extensions@.
15287
15288 @item fpud
15289 Enables support for double-precision floating-point hardware
15290 extensions. The single-precision floating-point extension is also
15291 enabled. Not available for ARC EM@.
15292
15293 @item fpuda
15294 Enables support for double-precision floating-point hardware
15295 extensions using double-precision assist instructions. The single-precision
15296 floating-point extension is also enabled. This option is
15297 only available for ARC EM@.
15298
15299 @item fpuda_div
15300 Enables support for double-precision floating-point hardware
15301 extensions using double-precision assist instructions.
15302 The single-precision floating-point, square-root, and divide
15303 extensions are also enabled. This option is
15304 only available for ARC EM@.
15305
15306 @item fpuda_fma
15307 Enables support for double-precision floating-point hardware
15308 extensions using double-precision assist instructions.
15309 The single-precision floating-point and fused multiply and add
15310 hardware extensions are also enabled. This option is
15311 only available for ARC EM@.
15312
15313 @item fpuda_all
15314 Enables support for double-precision floating-point hardware
15315 extensions using double-precision assist instructions.
15316 All single-precision floating-point hardware extensions are also
15317 enabled. This option is only available for ARC EM@.
15318
15319 @item fpus_div
15320 Enables support for single-precision floating-point, square-root and divide
15321 hardware extensions@.
15322
15323 @item fpud_div
15324 Enables support for double-precision floating-point, square-root and divide
15325 hardware extensions. This option
15326 includes option @samp{fpus_div}. Not available for ARC EM@.
15327
15328 @item fpus_fma
15329 Enables support for single-precision floating-point and
15330 fused multiply and add hardware extensions@.
15331
15332 @item fpud_fma
15333 Enables support for double-precision floating-point and
15334 fused multiply and add hardware extensions. This option
15335 includes option @samp{fpus_fma}. Not available for ARC EM@.
15336
15337 @item fpus_all
15338 Enables support for all single-precision floating-point hardware
15339 extensions@.
15340
15341 @item fpud_all
15342 Enables support for all single- and double-precision floating-point
15343 hardware extensions. Not available for ARC EM@.
15344
15345 @end table
15346
15347 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
15348 @opindex mirq-ctrl-saved
15349 Specifies general-purposes registers that the processor automatically
15350 saves/restores on interrupt entry and exit. @var{register-range} is
15351 specified as two registers separated by a dash. The register range
15352 always starts with @code{r0}, the upper limit is @code{fp} register.
15353 @var{blink} and @var{lp_count} are optional. This option is only
15354 valid for ARC EM and ARC HS cores.
15355
15356 @item -mrgf-banked-regs=@var{number}
15357 @opindex mrgf-banked-regs
15358 Specifies the number of registers replicated in second register bank
15359 on entry to fast interrupt. Fast interrupts are interrupts with the
15360 highest priority level P0. These interrupts save only PC and STATUS32
15361 registers to avoid memory transactions during interrupt entry and exit
15362 sequences. Use this option when you are using fast interrupts in an
15363 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
15364
15365 @item -mlpc-width=@var{width}
15366 @opindex mlpc-width
15367 Specify the width of the @code{lp_count} register. Valid values for
15368 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
15369 fixed to 32 bits. If the width is less than 32, the compiler does not
15370 attempt to transform loops in your program to use the zero-delay loop
15371 mechanism unless it is known that the @code{lp_count} register can
15372 hold the required loop-counter value. Depending on the width
15373 specified, the compiler and run-time library might continue to use the
15374 loop mechanism for various needs. This option defines macro
15375 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
15376
15377 @item -mrf16
15378 @opindex mrf16
15379 This option instructs the compiler to generate code for a 16-entry
15380 register file. This option defines the @code{__ARC_RF16__}
15381 preprocessor macro.
15382
15383 @end table
15384
15385 The following options are passed through to the assembler, and also
15386 define preprocessor macro symbols.
15387
15388 @c Flags used by the assembler, but for which we define preprocessor
15389 @c macro symbols as well.
15390 @table @gcctabopt
15391 @item -mdsp-packa
15392 @opindex mdsp-packa
15393 Passed down to the assembler to enable the DSP Pack A extensions.
15394 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
15395 deprecated.
15396
15397 @item -mdvbf
15398 @opindex mdvbf
15399 Passed down to the assembler to enable the dual Viterbi butterfly
15400 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
15401 option is deprecated.
15402
15403 @c ARC700 4.10 extension instruction
15404 @item -mlock
15405 @opindex mlock
15406 Passed down to the assembler to enable the locked load/store
15407 conditional extension. Also sets the preprocessor symbol
15408 @code{__Xlock}.
15409
15410 @item -mmac-d16
15411 @opindex mmac-d16
15412 Passed down to the assembler. Also sets the preprocessor symbol
15413 @code{__Xxmac_d16}. This option is deprecated.
15414
15415 @item -mmac-24
15416 @opindex mmac-24
15417 Passed down to the assembler. Also sets the preprocessor symbol
15418 @code{__Xxmac_24}. This option is deprecated.
15419
15420 @c ARC700 4.10 extension instruction
15421 @item -mrtsc
15422 @opindex mrtsc
15423 Passed down to the assembler to enable the 64-bit time-stamp counter
15424 extension instruction. Also sets the preprocessor symbol
15425 @code{__Xrtsc}. This option is deprecated.
15426
15427 @c ARC700 4.10 extension instruction
15428 @item -mswape
15429 @opindex mswape
15430 Passed down to the assembler to enable the swap byte ordering
15431 extension instruction. Also sets the preprocessor symbol
15432 @code{__Xswape}.
15433
15434 @item -mtelephony
15435 @opindex mtelephony
15436 Passed down to the assembler to enable dual- and single-operand
15437 instructions for telephony. Also sets the preprocessor symbol
15438 @code{__Xtelephony}. This option is deprecated.
15439
15440 @item -mxy
15441 @opindex mxy
15442 Passed down to the assembler to enable the XY memory extension. Also
15443 sets the preprocessor symbol @code{__Xxy}.
15444
15445 @end table
15446
15447 The following options control how the assembly code is annotated:
15448
15449 @c Assembly annotation options
15450 @table @gcctabopt
15451 @item -misize
15452 @opindex misize
15453 Annotate assembler instructions with estimated addresses.
15454
15455 @item -mannotate-align
15456 @opindex mannotate-align
15457 Explain what alignment considerations lead to the decision to make an
15458 instruction short or long.
15459
15460 @end table
15461
15462 The following options are passed through to the linker:
15463
15464 @c options passed through to the linker
15465 @table @gcctabopt
15466 @item -marclinux
15467 @opindex marclinux
15468 Passed through to the linker, to specify use of the @code{arclinux} emulation.
15469 This option is enabled by default in tool chains built for
15470 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
15471 when profiling is not requested.
15472
15473 @item -marclinux_prof
15474 @opindex marclinux_prof
15475 Passed through to the linker, to specify use of the
15476 @code{arclinux_prof} emulation. This option is enabled by default in
15477 tool chains built for @w{@code{arc-linux-uclibc}} and
15478 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
15479
15480 @end table
15481
15482 The following options control the semantics of generated code:
15483
15484 @c semantically relevant code generation options
15485 @table @gcctabopt
15486 @item -mlong-calls
15487 @opindex mlong-calls
15488 Generate calls as register indirect calls, thus providing access
15489 to the full 32-bit address range.
15490
15491 @item -mmedium-calls
15492 @opindex mmedium-calls
15493 Don't use less than 25-bit addressing range for calls, which is the
15494 offset available for an unconditional branch-and-link
15495 instruction. Conditional execution of function calls is suppressed, to
15496 allow use of the 25-bit range, rather than the 21-bit range with
15497 conditional branch-and-link. This is the default for tool chains built
15498 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
15499
15500 @item -G @var{num}
15501 @opindex G
15502 Put definitions of externally-visible data in a small data section if
15503 that data is no bigger than @var{num} bytes. The default value of
15504 @var{num} is 4 for any ARC configuration, or 8 when we have double
15505 load/store operations.
15506
15507 @item -mno-sdata
15508 @opindex mno-sdata
15509 Do not generate sdata references. This is the default for tool chains
15510 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
15511 targets.
15512
15513 @item -mvolatile-cache
15514 @opindex mvolatile-cache
15515 Use ordinarily cached memory accesses for volatile references. This is the
15516 default.
15517
15518 @item -mno-volatile-cache
15519 @opindex mno-volatile-cache
15520 Enable cache bypass for volatile references.
15521
15522 @end table
15523
15524 The following options fine tune code generation:
15525 @c code generation tuning options
15526 @table @gcctabopt
15527 @item -malign-call
15528 @opindex malign-call
15529 Do alignment optimizations for call instructions.
15530
15531 @item -mauto-modify-reg
15532 @opindex mauto-modify-reg
15533 Enable the use of pre/post modify with register displacement.
15534
15535 @item -mbbit-peephole
15536 @opindex mbbit-peephole
15537 Enable bbit peephole2.
15538
15539 @item -mno-brcc
15540 @opindex mno-brcc
15541 This option disables a target-specific pass in @file{arc_reorg} to
15542 generate compare-and-branch (@code{br@var{cc}}) instructions.
15543 It has no effect on
15544 generation of these instructions driven by the combiner pass.
15545
15546 @item -mcase-vector-pcrel
15547 @opindex mcase-vector-pcrel
15548 Use PC-relative switch case tables to enable case table shortening.
15549 This is the default for @option{-Os}.
15550
15551 @item -mcompact-casesi
15552 @opindex mcompact-casesi
15553 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
15554 and only available for ARCv1 cores.
15555
15556 @item -mno-cond-exec
15557 @opindex mno-cond-exec
15558 Disable the ARCompact-specific pass to generate conditional
15559 execution instructions.
15560
15561 Due to delay slot scheduling and interactions between operand numbers,
15562 literal sizes, instruction lengths, and the support for conditional execution,
15563 the target-independent pass to generate conditional execution is often lacking,
15564 so the ARC port has kept a special pass around that tries to find more
15565 conditional execution generation opportunities after register allocation,
15566 branch shortening, and delay slot scheduling have been done. This pass
15567 generally, but not always, improves performance and code size, at the cost of
15568 extra compilation time, which is why there is an option to switch it off.
15569 If you have a problem with call instructions exceeding their allowable
15570 offset range because they are conditionalized, you should consider using
15571 @option{-mmedium-calls} instead.
15572
15573 @item -mearly-cbranchsi
15574 @opindex mearly-cbranchsi
15575 Enable pre-reload use of the @code{cbranchsi} pattern.
15576
15577 @item -mexpand-adddi
15578 @opindex mexpand-adddi
15579 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
15580 @code{add.f}, @code{adc} etc. This option is deprecated.
15581
15582 @item -mindexed-loads
15583 @opindex mindexed-loads
15584 Enable the use of indexed loads. This can be problematic because some
15585 optimizers then assume that indexed stores exist, which is not
15586 the case.
15587
15588 @item -mlra
15589 @opindex mlra
15590 Enable Local Register Allocation. This is still experimental for ARC,
15591 so by default the compiler uses standard reload
15592 (i.e. @option{-mno-lra}).
15593
15594 @item -mlra-priority-none
15595 @opindex mlra-priority-none
15596 Don't indicate any priority for target registers.
15597
15598 @item -mlra-priority-compact
15599 @opindex mlra-priority-compact
15600 Indicate target register priority for r0..r3 / r12..r15.
15601
15602 @item -mlra-priority-noncompact
15603 @opindex mlra-priority-noncompact
15604 Reduce target register priority for r0..r3 / r12..r15.
15605
15606 @item -mno-millicode
15607 @opindex mno-millicode
15608 When optimizing for size (using @option{-Os}), prologues and epilogues
15609 that have to save or restore a large number of registers are often
15610 shortened by using call to a special function in libgcc; this is
15611 referred to as a @emph{millicode} call. As these calls can pose
15612 performance issues, and/or cause linking issues when linking in a
15613 nonstandard way, this option is provided to turn off millicode call
15614 generation.
15615
15616 @item -mmixed-code
15617 @opindex mmixed-code
15618 Tweak register allocation to help 16-bit instruction generation.
15619 This generally has the effect of decreasing the average instruction size
15620 while increasing the instruction count.
15621
15622 @item -mq-class
15623 @opindex mq-class
15624 Enable @samp{q} instruction alternatives.
15625 This is the default for @option{-Os}.
15626
15627 @item -mRcq
15628 @opindex mRcq
15629 Enable @samp{Rcq} constraint handling.
15630 Most short code generation depends on this.
15631 This is the default.
15632
15633 @item -mRcw
15634 @opindex mRcw
15635 Enable @samp{Rcw} constraint handling.
15636 Most ccfsm condexec mostly depends on this.
15637 This is the default.
15638
15639 @item -msize-level=@var{level}
15640 @opindex msize-level
15641 Fine-tune size optimization with regards to instruction lengths and alignment.
15642 The recognized values for @var{level} are:
15643 @table @samp
15644 @item 0
15645 No size optimization. This level is deprecated and treated like @samp{1}.
15646
15647 @item 1
15648 Short instructions are used opportunistically.
15649
15650 @item 2
15651 In addition, alignment of loops and of code after barriers are dropped.
15652
15653 @item 3
15654 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
15655
15656 @end table
15657
15658 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
15659 the behavior when this is not set is equivalent to level @samp{1}.
15660
15661 @item -mtune=@var{cpu}
15662 @opindex mtune
15663 Set instruction scheduling parameters for @var{cpu}, overriding any implied
15664 by @option{-mcpu=}.
15665
15666 Supported values for @var{cpu} are
15667
15668 @table @samp
15669 @item ARC600
15670 Tune for ARC600 CPU.
15671
15672 @item ARC601
15673 Tune for ARC601 CPU.
15674
15675 @item ARC700
15676 Tune for ARC700 CPU with standard multiplier block.
15677
15678 @item ARC700-xmac
15679 Tune for ARC700 CPU with XMAC block.
15680
15681 @item ARC725D
15682 Tune for ARC725D CPU.
15683
15684 @item ARC750D
15685 Tune for ARC750D CPU.
15686
15687 @end table
15688
15689 @item -mmultcost=@var{num}
15690 @opindex mmultcost
15691 Cost to assume for a multiply instruction, with @samp{4} being equal to a
15692 normal instruction.
15693
15694 @item -munalign-prob-threshold=@var{probability}
15695 @opindex munalign-prob-threshold
15696 Set probability threshold for unaligning branches.
15697 When tuning for @samp{ARC700} and optimizing for speed, branches without
15698 filled delay slot are preferably emitted unaligned and long, unless
15699 profiling indicates that the probability for the branch to be taken
15700 is below @var{probability}. @xref{Cross-profiling}.
15701 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
15702
15703 @end table
15704
15705 The following options are maintained for backward compatibility, but
15706 are now deprecated and will be removed in a future release:
15707
15708 @c Deprecated options
15709 @table @gcctabopt
15710
15711 @item -margonaut
15712 @opindex margonaut
15713 Obsolete FPX.
15714
15715 @item -mbig-endian
15716 @opindex mbig-endian
15717 @itemx -EB
15718 @opindex EB
15719 Compile code for big-endian targets. Use of these options is now
15720 deprecated. Big-endian code is supported by configuring GCC to build
15721 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
15722 for which big endian is the default.
15723
15724 @item -mlittle-endian
15725 @opindex mlittle-endian
15726 @itemx -EL
15727 @opindex EL
15728 Compile code for little-endian targets. Use of these options is now
15729 deprecated. Little-endian code is supported by configuring GCC to build
15730 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
15731 for which little endian is the default.
15732
15733 @item -mbarrel_shifter
15734 @opindex mbarrel_shifter
15735 Replaced by @option{-mbarrel-shifter}.
15736
15737 @item -mdpfp_compact
15738 @opindex mdpfp_compact
15739 Replaced by @option{-mdpfp-compact}.
15740
15741 @item -mdpfp_fast
15742 @opindex mdpfp_fast
15743 Replaced by @option{-mdpfp-fast}.
15744
15745 @item -mdsp_packa
15746 @opindex mdsp_packa
15747 Replaced by @option{-mdsp-packa}.
15748
15749 @item -mEA
15750 @opindex mEA
15751 Replaced by @option{-mea}.
15752
15753 @item -mmac_24
15754 @opindex mmac_24
15755 Replaced by @option{-mmac-24}.
15756
15757 @item -mmac_d16
15758 @opindex mmac_d16
15759 Replaced by @option{-mmac-d16}.
15760
15761 @item -mspfp_compact
15762 @opindex mspfp_compact
15763 Replaced by @option{-mspfp-compact}.
15764
15765 @item -mspfp_fast
15766 @opindex mspfp_fast
15767 Replaced by @option{-mspfp-fast}.
15768
15769 @item -mtune=@var{cpu}
15770 @opindex mtune
15771 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
15772 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
15773 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
15774
15775 @item -multcost=@var{num}
15776 @opindex multcost
15777 Replaced by @option{-mmultcost}.
15778
15779 @end table
15780
15781 @node ARM Options
15782 @subsection ARM Options
15783 @cindex ARM options
15784
15785 These @samp{-m} options are defined for the ARM port:
15786
15787 @table @gcctabopt
15788 @item -mabi=@var{name}
15789 @opindex mabi
15790 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
15791 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
15792
15793 @item -mapcs-frame
15794 @opindex mapcs-frame
15795 Generate a stack frame that is compliant with the ARM Procedure Call
15796 Standard for all functions, even if this is not strictly necessary for
15797 correct execution of the code. Specifying @option{-fomit-frame-pointer}
15798 with this option causes the stack frames not to be generated for
15799 leaf functions. The default is @option{-mno-apcs-frame}.
15800 This option is deprecated.
15801
15802 @item -mapcs
15803 @opindex mapcs
15804 This is a synonym for @option{-mapcs-frame} and is deprecated.
15805
15806 @ignore
15807 @c not currently implemented
15808 @item -mapcs-stack-check
15809 @opindex mapcs-stack-check
15810 Generate code to check the amount of stack space available upon entry to
15811 every function (that actually uses some stack space). If there is
15812 insufficient space available then either the function
15813 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
15814 called, depending upon the amount of stack space required. The runtime
15815 system is required to provide these functions. The default is
15816 @option{-mno-apcs-stack-check}, since this produces smaller code.
15817
15818 @c not currently implemented
15819 @item -mapcs-reentrant
15820 @opindex mapcs-reentrant
15821 Generate reentrant, position-independent code. The default is
15822 @option{-mno-apcs-reentrant}.
15823 @end ignore
15824
15825 @item -mthumb-interwork
15826 @opindex mthumb-interwork
15827 Generate code that supports calling between the ARM and Thumb
15828 instruction sets. Without this option, on pre-v5 architectures, the
15829 two instruction sets cannot be reliably used inside one program. The
15830 default is @option{-mno-thumb-interwork}, since slightly larger code
15831 is generated when @option{-mthumb-interwork} is specified. In AAPCS
15832 configurations this option is meaningless.
15833
15834 @item -mno-sched-prolog
15835 @opindex mno-sched-prolog
15836 Prevent the reordering of instructions in the function prologue, or the
15837 merging of those instruction with the instructions in the function's
15838 body. This means that all functions start with a recognizable set
15839 of instructions (or in fact one of a choice from a small set of
15840 different function prologues), and this information can be used to
15841 locate the start of functions inside an executable piece of code. The
15842 default is @option{-msched-prolog}.
15843
15844 @item -mfloat-abi=@var{name}
15845 @opindex mfloat-abi
15846 Specifies which floating-point ABI to use. Permissible values
15847 are: @samp{soft}, @samp{softfp} and @samp{hard}.
15848
15849 Specifying @samp{soft} causes GCC to generate output containing
15850 library calls for floating-point operations.
15851 @samp{softfp} allows the generation of code using hardware floating-point
15852 instructions, but still uses the soft-float calling conventions.
15853 @samp{hard} allows generation of floating-point instructions
15854 and uses FPU-specific calling conventions.
15855
15856 The default depends on the specific target configuration. Note that
15857 the hard-float and soft-float ABIs are not link-compatible; you must
15858 compile your entire program with the same ABI, and link with a
15859 compatible set of libraries.
15860
15861 @item -mlittle-endian
15862 @opindex mlittle-endian
15863 Generate code for a processor running in little-endian mode. This is
15864 the default for all standard configurations.
15865
15866 @item -mbig-endian
15867 @opindex mbig-endian
15868 Generate code for a processor running in big-endian mode; the default is
15869 to compile code for a little-endian processor.
15870
15871 @item -mbe8
15872 @itemx -mbe32
15873 @opindex mbe8
15874 When linking a big-endian image select between BE8 and BE32 formats.
15875 The option has no effect for little-endian images and is ignored. The
15876 default is dependent on the selected target architecture. For ARMv6
15877 and later architectures the default is BE8, for older architectures
15878 the default is BE32. BE32 format has been deprecated by ARM.
15879
15880 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
15881 @opindex march
15882 This specifies the name of the target ARM architecture. GCC uses this
15883 name to determine what kind of instructions it can emit when generating
15884 assembly code. This option can be used in conjunction with or instead
15885 of the @option{-mcpu=} option.
15886
15887 Permissible names are:
15888 @samp{armv4t},
15889 @samp{armv5t}, @samp{armv5te},
15890 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
15891 @samp{armv6z}, @samp{armv6zk},
15892 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
15893 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
15894 @samp{armv8.4-a},
15895 @samp{armv7-r},
15896 @samp{armv8-r},
15897 @samp{armv6-m}, @samp{armv6s-m},
15898 @samp{armv7-m}, @samp{armv7e-m},
15899 @samp{armv8-m.base}, @samp{armv8-m.main},
15900 @samp{iwmmxt} and @samp{iwmmxt2}.
15901
15902 Additionally, the following architectures, which lack support for the
15903 Thumb execution state, are recognized but support is deprecated:
15904 @samp{armv2}, @samp{armv2a}, @samp{armv3}, @samp{armv3m},
15905 @samp{armv4}, @samp{armv5} and @samp{armv5e}.
15906
15907 Many of the architectures support extensions. These can be added by
15908 appending @samp{+@var{extension}} to the architecture name. Extension
15909 options are processed in order and capabilities accumulate. An extension
15910 will also enable any necessary base extensions
15911 upon which it depends. For example, the @samp{+crypto} extension
15912 will always enable the @samp{+simd} extension. The exception to the
15913 additive construction is for extensions that are prefixed with
15914 @samp{+no@dots{}}: these extensions disable the specified option and
15915 any other extensions that may depend on the presence of that
15916 extension.
15917
15918 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
15919 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
15920 entirely disabled by the @samp{+nofp} option that follows it.
15921
15922 Most extension names are generically named, but have an effect that is
15923 dependent upon the architecture to which it is applied. For example,
15924 the @samp{+simd} option can be applied to both @samp{armv7-a} and
15925 @samp{armv8-a} architectures, but will enable the original ARMv7-A
15926 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
15927 variant for @samp{armv8-a}.
15928
15929 The table below lists the supported extensions for each architecture.
15930 Architectures not mentioned do not support any extensions.
15931
15932 @table @samp
15933 @item armv5e
15934 @itemx armv5te
15935 @itemx armv6
15936 @itemx armv6j
15937 @itemx armv6k
15938 @itemx armv6kz
15939 @itemx armv6t2
15940 @itemx armv6z
15941 @itemx armv6zk
15942 @table @samp
15943 @item +fp
15944 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
15945 used as an alias for this extension.
15946
15947 @item +nofp
15948 Disable the floating-point instructions.
15949 @end table
15950
15951 @item armv7
15952 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
15953 @table @samp
15954 @item +fp
15955 The VFPv3 floating-point instructions, with 16 double-precision
15956 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15957 for this extension. Note that floating-point is not supported by the
15958 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
15959 ARMv7-R architectures.
15960
15961 @item +nofp
15962 Disable the floating-point instructions.
15963 @end table
15964
15965 @item armv7-a
15966 @table @samp
15967 @item +fp
15968 The VFPv3 floating-point instructions, with 16 double-precision
15969 registers. The extension @samp{+vfpv3-d16} can be used as an alias
15970 for this extension.
15971
15972 @item +simd
15973 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
15974 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
15975 for this extension.
15976
15977 @item +vfpv3
15978 The VFPv3 floating-point instructions, with 32 double-precision
15979 registers.
15980
15981 @item +vfpv3-d16-fp16
15982 The VFPv3 floating-point instructions, with 16 double-precision
15983 registers and the half-precision floating-point conversion operations.
15984
15985 @item +vfpv3-fp16
15986 The VFPv3 floating-point instructions, with 32 double-precision
15987 registers and the half-precision floating-point conversion operations.
15988
15989 @item +vfpv4-d16
15990 The VFPv4 floating-point instructions, with 16 double-precision
15991 registers.
15992
15993 @item +vfpv4
15994 The VFPv4 floating-point instructions, with 32 double-precision
15995 registers.
15996
15997 @item +neon-fp16
15998 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
15999 the half-precision floating-point conversion operations.
16000
16001 @item +neon-vfpv4
16002 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
16003
16004 @item +nosimd
16005 Disable the Advanced SIMD instructions (does not disable floating point).
16006
16007 @item +nofp
16008 Disable the floating-point and Advanced SIMD instructions.
16009 @end table
16010
16011 @item armv7ve
16012 The extended version of the ARMv7-A architecture with support for
16013 virtualization.
16014 @table @samp
16015 @item +fp
16016 The VFPv4 floating-point instructions, with 16 double-precision registers.
16017 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16018
16019 @item +simd
16020 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16021 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16022
16023 @item +vfpv3-d16
16024 The VFPv3 floating-point instructions, with 16 double-precision
16025 registers.
16026
16027 @item +vfpv3
16028 The VFPv3 floating-point instructions, with 32 double-precision
16029 registers.
16030
16031 @item +vfpv3-d16-fp16
16032 The VFPv3 floating-point instructions, with 16 double-precision
16033 registers and the half-precision floating-point conversion operations.
16034
16035 @item +vfpv3-fp16
16036 The VFPv3 floating-point instructions, with 32 double-precision
16037 registers and the half-precision floating-point conversion operations.
16038
16039 @item +vfpv4-d16
16040 The VFPv4 floating-point instructions, with 16 double-precision
16041 registers.
16042
16043 @item +vfpv4
16044 The VFPv4 floating-point instructions, with 32 double-precision
16045 registers.
16046
16047 @item +neon
16048 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16049 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
16050
16051 @item +neon-fp16
16052 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16053 the half-precision floating-point conversion operations.
16054
16055 @item +nosimd
16056 Disable the Advanced SIMD instructions (does not disable floating point).
16057
16058 @item +nofp
16059 Disable the floating-point and Advanced SIMD instructions.
16060 @end table
16061
16062 @item armv8-a
16063 @table @samp
16064 @item +crc
16065 The Cyclic Redundancy Check (CRC) instructions.
16066 @item +simd
16067 The ARMv8-A Advanced SIMD and floating-point instructions.
16068 @item +crypto
16069 The cryptographic instructions.
16070 @item +nocrypto
16071 Disable the cryptographic instructions.
16072 @item +nofp
16073 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16074 @end table
16075
16076 @item armv8.1-a
16077 @table @samp
16078 @item +simd
16079 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16080
16081 @item +crypto
16082 The cryptographic instructions. This also enables the Advanced SIMD and
16083 floating-point instructions.
16084
16085 @item +nocrypto
16086 Disable the cryptographic instructions.
16087
16088 @item +nofp
16089 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16090 @end table
16091
16092 @item armv8.2-a
16093 @itemx armv8.3-a
16094 @table @samp
16095 @item +fp16
16096 The half-precision floating-point data processing instructions.
16097 This also enables the Advanced SIMD and floating-point instructions.
16098
16099 @item +fp16fml
16100 The half-precision floating-point fmla extension. This also enables
16101 the half-precision floating-point extension and Advanced SIMD and
16102 floating-point instructions.
16103
16104 @item +simd
16105 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16106
16107 @item +crypto
16108 The cryptographic instructions. This also enables the Advanced SIMD and
16109 floating-point instructions.
16110
16111 @item +dotprod
16112 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16113
16114 @item +nocrypto
16115 Disable the cryptographic extension.
16116
16117 @item +nofp
16118 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16119 @end table
16120
16121 @item armv8.4-a
16122 @table @samp
16123 @item +fp16
16124 The half-precision floating-point data processing instructions.
16125 This also enables the Advanced SIMD and floating-point instructions as well
16126 as the Dot Product extension and the half-precision floating-point fmla
16127 extension.
16128
16129 @item +simd
16130 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
16131 Dot Product extension.
16132
16133 @item +crypto
16134 The cryptographic instructions. This also enables the Advanced SIMD and
16135 floating-point instructions as well as the Dot Product extension.
16136
16137 @item +nocrypto
16138 Disable the cryptographic extension.
16139
16140 @item +nofp
16141 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16142 @end table
16143
16144 @item armv7-r
16145 @table @samp
16146 @item +fp.sp
16147 The single-precision VFPv3 floating-point instructions. The extension
16148 @samp{+vfpv3xd} can be used as an alias for this extension.
16149
16150 @item +fp
16151 The VFPv3 floating-point instructions with 16 double-precision registers.
16152 The extension +vfpv3-d16 can be used as an alias for this extension.
16153
16154 @item +nofp
16155 Disable the floating-point extension.
16156
16157 @item +idiv
16158 The ARM-state integer division instructions.
16159
16160 @item +noidiv
16161 Disable the ARM-state integer division extension.
16162 @end table
16163
16164 @item armv7e-m
16165 @table @samp
16166 @item +fp
16167 The single-precision VFPv4 floating-point instructions.
16168
16169 @item +fpv5
16170 The single-precision FPv5 floating-point instructions.
16171
16172 @item +fp.dp
16173 The single- and double-precision FPv5 floating-point instructions.
16174
16175 @item +nofp
16176 Disable the floating-point extensions.
16177 @end table
16178
16179 @item armv8-m.main
16180 @table @samp
16181 @item +dsp
16182 The DSP instructions.
16183
16184 @item +nodsp
16185 Disable the DSP extension.
16186
16187 @item +fp
16188 The single-precision floating-point instructions.
16189
16190 @item +fp.dp
16191 The single- and double-precision floating-point instructions.
16192
16193 @item +nofp
16194 Disable the floating-point extension.
16195 @end table
16196
16197 @item armv8-r
16198 @table @samp
16199 @item +crc
16200 The Cyclic Redundancy Check (CRC) instructions.
16201 @item +fp.sp
16202 The single-precision FPv5 floating-point instructions.
16203 @item +simd
16204 The ARMv8-A Advanced SIMD and floating-point instructions.
16205 @item +crypto
16206 The cryptographic instructions.
16207 @item +nocrypto
16208 Disable the cryptographic instructions.
16209 @item +nofp
16210 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16211 @end table
16212
16213 @end table
16214
16215 @option{-march=native} causes the compiler to auto-detect the architecture
16216 of the build computer. At present, this feature is only supported on
16217 GNU/Linux, and not all architectures are recognized. If the auto-detect
16218 is unsuccessful the option has no effect.
16219
16220 @item -mtune=@var{name}
16221 @opindex mtune
16222 This option specifies the name of the target ARM processor for
16223 which GCC should tune the performance of the code.
16224 For some ARM implementations better performance can be obtained by using
16225 this option.
16226 Permissible names are: @samp{arm2}, @samp{arm250},
16227 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
16228 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
16229 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
16230 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
16231 @samp{arm720},
16232 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
16233 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
16234 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
16235 @samp{strongarm1110},
16236 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
16237 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
16238 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
16239 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
16240 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
16241 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
16242 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
16243 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
16244 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
16245 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16246 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16247 @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7},
16248 @samp{cortex-r8}, @samp{cortex-r52},
16249 @samp{cortex-m33},
16250 @samp{cortex-m23},
16251 @samp{cortex-m7},
16252 @samp{cortex-m4},
16253 @samp{cortex-m3},
16254 @samp{cortex-m1},
16255 @samp{cortex-m0},
16256 @samp{cortex-m0plus},
16257 @samp{cortex-m1.small-multiply},
16258 @samp{cortex-m0.small-multiply},
16259 @samp{cortex-m0plus.small-multiply},
16260 @samp{exynos-m1},
16261 @samp{marvell-pj4},
16262 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
16263 @samp{fa526}, @samp{fa626},
16264 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
16265 @samp{xgene1}.
16266
16267 Additionally, this option can specify that GCC should tune the performance
16268 of the code for a big.LITTLE system. Permissible names are:
16269 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
16270 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16271 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
16272 @samp{cortex-a75.cortex-a55}.
16273
16274 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
16275 performance for a blend of processors within architecture @var{arch}.
16276 The aim is to generate code that run well on the current most popular
16277 processors, balancing between optimizations that benefit some CPUs in the
16278 range, and avoiding performance pitfalls of other CPUs. The effects of
16279 this option may change in future GCC versions as CPU models come and go.
16280
16281 @option{-mtune} permits the same extension options as @option{-mcpu}, but
16282 the extension options do not affect the tuning of the generated code.
16283
16284 @option{-mtune=native} causes the compiler to auto-detect the CPU
16285 of the build computer. At present, this feature is only supported on
16286 GNU/Linux, and not all architectures are recognized. If the auto-detect is
16287 unsuccessful the option has no effect.
16288
16289 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
16290 @opindex mcpu
16291 This specifies the name of the target ARM processor. GCC uses this name
16292 to derive the name of the target ARM architecture (as if specified
16293 by @option{-march}) and the ARM processor type for which to tune for
16294 performance (as if specified by @option{-mtune}). Where this option
16295 is used in conjunction with @option{-march} or @option{-mtune},
16296 those options take precedence over the appropriate part of this option.
16297
16298 Many of the supported CPUs implement optional architectural
16299 extensions. Where this is so the architectural extensions are
16300 normally enabled by default. If implementations that lack the
16301 extension exist, then the extension syntax can be used to disable
16302 those extensions that have been omitted. For floating-point and
16303 Advanced SIMD (Neon) instructions, the settings of the options
16304 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
16305 floating-point and Advanced SIMD instructions will only be used if
16306 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
16307 @option{-mfpu} other than @samp{auto} will override the available
16308 floating-point and SIMD extension instructions.
16309
16310 For example, @samp{cortex-a9} can be found in three major
16311 configurations: integer only, with just a floating-point unit or with
16312 floating-point and Advanced SIMD. The default is to enable all the
16313 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
16314 be used to disable just the SIMD or both the SIMD and floating-point
16315 instructions respectively.
16316
16317 Permissible names for this option are the same as those for
16318 @option{-mtune}.
16319
16320 The following extension options are common to the listed CPUs:
16321
16322 @table @samp
16323 @item +nodsp
16324 Disable the DSP instructions on @samp{cortex-m33}.
16325
16326 @item +nofp
16327 Disables the floating-point instructions on @samp{arm9e},
16328 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
16329 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
16330 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
16331 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
16332 Disables the floating-point and SIMD instructions on
16333 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
16334 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
16335 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
16336 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
16337 @samp{cortex-a53} and @samp{cortex-a55}.
16338
16339 @item +nofp.dp
16340 Disables the double-precision component of the floating-point instructions
16341 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
16342
16343 @item +nosimd
16344 Disables the SIMD (but not floating-point) instructions on
16345 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
16346 and @samp{cortex-a9}.
16347
16348 @item +crypto
16349 Enables the cryptographic instructions on @samp{cortex-a32},
16350 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
16351 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
16352 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16353 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
16354 @samp{cortex-a75.cortex-a55}.
16355 @end table
16356
16357 Additionally the @samp{generic-armv7-a} pseudo target defaults to
16358 VFPv3 with 16 double-precision registers. It supports the following
16359 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
16360 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
16361 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
16362 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
16363 @option{-march=armv7-a}.
16364
16365 @option{-mcpu=generic-@var{arch}} is also permissible, and is
16366 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
16367 See @option{-mtune} for more information.
16368
16369 @option{-mcpu=native} causes the compiler to auto-detect the CPU
16370 of the build computer. At present, this feature is only supported on
16371 GNU/Linux, and not all architectures are recognized. If the auto-detect
16372 is unsuccessful the option has no effect.
16373
16374 @item -mfpu=@var{name}
16375 @opindex mfpu
16376 This specifies what floating-point hardware (or hardware emulation) is
16377 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
16378 @samp{vfpv3},
16379 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
16380 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
16381 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
16382 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
16383 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
16384 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
16385 is an alias for @samp{vfpv2}.
16386
16387 The setting @samp{auto} is the default and is special. It causes the
16388 compiler to select the floating-point and Advanced SIMD instructions
16389 based on the settings of @option{-mcpu} and @option{-march}.
16390
16391 If the selected floating-point hardware includes the NEON extension
16392 (e.g. @option{-mfpu=neon}), note that floating-point
16393 operations are not generated by GCC's auto-vectorization pass unless
16394 @option{-funsafe-math-optimizations} is also specified. This is
16395 because NEON hardware does not fully implement the IEEE 754 standard for
16396 floating-point arithmetic (in particular denormal values are treated as
16397 zero), so the use of NEON instructions may lead to a loss of precision.
16398
16399 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}).
16400
16401 @item -mfp16-format=@var{name}
16402 @opindex mfp16-format
16403 Specify the format of the @code{__fp16} half-precision floating-point type.
16404 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
16405 the default is @samp{none}, in which case the @code{__fp16} type is not
16406 defined. @xref{Half-Precision}, for more information.
16407
16408 @item -mstructure-size-boundary=@var{n}
16409 @opindex mstructure-size-boundary
16410 The sizes of all structures and unions are rounded up to a multiple
16411 of the number of bits set by this option. Permissible values are 8, 32
16412 and 64. The default value varies for different toolchains. For the COFF
16413 targeted toolchain the default value is 8. A value of 64 is only allowed
16414 if the underlying ABI supports it.
16415
16416 Specifying a larger number can produce faster, more efficient code, but
16417 can also increase the size of the program. Different values are potentially
16418 incompatible. Code compiled with one value cannot necessarily expect to
16419 work with code or libraries compiled with another value, if they exchange
16420 information using structures or unions.
16421
16422 This option is deprecated.
16423
16424 @item -mabort-on-noreturn
16425 @opindex mabort-on-noreturn
16426 Generate a call to the function @code{abort} at the end of a
16427 @code{noreturn} function. It is executed if the function tries to
16428 return.
16429
16430 @item -mlong-calls
16431 @itemx -mno-long-calls
16432 @opindex mlong-calls
16433 @opindex mno-long-calls
16434 Tells the compiler to perform function calls by first loading the
16435 address of the function into a register and then performing a subroutine
16436 call on this register. This switch is needed if the target function
16437 lies outside of the 64-megabyte addressing range of the offset-based
16438 version of subroutine call instruction.
16439
16440 Even if this switch is enabled, not all function calls are turned
16441 into long calls. The heuristic is that static functions, functions
16442 that have the @code{short_call} attribute, functions that are inside
16443 the scope of a @code{#pragma no_long_calls} directive, and functions whose
16444 definitions have already been compiled within the current compilation
16445 unit are not turned into long calls. The exceptions to this rule are
16446 that weak function definitions, functions with the @code{long_call}
16447 attribute or the @code{section} attribute, and functions that are within
16448 the scope of a @code{#pragma long_calls} directive are always
16449 turned into long calls.
16450
16451 This feature is not enabled by default. Specifying
16452 @option{-mno-long-calls} restores the default behavior, as does
16453 placing the function calls within the scope of a @code{#pragma
16454 long_calls_off} directive. Note these switches have no effect on how
16455 the compiler generates code to handle function calls via function
16456 pointers.
16457
16458 @item -msingle-pic-base
16459 @opindex msingle-pic-base
16460 Treat the register used for PIC addressing as read-only, rather than
16461 loading it in the prologue for each function. The runtime system is
16462 responsible for initializing this register with an appropriate value
16463 before execution begins.
16464
16465 @item -mpic-register=@var{reg}
16466 @opindex mpic-register
16467 Specify the register to be used for PIC addressing.
16468 For standard PIC base case, the default is any suitable register
16469 determined by compiler. For single PIC base case, the default is
16470 @samp{R9} if target is EABI based or stack-checking is enabled,
16471 otherwise the default is @samp{R10}.
16472
16473 @item -mpic-data-is-text-relative
16474 @opindex mpic-data-is-text-relative
16475 Assume that the displacement between the text and data segments is fixed
16476 at static link time. This permits using PC-relative addressing
16477 operations to access data known to be in the data segment. For
16478 non-VxWorks RTP targets, this option is enabled by default. When
16479 disabled on such targets, it will enable @option{-msingle-pic-base} by
16480 default.
16481
16482 @item -mpoke-function-name
16483 @opindex mpoke-function-name
16484 Write the name of each function into the text section, directly
16485 preceding the function prologue. The generated code is similar to this:
16486
16487 @smallexample
16488 t0
16489 .ascii "arm_poke_function_name", 0
16490 .align
16491 t1
16492 .word 0xff000000 + (t1 - t0)
16493 arm_poke_function_name
16494 mov ip, sp
16495 stmfd sp!, @{fp, ip, lr, pc@}
16496 sub fp, ip, #4
16497 @end smallexample
16498
16499 When performing a stack backtrace, code can inspect the value of
16500 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
16501 location @code{pc - 12} and the top 8 bits are set, then we know that
16502 there is a function name embedded immediately preceding this location
16503 and has length @code{((pc[-3]) & 0xff000000)}.
16504
16505 @item -mthumb
16506 @itemx -marm
16507 @opindex marm
16508 @opindex mthumb
16509
16510 Select between generating code that executes in ARM and Thumb
16511 states. The default for most configurations is to generate code
16512 that executes in ARM state, but the default can be changed by
16513 configuring GCC with the @option{--with-mode=}@var{state}
16514 configure option.
16515
16516 You can also override the ARM and Thumb mode for each function
16517 by using the @code{target("thumb")} and @code{target("arm")} function attributes
16518 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
16519
16520 @item -mflip-thumb
16521 @opindex mflip-thumb
16522 Switch ARM/Thumb modes on alternating functions.
16523 This option is provided for regression testing of mixed Thumb/ARM code
16524 generation, and is not intended for ordinary use in compiling code.
16525
16526 @item -mtpcs-frame
16527 @opindex mtpcs-frame
16528 Generate a stack frame that is compliant with the Thumb Procedure Call
16529 Standard for all non-leaf functions. (A leaf function is one that does
16530 not call any other functions.) The default is @option{-mno-tpcs-frame}.
16531
16532 @item -mtpcs-leaf-frame
16533 @opindex mtpcs-leaf-frame
16534 Generate a stack frame that is compliant with the Thumb Procedure Call
16535 Standard for all leaf functions. (A leaf function is one that does
16536 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
16537
16538 @item -mcallee-super-interworking
16539 @opindex mcallee-super-interworking
16540 Gives all externally visible functions in the file being compiled an ARM
16541 instruction set header which switches to Thumb mode before executing the
16542 rest of the function. This allows these functions to be called from
16543 non-interworking code. This option is not valid in AAPCS configurations
16544 because interworking is enabled by default.
16545
16546 @item -mcaller-super-interworking
16547 @opindex mcaller-super-interworking
16548 Allows calls via function pointers (including virtual functions) to
16549 execute correctly regardless of whether the target code has been
16550 compiled for interworking or not. There is a small overhead in the cost
16551 of executing a function pointer if this option is enabled. This option
16552 is not valid in AAPCS configurations because interworking is enabled
16553 by default.
16554
16555 @item -mtp=@var{name}
16556 @opindex mtp
16557 Specify the access model for the thread local storage pointer. The valid
16558 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
16559 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
16560 (supported in the arm6k architecture), and @samp{auto}, which uses the
16561 best available method for the selected processor. The default setting is
16562 @samp{auto}.
16563
16564 @item -mtls-dialect=@var{dialect}
16565 @opindex mtls-dialect
16566 Specify the dialect to use for accessing thread local storage. Two
16567 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
16568 @samp{gnu} dialect selects the original GNU scheme for supporting
16569 local and global dynamic TLS models. The @samp{gnu2} dialect
16570 selects the GNU descriptor scheme, which provides better performance
16571 for shared libraries. The GNU descriptor scheme is compatible with
16572 the original scheme, but does require new assembler, linker and
16573 library support. Initial and local exec TLS models are unaffected by
16574 this option and always use the original scheme.
16575
16576 @item -mword-relocations
16577 @opindex mword-relocations
16578 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
16579 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
16580 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
16581 is specified.
16582
16583 @item -mfix-cortex-m3-ldrd
16584 @opindex mfix-cortex-m3-ldrd
16585 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
16586 with overlapping destination and base registers are used. This option avoids
16587 generating these instructions. This option is enabled by default when
16588 @option{-mcpu=cortex-m3} is specified.
16589
16590 @item -munaligned-access
16591 @itemx -mno-unaligned-access
16592 @opindex munaligned-access
16593 @opindex mno-unaligned-access
16594 Enables (or disables) reading and writing of 16- and 32- bit values
16595 from addresses that are not 16- or 32- bit aligned. By default
16596 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
16597 ARMv8-M Baseline architectures, and enabled for all other
16598 architectures. If unaligned access is not enabled then words in packed
16599 data structures are accessed a byte at a time.
16600
16601 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
16602 generated object file to either true or false, depending upon the
16603 setting of this option. If unaligned access is enabled then the
16604 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
16605 defined.
16606
16607 @item -mneon-for-64bits
16608 @opindex mneon-for-64bits
16609 Enables using Neon to handle scalar 64-bits operations. This is
16610 disabled by default since the cost of moving data from core registers
16611 to Neon is high.
16612
16613 @item -mslow-flash-data
16614 @opindex mslow-flash-data
16615 Assume loading data from flash is slower than fetching instruction.
16616 Therefore literal load is minimized for better performance.
16617 This option is only supported when compiling for ARMv7 M-profile and
16618 off by default.
16619
16620 @item -masm-syntax-unified
16621 @opindex masm-syntax-unified
16622 Assume inline assembler is using unified asm syntax. The default is
16623 currently off which implies divided syntax. This option has no impact
16624 on Thumb2. However, this may change in future releases of GCC.
16625 Divided syntax should be considered deprecated.
16626
16627 @item -mrestrict-it
16628 @opindex mrestrict-it
16629 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
16630 IT blocks can only contain a single 16-bit instruction from a select
16631 set of instructions. This option is on by default for ARMv8-A Thumb mode.
16632
16633 @item -mprint-tune-info
16634 @opindex mprint-tune-info
16635 Print CPU tuning information as comment in assembler file. This is
16636 an option used only for regression testing of the compiler and not
16637 intended for ordinary use in compiling code. This option is disabled
16638 by default.
16639
16640 @item -mverbose-cost-dump
16641 @opindex mverbose-cost-dump
16642 Enable verbose cost model dumping in the debug dump files. This option is
16643 provided for use in debugging the compiler.
16644
16645 @item -mpure-code
16646 @opindex mpure-code
16647 Do not allow constant data to be placed in code sections.
16648 Additionally, when compiling for ELF object format give all text sections the
16649 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
16650 is only available when generating non-pic code for M-profile targets with the
16651 MOVT instruction.
16652
16653 @item -mcmse
16654 @opindex mcmse
16655 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
16656 Development Tools Engineering Specification", which can be found on
16657 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
16658 @end table
16659
16660 @node AVR Options
16661 @subsection AVR Options
16662 @cindex AVR Options
16663
16664 These options are defined for AVR implementations:
16665
16666 @table @gcctabopt
16667 @item -mmcu=@var{mcu}
16668 @opindex mmcu
16669 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16670
16671 The default for this option is@tie{}@samp{avr2}.
16672
16673 GCC supports the following AVR devices and ISAs:
16674
16675 @include avr-mmcu.texi
16676
16677 @item -mabsdata
16678 @opindex mabsdata
16679
16680 Assume that all data in static storage can be accessed by LDS / STS
16681 instructions. This option has only an effect on reduced Tiny devices like
16682 ATtiny40. See also the @code{absdata}
16683 @ref{AVR Variable Attributes,variable attribute}.
16684
16685 @item -maccumulate-args
16686 @opindex maccumulate-args
16687 Accumulate outgoing function arguments and acquire/release the needed
16688 stack space for outgoing function arguments once in function
16689 prologue/epilogue. Without this option, outgoing arguments are pushed
16690 before calling a function and popped afterwards.
16691
16692 Popping the arguments after the function call can be expensive on
16693 AVR so that accumulating the stack space might lead to smaller
16694 executables because arguments need not be removed from the
16695 stack after such a function call.
16696
16697 This option can lead to reduced code size for functions that perform
16698 several calls to functions that get their arguments on the stack like
16699 calls to printf-like functions.
16700
16701 @item -mbranch-cost=@var{cost}
16702 @opindex mbranch-cost
16703 Set the branch costs for conditional branch instructions to
16704 @var{cost}. Reasonable values for @var{cost} are small, non-negative
16705 integers. The default branch cost is 0.
16706
16707 @item -mcall-prologues
16708 @opindex mcall-prologues
16709 Functions prologues/epilogues are expanded as calls to appropriate
16710 subroutines. Code size is smaller.
16711
16712 @item -mgas-isr-prologues
16713 @opindex mgas-isr-prologues
16714 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
16715 instruction supported by GNU Binutils.
16716 If this option is on, the feature can still be disabled for individual
16717 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
16718 function attribute. This feature is activated per default
16719 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
16720 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
16721
16722 @item -mint8
16723 @opindex mint8
16724 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
16725 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
16726 and @code{long long} is 4 bytes. Please note that this option does not
16727 conform to the C standards, but it results in smaller code
16728 size.
16729
16730 @item -mmain-is-OS_task
16731 @opindex mmain-is-OS_task
16732 Do not save registers in @code{main}. The effect is the same like
16733 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
16734 to @code{main}. It is activated per default if optimization is on.
16735
16736 @item -mn-flash=@var{num}
16737 @opindex mn-flash
16738 Assume that the flash memory has a size of
16739 @var{num} times 64@tie{}KiB.
16740
16741 @item -mno-interrupts
16742 @opindex mno-interrupts
16743 Generated code is not compatible with hardware interrupts.
16744 Code size is smaller.
16745
16746 @item -mrelax
16747 @opindex mrelax
16748 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
16749 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
16750 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
16751 the assembler's command line and the @option{--relax} option to the
16752 linker's command line.
16753
16754 Jump relaxing is performed by the linker because jump offsets are not
16755 known before code is located. Therefore, the assembler code generated by the
16756 compiler is the same, but the instructions in the executable may
16757 differ from instructions in the assembler code.
16758
16759 Relaxing must be turned on if linker stubs are needed, see the
16760 section on @code{EIND} and linker stubs below.
16761
16762 @item -mrmw
16763 @opindex mrmw
16764 Assume that the device supports the Read-Modify-Write
16765 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
16766
16767 @item -mshort-calls
16768 @opindex mshort-calls
16769
16770 Assume that @code{RJMP} and @code{RCALL} can target the whole
16771 program memory.
16772
16773 This option is used internally for multilib selection. It is
16774 not an optimization option, and you don't need to set it by hand.
16775
16776 @item -msp8
16777 @opindex msp8
16778 Treat the stack pointer register as an 8-bit register,
16779 i.e.@: assume the high byte of the stack pointer is zero.
16780 In general, you don't need to set this option by hand.
16781
16782 This option is used internally by the compiler to select and
16783 build multilibs for architectures @code{avr2} and @code{avr25}.
16784 These architectures mix devices with and without @code{SPH}.
16785 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
16786 the compiler driver adds or removes this option from the compiler
16787 proper's command line, because the compiler then knows if the device
16788 or architecture has an 8-bit stack pointer and thus no @code{SPH}
16789 register or not.
16790
16791 @item -mstrict-X
16792 @opindex mstrict-X
16793 Use address register @code{X} in a way proposed by the hardware. This means
16794 that @code{X} is only used in indirect, post-increment or
16795 pre-decrement addressing.
16796
16797 Without this option, the @code{X} register may be used in the same way
16798 as @code{Y} or @code{Z} which then is emulated by additional
16799 instructions.
16800 For example, loading a value with @code{X+const} addressing with a
16801 small non-negative @code{const < 64} to a register @var{Rn} is
16802 performed as
16803
16804 @example
16805 adiw r26, const ; X += const
16806 ld @var{Rn}, X ; @var{Rn} = *X
16807 sbiw r26, const ; X -= const
16808 @end example
16809
16810 @item -mtiny-stack
16811 @opindex mtiny-stack
16812 Only change the lower 8@tie{}bits of the stack pointer.
16813
16814 @item -mfract-convert-truncate
16815 @opindex mfract-convert-truncate
16816 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
16817
16818 @item -nodevicelib
16819 @opindex nodevicelib
16820 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
16821
16822 @item -Waddr-space-convert
16823 @opindex Waddr-space-convert
16824 Warn about conversions between address spaces in the case where the
16825 resulting address space is not contained in the incoming address space.
16826
16827 @item -Wmisspelled-isr
16828 @opindex Wmisspelled-isr
16829 Warn if the ISR is misspelled, i.e. without __vector prefix.
16830 Enabled by default.
16831 @end table
16832
16833 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
16834 @cindex @code{EIND}
16835 Pointers in the implementation are 16@tie{}bits wide.
16836 The address of a function or label is represented as word address so
16837 that indirect jumps and calls can target any code address in the
16838 range of 64@tie{}Ki words.
16839
16840 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
16841 bytes of program memory space, there is a special function register called
16842 @code{EIND} that serves as most significant part of the target address
16843 when @code{EICALL} or @code{EIJMP} instructions are used.
16844
16845 Indirect jumps and calls on these devices are handled as follows by
16846 the compiler and are subject to some limitations:
16847
16848 @itemize @bullet
16849
16850 @item
16851 The compiler never sets @code{EIND}.
16852
16853 @item
16854 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
16855 instructions or might read @code{EIND} directly in order to emulate an
16856 indirect call/jump by means of a @code{RET} instruction.
16857
16858 @item
16859 The compiler assumes that @code{EIND} never changes during the startup
16860 code or during the application. In particular, @code{EIND} is not
16861 saved/restored in function or interrupt service routine
16862 prologue/epilogue.
16863
16864 @item
16865 For indirect calls to functions and computed goto, the linker
16866 generates @emph{stubs}. Stubs are jump pads sometimes also called
16867 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
16868 The stub contains a direct jump to the desired address.
16869
16870 @item
16871 Linker relaxation must be turned on so that the linker generates
16872 the stubs correctly in all situations. See the compiler option
16873 @option{-mrelax} and the linker option @option{--relax}.
16874 There are corner cases where the linker is supposed to generate stubs
16875 but aborts without relaxation and without a helpful error message.
16876
16877 @item
16878 The default linker script is arranged for code with @code{EIND = 0}.
16879 If code is supposed to work for a setup with @code{EIND != 0}, a custom
16880 linker script has to be used in order to place the sections whose
16881 name start with @code{.trampolines} into the segment where @code{EIND}
16882 points to.
16883
16884 @item
16885 The startup code from libgcc never sets @code{EIND}.
16886 Notice that startup code is a blend of code from libgcc and AVR-LibC.
16887 For the impact of AVR-LibC on @code{EIND}, see the
16888 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
16889
16890 @item
16891 It is legitimate for user-specific startup code to set up @code{EIND}
16892 early, for example by means of initialization code located in
16893 section @code{.init3}. Such code runs prior to general startup code
16894 that initializes RAM and calls constructors, but after the bit
16895 of startup code from AVR-LibC that sets @code{EIND} to the segment
16896 where the vector table is located.
16897 @example
16898 #include <avr/io.h>
16899
16900 static void
16901 __attribute__((section(".init3"),naked,used,no_instrument_function))
16902 init3_set_eind (void)
16903 @{
16904 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
16905 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
16906 @}
16907 @end example
16908
16909 @noindent
16910 The @code{__trampolines_start} symbol is defined in the linker script.
16911
16912 @item
16913 Stubs are generated automatically by the linker if
16914 the following two conditions are met:
16915 @itemize @minus
16916
16917 @item The address of a label is taken by means of the @code{gs} modifier
16918 (short for @emph{generate stubs}) like so:
16919 @example
16920 LDI r24, lo8(gs(@var{func}))
16921 LDI r25, hi8(gs(@var{func}))
16922 @end example
16923 @item The final location of that label is in a code segment
16924 @emph{outside} the segment where the stubs are located.
16925 @end itemize
16926
16927 @item
16928 The compiler emits such @code{gs} modifiers for code labels in the
16929 following situations:
16930 @itemize @minus
16931 @item Taking address of a function or code label.
16932 @item Computed goto.
16933 @item If prologue-save function is used, see @option{-mcall-prologues}
16934 command-line option.
16935 @item Switch/case dispatch tables. If you do not want such dispatch
16936 tables you can specify the @option{-fno-jump-tables} command-line option.
16937 @item C and C++ constructors/destructors called during startup/shutdown.
16938 @item If the tools hit a @code{gs()} modifier explained above.
16939 @end itemize
16940
16941 @item
16942 Jumping to non-symbolic addresses like so is @emph{not} supported:
16943
16944 @example
16945 int main (void)
16946 @{
16947 /* Call function at word address 0x2 */
16948 return ((int(*)(void)) 0x2)();
16949 @}
16950 @end example
16951
16952 Instead, a stub has to be set up, i.e.@: the function has to be called
16953 through a symbol (@code{func_4} in the example):
16954
16955 @example
16956 int main (void)
16957 @{
16958 extern int func_4 (void);
16959
16960 /* Call function at byte address 0x4 */
16961 return func_4();
16962 @}
16963 @end example
16964
16965 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
16966 Alternatively, @code{func_4} can be defined in the linker script.
16967 @end itemize
16968
16969 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
16970 @cindex @code{RAMPD}
16971 @cindex @code{RAMPX}
16972 @cindex @code{RAMPY}
16973 @cindex @code{RAMPZ}
16974 Some AVR devices support memories larger than the 64@tie{}KiB range
16975 that can be accessed with 16-bit pointers. To access memory locations
16976 outside this 64@tie{}KiB range, the content of a @code{RAMP}
16977 register is used as high part of the address:
16978 The @code{X}, @code{Y}, @code{Z} address register is concatenated
16979 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
16980 register, respectively, to get a wide address. Similarly,
16981 @code{RAMPD} is used together with direct addressing.
16982
16983 @itemize
16984 @item
16985 The startup code initializes the @code{RAMP} special function
16986 registers with zero.
16987
16988 @item
16989 If a @ref{AVR Named Address Spaces,named address space} other than
16990 generic or @code{__flash} is used, then @code{RAMPZ} is set
16991 as needed before the operation.
16992
16993 @item
16994 If the device supports RAM larger than 64@tie{}KiB and the compiler
16995 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
16996 is reset to zero after the operation.
16997
16998 @item
16999 If the device comes with a specific @code{RAMP} register, the ISR
17000 prologue/epilogue saves/restores that SFR and initializes it with
17001 zero in case the ISR code might (implicitly) use it.
17002
17003 @item
17004 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
17005 If you use inline assembler to read from locations outside the
17006 16-bit address range and change one of the @code{RAMP} registers,
17007 you must reset it to zero after the access.
17008
17009 @end itemize
17010
17011 @subsubsection AVR Built-in Macros
17012
17013 GCC defines several built-in macros so that the user code can test
17014 for the presence or absence of features. Almost any of the following
17015 built-in macros are deduced from device capabilities and thus
17016 triggered by the @option{-mmcu=} command-line option.
17017
17018 For even more AVR-specific built-in macros see
17019 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
17020
17021 @table @code
17022
17023 @item __AVR_ARCH__
17024 Build-in macro that resolves to a decimal number that identifies the
17025 architecture and depends on the @option{-mmcu=@var{mcu}} option.
17026 Possible values are:
17027
17028 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
17029 @code{4}, @code{5}, @code{51}, @code{6}
17030
17031 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
17032 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
17033
17034 respectively and
17035
17036 @code{100},
17037 @code{102}, @code{103}, @code{104},
17038 @code{105}, @code{106}, @code{107}
17039
17040 for @var{mcu}=@code{avrtiny},
17041 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
17042 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
17043 If @var{mcu} specifies a device, this built-in macro is set
17044 accordingly. For example, with @option{-mmcu=atmega8} the macro is
17045 defined to @code{4}.
17046
17047 @item __AVR_@var{Device}__
17048 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
17049 the device's name. For example, @option{-mmcu=atmega8} defines the
17050 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
17051 @code{__AVR_ATtiny261A__}, etc.
17052
17053 The built-in macros' names follow
17054 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
17055 the device name as from the AVR user manual. The difference between
17056 @var{Device} in the built-in macro and @var{device} in
17057 @option{-mmcu=@var{device}} is that the latter is always lowercase.
17058
17059 If @var{device} is not a device but only a core architecture like
17060 @samp{avr51}, this macro is not defined.
17061
17062 @item __AVR_DEVICE_NAME__
17063 Setting @option{-mmcu=@var{device}} defines this built-in macro to
17064 the device's name. For example, with @option{-mmcu=atmega8} the macro
17065 is defined to @code{atmega8}.
17066
17067 If @var{device} is not a device but only a core architecture like
17068 @samp{avr51}, this macro is not defined.
17069
17070 @item __AVR_XMEGA__
17071 The device / architecture belongs to the XMEGA family of devices.
17072
17073 @item __AVR_HAVE_ELPM__
17074 The device has the @code{ELPM} instruction.
17075
17076 @item __AVR_HAVE_ELPMX__
17077 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
17078 R@var{n},Z+} instructions.
17079
17080 @item __AVR_HAVE_MOVW__
17081 The device has the @code{MOVW} instruction to perform 16-bit
17082 register-register moves.
17083
17084 @item __AVR_HAVE_LPMX__
17085 The device has the @code{LPM R@var{n},Z} and
17086 @code{LPM R@var{n},Z+} instructions.
17087
17088 @item __AVR_HAVE_MUL__
17089 The device has a hardware multiplier.
17090
17091 @item __AVR_HAVE_JMP_CALL__
17092 The device has the @code{JMP} and @code{CALL} instructions.
17093 This is the case for devices with more than 8@tie{}KiB of program
17094 memory.
17095
17096 @item __AVR_HAVE_EIJMP_EICALL__
17097 @itemx __AVR_3_BYTE_PC__
17098 The device has the @code{EIJMP} and @code{EICALL} instructions.
17099 This is the case for devices with more than 128@tie{}KiB of program memory.
17100 This also means that the program counter
17101 (PC) is 3@tie{}bytes wide.
17102
17103 @item __AVR_2_BYTE_PC__
17104 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
17105 with up to 128@tie{}KiB of program memory.
17106
17107 @item __AVR_HAVE_8BIT_SP__
17108 @itemx __AVR_HAVE_16BIT_SP__
17109 The stack pointer (SP) register is treated as 8-bit respectively
17110 16-bit register by the compiler.
17111 The definition of these macros is affected by @option{-mtiny-stack}.
17112
17113 @item __AVR_HAVE_SPH__
17114 @itemx __AVR_SP8__
17115 The device has the SPH (high part of stack pointer) special function
17116 register or has an 8-bit stack pointer, respectively.
17117 The definition of these macros is affected by @option{-mmcu=} and
17118 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
17119 by @option{-msp8}.
17120
17121 @item __AVR_HAVE_RAMPD__
17122 @itemx __AVR_HAVE_RAMPX__
17123 @itemx __AVR_HAVE_RAMPY__
17124 @itemx __AVR_HAVE_RAMPZ__
17125 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
17126 @code{RAMPZ} special function register, respectively.
17127
17128 @item __NO_INTERRUPTS__
17129 This macro reflects the @option{-mno-interrupts} command-line option.
17130
17131 @item __AVR_ERRATA_SKIP__
17132 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
17133 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17134 instructions because of a hardware erratum. Skip instructions are
17135 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
17136 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
17137 set.
17138
17139 @item __AVR_ISA_RMW__
17140 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
17141
17142 @item __AVR_SFR_OFFSET__=@var{offset}
17143 Instructions that can address I/O special function registers directly
17144 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
17145 address as if addressed by an instruction to access RAM like @code{LD}
17146 or @code{STS}. This offset depends on the device architecture and has
17147 to be subtracted from the RAM address in order to get the
17148 respective I/O@tie{}address.
17149
17150 @item __AVR_SHORT_CALLS__
17151 The @option{-mshort-calls} command line option is set.
17152
17153 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
17154 Some devices support reading from flash memory by means of @code{LD*}
17155 instructions. The flash memory is seen in the data address space
17156 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
17157 is not defined, this feature is not available. If defined,
17158 the address space is linear and there is no need to put
17159 @code{.rodata} into RAM. This is handled by the default linker
17160 description file, and is currently available for
17161 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
17162 there is no need to use address spaces like @code{__flash} or
17163 features like attribute @code{progmem} and @code{pgm_read_*}.
17164
17165 @item __WITH_AVRLIBC__
17166 The compiler is configured to be used together with AVR-Libc.
17167 See the @option{--with-avrlibc} configure option.
17168
17169 @end table
17170
17171 @node Blackfin Options
17172 @subsection Blackfin Options
17173 @cindex Blackfin Options
17174
17175 @table @gcctabopt
17176 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
17177 @opindex mcpu=
17178 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
17179 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
17180 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
17181 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
17182 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
17183 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
17184 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
17185 @samp{bf561}, @samp{bf592}.
17186
17187 The optional @var{sirevision} specifies the silicon revision of the target
17188 Blackfin processor. Any workarounds available for the targeted silicon revision
17189 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
17190 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
17191 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
17192 hexadecimal digits representing the major and minor numbers in the silicon
17193 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
17194 is not defined. If @var{sirevision} is @samp{any}, the
17195 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
17196 If this optional @var{sirevision} is not used, GCC assumes the latest known
17197 silicon revision of the targeted Blackfin processor.
17198
17199 GCC defines a preprocessor macro for the specified @var{cpu}.
17200 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
17201 provided by libgloss to be linked in if @option{-msim} is not given.
17202
17203 Without this option, @samp{bf532} is used as the processor by default.
17204
17205 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
17206 only the preprocessor macro is defined.
17207
17208 @item -msim
17209 @opindex msim
17210 Specifies that the program will be run on the simulator. This causes
17211 the simulator BSP provided by libgloss to be linked in. This option
17212 has effect only for @samp{bfin-elf} toolchain.
17213 Certain other options, such as @option{-mid-shared-library} and
17214 @option{-mfdpic}, imply @option{-msim}.
17215
17216 @item -momit-leaf-frame-pointer
17217 @opindex momit-leaf-frame-pointer
17218 Don't keep the frame pointer in a register for leaf functions. This
17219 avoids the instructions to save, set up and restore frame pointers and
17220 makes an extra register available in leaf functions.
17221
17222 @item -mspecld-anomaly
17223 @opindex mspecld-anomaly
17224 When enabled, the compiler ensures that the generated code does not
17225 contain speculative loads after jump instructions. If this option is used,
17226 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
17227
17228 @item -mno-specld-anomaly
17229 @opindex mno-specld-anomaly
17230 Don't generate extra code to prevent speculative loads from occurring.
17231
17232 @item -mcsync-anomaly
17233 @opindex mcsync-anomaly
17234 When enabled, the compiler ensures that the generated code does not
17235 contain CSYNC or SSYNC instructions too soon after conditional branches.
17236 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
17237
17238 @item -mno-csync-anomaly
17239 @opindex mno-csync-anomaly
17240 Don't generate extra code to prevent CSYNC or SSYNC instructions from
17241 occurring too soon after a conditional branch.
17242
17243 @item -mlow-64k
17244 @opindex mlow-64k
17245 When enabled, the compiler is free to take advantage of the knowledge that
17246 the entire program fits into the low 64k of memory.
17247
17248 @item -mno-low-64k
17249 @opindex mno-low-64k
17250 Assume that the program is arbitrarily large. This is the default.
17251
17252 @item -mstack-check-l1
17253 @opindex mstack-check-l1
17254 Do stack checking using information placed into L1 scratchpad memory by the
17255 uClinux kernel.
17256
17257 @item -mid-shared-library
17258 @opindex mid-shared-library
17259 Generate code that supports shared libraries via the library ID method.
17260 This allows for execute in place and shared libraries in an environment
17261 without virtual memory management. This option implies @option{-fPIC}.
17262 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17263
17264 @item -mno-id-shared-library
17265 @opindex mno-id-shared-library
17266 Generate code that doesn't assume ID-based shared libraries are being used.
17267 This is the default.
17268
17269 @item -mleaf-id-shared-library
17270 @opindex mleaf-id-shared-library
17271 Generate code that supports shared libraries via the library ID method,
17272 but assumes that this library or executable won't link against any other
17273 ID shared libraries. That allows the compiler to use faster code for jumps
17274 and calls.
17275
17276 @item -mno-leaf-id-shared-library
17277 @opindex mno-leaf-id-shared-library
17278 Do not assume that the code being compiled won't link against any ID shared
17279 libraries. Slower code is generated for jump and call insns.
17280
17281 @item -mshared-library-id=n
17282 @opindex mshared-library-id
17283 Specifies the identification number of the ID-based shared library being
17284 compiled. Specifying a value of 0 generates more compact code; specifying
17285 other values forces the allocation of that number to the current
17286 library but is no more space- or time-efficient than omitting this option.
17287
17288 @item -msep-data
17289 @opindex msep-data
17290 Generate code that allows the data segment to be located in a different
17291 area of memory from the text segment. This allows for execute in place in
17292 an environment without virtual memory management by eliminating relocations
17293 against the text section.
17294
17295 @item -mno-sep-data
17296 @opindex mno-sep-data
17297 Generate code that assumes that the data segment follows the text segment.
17298 This is the default.
17299
17300 @item -mlong-calls
17301 @itemx -mno-long-calls
17302 @opindex mlong-calls
17303 @opindex mno-long-calls
17304 Tells the compiler to perform function calls by first loading the
17305 address of the function into a register and then performing a subroutine
17306 call on this register. This switch is needed if the target function
17307 lies outside of the 24-bit addressing range of the offset-based
17308 version of subroutine call instruction.
17309
17310 This feature is not enabled by default. Specifying
17311 @option{-mno-long-calls} restores the default behavior. Note these
17312 switches have no effect on how the compiler generates code to handle
17313 function calls via function pointers.
17314
17315 @item -mfast-fp
17316 @opindex mfast-fp
17317 Link with the fast floating-point library. This library relaxes some of
17318 the IEEE floating-point standard's rules for checking inputs against
17319 Not-a-Number (NAN), in the interest of performance.
17320
17321 @item -minline-plt
17322 @opindex minline-plt
17323 Enable inlining of PLT entries in function calls to functions that are
17324 not known to bind locally. It has no effect without @option{-mfdpic}.
17325
17326 @item -mmulticore
17327 @opindex mmulticore
17328 Build a standalone application for multicore Blackfin processors.
17329 This option causes proper start files and link scripts supporting
17330 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
17331 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
17332
17333 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
17334 selects the one-application-per-core programming model. Without
17335 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
17336 programming model is used. In this model, the main function of Core B
17337 should be named as @code{coreb_main}.
17338
17339 If this option is not used, the single-core application programming
17340 model is used.
17341
17342 @item -mcorea
17343 @opindex mcorea
17344 Build a standalone application for Core A of BF561 when using
17345 the one-application-per-core programming model. Proper start files
17346 and link scripts are used to support Core A, and the macro
17347 @code{__BFIN_COREA} is defined.
17348 This option can only be used in conjunction with @option{-mmulticore}.
17349
17350 @item -mcoreb
17351 @opindex mcoreb
17352 Build a standalone application for Core B of BF561 when using
17353 the one-application-per-core programming model. Proper start files
17354 and link scripts are used to support Core B, and the macro
17355 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
17356 should be used instead of @code{main}.
17357 This option can only be used in conjunction with @option{-mmulticore}.
17358
17359 @item -msdram
17360 @opindex msdram
17361 Build a standalone application for SDRAM. Proper start files and
17362 link scripts are used to put the application into SDRAM, and the macro
17363 @code{__BFIN_SDRAM} is defined.
17364 The loader should initialize SDRAM before loading the application.
17365
17366 @item -micplb
17367 @opindex micplb
17368 Assume that ICPLBs are enabled at run time. This has an effect on certain
17369 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
17370 are enabled; for standalone applications the default is off.
17371 @end table
17372
17373 @node C6X Options
17374 @subsection C6X Options
17375 @cindex C6X Options
17376
17377 @table @gcctabopt
17378 @item -march=@var{name}
17379 @opindex march
17380 This specifies the name of the target architecture. GCC uses this
17381 name to determine what kind of instructions it can emit when generating
17382 assembly code. Permissible names are: @samp{c62x},
17383 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
17384
17385 @item -mbig-endian
17386 @opindex mbig-endian
17387 Generate code for a big-endian target.
17388
17389 @item -mlittle-endian
17390 @opindex mlittle-endian
17391 Generate code for a little-endian target. This is the default.
17392
17393 @item -msim
17394 @opindex msim
17395 Choose startup files and linker script suitable for the simulator.
17396
17397 @item -msdata=default
17398 @opindex msdata=default
17399 Put small global and static data in the @code{.neardata} section,
17400 which is pointed to by register @code{B14}. Put small uninitialized
17401 global and static data in the @code{.bss} section, which is adjacent
17402 to the @code{.neardata} section. Put small read-only data into the
17403 @code{.rodata} section. The corresponding sections used for large
17404 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
17405
17406 @item -msdata=all
17407 @opindex msdata=all
17408 Put all data, not just small objects, into the sections reserved for
17409 small data, and use addressing relative to the @code{B14} register to
17410 access them.
17411
17412 @item -msdata=none
17413 @opindex msdata=none
17414 Make no use of the sections reserved for small data, and use absolute
17415 addresses to access all data. Put all initialized global and static
17416 data in the @code{.fardata} section, and all uninitialized data in the
17417 @code{.far} section. Put all constant data into the @code{.const}
17418 section.
17419 @end table
17420
17421 @node CRIS Options
17422 @subsection CRIS Options
17423 @cindex CRIS Options
17424
17425 These options are defined specifically for the CRIS ports.
17426
17427 @table @gcctabopt
17428 @item -march=@var{architecture-type}
17429 @itemx -mcpu=@var{architecture-type}
17430 @opindex march
17431 @opindex mcpu
17432 Generate code for the specified architecture. The choices for
17433 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
17434 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
17435 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
17436 @samp{v10}.
17437
17438 @item -mtune=@var{architecture-type}
17439 @opindex mtune
17440 Tune to @var{architecture-type} everything applicable about the generated
17441 code, except for the ABI and the set of available instructions. The
17442 choices for @var{architecture-type} are the same as for
17443 @option{-march=@var{architecture-type}}.
17444
17445 @item -mmax-stack-frame=@var{n}
17446 @opindex mmax-stack-frame
17447 Warn when the stack frame of a function exceeds @var{n} bytes.
17448
17449 @item -metrax4
17450 @itemx -metrax100
17451 @opindex metrax4
17452 @opindex metrax100
17453 The options @option{-metrax4} and @option{-metrax100} are synonyms for
17454 @option{-march=v3} and @option{-march=v8} respectively.
17455
17456 @item -mmul-bug-workaround
17457 @itemx -mno-mul-bug-workaround
17458 @opindex mmul-bug-workaround
17459 @opindex mno-mul-bug-workaround
17460 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
17461 models where it applies. This option is active by default.
17462
17463 @item -mpdebug
17464 @opindex mpdebug
17465 Enable CRIS-specific verbose debug-related information in the assembly
17466 code. This option also has the effect of turning off the @samp{#NO_APP}
17467 formatted-code indicator to the assembler at the beginning of the
17468 assembly file.
17469
17470 @item -mcc-init
17471 @opindex mcc-init
17472 Do not use condition-code results from previous instruction; always emit
17473 compare and test instructions before use of condition codes.
17474
17475 @item -mno-side-effects
17476 @opindex mno-side-effects
17477 Do not emit instructions with side effects in addressing modes other than
17478 post-increment.
17479
17480 @item -mstack-align
17481 @itemx -mno-stack-align
17482 @itemx -mdata-align
17483 @itemx -mno-data-align
17484 @itemx -mconst-align
17485 @itemx -mno-const-align
17486 @opindex mstack-align
17487 @opindex mno-stack-align
17488 @opindex mdata-align
17489 @opindex mno-data-align
17490 @opindex mconst-align
17491 @opindex mno-const-align
17492 These options (@samp{no-} options) arrange (eliminate arrangements) for the
17493 stack frame, individual data and constants to be aligned for the maximum
17494 single data access size for the chosen CPU model. The default is to
17495 arrange for 32-bit alignment. ABI details such as structure layout are
17496 not affected by these options.
17497
17498 @item -m32-bit
17499 @itemx -m16-bit
17500 @itemx -m8-bit
17501 @opindex m32-bit
17502 @opindex m16-bit
17503 @opindex m8-bit
17504 Similar to the stack- data- and const-align options above, these options
17505 arrange for stack frame, writable data and constants to all be 32-bit,
17506 16-bit or 8-bit aligned. The default is 32-bit alignment.
17507
17508 @item -mno-prologue-epilogue
17509 @itemx -mprologue-epilogue
17510 @opindex mno-prologue-epilogue
17511 @opindex mprologue-epilogue
17512 With @option{-mno-prologue-epilogue}, the normal function prologue and
17513 epilogue which set up the stack frame are omitted and no return
17514 instructions or return sequences are generated in the code. Use this
17515 option only together with visual inspection of the compiled code: no
17516 warnings or errors are generated when call-saved registers must be saved,
17517 or storage for local variables needs to be allocated.
17518
17519 @item -mno-gotplt
17520 @itemx -mgotplt
17521 @opindex mno-gotplt
17522 @opindex mgotplt
17523 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
17524 instruction sequences that load addresses for functions from the PLT part
17525 of the GOT rather than (traditional on other architectures) calls to the
17526 PLT@. The default is @option{-mgotplt}.
17527
17528 @item -melf
17529 @opindex melf
17530 Legacy no-op option only recognized with the cris-axis-elf and
17531 cris-axis-linux-gnu targets.
17532
17533 @item -mlinux
17534 @opindex mlinux
17535 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
17536
17537 @item -sim
17538 @opindex sim
17539 This option, recognized for the cris-axis-elf, arranges
17540 to link with input-output functions from a simulator library. Code,
17541 initialized data and zero-initialized data are allocated consecutively.
17542
17543 @item -sim2
17544 @opindex sim2
17545 Like @option{-sim}, but pass linker options to locate initialized data at
17546 0x40000000 and zero-initialized data at 0x80000000.
17547 @end table
17548
17549 @node CR16 Options
17550 @subsection CR16 Options
17551 @cindex CR16 Options
17552
17553 These options are defined specifically for the CR16 ports.
17554
17555 @table @gcctabopt
17556
17557 @item -mmac
17558 @opindex mmac
17559 Enable the use of multiply-accumulate instructions. Disabled by default.
17560
17561 @item -mcr16cplus
17562 @itemx -mcr16c
17563 @opindex mcr16cplus
17564 @opindex mcr16c
17565 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
17566 is default.
17567
17568 @item -msim
17569 @opindex msim
17570 Links the library libsim.a which is in compatible with simulator. Applicable
17571 to ELF compiler only.
17572
17573 @item -mint32
17574 @opindex mint32
17575 Choose integer type as 32-bit wide.
17576
17577 @item -mbit-ops
17578 @opindex mbit-ops
17579 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
17580
17581 @item -mdata-model=@var{model}
17582 @opindex mdata-model
17583 Choose a data model. The choices for @var{model} are @samp{near},
17584 @samp{far} or @samp{medium}. @samp{medium} is default.
17585 However, @samp{far} is not valid with @option{-mcr16c}, as the
17586 CR16C architecture does not support the far data model.
17587 @end table
17588
17589 @node Darwin Options
17590 @subsection Darwin Options
17591 @cindex Darwin options
17592
17593 These options are defined for all architectures running the Darwin operating
17594 system.
17595
17596 FSF GCC on Darwin does not create ``fat'' object files; it creates
17597 an object file for the single architecture that GCC was built to
17598 target. Apple's GCC on Darwin does create ``fat'' files if multiple
17599 @option{-arch} options are used; it does so by running the compiler or
17600 linker multiple times and joining the results together with
17601 @file{lipo}.
17602
17603 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
17604 @samp{i686}) is determined by the flags that specify the ISA
17605 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
17606 @option{-force_cpusubtype_ALL} option can be used to override this.
17607
17608 The Darwin tools vary in their behavior when presented with an ISA
17609 mismatch. The assembler, @file{as}, only permits instructions to
17610 be used that are valid for the subtype of the file it is generating,
17611 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
17612 The linker for shared libraries, @file{/usr/bin/libtool}, fails
17613 and prints an error if asked to create a shared library with a less
17614 restrictive subtype than its input files (for instance, trying to put
17615 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
17616 for executables, @command{ld}, quietly gives the executable the most
17617 restrictive subtype of any of its input files.
17618
17619 @table @gcctabopt
17620 @item -F@var{dir}
17621 @opindex F
17622 Add the framework directory @var{dir} to the head of the list of
17623 directories to be searched for header files. These directories are
17624 interleaved with those specified by @option{-I} options and are
17625 scanned in a left-to-right order.
17626
17627 A framework directory is a directory with frameworks in it. A
17628 framework is a directory with a @file{Headers} and/or
17629 @file{PrivateHeaders} directory contained directly in it that ends
17630 in @file{.framework}. The name of a framework is the name of this
17631 directory excluding the @file{.framework}. Headers associated with
17632 the framework are found in one of those two directories, with
17633 @file{Headers} being searched first. A subframework is a framework
17634 directory that is in a framework's @file{Frameworks} directory.
17635 Includes of subframework headers can only appear in a header of a
17636 framework that contains the subframework, or in a sibling subframework
17637 header. Two subframeworks are siblings if they occur in the same
17638 framework. A subframework should not have the same name as a
17639 framework; a warning is issued if this is violated. Currently a
17640 subframework cannot have subframeworks; in the future, the mechanism
17641 may be extended to support this. The standard frameworks can be found
17642 in @file{/System/Library/Frameworks} and
17643 @file{/Library/Frameworks}. An example include looks like
17644 @code{#include <Framework/header.h>}, where @file{Framework} denotes
17645 the name of the framework and @file{header.h} is found in the
17646 @file{PrivateHeaders} or @file{Headers} directory.
17647
17648 @item -iframework@var{dir}
17649 @opindex iframework
17650 Like @option{-F} except the directory is a treated as a system
17651 directory. The main difference between this @option{-iframework} and
17652 @option{-F} is that with @option{-iframework} the compiler does not
17653 warn about constructs contained within header files found via
17654 @var{dir}. This option is valid only for the C family of languages.
17655
17656 @item -gused
17657 @opindex gused
17658 Emit debugging information for symbols that are used. For stabs
17659 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
17660 This is by default ON@.
17661
17662 @item -gfull
17663 @opindex gfull
17664 Emit debugging information for all symbols and types.
17665
17666 @item -mmacosx-version-min=@var{version}
17667 The earliest version of MacOS X that this executable will run on
17668 is @var{version}. Typical values of @var{version} include @code{10.1},
17669 @code{10.2}, and @code{10.3.9}.
17670
17671 If the compiler was built to use the system's headers by default,
17672 then the default for this option is the system version on which the
17673 compiler is running, otherwise the default is to make choices that
17674 are compatible with as many systems and code bases as possible.
17675
17676 @item -mkernel
17677 @opindex mkernel
17678 Enable kernel development mode. The @option{-mkernel} option sets
17679 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
17680 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
17681 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
17682 applicable. This mode also sets @option{-mno-altivec},
17683 @option{-msoft-float}, @option{-fno-builtin} and
17684 @option{-mlong-branch} for PowerPC targets.
17685
17686 @item -mone-byte-bool
17687 @opindex mone-byte-bool
17688 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
17689 By default @code{sizeof(bool)} is @code{4} when compiling for
17690 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
17691 option has no effect on x86.
17692
17693 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
17694 to generate code that is not binary compatible with code generated
17695 without that switch. Using this switch may require recompiling all
17696 other modules in a program, including system libraries. Use this
17697 switch to conform to a non-default data model.
17698
17699 @item -mfix-and-continue
17700 @itemx -ffix-and-continue
17701 @itemx -findirect-data
17702 @opindex mfix-and-continue
17703 @opindex ffix-and-continue
17704 @opindex findirect-data
17705 Generate code suitable for fast turnaround development, such as to
17706 allow GDB to dynamically load @file{.o} files into already-running
17707 programs. @option{-findirect-data} and @option{-ffix-and-continue}
17708 are provided for backwards compatibility.
17709
17710 @item -all_load
17711 @opindex all_load
17712 Loads all members of static archive libraries.
17713 See man ld(1) for more information.
17714
17715 @item -arch_errors_fatal
17716 @opindex arch_errors_fatal
17717 Cause the errors having to do with files that have the wrong architecture
17718 to be fatal.
17719
17720 @item -bind_at_load
17721 @opindex bind_at_load
17722 Causes the output file to be marked such that the dynamic linker will
17723 bind all undefined references when the file is loaded or launched.
17724
17725 @item -bundle
17726 @opindex bundle
17727 Produce a Mach-o bundle format file.
17728 See man ld(1) for more information.
17729
17730 @item -bundle_loader @var{executable}
17731 @opindex bundle_loader
17732 This option specifies the @var{executable} that will load the build
17733 output file being linked. See man ld(1) for more information.
17734
17735 @item -dynamiclib
17736 @opindex dynamiclib
17737 When passed this option, GCC produces a dynamic library instead of
17738 an executable when linking, using the Darwin @file{libtool} command.
17739
17740 @item -force_cpusubtype_ALL
17741 @opindex force_cpusubtype_ALL
17742 This causes GCC's output file to have the @samp{ALL} subtype, instead of
17743 one controlled by the @option{-mcpu} or @option{-march} option.
17744
17745 @item -allowable_client @var{client_name}
17746 @itemx -client_name
17747 @itemx -compatibility_version
17748 @itemx -current_version
17749 @itemx -dead_strip
17750 @itemx -dependency-file
17751 @itemx -dylib_file
17752 @itemx -dylinker_install_name
17753 @itemx -dynamic
17754 @itemx -exported_symbols_list
17755 @itemx -filelist
17756 @need 800
17757 @itemx -flat_namespace
17758 @itemx -force_flat_namespace
17759 @itemx -headerpad_max_install_names
17760 @itemx -image_base
17761 @itemx -init
17762 @itemx -install_name
17763 @itemx -keep_private_externs
17764 @itemx -multi_module
17765 @itemx -multiply_defined
17766 @itemx -multiply_defined_unused
17767 @need 800
17768 @itemx -noall_load
17769 @itemx -no_dead_strip_inits_and_terms
17770 @itemx -nofixprebinding
17771 @itemx -nomultidefs
17772 @itemx -noprebind
17773 @itemx -noseglinkedit
17774 @itemx -pagezero_size
17775 @itemx -prebind
17776 @itemx -prebind_all_twolevel_modules
17777 @itemx -private_bundle
17778 @need 800
17779 @itemx -read_only_relocs
17780 @itemx -sectalign
17781 @itemx -sectobjectsymbols
17782 @itemx -whyload
17783 @itemx -seg1addr
17784 @itemx -sectcreate
17785 @itemx -sectobjectsymbols
17786 @itemx -sectorder
17787 @itemx -segaddr
17788 @itemx -segs_read_only_addr
17789 @need 800
17790 @itemx -segs_read_write_addr
17791 @itemx -seg_addr_table
17792 @itemx -seg_addr_table_filename
17793 @itemx -seglinkedit
17794 @itemx -segprot
17795 @itemx -segs_read_only_addr
17796 @itemx -segs_read_write_addr
17797 @itemx -single_module
17798 @itemx -static
17799 @itemx -sub_library
17800 @need 800
17801 @itemx -sub_umbrella
17802 @itemx -twolevel_namespace
17803 @itemx -umbrella
17804 @itemx -undefined
17805 @itemx -unexported_symbols_list
17806 @itemx -weak_reference_mismatches
17807 @itemx -whatsloaded
17808 @opindex allowable_client
17809 @opindex client_name
17810 @opindex compatibility_version
17811 @opindex current_version
17812 @opindex dead_strip
17813 @opindex dependency-file
17814 @opindex dylib_file
17815 @opindex dylinker_install_name
17816 @opindex dynamic
17817 @opindex exported_symbols_list
17818 @opindex filelist
17819 @opindex flat_namespace
17820 @opindex force_flat_namespace
17821 @opindex headerpad_max_install_names
17822 @opindex image_base
17823 @opindex init
17824 @opindex install_name
17825 @opindex keep_private_externs
17826 @opindex multi_module
17827 @opindex multiply_defined
17828 @opindex multiply_defined_unused
17829 @opindex noall_load
17830 @opindex no_dead_strip_inits_and_terms
17831 @opindex nofixprebinding
17832 @opindex nomultidefs
17833 @opindex noprebind
17834 @opindex noseglinkedit
17835 @opindex pagezero_size
17836 @opindex prebind
17837 @opindex prebind_all_twolevel_modules
17838 @opindex private_bundle
17839 @opindex read_only_relocs
17840 @opindex sectalign
17841 @opindex sectobjectsymbols
17842 @opindex whyload
17843 @opindex seg1addr
17844 @opindex sectcreate
17845 @opindex sectobjectsymbols
17846 @opindex sectorder
17847 @opindex segaddr
17848 @opindex segs_read_only_addr
17849 @opindex segs_read_write_addr
17850 @opindex seg_addr_table
17851 @opindex seg_addr_table_filename
17852 @opindex seglinkedit
17853 @opindex segprot
17854 @opindex segs_read_only_addr
17855 @opindex segs_read_write_addr
17856 @opindex single_module
17857 @opindex static
17858 @opindex sub_library
17859 @opindex sub_umbrella
17860 @opindex twolevel_namespace
17861 @opindex umbrella
17862 @opindex undefined
17863 @opindex unexported_symbols_list
17864 @opindex weak_reference_mismatches
17865 @opindex whatsloaded
17866 These options are passed to the Darwin linker. The Darwin linker man page
17867 describes them in detail.
17868 @end table
17869
17870 @node DEC Alpha Options
17871 @subsection DEC Alpha Options
17872
17873 These @samp{-m} options are defined for the DEC Alpha implementations:
17874
17875 @table @gcctabopt
17876 @item -mno-soft-float
17877 @itemx -msoft-float
17878 @opindex mno-soft-float
17879 @opindex msoft-float
17880 Use (do not use) the hardware floating-point instructions for
17881 floating-point operations. When @option{-msoft-float} is specified,
17882 functions in @file{libgcc.a} are used to perform floating-point
17883 operations. Unless they are replaced by routines that emulate the
17884 floating-point operations, or compiled in such a way as to call such
17885 emulations routines, these routines issue floating-point
17886 operations. If you are compiling for an Alpha without floating-point
17887 operations, you must ensure that the library is built so as not to call
17888 them.
17889
17890 Note that Alpha implementations without floating-point operations are
17891 required to have floating-point registers.
17892
17893 @item -mfp-reg
17894 @itemx -mno-fp-regs
17895 @opindex mfp-reg
17896 @opindex mno-fp-regs
17897 Generate code that uses (does not use) the floating-point register set.
17898 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
17899 register set is not used, floating-point operands are passed in integer
17900 registers as if they were integers and floating-point results are passed
17901 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
17902 so any function with a floating-point argument or return value called by code
17903 compiled with @option{-mno-fp-regs} must also be compiled with that
17904 option.
17905
17906 A typical use of this option is building a kernel that does not use,
17907 and hence need not save and restore, any floating-point registers.
17908
17909 @item -mieee
17910 @opindex mieee
17911 The Alpha architecture implements floating-point hardware optimized for
17912 maximum performance. It is mostly compliant with the IEEE floating-point
17913 standard. However, for full compliance, software assistance is
17914 required. This option generates code fully IEEE-compliant code
17915 @emph{except} that the @var{inexact-flag} is not maintained (see below).
17916 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
17917 defined during compilation. The resulting code is less efficient but is
17918 able to correctly support denormalized numbers and exceptional IEEE
17919 values such as not-a-number and plus/minus infinity. Other Alpha
17920 compilers call this option @option{-ieee_with_no_inexact}.
17921
17922 @item -mieee-with-inexact
17923 @opindex mieee-with-inexact
17924 This is like @option{-mieee} except the generated code also maintains
17925 the IEEE @var{inexact-flag}. Turning on this option causes the
17926 generated code to implement fully-compliant IEEE math. In addition to
17927 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
17928 macro. On some Alpha implementations the resulting code may execute
17929 significantly slower than the code generated by default. Since there is
17930 very little code that depends on the @var{inexact-flag}, you should
17931 normally not specify this option. Other Alpha compilers call this
17932 option @option{-ieee_with_inexact}.
17933
17934 @item -mfp-trap-mode=@var{trap-mode}
17935 @opindex mfp-trap-mode
17936 This option controls what floating-point related traps are enabled.
17937 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
17938 The trap mode can be set to one of four values:
17939
17940 @table @samp
17941 @item n
17942 This is the default (normal) setting. The only traps that are enabled
17943 are the ones that cannot be disabled in software (e.g., division by zero
17944 trap).
17945
17946 @item u
17947 In addition to the traps enabled by @samp{n}, underflow traps are enabled
17948 as well.
17949
17950 @item su
17951 Like @samp{u}, but the instructions are marked to be safe for software
17952 completion (see Alpha architecture manual for details).
17953
17954 @item sui
17955 Like @samp{su}, but inexact traps are enabled as well.
17956 @end table
17957
17958 @item -mfp-rounding-mode=@var{rounding-mode}
17959 @opindex mfp-rounding-mode
17960 Selects the IEEE rounding mode. Other Alpha compilers call this option
17961 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
17962 of:
17963
17964 @table @samp
17965 @item n
17966 Normal IEEE rounding mode. Floating-point numbers are rounded towards
17967 the nearest machine number or towards the even machine number in case
17968 of a tie.
17969
17970 @item m
17971 Round towards minus infinity.
17972
17973 @item c
17974 Chopped rounding mode. Floating-point numbers are rounded towards zero.
17975
17976 @item d
17977 Dynamic rounding mode. A field in the floating-point control register
17978 (@var{fpcr}, see Alpha architecture reference manual) controls the
17979 rounding mode in effect. The C library initializes this register for
17980 rounding towards plus infinity. Thus, unless your program modifies the
17981 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
17982 @end table
17983
17984 @item -mtrap-precision=@var{trap-precision}
17985 @opindex mtrap-precision
17986 In the Alpha architecture, floating-point traps are imprecise. This
17987 means without software assistance it is impossible to recover from a
17988 floating trap and program execution normally needs to be terminated.
17989 GCC can generate code that can assist operating system trap handlers
17990 in determining the exact location that caused a floating-point trap.
17991 Depending on the requirements of an application, different levels of
17992 precisions can be selected:
17993
17994 @table @samp
17995 @item p
17996 Program precision. This option is the default and means a trap handler
17997 can only identify which program caused a floating-point exception.
17998
17999 @item f
18000 Function precision. The trap handler can determine the function that
18001 caused a floating-point exception.
18002
18003 @item i
18004 Instruction precision. The trap handler can determine the exact
18005 instruction that caused a floating-point exception.
18006 @end table
18007
18008 Other Alpha compilers provide the equivalent options called
18009 @option{-scope_safe} and @option{-resumption_safe}.
18010
18011 @item -mieee-conformant
18012 @opindex mieee-conformant
18013 This option marks the generated code as IEEE conformant. You must not
18014 use this option unless you also specify @option{-mtrap-precision=i} and either
18015 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
18016 is to emit the line @samp{.eflag 48} in the function prologue of the
18017 generated assembly file.
18018
18019 @item -mbuild-constants
18020 @opindex mbuild-constants
18021 Normally GCC examines a 32- or 64-bit integer constant to
18022 see if it can construct it from smaller constants in two or three
18023 instructions. If it cannot, it outputs the constant as a literal and
18024 generates code to load it from the data segment at run time.
18025
18026 Use this option to require GCC to construct @emph{all} integer constants
18027 using code, even if it takes more instructions (the maximum is six).
18028
18029 You typically use this option to build a shared library dynamic
18030 loader. Itself a shared library, it must relocate itself in memory
18031 before it can find the variables and constants in its own data segment.
18032
18033 @item -mbwx
18034 @itemx -mno-bwx
18035 @itemx -mcix
18036 @itemx -mno-cix
18037 @itemx -mfix
18038 @itemx -mno-fix
18039 @itemx -mmax
18040 @itemx -mno-max
18041 @opindex mbwx
18042 @opindex mno-bwx
18043 @opindex mcix
18044 @opindex mno-cix
18045 @opindex mfix
18046 @opindex mno-fix
18047 @opindex mmax
18048 @opindex mno-max
18049 Indicate whether GCC should generate code to use the optional BWX,
18050 CIX, FIX and MAX instruction sets. The default is to use the instruction
18051 sets supported by the CPU type specified via @option{-mcpu=} option or that
18052 of the CPU on which GCC was built if none is specified.
18053
18054 @item -mfloat-vax
18055 @itemx -mfloat-ieee
18056 @opindex mfloat-vax
18057 @opindex mfloat-ieee
18058 Generate code that uses (does not use) VAX F and G floating-point
18059 arithmetic instead of IEEE single and double precision.
18060
18061 @item -mexplicit-relocs
18062 @itemx -mno-explicit-relocs
18063 @opindex mexplicit-relocs
18064 @opindex mno-explicit-relocs
18065 Older Alpha assemblers provided no way to generate symbol relocations
18066 except via assembler macros. Use of these macros does not allow
18067 optimal instruction scheduling. GNU binutils as of version 2.12
18068 supports a new syntax that allows the compiler to explicitly mark
18069 which relocations should apply to which instructions. This option
18070 is mostly useful for debugging, as GCC detects the capabilities of
18071 the assembler when it is built and sets the default accordingly.
18072
18073 @item -msmall-data
18074 @itemx -mlarge-data
18075 @opindex msmall-data
18076 @opindex mlarge-data
18077 When @option{-mexplicit-relocs} is in effect, static data is
18078 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
18079 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
18080 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
18081 16-bit relocations off of the @code{$gp} register. This limits the
18082 size of the small data area to 64KB, but allows the variables to be
18083 directly accessed via a single instruction.
18084
18085 The default is @option{-mlarge-data}. With this option the data area
18086 is limited to just below 2GB@. Programs that require more than 2GB of
18087 data must use @code{malloc} or @code{mmap} to allocate the data in the
18088 heap instead of in the program's data segment.
18089
18090 When generating code for shared libraries, @option{-fpic} implies
18091 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
18092
18093 @item -msmall-text
18094 @itemx -mlarge-text
18095 @opindex msmall-text
18096 @opindex mlarge-text
18097 When @option{-msmall-text} is used, the compiler assumes that the
18098 code of the entire program (or shared library) fits in 4MB, and is
18099 thus reachable with a branch instruction. When @option{-msmall-data}
18100 is used, the compiler can assume that all local symbols share the
18101 same @code{$gp} value, and thus reduce the number of instructions
18102 required for a function call from 4 to 1.
18103
18104 The default is @option{-mlarge-text}.
18105
18106 @item -mcpu=@var{cpu_type}
18107 @opindex mcpu
18108 Set the instruction set and instruction scheduling parameters for
18109 machine type @var{cpu_type}. You can specify either the @samp{EV}
18110 style name or the corresponding chip number. GCC supports scheduling
18111 parameters for the EV4, EV5 and EV6 family of processors and
18112 chooses the default values for the instruction set from the processor
18113 you specify. If you do not specify a processor type, GCC defaults
18114 to the processor on which the compiler was built.
18115
18116 Supported values for @var{cpu_type} are
18117
18118 @table @samp
18119 @item ev4
18120 @itemx ev45
18121 @itemx 21064
18122 Schedules as an EV4 and has no instruction set extensions.
18123
18124 @item ev5
18125 @itemx 21164
18126 Schedules as an EV5 and has no instruction set extensions.
18127
18128 @item ev56
18129 @itemx 21164a
18130 Schedules as an EV5 and supports the BWX extension.
18131
18132 @item pca56
18133 @itemx 21164pc
18134 @itemx 21164PC
18135 Schedules as an EV5 and supports the BWX and MAX extensions.
18136
18137 @item ev6
18138 @itemx 21264
18139 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
18140
18141 @item ev67
18142 @itemx 21264a
18143 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
18144 @end table
18145
18146 Native toolchains also support the value @samp{native},
18147 which selects the best architecture option for the host processor.
18148 @option{-mcpu=native} has no effect if GCC does not recognize
18149 the processor.
18150
18151 @item -mtune=@var{cpu_type}
18152 @opindex mtune
18153 Set only the instruction scheduling parameters for machine type
18154 @var{cpu_type}. The instruction set is not changed.
18155
18156 Native toolchains also support the value @samp{native},
18157 which selects the best architecture option for the host processor.
18158 @option{-mtune=native} has no effect if GCC does not recognize
18159 the processor.
18160
18161 @item -mmemory-latency=@var{time}
18162 @opindex mmemory-latency
18163 Sets the latency the scheduler should assume for typical memory
18164 references as seen by the application. This number is highly
18165 dependent on the memory access patterns used by the application
18166 and the size of the external cache on the machine.
18167
18168 Valid options for @var{time} are
18169
18170 @table @samp
18171 @item @var{number}
18172 A decimal number representing clock cycles.
18173
18174 @item L1
18175 @itemx L2
18176 @itemx L3
18177 @itemx main
18178 The compiler contains estimates of the number of clock cycles for
18179 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
18180 (also called Dcache, Scache, and Bcache), as well as to main memory.
18181 Note that L3 is only valid for EV5.
18182
18183 @end table
18184 @end table
18185
18186 @node FR30 Options
18187 @subsection FR30 Options
18188 @cindex FR30 Options
18189
18190 These options are defined specifically for the FR30 port.
18191
18192 @table @gcctabopt
18193
18194 @item -msmall-model
18195 @opindex msmall-model
18196 Use the small address space model. This can produce smaller code, but
18197 it does assume that all symbolic values and addresses fit into a
18198 20-bit range.
18199
18200 @item -mno-lsim
18201 @opindex mno-lsim
18202 Assume that runtime support has been provided and so there is no need
18203 to include the simulator library (@file{libsim.a}) on the linker
18204 command line.
18205
18206 @end table
18207
18208 @node FT32 Options
18209 @subsection FT32 Options
18210 @cindex FT32 Options
18211
18212 These options are defined specifically for the FT32 port.
18213
18214 @table @gcctabopt
18215
18216 @item -msim
18217 @opindex msim
18218 Specifies that the program will be run on the simulator. This causes
18219 an alternate runtime startup and library to be linked.
18220 You must not use this option when generating programs that will run on
18221 real hardware; you must provide your own runtime library for whatever
18222 I/O functions are needed.
18223
18224 @item -mlra
18225 @opindex mlra
18226 Enable Local Register Allocation. This is still experimental for FT32,
18227 so by default the compiler uses standard reload.
18228
18229 @item -mnodiv
18230 @opindex mnodiv
18231 Do not use div and mod instructions.
18232
18233 @item -mft32b
18234 @opindex mft32b
18235 Enable use of the extended instructions of the FT32B processor.
18236
18237 @item -mcompress
18238 @opindex mcompress
18239 Compress all code using the Ft32B code compression scheme.
18240
18241 @item -mnopm
18242 @opindex mnopm
18243 Do not generate code that reads program memory.
18244
18245 @end table
18246
18247 @node FRV Options
18248 @subsection FRV Options
18249 @cindex FRV Options
18250
18251 @table @gcctabopt
18252 @item -mgpr-32
18253 @opindex mgpr-32
18254
18255 Only use the first 32 general-purpose registers.
18256
18257 @item -mgpr-64
18258 @opindex mgpr-64
18259
18260 Use all 64 general-purpose registers.
18261
18262 @item -mfpr-32
18263 @opindex mfpr-32
18264
18265 Use only the first 32 floating-point registers.
18266
18267 @item -mfpr-64
18268 @opindex mfpr-64
18269
18270 Use all 64 floating-point registers.
18271
18272 @item -mhard-float
18273 @opindex mhard-float
18274
18275 Use hardware instructions for floating-point operations.
18276
18277 @item -msoft-float
18278 @opindex msoft-float
18279
18280 Use library routines for floating-point operations.
18281
18282 @item -malloc-cc
18283 @opindex malloc-cc
18284
18285 Dynamically allocate condition code registers.
18286
18287 @item -mfixed-cc
18288 @opindex mfixed-cc
18289
18290 Do not try to dynamically allocate condition code registers, only
18291 use @code{icc0} and @code{fcc0}.
18292
18293 @item -mdword
18294 @opindex mdword
18295
18296 Change ABI to use double word insns.
18297
18298 @item -mno-dword
18299 @opindex mno-dword
18300
18301 Do not use double word instructions.
18302
18303 @item -mdouble
18304 @opindex mdouble
18305
18306 Use floating-point double instructions.
18307
18308 @item -mno-double
18309 @opindex mno-double
18310
18311 Do not use floating-point double instructions.
18312
18313 @item -mmedia
18314 @opindex mmedia
18315
18316 Use media instructions.
18317
18318 @item -mno-media
18319 @opindex mno-media
18320
18321 Do not use media instructions.
18322
18323 @item -mmuladd
18324 @opindex mmuladd
18325
18326 Use multiply and add/subtract instructions.
18327
18328 @item -mno-muladd
18329 @opindex mno-muladd
18330
18331 Do not use multiply and add/subtract instructions.
18332
18333 @item -mfdpic
18334 @opindex mfdpic
18335
18336 Select the FDPIC ABI, which uses function descriptors to represent
18337 pointers to functions. Without any PIC/PIE-related options, it
18338 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
18339 assumes GOT entries and small data are within a 12-bit range from the
18340 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
18341 are computed with 32 bits.
18342 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18343
18344 @item -minline-plt
18345 @opindex minline-plt
18346
18347 Enable inlining of PLT entries in function calls to functions that are
18348 not known to bind locally. It has no effect without @option{-mfdpic}.
18349 It's enabled by default if optimizing for speed and compiling for
18350 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
18351 optimization option such as @option{-O3} or above is present in the
18352 command line.
18353
18354 @item -mTLS
18355 @opindex mTLS
18356
18357 Assume a large TLS segment when generating thread-local code.
18358
18359 @item -mtls
18360 @opindex mtls
18361
18362 Do not assume a large TLS segment when generating thread-local code.
18363
18364 @item -mgprel-ro
18365 @opindex mgprel-ro
18366
18367 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
18368 that is known to be in read-only sections. It's enabled by default,
18369 except for @option{-fpic} or @option{-fpie}: even though it may help
18370 make the global offset table smaller, it trades 1 instruction for 4.
18371 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
18372 one of which may be shared by multiple symbols, and it avoids the need
18373 for a GOT entry for the referenced symbol, so it's more likely to be a
18374 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
18375
18376 @item -multilib-library-pic
18377 @opindex multilib-library-pic
18378
18379 Link with the (library, not FD) pic libraries. It's implied by
18380 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
18381 @option{-fpic} without @option{-mfdpic}. You should never have to use
18382 it explicitly.
18383
18384 @item -mlinked-fp
18385 @opindex mlinked-fp
18386
18387 Follow the EABI requirement of always creating a frame pointer whenever
18388 a stack frame is allocated. This option is enabled by default and can
18389 be disabled with @option{-mno-linked-fp}.
18390
18391 @item -mlong-calls
18392 @opindex mlong-calls
18393
18394 Use indirect addressing to call functions outside the current
18395 compilation unit. This allows the functions to be placed anywhere
18396 within the 32-bit address space.
18397
18398 @item -malign-labels
18399 @opindex malign-labels
18400
18401 Try to align labels to an 8-byte boundary by inserting NOPs into the
18402 previous packet. This option only has an effect when VLIW packing
18403 is enabled. It doesn't create new packets; it merely adds NOPs to
18404 existing ones.
18405
18406 @item -mlibrary-pic
18407 @opindex mlibrary-pic
18408
18409 Generate position-independent EABI code.
18410
18411 @item -macc-4
18412 @opindex macc-4
18413
18414 Use only the first four media accumulator registers.
18415
18416 @item -macc-8
18417 @opindex macc-8
18418
18419 Use all eight media accumulator registers.
18420
18421 @item -mpack
18422 @opindex mpack
18423
18424 Pack VLIW instructions.
18425
18426 @item -mno-pack
18427 @opindex mno-pack
18428
18429 Do not pack VLIW instructions.
18430
18431 @item -mno-eflags
18432 @opindex mno-eflags
18433
18434 Do not mark ABI switches in e_flags.
18435
18436 @item -mcond-move
18437 @opindex mcond-move
18438
18439 Enable the use of conditional-move instructions (default).
18440
18441 This switch is mainly for debugging the compiler and will likely be removed
18442 in a future version.
18443
18444 @item -mno-cond-move
18445 @opindex mno-cond-move
18446
18447 Disable the use of conditional-move instructions.
18448
18449 This switch is mainly for debugging the compiler and will likely be removed
18450 in a future version.
18451
18452 @item -mscc
18453 @opindex mscc
18454
18455 Enable the use of conditional set instructions (default).
18456
18457 This switch is mainly for debugging the compiler and will likely be removed
18458 in a future version.
18459
18460 @item -mno-scc
18461 @opindex mno-scc
18462
18463 Disable the use of conditional set instructions.
18464
18465 This switch is mainly for debugging the compiler and will likely be removed
18466 in a future version.
18467
18468 @item -mcond-exec
18469 @opindex mcond-exec
18470
18471 Enable the use of conditional execution (default).
18472
18473 This switch is mainly for debugging the compiler and will likely be removed
18474 in a future version.
18475
18476 @item -mno-cond-exec
18477 @opindex mno-cond-exec
18478
18479 Disable the use of conditional execution.
18480
18481 This switch is mainly for debugging the compiler and will likely be removed
18482 in a future version.
18483
18484 @item -mvliw-branch
18485 @opindex mvliw-branch
18486
18487 Run a pass to pack branches into VLIW instructions (default).
18488
18489 This switch is mainly for debugging the compiler and will likely be removed
18490 in a future version.
18491
18492 @item -mno-vliw-branch
18493 @opindex mno-vliw-branch
18494
18495 Do not run a pass to pack branches into VLIW instructions.
18496
18497 This switch is mainly for debugging the compiler and will likely be removed
18498 in a future version.
18499
18500 @item -mmulti-cond-exec
18501 @opindex mmulti-cond-exec
18502
18503 Enable optimization of @code{&&} and @code{||} in conditional execution
18504 (default).
18505
18506 This switch is mainly for debugging the compiler and will likely be removed
18507 in a future version.
18508
18509 @item -mno-multi-cond-exec
18510 @opindex mno-multi-cond-exec
18511
18512 Disable optimization of @code{&&} and @code{||} in conditional execution.
18513
18514 This switch is mainly for debugging the compiler and will likely be removed
18515 in a future version.
18516
18517 @item -mnested-cond-exec
18518 @opindex mnested-cond-exec
18519
18520 Enable nested conditional execution optimizations (default).
18521
18522 This switch is mainly for debugging the compiler and will likely be removed
18523 in a future version.
18524
18525 @item -mno-nested-cond-exec
18526 @opindex mno-nested-cond-exec
18527
18528 Disable nested conditional execution optimizations.
18529
18530 This switch is mainly for debugging the compiler and will likely be removed
18531 in a future version.
18532
18533 @item -moptimize-membar
18534 @opindex moptimize-membar
18535
18536 This switch removes redundant @code{membar} instructions from the
18537 compiler-generated code. It is enabled by default.
18538
18539 @item -mno-optimize-membar
18540 @opindex mno-optimize-membar
18541
18542 This switch disables the automatic removal of redundant @code{membar}
18543 instructions from the generated code.
18544
18545 @item -mtomcat-stats
18546 @opindex mtomcat-stats
18547
18548 Cause gas to print out tomcat statistics.
18549
18550 @item -mcpu=@var{cpu}
18551 @opindex mcpu
18552
18553 Select the processor type for which to generate code. Possible values are
18554 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
18555 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
18556
18557 @end table
18558
18559 @node GNU/Linux Options
18560 @subsection GNU/Linux Options
18561
18562 These @samp{-m} options are defined for GNU/Linux targets:
18563
18564 @table @gcctabopt
18565 @item -mglibc
18566 @opindex mglibc
18567 Use the GNU C library. This is the default except
18568 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
18569 @samp{*-*-linux-*android*} targets.
18570
18571 @item -muclibc
18572 @opindex muclibc
18573 Use uClibc C library. This is the default on
18574 @samp{*-*-linux-*uclibc*} targets.
18575
18576 @item -mmusl
18577 @opindex mmusl
18578 Use the musl C library. This is the default on
18579 @samp{*-*-linux-*musl*} targets.
18580
18581 @item -mbionic
18582 @opindex mbionic
18583 Use Bionic C library. This is the default on
18584 @samp{*-*-linux-*android*} targets.
18585
18586 @item -mandroid
18587 @opindex mandroid
18588 Compile code compatible with Android platform. This is the default on
18589 @samp{*-*-linux-*android*} targets.
18590
18591 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
18592 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
18593 this option makes the GCC driver pass Android-specific options to the linker.
18594 Finally, this option causes the preprocessor macro @code{__ANDROID__}
18595 to be defined.
18596
18597 @item -tno-android-cc
18598 @opindex tno-android-cc
18599 Disable compilation effects of @option{-mandroid}, i.e., do not enable
18600 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
18601 @option{-fno-rtti} by default.
18602
18603 @item -tno-android-ld
18604 @opindex tno-android-ld
18605 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
18606 linking options to the linker.
18607
18608 @end table
18609
18610 @node H8/300 Options
18611 @subsection H8/300 Options
18612
18613 These @samp{-m} options are defined for the H8/300 implementations:
18614
18615 @table @gcctabopt
18616 @item -mrelax
18617 @opindex mrelax
18618 Shorten some address references at link time, when possible; uses the
18619 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
18620 ld, Using ld}, for a fuller description.
18621
18622 @item -mh
18623 @opindex mh
18624 Generate code for the H8/300H@.
18625
18626 @item -ms
18627 @opindex ms
18628 Generate code for the H8S@.
18629
18630 @item -mn
18631 @opindex mn
18632 Generate code for the H8S and H8/300H in the normal mode. This switch
18633 must be used either with @option{-mh} or @option{-ms}.
18634
18635 @item -ms2600
18636 @opindex ms2600
18637 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
18638
18639 @item -mexr
18640 @opindex mexr
18641 Extended registers are stored on stack before execution of function
18642 with monitor attribute. Default option is @option{-mexr}.
18643 This option is valid only for H8S targets.
18644
18645 @item -mno-exr
18646 @opindex mno-exr
18647 Extended registers are not stored on stack before execution of function
18648 with monitor attribute. Default option is @option{-mno-exr}.
18649 This option is valid only for H8S targets.
18650
18651 @item -mint32
18652 @opindex mint32
18653 Make @code{int} data 32 bits by default.
18654
18655 @item -malign-300
18656 @opindex malign-300
18657 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
18658 The default for the H8/300H and H8S is to align longs and floats on
18659 4-byte boundaries.
18660 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
18661 This option has no effect on the H8/300.
18662 @end table
18663
18664 @node HPPA Options
18665 @subsection HPPA Options
18666 @cindex HPPA Options
18667
18668 These @samp{-m} options are defined for the HPPA family of computers:
18669
18670 @table @gcctabopt
18671 @item -march=@var{architecture-type}
18672 @opindex march
18673 Generate code for the specified architecture. The choices for
18674 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
18675 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
18676 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
18677 architecture option for your machine. Code compiled for lower numbered
18678 architectures runs on higher numbered architectures, but not the
18679 other way around.
18680
18681 @item -mpa-risc-1-0
18682 @itemx -mpa-risc-1-1
18683 @itemx -mpa-risc-2-0
18684 @opindex mpa-risc-1-0
18685 @opindex mpa-risc-1-1
18686 @opindex mpa-risc-2-0
18687 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
18688
18689 @item -mcaller-copies
18690 @opindex mcaller-copies
18691 The caller copies function arguments passed by hidden reference. This
18692 option should be used with care as it is not compatible with the default
18693 32-bit runtime. However, only aggregates larger than eight bytes are
18694 passed by hidden reference and the option provides better compatibility
18695 with OpenMP.
18696
18697 @item -mjump-in-delay
18698 @opindex mjump-in-delay
18699 This option is ignored and provided for compatibility purposes only.
18700
18701 @item -mdisable-fpregs
18702 @opindex mdisable-fpregs
18703 Prevent floating-point registers from being used in any manner. This is
18704 necessary for compiling kernels that perform lazy context switching of
18705 floating-point registers. If you use this option and attempt to perform
18706 floating-point operations, the compiler aborts.
18707
18708 @item -mdisable-indexing
18709 @opindex mdisable-indexing
18710 Prevent the compiler from using indexing address modes. This avoids some
18711 rather obscure problems when compiling MIG generated code under MACH@.
18712
18713 @item -mno-space-regs
18714 @opindex mno-space-regs
18715 Generate code that assumes the target has no space registers. This allows
18716 GCC to generate faster indirect calls and use unscaled index address modes.
18717
18718 Such code is suitable for level 0 PA systems and kernels.
18719
18720 @item -mfast-indirect-calls
18721 @opindex mfast-indirect-calls
18722 Generate code that assumes calls never cross space boundaries. This
18723 allows GCC to emit code that performs faster indirect calls.
18724
18725 This option does not work in the presence of shared libraries or nested
18726 functions.
18727
18728 @item -mfixed-range=@var{register-range}
18729 @opindex mfixed-range
18730 Generate code treating the given register range as fixed registers.
18731 A fixed register is one that the register allocator cannot use. This is
18732 useful when compiling kernel code. A register range is specified as
18733 two registers separated by a dash. Multiple register ranges can be
18734 specified separated by a comma.
18735
18736 @item -mlong-load-store
18737 @opindex mlong-load-store
18738 Generate 3-instruction load and store sequences as sometimes required by
18739 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
18740 the HP compilers.
18741
18742 @item -mportable-runtime
18743 @opindex mportable-runtime
18744 Use the portable calling conventions proposed by HP for ELF systems.
18745
18746 @item -mgas
18747 @opindex mgas
18748 Enable the use of assembler directives only GAS understands.
18749
18750 @item -mschedule=@var{cpu-type}
18751 @opindex mschedule
18752 Schedule code according to the constraints for the machine type
18753 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
18754 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
18755 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
18756 proper scheduling option for your machine. The default scheduling is
18757 @samp{8000}.
18758
18759 @item -mlinker-opt
18760 @opindex mlinker-opt
18761 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
18762 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
18763 linkers in which they give bogus error messages when linking some programs.
18764
18765 @item -msoft-float
18766 @opindex msoft-float
18767 Generate output containing library calls for floating point.
18768 @strong{Warning:} the requisite libraries are not available for all HPPA
18769 targets. Normally the facilities of the machine's usual C compiler are
18770 used, but this cannot be done directly in cross-compilation. You must make
18771 your own arrangements to provide suitable library functions for
18772 cross-compilation.
18773
18774 @option{-msoft-float} changes the calling convention in the output file;
18775 therefore, it is only useful if you compile @emph{all} of a program with
18776 this option. In particular, you need to compile @file{libgcc.a}, the
18777 library that comes with GCC, with @option{-msoft-float} in order for
18778 this to work.
18779
18780 @item -msio
18781 @opindex msio
18782 Generate the predefine, @code{_SIO}, for server IO@. The default is
18783 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
18784 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
18785 options are available under HP-UX and HI-UX@.
18786
18787 @item -mgnu-ld
18788 @opindex mgnu-ld
18789 Use options specific to GNU @command{ld}.
18790 This passes @option{-shared} to @command{ld} when
18791 building a shared library. It is the default when GCC is configured,
18792 explicitly or implicitly, with the GNU linker. This option does not
18793 affect which @command{ld} is called; it only changes what parameters
18794 are passed to that @command{ld}.
18795 The @command{ld} that is called is determined by the
18796 @option{--with-ld} configure option, GCC's program search path, and
18797 finally by the user's @env{PATH}. The linker used by GCC can be printed
18798 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
18799 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18800
18801 @item -mhp-ld
18802 @opindex mhp-ld
18803 Use options specific to HP @command{ld}.
18804 This passes @option{-b} to @command{ld} when building
18805 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
18806 links. It is the default when GCC is configured, explicitly or
18807 implicitly, with the HP linker. This option does not affect
18808 which @command{ld} is called; it only changes what parameters are passed to that
18809 @command{ld}.
18810 The @command{ld} that is called is determined by the @option{--with-ld}
18811 configure option, GCC's program search path, and finally by the user's
18812 @env{PATH}. The linker used by GCC can be printed using @samp{which
18813 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
18814 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
18815
18816 @item -mlong-calls
18817 @opindex mno-long-calls
18818 Generate code that uses long call sequences. This ensures that a call
18819 is always able to reach linker generated stubs. The default is to generate
18820 long calls only when the distance from the call site to the beginning
18821 of the function or translation unit, as the case may be, exceeds a
18822 predefined limit set by the branch type being used. The limits for
18823 normal calls are 7,600,000 and 240,000 bytes, respectively for the
18824 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
18825 240,000 bytes.
18826
18827 Distances are measured from the beginning of functions when using the
18828 @option{-ffunction-sections} option, or when using the @option{-mgas}
18829 and @option{-mno-portable-runtime} options together under HP-UX with
18830 the SOM linker.
18831
18832 It is normally not desirable to use this option as it degrades
18833 performance. However, it may be useful in large applications,
18834 particularly when partial linking is used to build the application.
18835
18836 The types of long calls used depends on the capabilities of the
18837 assembler and linker, and the type of code being generated. The
18838 impact on systems that support long absolute calls, and long pic
18839 symbol-difference or pc-relative calls should be relatively small.
18840 However, an indirect call is used on 32-bit ELF systems in pic code
18841 and it is quite long.
18842
18843 @item -munix=@var{unix-std}
18844 @opindex march
18845 Generate compiler predefines and select a startfile for the specified
18846 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
18847 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
18848 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
18849 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
18850 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
18851 and later.
18852
18853 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
18854 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
18855 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
18856 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
18857 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
18858 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
18859
18860 It is @emph{important} to note that this option changes the interfaces
18861 for various library routines. It also affects the operational behavior
18862 of the C library. Thus, @emph{extreme} care is needed in using this
18863 option.
18864
18865 Library code that is intended to operate with more than one UNIX
18866 standard must test, set and restore the variable @code{__xpg4_extended_mask}
18867 as appropriate. Most GNU software doesn't provide this capability.
18868
18869 @item -nolibdld
18870 @opindex nolibdld
18871 Suppress the generation of link options to search libdld.sl when the
18872 @option{-static} option is specified on HP-UX 10 and later.
18873
18874 @item -static
18875 @opindex static
18876 The HP-UX implementation of setlocale in libc has a dependency on
18877 libdld.sl. There isn't an archive version of libdld.sl. Thus,
18878 when the @option{-static} option is specified, special link options
18879 are needed to resolve this dependency.
18880
18881 On HP-UX 10 and later, the GCC driver adds the necessary options to
18882 link with libdld.sl when the @option{-static} option is specified.
18883 This causes the resulting binary to be dynamic. On the 64-bit port,
18884 the linkers generate dynamic binaries by default in any case. The
18885 @option{-nolibdld} option can be used to prevent the GCC driver from
18886 adding these link options.
18887
18888 @item -threads
18889 @opindex threads
18890 Add support for multithreading with the @dfn{dce thread} library
18891 under HP-UX@. This option sets flags for both the preprocessor and
18892 linker.
18893 @end table
18894
18895 @node IA-64 Options
18896 @subsection IA-64 Options
18897 @cindex IA-64 Options
18898
18899 These are the @samp{-m} options defined for the Intel IA-64 architecture.
18900
18901 @table @gcctabopt
18902 @item -mbig-endian
18903 @opindex mbig-endian
18904 Generate code for a big-endian target. This is the default for HP-UX@.
18905
18906 @item -mlittle-endian
18907 @opindex mlittle-endian
18908 Generate code for a little-endian target. This is the default for AIX5
18909 and GNU/Linux.
18910
18911 @item -mgnu-as
18912 @itemx -mno-gnu-as
18913 @opindex mgnu-as
18914 @opindex mno-gnu-as
18915 Generate (or don't) code for the GNU assembler. This is the default.
18916 @c Also, this is the default if the configure option @option{--with-gnu-as}
18917 @c is used.
18918
18919 @item -mgnu-ld
18920 @itemx -mno-gnu-ld
18921 @opindex mgnu-ld
18922 @opindex mno-gnu-ld
18923 Generate (or don't) code for the GNU linker. This is the default.
18924 @c Also, this is the default if the configure option @option{--with-gnu-ld}
18925 @c is used.
18926
18927 @item -mno-pic
18928 @opindex mno-pic
18929 Generate code that does not use a global pointer register. The result
18930 is not position independent code, and violates the IA-64 ABI@.
18931
18932 @item -mvolatile-asm-stop
18933 @itemx -mno-volatile-asm-stop
18934 @opindex mvolatile-asm-stop
18935 @opindex mno-volatile-asm-stop
18936 Generate (or don't) a stop bit immediately before and after volatile asm
18937 statements.
18938
18939 @item -mregister-names
18940 @itemx -mno-register-names
18941 @opindex mregister-names
18942 @opindex mno-register-names
18943 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
18944 the stacked registers. This may make assembler output more readable.
18945
18946 @item -mno-sdata
18947 @itemx -msdata
18948 @opindex mno-sdata
18949 @opindex msdata
18950 Disable (or enable) optimizations that use the small data section. This may
18951 be useful for working around optimizer bugs.
18952
18953 @item -mconstant-gp
18954 @opindex mconstant-gp
18955 Generate code that uses a single constant global pointer value. This is
18956 useful when compiling kernel code.
18957
18958 @item -mauto-pic
18959 @opindex mauto-pic
18960 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
18961 This is useful when compiling firmware code.
18962
18963 @item -minline-float-divide-min-latency
18964 @opindex minline-float-divide-min-latency
18965 Generate code for inline divides of floating-point values
18966 using the minimum latency algorithm.
18967
18968 @item -minline-float-divide-max-throughput
18969 @opindex minline-float-divide-max-throughput
18970 Generate code for inline divides of floating-point values
18971 using the maximum throughput algorithm.
18972
18973 @item -mno-inline-float-divide
18974 @opindex mno-inline-float-divide
18975 Do not generate inline code for divides of floating-point values.
18976
18977 @item -minline-int-divide-min-latency
18978 @opindex minline-int-divide-min-latency
18979 Generate code for inline divides of integer values
18980 using the minimum latency algorithm.
18981
18982 @item -minline-int-divide-max-throughput
18983 @opindex minline-int-divide-max-throughput
18984 Generate code for inline divides of integer values
18985 using the maximum throughput algorithm.
18986
18987 @item -mno-inline-int-divide
18988 @opindex mno-inline-int-divide
18989 Do not generate inline code for divides of integer values.
18990
18991 @item -minline-sqrt-min-latency
18992 @opindex minline-sqrt-min-latency
18993 Generate code for inline square roots
18994 using the minimum latency algorithm.
18995
18996 @item -minline-sqrt-max-throughput
18997 @opindex minline-sqrt-max-throughput
18998 Generate code for inline square roots
18999 using the maximum throughput algorithm.
19000
19001 @item -mno-inline-sqrt
19002 @opindex mno-inline-sqrt
19003 Do not generate inline code for @code{sqrt}.
19004
19005 @item -mfused-madd
19006 @itemx -mno-fused-madd
19007 @opindex mfused-madd
19008 @opindex mno-fused-madd
19009 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
19010 instructions. The default is to use these instructions.
19011
19012 @item -mno-dwarf2-asm
19013 @itemx -mdwarf2-asm
19014 @opindex mno-dwarf2-asm
19015 @opindex mdwarf2-asm
19016 Don't (or do) generate assembler code for the DWARF line number debugging
19017 info. This may be useful when not using the GNU assembler.
19018
19019 @item -mearly-stop-bits
19020 @itemx -mno-early-stop-bits
19021 @opindex mearly-stop-bits
19022 @opindex mno-early-stop-bits
19023 Allow stop bits to be placed earlier than immediately preceding the
19024 instruction that triggered the stop bit. This can improve instruction
19025 scheduling, but does not always do so.
19026
19027 @item -mfixed-range=@var{register-range}
19028 @opindex mfixed-range
19029 Generate code treating the given register range as fixed registers.
19030 A fixed register is one that the register allocator cannot use. This is
19031 useful when compiling kernel code. A register range is specified as
19032 two registers separated by a dash. Multiple register ranges can be
19033 specified separated by a comma.
19034
19035 @item -mtls-size=@var{tls-size}
19036 @opindex mtls-size
19037 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
19038 64.
19039
19040 @item -mtune=@var{cpu-type}
19041 @opindex mtune
19042 Tune the instruction scheduling for a particular CPU, Valid values are
19043 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
19044 and @samp{mckinley}.
19045
19046 @item -milp32
19047 @itemx -mlp64
19048 @opindex milp32
19049 @opindex mlp64
19050 Generate code for a 32-bit or 64-bit environment.
19051 The 32-bit environment sets int, long and pointer to 32 bits.
19052 The 64-bit environment sets int to 32 bits and long and pointer
19053 to 64 bits. These are HP-UX specific flags.
19054
19055 @item -mno-sched-br-data-spec
19056 @itemx -msched-br-data-spec
19057 @opindex mno-sched-br-data-spec
19058 @opindex msched-br-data-spec
19059 (Dis/En)able data speculative scheduling before reload.
19060 This results in generation of @code{ld.a} instructions and
19061 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19062 The default setting is disabled.
19063
19064 @item -msched-ar-data-spec
19065 @itemx -mno-sched-ar-data-spec
19066 @opindex msched-ar-data-spec
19067 @opindex mno-sched-ar-data-spec
19068 (En/Dis)able data speculative scheduling after reload.
19069 This results in generation of @code{ld.a} instructions and
19070 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19071 The default setting is enabled.
19072
19073 @item -mno-sched-control-spec
19074 @itemx -msched-control-spec
19075 @opindex mno-sched-control-spec
19076 @opindex msched-control-spec
19077 (Dis/En)able control speculative scheduling. This feature is
19078 available only during region scheduling (i.e.@: before reload).
19079 This results in generation of the @code{ld.s} instructions and
19080 the corresponding check instructions @code{chk.s}.
19081 The default setting is disabled.
19082
19083 @item -msched-br-in-data-spec
19084 @itemx -mno-sched-br-in-data-spec
19085 @opindex msched-br-in-data-spec
19086 @opindex mno-sched-br-in-data-spec
19087 (En/Dis)able speculative scheduling of the instructions that
19088 are dependent on the data speculative loads before reload.
19089 This is effective only with @option{-msched-br-data-spec} enabled.
19090 The default setting is enabled.
19091
19092 @item -msched-ar-in-data-spec
19093 @itemx -mno-sched-ar-in-data-spec
19094 @opindex msched-ar-in-data-spec
19095 @opindex mno-sched-ar-in-data-spec
19096 (En/Dis)able speculative scheduling of the instructions that
19097 are dependent on the data speculative loads after reload.
19098 This is effective only with @option{-msched-ar-data-spec} enabled.
19099 The default setting is enabled.
19100
19101 @item -msched-in-control-spec
19102 @itemx -mno-sched-in-control-spec
19103 @opindex msched-in-control-spec
19104 @opindex mno-sched-in-control-spec
19105 (En/Dis)able speculative scheduling of the instructions that
19106 are dependent on the control speculative loads.
19107 This is effective only with @option{-msched-control-spec} enabled.
19108 The default setting is enabled.
19109
19110 @item -mno-sched-prefer-non-data-spec-insns
19111 @itemx -msched-prefer-non-data-spec-insns
19112 @opindex mno-sched-prefer-non-data-spec-insns
19113 @opindex msched-prefer-non-data-spec-insns
19114 If enabled, data-speculative instructions are chosen for schedule
19115 only if there are no other choices at the moment. This makes
19116 the use of the data speculation much more conservative.
19117 The default setting is disabled.
19118
19119 @item -mno-sched-prefer-non-control-spec-insns
19120 @itemx -msched-prefer-non-control-spec-insns
19121 @opindex mno-sched-prefer-non-control-spec-insns
19122 @opindex msched-prefer-non-control-spec-insns
19123 If enabled, control-speculative instructions are chosen for schedule
19124 only if there are no other choices at the moment. This makes
19125 the use of the control speculation much more conservative.
19126 The default setting is disabled.
19127
19128 @item -mno-sched-count-spec-in-critical-path
19129 @itemx -msched-count-spec-in-critical-path
19130 @opindex mno-sched-count-spec-in-critical-path
19131 @opindex msched-count-spec-in-critical-path
19132 If enabled, speculative dependencies are considered during
19133 computation of the instructions priorities. This makes the use of the
19134 speculation a bit more conservative.
19135 The default setting is disabled.
19136
19137 @item -msched-spec-ldc
19138 @opindex msched-spec-ldc
19139 Use a simple data speculation check. This option is on by default.
19140
19141 @item -msched-control-spec-ldc
19142 @opindex msched-spec-ldc
19143 Use a simple check for control speculation. This option is on by default.
19144
19145 @item -msched-stop-bits-after-every-cycle
19146 @opindex msched-stop-bits-after-every-cycle
19147 Place a stop bit after every cycle when scheduling. This option is on
19148 by default.
19149
19150 @item -msched-fp-mem-deps-zero-cost
19151 @opindex msched-fp-mem-deps-zero-cost
19152 Assume that floating-point stores and loads are not likely to cause a conflict
19153 when placed into the same instruction group. This option is disabled by
19154 default.
19155
19156 @item -msel-sched-dont-check-control-spec
19157 @opindex msel-sched-dont-check-control-spec
19158 Generate checks for control speculation in selective scheduling.
19159 This flag is disabled by default.
19160
19161 @item -msched-max-memory-insns=@var{max-insns}
19162 @opindex msched-max-memory-insns
19163 Limit on the number of memory insns per instruction group, giving lower
19164 priority to subsequent memory insns attempting to schedule in the same
19165 instruction group. Frequently useful to prevent cache bank conflicts.
19166 The default value is 1.
19167
19168 @item -msched-max-memory-insns-hard-limit
19169 @opindex msched-max-memory-insns-hard-limit
19170 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
19171 disallowing more than that number in an instruction group.
19172 Otherwise, the limit is ``soft'', meaning that non-memory operations
19173 are preferred when the limit is reached, but memory operations may still
19174 be scheduled.
19175
19176 @end table
19177
19178 @node LM32 Options
19179 @subsection LM32 Options
19180 @cindex LM32 options
19181
19182 These @option{-m} options are defined for the LatticeMico32 architecture:
19183
19184 @table @gcctabopt
19185 @item -mbarrel-shift-enabled
19186 @opindex mbarrel-shift-enabled
19187 Enable barrel-shift instructions.
19188
19189 @item -mdivide-enabled
19190 @opindex mdivide-enabled
19191 Enable divide and modulus instructions.
19192
19193 @item -mmultiply-enabled
19194 @opindex multiply-enabled
19195 Enable multiply instructions.
19196
19197 @item -msign-extend-enabled
19198 @opindex msign-extend-enabled
19199 Enable sign extend instructions.
19200
19201 @item -muser-enabled
19202 @opindex muser-enabled
19203 Enable user-defined instructions.
19204
19205 @end table
19206
19207 @node M32C Options
19208 @subsection M32C Options
19209 @cindex M32C options
19210
19211 @table @gcctabopt
19212 @item -mcpu=@var{name}
19213 @opindex mcpu=
19214 Select the CPU for which code is generated. @var{name} may be one of
19215 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
19216 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
19217 the M32C/80 series.
19218
19219 @item -msim
19220 @opindex msim
19221 Specifies that the program will be run on the simulator. This causes
19222 an alternate runtime library to be linked in which supports, for
19223 example, file I/O@. You must not use this option when generating
19224 programs that will run on real hardware; you must provide your own
19225 runtime library for whatever I/O functions are needed.
19226
19227 @item -memregs=@var{number}
19228 @opindex memregs=
19229 Specifies the number of memory-based pseudo-registers GCC uses
19230 during code generation. These pseudo-registers are used like real
19231 registers, so there is a tradeoff between GCC's ability to fit the
19232 code into available registers, and the performance penalty of using
19233 memory instead of registers. Note that all modules in a program must
19234 be compiled with the same value for this option. Because of that, you
19235 must not use this option with GCC's default runtime libraries.
19236
19237 @end table
19238
19239 @node M32R/D Options
19240 @subsection M32R/D Options
19241 @cindex M32R/D options
19242
19243 These @option{-m} options are defined for Renesas M32R/D architectures:
19244
19245 @table @gcctabopt
19246 @item -m32r2
19247 @opindex m32r2
19248 Generate code for the M32R/2@.
19249
19250 @item -m32rx
19251 @opindex m32rx
19252 Generate code for the M32R/X@.
19253
19254 @item -m32r
19255 @opindex m32r
19256 Generate code for the M32R@. This is the default.
19257
19258 @item -mmodel=small
19259 @opindex mmodel=small
19260 Assume all objects live in the lower 16MB of memory (so that their addresses
19261 can be loaded with the @code{ld24} instruction), and assume all subroutines
19262 are reachable with the @code{bl} instruction.
19263 This is the default.
19264
19265 The addressability of a particular object can be set with the
19266 @code{model} attribute.
19267
19268 @item -mmodel=medium
19269 @opindex mmodel=medium
19270 Assume objects may be anywhere in the 32-bit address space (the compiler
19271 generates @code{seth/add3} instructions to load their addresses), and
19272 assume all subroutines are reachable with the @code{bl} instruction.
19273
19274 @item -mmodel=large
19275 @opindex mmodel=large
19276 Assume objects may be anywhere in the 32-bit address space (the compiler
19277 generates @code{seth/add3} instructions to load their addresses), and
19278 assume subroutines may not be reachable with the @code{bl} instruction
19279 (the compiler generates the much slower @code{seth/add3/jl}
19280 instruction sequence).
19281
19282 @item -msdata=none
19283 @opindex msdata=none
19284 Disable use of the small data area. Variables are put into
19285 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
19286 @code{section} attribute has been specified).
19287 This is the default.
19288
19289 The small data area consists of sections @code{.sdata} and @code{.sbss}.
19290 Objects may be explicitly put in the small data area with the
19291 @code{section} attribute using one of these sections.
19292
19293 @item -msdata=sdata
19294 @opindex msdata=sdata
19295 Put small global and static data in the small data area, but do not
19296 generate special code to reference them.
19297
19298 @item -msdata=use
19299 @opindex msdata=use
19300 Put small global and static data in the small data area, and generate
19301 special instructions to reference them.
19302
19303 @item -G @var{num}
19304 @opindex G
19305 @cindex smaller data references
19306 Put global and static objects less than or equal to @var{num} bytes
19307 into the small data or BSS sections instead of the normal data or BSS
19308 sections. The default value of @var{num} is 8.
19309 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
19310 for this option to have any effect.
19311
19312 All modules should be compiled with the same @option{-G @var{num}} value.
19313 Compiling with different values of @var{num} may or may not work; if it
19314 doesn't the linker gives an error message---incorrect code is not
19315 generated.
19316
19317 @item -mdebug
19318 @opindex mdebug
19319 Makes the M32R-specific code in the compiler display some statistics
19320 that might help in debugging programs.
19321
19322 @item -malign-loops
19323 @opindex malign-loops
19324 Align all loops to a 32-byte boundary.
19325
19326 @item -mno-align-loops
19327 @opindex mno-align-loops
19328 Do not enforce a 32-byte alignment for loops. This is the default.
19329
19330 @item -missue-rate=@var{number}
19331 @opindex missue-rate=@var{number}
19332 Issue @var{number} instructions per cycle. @var{number} can only be 1
19333 or 2.
19334
19335 @item -mbranch-cost=@var{number}
19336 @opindex mbranch-cost=@var{number}
19337 @var{number} can only be 1 or 2. If it is 1 then branches are
19338 preferred over conditional code, if it is 2, then the opposite applies.
19339
19340 @item -mflush-trap=@var{number}
19341 @opindex mflush-trap=@var{number}
19342 Specifies the trap number to use to flush the cache. The default is
19343 12. Valid numbers are between 0 and 15 inclusive.
19344
19345 @item -mno-flush-trap
19346 @opindex mno-flush-trap
19347 Specifies that the cache cannot be flushed by using a trap.
19348
19349 @item -mflush-func=@var{name}
19350 @opindex mflush-func=@var{name}
19351 Specifies the name of the operating system function to call to flush
19352 the cache. The default is @samp{_flush_cache}, but a function call
19353 is only used if a trap is not available.
19354
19355 @item -mno-flush-func
19356 @opindex mno-flush-func
19357 Indicates that there is no OS function for flushing the cache.
19358
19359 @end table
19360
19361 @node M680x0 Options
19362 @subsection M680x0 Options
19363 @cindex M680x0 options
19364
19365 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
19366 The default settings depend on which architecture was selected when
19367 the compiler was configured; the defaults for the most common choices
19368 are given below.
19369
19370 @table @gcctabopt
19371 @item -march=@var{arch}
19372 @opindex march
19373 Generate code for a specific M680x0 or ColdFire instruction set
19374 architecture. Permissible values of @var{arch} for M680x0
19375 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
19376 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
19377 architectures are selected according to Freescale's ISA classification
19378 and the permissible values are: @samp{isaa}, @samp{isaaplus},
19379 @samp{isab} and @samp{isac}.
19380
19381 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
19382 code for a ColdFire target. The @var{arch} in this macro is one of the
19383 @option{-march} arguments given above.
19384
19385 When used together, @option{-march} and @option{-mtune} select code
19386 that runs on a family of similar processors but that is optimized
19387 for a particular microarchitecture.
19388
19389 @item -mcpu=@var{cpu}
19390 @opindex mcpu
19391 Generate code for a specific M680x0 or ColdFire processor.
19392 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
19393 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
19394 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
19395 below, which also classifies the CPUs into families:
19396
19397 @multitable @columnfractions 0.20 0.80
19398 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
19399 @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}
19400 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
19401 @item @samp{5206e} @tab @samp{5206e}
19402 @item @samp{5208} @tab @samp{5207} @samp{5208}
19403 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
19404 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
19405 @item @samp{5216} @tab @samp{5214} @samp{5216}
19406 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
19407 @item @samp{5225} @tab @samp{5224} @samp{5225}
19408 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
19409 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
19410 @item @samp{5249} @tab @samp{5249}
19411 @item @samp{5250} @tab @samp{5250}
19412 @item @samp{5271} @tab @samp{5270} @samp{5271}
19413 @item @samp{5272} @tab @samp{5272}
19414 @item @samp{5275} @tab @samp{5274} @samp{5275}
19415 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
19416 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
19417 @item @samp{5307} @tab @samp{5307}
19418 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
19419 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
19420 @item @samp{5407} @tab @samp{5407}
19421 @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}
19422 @end multitable
19423
19424 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
19425 @var{arch} is compatible with @var{cpu}. Other combinations of
19426 @option{-mcpu} and @option{-march} are rejected.
19427
19428 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
19429 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
19430 where the value of @var{family} is given by the table above.
19431
19432 @item -mtune=@var{tune}
19433 @opindex mtune
19434 Tune the code for a particular microarchitecture within the
19435 constraints set by @option{-march} and @option{-mcpu}.
19436 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
19437 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
19438 and @samp{cpu32}. The ColdFire microarchitectures
19439 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
19440
19441 You can also use @option{-mtune=68020-40} for code that needs
19442 to run relatively well on 68020, 68030 and 68040 targets.
19443 @option{-mtune=68020-60} is similar but includes 68060 targets
19444 as well. These two options select the same tuning decisions as
19445 @option{-m68020-40} and @option{-m68020-60} respectively.
19446
19447 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
19448 when tuning for 680x0 architecture @var{arch}. It also defines
19449 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
19450 option is used. If GCC is tuning for a range of architectures,
19451 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
19452 it defines the macros for every architecture in the range.
19453
19454 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
19455 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
19456 of the arguments given above.
19457
19458 @item -m68000
19459 @itemx -mc68000
19460 @opindex m68000
19461 @opindex mc68000
19462 Generate output for a 68000. This is the default
19463 when the compiler is configured for 68000-based systems.
19464 It is equivalent to @option{-march=68000}.
19465
19466 Use this option for microcontrollers with a 68000 or EC000 core,
19467 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
19468
19469 @item -m68010
19470 @opindex m68010
19471 Generate output for a 68010. This is the default
19472 when the compiler is configured for 68010-based systems.
19473 It is equivalent to @option{-march=68010}.
19474
19475 @item -m68020
19476 @itemx -mc68020
19477 @opindex m68020
19478 @opindex mc68020
19479 Generate output for a 68020. This is the default
19480 when the compiler is configured for 68020-based systems.
19481 It is equivalent to @option{-march=68020}.
19482
19483 @item -m68030
19484 @opindex m68030
19485 Generate output for a 68030. This is the default when the compiler is
19486 configured for 68030-based systems. It is equivalent to
19487 @option{-march=68030}.
19488
19489 @item -m68040
19490 @opindex m68040
19491 Generate output for a 68040. This is the default when the compiler is
19492 configured for 68040-based systems. It is equivalent to
19493 @option{-march=68040}.
19494
19495 This option inhibits the use of 68881/68882 instructions that have to be
19496 emulated by software on the 68040. Use this option if your 68040 does not
19497 have code to emulate those instructions.
19498
19499 @item -m68060
19500 @opindex m68060
19501 Generate output for a 68060. This is the default when the compiler is
19502 configured for 68060-based systems. It is equivalent to
19503 @option{-march=68060}.
19504
19505 This option inhibits the use of 68020 and 68881/68882 instructions that
19506 have to be emulated by software on the 68060. Use this option if your 68060
19507 does not have code to emulate those instructions.
19508
19509 @item -mcpu32
19510 @opindex mcpu32
19511 Generate output for a CPU32. This is the default
19512 when the compiler is configured for CPU32-based systems.
19513 It is equivalent to @option{-march=cpu32}.
19514
19515 Use this option for microcontrollers with a
19516 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
19517 68336, 68340, 68341, 68349 and 68360.
19518
19519 @item -m5200
19520 @opindex m5200
19521 Generate output for a 520X ColdFire CPU@. This is the default
19522 when the compiler is configured for 520X-based systems.
19523 It is equivalent to @option{-mcpu=5206}, and is now deprecated
19524 in favor of that option.
19525
19526 Use this option for microcontroller with a 5200 core, including
19527 the MCF5202, MCF5203, MCF5204 and MCF5206.
19528
19529 @item -m5206e
19530 @opindex m5206e
19531 Generate output for a 5206e ColdFire CPU@. The option is now
19532 deprecated in favor of the equivalent @option{-mcpu=5206e}.
19533
19534 @item -m528x
19535 @opindex m528x
19536 Generate output for a member of the ColdFire 528X family.
19537 The option is now deprecated in favor of the equivalent
19538 @option{-mcpu=528x}.
19539
19540 @item -m5307
19541 @opindex m5307
19542 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
19543 in favor of the equivalent @option{-mcpu=5307}.
19544
19545 @item -m5407
19546 @opindex m5407
19547 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
19548 in favor of the equivalent @option{-mcpu=5407}.
19549
19550 @item -mcfv4e
19551 @opindex mcfv4e
19552 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
19553 This includes use of hardware floating-point instructions.
19554 The option is equivalent to @option{-mcpu=547x}, and is now
19555 deprecated in favor of that option.
19556
19557 @item -m68020-40
19558 @opindex m68020-40
19559 Generate output for a 68040, without using any of the new instructions.
19560 This results in code that can run relatively efficiently on either a
19561 68020/68881 or a 68030 or a 68040. The generated code does use the
19562 68881 instructions that are emulated on the 68040.
19563
19564 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
19565
19566 @item -m68020-60
19567 @opindex m68020-60
19568 Generate output for a 68060, without using any of the new instructions.
19569 This results in code that can run relatively efficiently on either a
19570 68020/68881 or a 68030 or a 68040. The generated code does use the
19571 68881 instructions that are emulated on the 68060.
19572
19573 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
19574
19575 @item -mhard-float
19576 @itemx -m68881
19577 @opindex mhard-float
19578 @opindex m68881
19579 Generate floating-point instructions. This is the default for 68020
19580 and above, and for ColdFire devices that have an FPU@. It defines the
19581 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
19582 on ColdFire targets.
19583
19584 @item -msoft-float
19585 @opindex msoft-float
19586 Do not generate floating-point instructions; use library calls instead.
19587 This is the default for 68000, 68010, and 68832 targets. It is also
19588 the default for ColdFire devices that have no FPU.
19589
19590 @item -mdiv
19591 @itemx -mno-div
19592 @opindex mdiv
19593 @opindex mno-div
19594 Generate (do not generate) ColdFire hardware divide and remainder
19595 instructions. If @option{-march} is used without @option{-mcpu},
19596 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
19597 architectures. Otherwise, the default is taken from the target CPU
19598 (either the default CPU, or the one specified by @option{-mcpu}). For
19599 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
19600 @option{-mcpu=5206e}.
19601
19602 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
19603
19604 @item -mshort
19605 @opindex mshort
19606 Consider type @code{int} to be 16 bits wide, like @code{short int}.
19607 Additionally, parameters passed on the stack are also aligned to a
19608 16-bit boundary even on targets whose API mandates promotion to 32-bit.
19609
19610 @item -mno-short
19611 @opindex mno-short
19612 Do not consider type @code{int} to be 16 bits wide. This is the default.
19613
19614 @item -mnobitfield
19615 @itemx -mno-bitfield
19616 @opindex mnobitfield
19617 @opindex mno-bitfield
19618 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
19619 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
19620
19621 @item -mbitfield
19622 @opindex mbitfield
19623 Do use the bit-field instructions. The @option{-m68020} option implies
19624 @option{-mbitfield}. This is the default if you use a configuration
19625 designed for a 68020.
19626
19627 @item -mrtd
19628 @opindex mrtd
19629 Use a different function-calling convention, in which functions
19630 that take a fixed number of arguments return with the @code{rtd}
19631 instruction, which pops their arguments while returning. This
19632 saves one instruction in the caller since there is no need to pop
19633 the arguments there.
19634
19635 This calling convention is incompatible with the one normally
19636 used on Unix, so you cannot use it if you need to call libraries
19637 compiled with the Unix compiler.
19638
19639 Also, you must provide function prototypes for all functions that
19640 take variable numbers of arguments (including @code{printf});
19641 otherwise incorrect code is generated for calls to those
19642 functions.
19643
19644 In addition, seriously incorrect code results if you call a
19645 function with too many arguments. (Normally, extra arguments are
19646 harmlessly ignored.)
19647
19648 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
19649 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
19650
19651 @item -mno-rtd
19652 @opindex mno-rtd
19653 Do not use the calling conventions selected by @option{-mrtd}.
19654 This is the default.
19655
19656 @item -malign-int
19657 @itemx -mno-align-int
19658 @opindex malign-int
19659 @opindex mno-align-int
19660 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
19661 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
19662 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
19663 Aligning variables on 32-bit boundaries produces code that runs somewhat
19664 faster on processors with 32-bit busses at the expense of more memory.
19665
19666 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
19667 aligns structures containing the above types differently than
19668 most published application binary interface specifications for the m68k.
19669
19670 @item -mpcrel
19671 @opindex mpcrel
19672 Use the pc-relative addressing mode of the 68000 directly, instead of
19673 using a global offset table. At present, this option implies @option{-fpic},
19674 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
19675 not presently supported with @option{-mpcrel}, though this could be supported for
19676 68020 and higher processors.
19677
19678 @item -mno-strict-align
19679 @itemx -mstrict-align
19680 @opindex mno-strict-align
19681 @opindex mstrict-align
19682 Do not (do) assume that unaligned memory references are handled by
19683 the system.
19684
19685 @item -msep-data
19686 Generate code that allows the data segment to be located in a different
19687 area of memory from the text segment. This allows for execute-in-place in
19688 an environment without virtual memory management. This option implies
19689 @option{-fPIC}.
19690
19691 @item -mno-sep-data
19692 Generate code that assumes that the data segment follows the text segment.
19693 This is the default.
19694
19695 @item -mid-shared-library
19696 Generate code that supports shared libraries via the library ID method.
19697 This allows for execute-in-place and shared libraries in an environment
19698 without virtual memory management. This option implies @option{-fPIC}.
19699
19700 @item -mno-id-shared-library
19701 Generate code that doesn't assume ID-based shared libraries are being used.
19702 This is the default.
19703
19704 @item -mshared-library-id=n
19705 Specifies the identification number of the ID-based shared library being
19706 compiled. Specifying a value of 0 generates more compact code; specifying
19707 other values forces the allocation of that number to the current
19708 library, but is no more space- or time-efficient than omitting this option.
19709
19710 @item -mxgot
19711 @itemx -mno-xgot
19712 @opindex mxgot
19713 @opindex mno-xgot
19714 When generating position-independent code for ColdFire, generate code
19715 that works if the GOT has more than 8192 entries. This code is
19716 larger and slower than code generated without this option. On M680x0
19717 processors, this option is not needed; @option{-fPIC} suffices.
19718
19719 GCC normally uses a single instruction to load values from the GOT@.
19720 While this is relatively efficient, it only works if the GOT
19721 is smaller than about 64k. Anything larger causes the linker
19722 to report an error such as:
19723
19724 @cindex relocation truncated to fit (ColdFire)
19725 @smallexample
19726 relocation truncated to fit: R_68K_GOT16O foobar
19727 @end smallexample
19728
19729 If this happens, you should recompile your code with @option{-mxgot}.
19730 It should then work with very large GOTs. However, code generated with
19731 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
19732 the value of a global symbol.
19733
19734 Note that some linkers, including newer versions of the GNU linker,
19735 can create multiple GOTs and sort GOT entries. If you have such a linker,
19736 you should only need to use @option{-mxgot} when compiling a single
19737 object file that accesses more than 8192 GOT entries. Very few do.
19738
19739 These options have no effect unless GCC is generating
19740 position-independent code.
19741
19742 @item -mlong-jump-table-offsets
19743 @opindex mlong-jump-table-offsets
19744 Use 32-bit offsets in @code{switch} tables. The default is to use
19745 16-bit offsets.
19746
19747 @end table
19748
19749 @node MCore Options
19750 @subsection MCore Options
19751 @cindex MCore options
19752
19753 These are the @samp{-m} options defined for the Motorola M*Core
19754 processors.
19755
19756 @table @gcctabopt
19757
19758 @item -mhardlit
19759 @itemx -mno-hardlit
19760 @opindex mhardlit
19761 @opindex mno-hardlit
19762 Inline constants into the code stream if it can be done in two
19763 instructions or less.
19764
19765 @item -mdiv
19766 @itemx -mno-div
19767 @opindex mdiv
19768 @opindex mno-div
19769 Use the divide instruction. (Enabled by default).
19770
19771 @item -mrelax-immediate
19772 @itemx -mno-relax-immediate
19773 @opindex mrelax-immediate
19774 @opindex mno-relax-immediate
19775 Allow arbitrary-sized immediates in bit operations.
19776
19777 @item -mwide-bitfields
19778 @itemx -mno-wide-bitfields
19779 @opindex mwide-bitfields
19780 @opindex mno-wide-bitfields
19781 Always treat bit-fields as @code{int}-sized.
19782
19783 @item -m4byte-functions
19784 @itemx -mno-4byte-functions
19785 @opindex m4byte-functions
19786 @opindex mno-4byte-functions
19787 Force all functions to be aligned to a 4-byte boundary.
19788
19789 @item -mcallgraph-data
19790 @itemx -mno-callgraph-data
19791 @opindex mcallgraph-data
19792 @opindex mno-callgraph-data
19793 Emit callgraph information.
19794
19795 @item -mslow-bytes
19796 @itemx -mno-slow-bytes
19797 @opindex mslow-bytes
19798 @opindex mno-slow-bytes
19799 Prefer word access when reading byte quantities.
19800
19801 @item -mlittle-endian
19802 @itemx -mbig-endian
19803 @opindex mlittle-endian
19804 @opindex mbig-endian
19805 Generate code for a little-endian target.
19806
19807 @item -m210
19808 @itemx -m340
19809 @opindex m210
19810 @opindex m340
19811 Generate code for the 210 processor.
19812
19813 @item -mno-lsim
19814 @opindex mno-lsim
19815 Assume that runtime support has been provided and so omit the
19816 simulator library (@file{libsim.a)} from the linker command line.
19817
19818 @item -mstack-increment=@var{size}
19819 @opindex mstack-increment
19820 Set the maximum amount for a single stack increment operation. Large
19821 values can increase the speed of programs that contain functions
19822 that need a large amount of stack space, but they can also trigger a
19823 segmentation fault if the stack is extended too much. The default
19824 value is 0x1000.
19825
19826 @end table
19827
19828 @node MeP Options
19829 @subsection MeP Options
19830 @cindex MeP options
19831
19832 @table @gcctabopt
19833
19834 @item -mabsdiff
19835 @opindex mabsdiff
19836 Enables the @code{abs} instruction, which is the absolute difference
19837 between two registers.
19838
19839 @item -mall-opts
19840 @opindex mall-opts
19841 Enables all the optional instructions---average, multiply, divide, bit
19842 operations, leading zero, absolute difference, min/max, clip, and
19843 saturation.
19844
19845
19846 @item -maverage
19847 @opindex maverage
19848 Enables the @code{ave} instruction, which computes the average of two
19849 registers.
19850
19851 @item -mbased=@var{n}
19852 @opindex mbased=
19853 Variables of size @var{n} bytes or smaller are placed in the
19854 @code{.based} section by default. Based variables use the @code{$tp}
19855 register as a base register, and there is a 128-byte limit to the
19856 @code{.based} section.
19857
19858 @item -mbitops
19859 @opindex mbitops
19860 Enables the bit operation instructions---bit test (@code{btstm}), set
19861 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
19862 test-and-set (@code{tas}).
19863
19864 @item -mc=@var{name}
19865 @opindex mc=
19866 Selects which section constant data is placed in. @var{name} may
19867 be @samp{tiny}, @samp{near}, or @samp{far}.
19868
19869 @item -mclip
19870 @opindex mclip
19871 Enables the @code{clip} instruction. Note that @option{-mclip} is not
19872 useful unless you also provide @option{-mminmax}.
19873
19874 @item -mconfig=@var{name}
19875 @opindex mconfig=
19876 Selects one of the built-in core configurations. Each MeP chip has
19877 one or more modules in it; each module has a core CPU and a variety of
19878 coprocessors, optional instructions, and peripherals. The
19879 @code{MeP-Integrator} tool, not part of GCC, provides these
19880 configurations through this option; using this option is the same as
19881 using all the corresponding command-line options. The default
19882 configuration is @samp{default}.
19883
19884 @item -mcop
19885 @opindex mcop
19886 Enables the coprocessor instructions. By default, this is a 32-bit
19887 coprocessor. Note that the coprocessor is normally enabled via the
19888 @option{-mconfig=} option.
19889
19890 @item -mcop32
19891 @opindex mcop32
19892 Enables the 32-bit coprocessor's instructions.
19893
19894 @item -mcop64
19895 @opindex mcop64
19896 Enables the 64-bit coprocessor's instructions.
19897
19898 @item -mivc2
19899 @opindex mivc2
19900 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
19901
19902 @item -mdc
19903 @opindex mdc
19904 Causes constant variables to be placed in the @code{.near} section.
19905
19906 @item -mdiv
19907 @opindex mdiv
19908 Enables the @code{div} and @code{divu} instructions.
19909
19910 @item -meb
19911 @opindex meb
19912 Generate big-endian code.
19913
19914 @item -mel
19915 @opindex mel
19916 Generate little-endian code.
19917
19918 @item -mio-volatile
19919 @opindex mio-volatile
19920 Tells the compiler that any variable marked with the @code{io}
19921 attribute is to be considered volatile.
19922
19923 @item -ml
19924 @opindex ml
19925 Causes variables to be assigned to the @code{.far} section by default.
19926
19927 @item -mleadz
19928 @opindex mleadz
19929 Enables the @code{leadz} (leading zero) instruction.
19930
19931 @item -mm
19932 @opindex mm
19933 Causes variables to be assigned to the @code{.near} section by default.
19934
19935 @item -mminmax
19936 @opindex mminmax
19937 Enables the @code{min} and @code{max} instructions.
19938
19939 @item -mmult
19940 @opindex mmult
19941 Enables the multiplication and multiply-accumulate instructions.
19942
19943 @item -mno-opts
19944 @opindex mno-opts
19945 Disables all the optional instructions enabled by @option{-mall-opts}.
19946
19947 @item -mrepeat
19948 @opindex mrepeat
19949 Enables the @code{repeat} and @code{erepeat} instructions, used for
19950 low-overhead looping.
19951
19952 @item -ms
19953 @opindex ms
19954 Causes all variables to default to the @code{.tiny} section. Note
19955 that there is a 65536-byte limit to this section. Accesses to these
19956 variables use the @code{%gp} base register.
19957
19958 @item -msatur
19959 @opindex msatur
19960 Enables the saturation instructions. Note that the compiler does not
19961 currently generate these itself, but this option is included for
19962 compatibility with other tools, like @code{as}.
19963
19964 @item -msdram
19965 @opindex msdram
19966 Link the SDRAM-based runtime instead of the default ROM-based runtime.
19967
19968 @item -msim
19969 @opindex msim
19970 Link the simulator run-time libraries.
19971
19972 @item -msimnovec
19973 @opindex msimnovec
19974 Link the simulator runtime libraries, excluding built-in support
19975 for reset and exception vectors and tables.
19976
19977 @item -mtf
19978 @opindex mtf
19979 Causes all functions to default to the @code{.far} section. Without
19980 this option, functions default to the @code{.near} section.
19981
19982 @item -mtiny=@var{n}
19983 @opindex mtiny=
19984 Variables that are @var{n} bytes or smaller are allocated to the
19985 @code{.tiny} section. These variables use the @code{$gp} base
19986 register. The default for this option is 4, but note that there's a
19987 65536-byte limit to the @code{.tiny} section.
19988
19989 @end table
19990
19991 @node MicroBlaze Options
19992 @subsection MicroBlaze Options
19993 @cindex MicroBlaze Options
19994
19995 @table @gcctabopt
19996
19997 @item -msoft-float
19998 @opindex msoft-float
19999 Use software emulation for floating point (default).
20000
20001 @item -mhard-float
20002 @opindex mhard-float
20003 Use hardware floating-point instructions.
20004
20005 @item -mmemcpy
20006 @opindex mmemcpy
20007 Do not optimize block moves, use @code{memcpy}.
20008
20009 @item -mno-clearbss
20010 @opindex mno-clearbss
20011 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
20012
20013 @item -mcpu=@var{cpu-type}
20014 @opindex mcpu=
20015 Use features of, and schedule code for, the given CPU.
20016 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
20017 where @var{X} is a major version, @var{YY} is the minor version, and
20018 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
20019 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
20020
20021 @item -mxl-soft-mul
20022 @opindex mxl-soft-mul
20023 Use software multiply emulation (default).
20024
20025 @item -mxl-soft-div
20026 @opindex mxl-soft-div
20027 Use software emulation for divides (default).
20028
20029 @item -mxl-barrel-shift
20030 @opindex mxl-barrel-shift
20031 Use the hardware barrel shifter.
20032
20033 @item -mxl-pattern-compare
20034 @opindex mxl-pattern-compare
20035 Use pattern compare instructions.
20036
20037 @item -msmall-divides
20038 @opindex msmall-divides
20039 Use table lookup optimization for small signed integer divisions.
20040
20041 @item -mxl-stack-check
20042 @opindex mxl-stack-check
20043 This option is deprecated. Use @option{-fstack-check} instead.
20044
20045 @item -mxl-gp-opt
20046 @opindex mxl-gp-opt
20047 Use GP-relative @code{.sdata}/@code{.sbss} sections.
20048
20049 @item -mxl-multiply-high
20050 @opindex mxl-multiply-high
20051 Use multiply high instructions for high part of 32x32 multiply.
20052
20053 @item -mxl-float-convert
20054 @opindex mxl-float-convert
20055 Use hardware floating-point conversion instructions.
20056
20057 @item -mxl-float-sqrt
20058 @opindex mxl-float-sqrt
20059 Use hardware floating-point square root instruction.
20060
20061 @item -mbig-endian
20062 @opindex mbig-endian
20063 Generate code for a big-endian target.
20064
20065 @item -mlittle-endian
20066 @opindex mlittle-endian
20067 Generate code for a little-endian target.
20068
20069 @item -mxl-reorder
20070 @opindex mxl-reorder
20071 Use reorder instructions (swap and byte reversed load/store).
20072
20073 @item -mxl-mode-@var{app-model}
20074 Select application model @var{app-model}. Valid models are
20075 @table @samp
20076 @item executable
20077 normal executable (default), uses startup code @file{crt0.o}.
20078
20079 @item -mpic-data-is-text-relative
20080 @opindex mpic-data-is-text-relative
20081 Assume that the displacement between the text and data segments is fixed
20082 at static link time. This allows data to be referenced by offset from start of
20083 text address instead of GOT since PC-relative addressing is not supported.
20084
20085 @item xmdstub
20086 for use with Xilinx Microprocessor Debugger (XMD) based
20087 software intrusive debug agent called xmdstub. This uses startup file
20088 @file{crt1.o} and sets the start address of the program to 0x800.
20089
20090 @item bootstrap
20091 for applications that are loaded using a bootloader.
20092 This model uses startup file @file{crt2.o} which does not contain a processor
20093 reset vector handler. This is suitable for transferring control on a
20094 processor reset to the bootloader rather than the application.
20095
20096 @item novectors
20097 for applications that do not require any of the
20098 MicroBlaze vectors. This option may be useful for applications running
20099 within a monitoring application. This model uses @file{crt3.o} as a startup file.
20100 @end table
20101
20102 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
20103 @option{-mxl-mode-@var{app-model}}.
20104
20105 @end table
20106
20107 @node MIPS Options
20108 @subsection MIPS Options
20109 @cindex MIPS options
20110
20111 @table @gcctabopt
20112
20113 @item -EB
20114 @opindex EB
20115 Generate big-endian code.
20116
20117 @item -EL
20118 @opindex EL
20119 Generate little-endian code. This is the default for @samp{mips*el-*-*}
20120 configurations.
20121
20122 @item -march=@var{arch}
20123 @opindex march
20124 Generate code that runs on @var{arch}, which can be the name of a
20125 generic MIPS ISA, or the name of a particular processor.
20126 The ISA names are:
20127 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
20128 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
20129 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
20130 @samp{mips64r5} and @samp{mips64r6}.
20131 The processor names are:
20132 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
20133 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
20134 @samp{5kc}, @samp{5kf},
20135 @samp{20kc},
20136 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
20137 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
20138 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
20139 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
20140 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
20141 @samp{i6400},
20142 @samp{interaptiv},
20143 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
20144 @samp{m4k},
20145 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
20146 @samp{m5100}, @samp{m5101},
20147 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
20148 @samp{orion},
20149 @samp{p5600},
20150 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
20151 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
20152 @samp{rm7000}, @samp{rm9000},
20153 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
20154 @samp{sb1},
20155 @samp{sr71000},
20156 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
20157 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
20158 @samp{xlr} and @samp{xlp}.
20159 The special value @samp{from-abi} selects the
20160 most compatible architecture for the selected ABI (that is,
20161 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
20162
20163 The native Linux/GNU toolchain also supports the value @samp{native},
20164 which selects the best architecture option for the host processor.
20165 @option{-march=native} has no effect if GCC does not recognize
20166 the processor.
20167
20168 In processor names, a final @samp{000} can be abbreviated as @samp{k}
20169 (for example, @option{-march=r2k}). Prefixes are optional, and
20170 @samp{vr} may be written @samp{r}.
20171
20172 Names of the form @samp{@var{n}f2_1} refer to processors with
20173 FPUs clocked at half the rate of the core, names of the form
20174 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
20175 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
20176 processors with FPUs clocked a ratio of 3:2 with respect to the core.
20177 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
20178 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
20179 accepted as synonyms for @samp{@var{n}f1_1}.
20180
20181 GCC defines two macros based on the value of this option. The first
20182 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
20183 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
20184 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
20185 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
20186 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
20187
20188 Note that the @code{_MIPS_ARCH} macro uses the processor names given
20189 above. In other words, it has the full prefix and does not
20190 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
20191 the macro names the resolved architecture (either @code{"mips1"} or
20192 @code{"mips3"}). It names the default architecture when no
20193 @option{-march} option is given.
20194
20195 @item -mtune=@var{arch}
20196 @opindex mtune
20197 Optimize for @var{arch}. Among other things, this option controls
20198 the way instructions are scheduled, and the perceived cost of arithmetic
20199 operations. The list of @var{arch} values is the same as for
20200 @option{-march}.
20201
20202 When this option is not used, GCC optimizes for the processor
20203 specified by @option{-march}. By using @option{-march} and
20204 @option{-mtune} together, it is possible to generate code that
20205 runs on a family of processors, but optimize the code for one
20206 particular member of that family.
20207
20208 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
20209 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
20210 @option{-march} ones described above.
20211
20212 @item -mips1
20213 @opindex mips1
20214 Equivalent to @option{-march=mips1}.
20215
20216 @item -mips2
20217 @opindex mips2
20218 Equivalent to @option{-march=mips2}.
20219
20220 @item -mips3
20221 @opindex mips3
20222 Equivalent to @option{-march=mips3}.
20223
20224 @item -mips4
20225 @opindex mips4
20226 Equivalent to @option{-march=mips4}.
20227
20228 @item -mips32
20229 @opindex mips32
20230 Equivalent to @option{-march=mips32}.
20231
20232 @item -mips32r3
20233 @opindex mips32r3
20234 Equivalent to @option{-march=mips32r3}.
20235
20236 @item -mips32r5
20237 @opindex mips32r5
20238 Equivalent to @option{-march=mips32r5}.
20239
20240 @item -mips32r6
20241 @opindex mips32r6
20242 Equivalent to @option{-march=mips32r6}.
20243
20244 @item -mips64
20245 @opindex mips64
20246 Equivalent to @option{-march=mips64}.
20247
20248 @item -mips64r2
20249 @opindex mips64r2
20250 Equivalent to @option{-march=mips64r2}.
20251
20252 @item -mips64r3
20253 @opindex mips64r3
20254 Equivalent to @option{-march=mips64r3}.
20255
20256 @item -mips64r5
20257 @opindex mips64r5
20258 Equivalent to @option{-march=mips64r5}.
20259
20260 @item -mips64r6
20261 @opindex mips64r6
20262 Equivalent to @option{-march=mips64r6}.
20263
20264 @item -mips16
20265 @itemx -mno-mips16
20266 @opindex mips16
20267 @opindex mno-mips16
20268 Generate (do not generate) MIPS16 code. If GCC is targeting a
20269 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
20270
20271 MIPS16 code generation can also be controlled on a per-function basis
20272 by means of @code{mips16} and @code{nomips16} attributes.
20273 @xref{Function Attributes}, for more information.
20274
20275 @item -mflip-mips16
20276 @opindex mflip-mips16
20277 Generate MIPS16 code on alternating functions. This option is provided
20278 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
20279 not intended for ordinary use in compiling user code.
20280
20281 @item -minterlink-compressed
20282 @itemx -mno-interlink-compressed
20283 @opindex minterlink-compressed
20284 @opindex mno-interlink-compressed
20285 Require (do not require) that code using the standard (uncompressed) MIPS ISA
20286 be link-compatible with MIPS16 and microMIPS code, and vice versa.
20287
20288 For example, code using the standard ISA encoding cannot jump directly
20289 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
20290 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
20291 knows that the target of the jump is not compressed.
20292
20293 @item -minterlink-mips16
20294 @itemx -mno-interlink-mips16
20295 @opindex minterlink-mips16
20296 @opindex mno-interlink-mips16
20297 Aliases of @option{-minterlink-compressed} and
20298 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
20299 and are retained for backwards compatibility.
20300
20301 @item -mabi=32
20302 @itemx -mabi=o64
20303 @itemx -mabi=n32
20304 @itemx -mabi=64
20305 @itemx -mabi=eabi
20306 @opindex mabi=32
20307 @opindex mabi=o64
20308 @opindex mabi=n32
20309 @opindex mabi=64
20310 @opindex mabi=eabi
20311 Generate code for the given ABI@.
20312
20313 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
20314 generates 64-bit code when you select a 64-bit architecture, but you
20315 can use @option{-mgp32} to get 32-bit code instead.
20316
20317 For information about the O64 ABI, see
20318 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
20319
20320 GCC supports a variant of the o32 ABI in which floating-point registers
20321 are 64 rather than 32 bits wide. You can select this combination with
20322 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
20323 and @code{mfhc1} instructions and is therefore only supported for
20324 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
20325
20326 The register assignments for arguments and return values remain the
20327 same, but each scalar value is passed in a single 64-bit register
20328 rather than a pair of 32-bit registers. For example, scalar
20329 floating-point values are returned in @samp{$f0} only, not a
20330 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
20331 remains the same in that the even-numbered double-precision registers
20332 are saved.
20333
20334 Two additional variants of the o32 ABI are supported to enable
20335 a transition from 32-bit to 64-bit registers. These are FPXX
20336 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
20337 The FPXX extension mandates that all code must execute correctly
20338 when run using 32-bit or 64-bit registers. The code can be interlinked
20339 with either FP32 or FP64, but not both.
20340 The FP64A extension is similar to the FP64 extension but forbids the
20341 use of odd-numbered single-precision registers. This can be used
20342 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
20343 processors and allows both FP32 and FP64A code to interlink and
20344 run in the same process without changing FPU modes.
20345
20346 @item -mabicalls
20347 @itemx -mno-abicalls
20348 @opindex mabicalls
20349 @opindex mno-abicalls
20350 Generate (do not generate) code that is suitable for SVR4-style
20351 dynamic objects. @option{-mabicalls} is the default for SVR4-based
20352 systems.
20353
20354 @item -mshared
20355 @itemx -mno-shared
20356 Generate (do not generate) code that is fully position-independent,
20357 and that can therefore be linked into shared libraries. This option
20358 only affects @option{-mabicalls}.
20359
20360 All @option{-mabicalls} code has traditionally been position-independent,
20361 regardless of options like @option{-fPIC} and @option{-fpic}. However,
20362 as an extension, the GNU toolchain allows executables to use absolute
20363 accesses for locally-binding symbols. It can also use shorter GP
20364 initialization sequences and generate direct calls to locally-defined
20365 functions. This mode is selected by @option{-mno-shared}.
20366
20367 @option{-mno-shared} depends on binutils 2.16 or higher and generates
20368 objects that can only be linked by the GNU linker. However, the option
20369 does not affect the ABI of the final executable; it only affects the ABI
20370 of relocatable objects. Using @option{-mno-shared} generally makes
20371 executables both smaller and quicker.
20372
20373 @option{-mshared} is the default.
20374
20375 @item -mplt
20376 @itemx -mno-plt
20377 @opindex mplt
20378 @opindex mno-plt
20379 Assume (do not assume) that the static and dynamic linkers
20380 support PLTs and copy relocations. This option only affects
20381 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
20382 has no effect without @option{-msym32}.
20383
20384 You can make @option{-mplt} the default by configuring
20385 GCC with @option{--with-mips-plt}. The default is
20386 @option{-mno-plt} otherwise.
20387
20388 @item -mxgot
20389 @itemx -mno-xgot
20390 @opindex mxgot
20391 @opindex mno-xgot
20392 Lift (do not lift) the usual restrictions on the size of the global
20393 offset table.
20394
20395 GCC normally uses a single instruction to load values from the GOT@.
20396 While this is relatively efficient, it only works if the GOT
20397 is smaller than about 64k. Anything larger causes the linker
20398 to report an error such as:
20399
20400 @cindex relocation truncated to fit (MIPS)
20401 @smallexample
20402 relocation truncated to fit: R_MIPS_GOT16 foobar
20403 @end smallexample
20404
20405 If this happens, you should recompile your code with @option{-mxgot}.
20406 This works with very large GOTs, although the code is also
20407 less efficient, since it takes three instructions to fetch the
20408 value of a global symbol.
20409
20410 Note that some linkers can create multiple GOTs. If you have such a
20411 linker, you should only need to use @option{-mxgot} when a single object
20412 file accesses more than 64k's worth of GOT entries. Very few do.
20413
20414 These options have no effect unless GCC is generating position
20415 independent code.
20416
20417 @item -mgp32
20418 @opindex mgp32
20419 Assume that general-purpose registers are 32 bits wide.
20420
20421 @item -mgp64
20422 @opindex mgp64
20423 Assume that general-purpose registers are 64 bits wide.
20424
20425 @item -mfp32
20426 @opindex mfp32
20427 Assume that floating-point registers are 32 bits wide.
20428
20429 @item -mfp64
20430 @opindex mfp64
20431 Assume that floating-point registers are 64 bits wide.
20432
20433 @item -mfpxx
20434 @opindex mfpxx
20435 Do not assume the width of floating-point registers.
20436
20437 @item -mhard-float
20438 @opindex mhard-float
20439 Use floating-point coprocessor instructions.
20440
20441 @item -msoft-float
20442 @opindex msoft-float
20443 Do not use floating-point coprocessor instructions. Implement
20444 floating-point calculations using library calls instead.
20445
20446 @item -mno-float
20447 @opindex mno-float
20448 Equivalent to @option{-msoft-float}, but additionally asserts that the
20449 program being compiled does not perform any floating-point operations.
20450 This option is presently supported only by some bare-metal MIPS
20451 configurations, where it may select a special set of libraries
20452 that lack all floating-point support (including, for example, the
20453 floating-point @code{printf} formats).
20454 If code compiled with @option{-mno-float} accidentally contains
20455 floating-point operations, it is likely to suffer a link-time
20456 or run-time failure.
20457
20458 @item -msingle-float
20459 @opindex msingle-float
20460 Assume that the floating-point coprocessor only supports single-precision
20461 operations.
20462
20463 @item -mdouble-float
20464 @opindex mdouble-float
20465 Assume that the floating-point coprocessor supports double-precision
20466 operations. This is the default.
20467
20468 @item -modd-spreg
20469 @itemx -mno-odd-spreg
20470 @opindex modd-spreg
20471 @opindex mno-odd-spreg
20472 Enable the use of odd-numbered single-precision floating-point registers
20473 for the o32 ABI. This is the default for processors that are known to
20474 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
20475 is set by default.
20476
20477 @item -mabs=2008
20478 @itemx -mabs=legacy
20479 @opindex mabs=2008
20480 @opindex mabs=legacy
20481 These options control the treatment of the special not-a-number (NaN)
20482 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
20483 @code{neg.@i{fmt}} machine instructions.
20484
20485 By default or when @option{-mabs=legacy} is used the legacy
20486 treatment is selected. In this case these instructions are considered
20487 arithmetic and avoided where correct operation is required and the
20488 input operand might be a NaN. A longer sequence of instructions that
20489 manipulate the sign bit of floating-point datum manually is used
20490 instead unless the @option{-ffinite-math-only} option has also been
20491 specified.
20492
20493 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
20494 this case these instructions are considered non-arithmetic and therefore
20495 operating correctly in all cases, including in particular where the
20496 input operand is a NaN. These instructions are therefore always used
20497 for the respective operations.
20498
20499 @item -mnan=2008
20500 @itemx -mnan=legacy
20501 @opindex mnan=2008
20502 @opindex mnan=legacy
20503 These options control the encoding of the special not-a-number (NaN)
20504 IEEE 754 floating-point data.
20505
20506 The @option{-mnan=legacy} option selects the legacy encoding. In this
20507 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
20508 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
20509 by the first bit of their trailing significand field being 1.
20510
20511 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
20512 this case qNaNs are denoted by the first bit of their trailing
20513 significand field being 1, whereas sNaNs are denoted by the first bit of
20514 their trailing significand field being 0.
20515
20516 The default is @option{-mnan=legacy} unless GCC has been configured with
20517 @option{--with-nan=2008}.
20518
20519 @item -mllsc
20520 @itemx -mno-llsc
20521 @opindex mllsc
20522 @opindex mno-llsc
20523 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
20524 implement atomic memory built-in functions. When neither option is
20525 specified, GCC uses the instructions if the target architecture
20526 supports them.
20527
20528 @option{-mllsc} is useful if the runtime environment can emulate the
20529 instructions and @option{-mno-llsc} can be useful when compiling for
20530 nonstandard ISAs. You can make either option the default by
20531 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
20532 respectively. @option{--with-llsc} is the default for some
20533 configurations; see the installation documentation for details.
20534
20535 @item -mdsp
20536 @itemx -mno-dsp
20537 @opindex mdsp
20538 @opindex mno-dsp
20539 Use (do not use) revision 1 of the MIPS DSP ASE@.
20540 @xref{MIPS DSP Built-in Functions}. This option defines the
20541 preprocessor macro @code{__mips_dsp}. It also defines
20542 @code{__mips_dsp_rev} to 1.
20543
20544 @item -mdspr2
20545 @itemx -mno-dspr2
20546 @opindex mdspr2
20547 @opindex mno-dspr2
20548 Use (do not use) revision 2 of the MIPS DSP ASE@.
20549 @xref{MIPS DSP Built-in Functions}. This option defines the
20550 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
20551 It also defines @code{__mips_dsp_rev} to 2.
20552
20553 @item -msmartmips
20554 @itemx -mno-smartmips
20555 @opindex msmartmips
20556 @opindex mno-smartmips
20557 Use (do not use) the MIPS SmartMIPS ASE.
20558
20559 @item -mpaired-single
20560 @itemx -mno-paired-single
20561 @opindex mpaired-single
20562 @opindex mno-paired-single
20563 Use (do not use) paired-single floating-point instructions.
20564 @xref{MIPS Paired-Single Support}. This option requires
20565 hardware floating-point support to be enabled.
20566
20567 @item -mdmx
20568 @itemx -mno-mdmx
20569 @opindex mdmx
20570 @opindex mno-mdmx
20571 Use (do not use) MIPS Digital Media Extension instructions.
20572 This option can only be used when generating 64-bit code and requires
20573 hardware floating-point support to be enabled.
20574
20575 @item -mips3d
20576 @itemx -mno-mips3d
20577 @opindex mips3d
20578 @opindex mno-mips3d
20579 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
20580 The option @option{-mips3d} implies @option{-mpaired-single}.
20581
20582 @item -mmicromips
20583 @itemx -mno-micromips
20584 @opindex mmicromips
20585 @opindex mno-mmicromips
20586 Generate (do not generate) microMIPS code.
20587
20588 MicroMIPS code generation can also be controlled on a per-function basis
20589 by means of @code{micromips} and @code{nomicromips} attributes.
20590 @xref{Function Attributes}, for more information.
20591
20592 @item -mmt
20593 @itemx -mno-mt
20594 @opindex mmt
20595 @opindex mno-mt
20596 Use (do not use) MT Multithreading instructions.
20597
20598 @item -mmcu
20599 @itemx -mno-mcu
20600 @opindex mmcu
20601 @opindex mno-mcu
20602 Use (do not use) the MIPS MCU ASE instructions.
20603
20604 @item -meva
20605 @itemx -mno-eva
20606 @opindex meva
20607 @opindex mno-eva
20608 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
20609
20610 @item -mvirt
20611 @itemx -mno-virt
20612 @opindex mvirt
20613 @opindex mno-virt
20614 Use (do not use) the MIPS Virtualization (VZ) instructions.
20615
20616 @item -mxpa
20617 @itemx -mno-xpa
20618 @opindex mxpa
20619 @opindex mno-xpa
20620 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
20621
20622 @item -mlong64
20623 @opindex mlong64
20624 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
20625 an explanation of the default and the way that the pointer size is
20626 determined.
20627
20628 @item -mlong32
20629 @opindex mlong32
20630 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
20631
20632 The default size of @code{int}s, @code{long}s and pointers depends on
20633 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
20634 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
20635 32-bit @code{long}s. Pointers are the same size as @code{long}s,
20636 or the same size as integer registers, whichever is smaller.
20637
20638 @item -msym32
20639 @itemx -mno-sym32
20640 @opindex msym32
20641 @opindex mno-sym32
20642 Assume (do not assume) that all symbols have 32-bit values, regardless
20643 of the selected ABI@. This option is useful in combination with
20644 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
20645 to generate shorter and faster references to symbolic addresses.
20646
20647 @item -G @var{num}
20648 @opindex G
20649 Put definitions of externally-visible data in a small data section
20650 if that data is no bigger than @var{num} bytes. GCC can then generate
20651 more efficient accesses to the data; see @option{-mgpopt} for details.
20652
20653 The default @option{-G} option depends on the configuration.
20654
20655 @item -mlocal-sdata
20656 @itemx -mno-local-sdata
20657 @opindex mlocal-sdata
20658 @opindex mno-local-sdata
20659 Extend (do not extend) the @option{-G} behavior to local data too,
20660 such as to static variables in C@. @option{-mlocal-sdata} is the
20661 default for all configurations.
20662
20663 If the linker complains that an application is using too much small data,
20664 you might want to try rebuilding the less performance-critical parts with
20665 @option{-mno-local-sdata}. You might also want to build large
20666 libraries with @option{-mno-local-sdata}, so that the libraries leave
20667 more room for the main program.
20668
20669 @item -mextern-sdata
20670 @itemx -mno-extern-sdata
20671 @opindex mextern-sdata
20672 @opindex mno-extern-sdata
20673 Assume (do not assume) that externally-defined data is in
20674 a small data section if the size of that data is within the @option{-G} limit.
20675 @option{-mextern-sdata} is the default for all configurations.
20676
20677 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
20678 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
20679 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
20680 is placed in a small data section. If @var{Var} is defined by another
20681 module, you must either compile that module with a high-enough
20682 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
20683 definition. If @var{Var} is common, you must link the application
20684 with a high-enough @option{-G} setting.
20685
20686 The easiest way of satisfying these restrictions is to compile
20687 and link every module with the same @option{-G} option. However,
20688 you may wish to build a library that supports several different
20689 small data limits. You can do this by compiling the library with
20690 the highest supported @option{-G} setting and additionally using
20691 @option{-mno-extern-sdata} to stop the library from making assumptions
20692 about externally-defined data.
20693
20694 @item -mgpopt
20695 @itemx -mno-gpopt
20696 @opindex mgpopt
20697 @opindex mno-gpopt
20698 Use (do not use) GP-relative accesses for symbols that are known to be
20699 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
20700 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
20701 configurations.
20702
20703 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
20704 might not hold the value of @code{_gp}. For example, if the code is
20705 part of a library that might be used in a boot monitor, programs that
20706 call boot monitor routines pass an unknown value in @code{$gp}.
20707 (In such situations, the boot monitor itself is usually compiled
20708 with @option{-G0}.)
20709
20710 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
20711 @option{-mno-extern-sdata}.
20712
20713 @item -membedded-data
20714 @itemx -mno-embedded-data
20715 @opindex membedded-data
20716 @opindex mno-embedded-data
20717 Allocate variables to the read-only data section first if possible, then
20718 next in the small data section if possible, otherwise in data. This gives
20719 slightly slower code than the default, but reduces the amount of RAM required
20720 when executing, and thus may be preferred for some embedded systems.
20721
20722 @item -muninit-const-in-rodata
20723 @itemx -mno-uninit-const-in-rodata
20724 @opindex muninit-const-in-rodata
20725 @opindex mno-uninit-const-in-rodata
20726 Put uninitialized @code{const} variables in the read-only data section.
20727 This option is only meaningful in conjunction with @option{-membedded-data}.
20728
20729 @item -mcode-readable=@var{setting}
20730 @opindex mcode-readable
20731 Specify whether GCC may generate code that reads from executable sections.
20732 There are three possible settings:
20733
20734 @table @gcctabopt
20735 @item -mcode-readable=yes
20736 Instructions may freely access executable sections. This is the
20737 default setting.
20738
20739 @item -mcode-readable=pcrel
20740 MIPS16 PC-relative load instructions can access executable sections,
20741 but other instructions must not do so. This option is useful on 4KSc
20742 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
20743 It is also useful on processors that can be configured to have a dual
20744 instruction/data SRAM interface and that, like the M4K, automatically
20745 redirect PC-relative loads to the instruction RAM.
20746
20747 @item -mcode-readable=no
20748 Instructions must not access executable sections. This option can be
20749 useful on targets that are configured to have a dual instruction/data
20750 SRAM interface but that (unlike the M4K) do not automatically redirect
20751 PC-relative loads to the instruction RAM.
20752 @end table
20753
20754 @item -msplit-addresses
20755 @itemx -mno-split-addresses
20756 @opindex msplit-addresses
20757 @opindex mno-split-addresses
20758 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
20759 relocation operators. This option has been superseded by
20760 @option{-mexplicit-relocs} but is retained for backwards compatibility.
20761
20762 @item -mexplicit-relocs
20763 @itemx -mno-explicit-relocs
20764 @opindex mexplicit-relocs
20765 @opindex mno-explicit-relocs
20766 Use (do not use) assembler relocation operators when dealing with symbolic
20767 addresses. The alternative, selected by @option{-mno-explicit-relocs},
20768 is to use assembler macros instead.
20769
20770 @option{-mexplicit-relocs} is the default if GCC was configured
20771 to use an assembler that supports relocation operators.
20772
20773 @item -mcheck-zero-division
20774 @itemx -mno-check-zero-division
20775 @opindex mcheck-zero-division
20776 @opindex mno-check-zero-division
20777 Trap (do not trap) on integer division by zero.
20778
20779 The default is @option{-mcheck-zero-division}.
20780
20781 @item -mdivide-traps
20782 @itemx -mdivide-breaks
20783 @opindex mdivide-traps
20784 @opindex mdivide-breaks
20785 MIPS systems check for division by zero by generating either a
20786 conditional trap or a break instruction. Using traps results in
20787 smaller code, but is only supported on MIPS II and later. Also, some
20788 versions of the Linux kernel have a bug that prevents trap from
20789 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
20790 allow conditional traps on architectures that support them and
20791 @option{-mdivide-breaks} to force the use of breaks.
20792
20793 The default is usually @option{-mdivide-traps}, but this can be
20794 overridden at configure time using @option{--with-divide=breaks}.
20795 Divide-by-zero checks can be completely disabled using
20796 @option{-mno-check-zero-division}.
20797
20798 @item -mload-store-pairs
20799 @itemx -mno-load-store-pairs
20800 @opindex mload-store-pairs
20801 @opindex mno-load-store-pairs
20802 Enable (disable) an optimization that pairs consecutive load or store
20803 instructions to enable load/store bonding. This option is enabled by
20804 default but only takes effect when the selected architecture is known
20805 to support bonding.
20806
20807 @item -mmemcpy
20808 @itemx -mno-memcpy
20809 @opindex mmemcpy
20810 @opindex mno-memcpy
20811 Force (do not force) the use of @code{memcpy} for non-trivial block
20812 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
20813 most constant-sized copies.
20814
20815 @item -mlong-calls
20816 @itemx -mno-long-calls
20817 @opindex mlong-calls
20818 @opindex mno-long-calls
20819 Disable (do not disable) use of the @code{jal} instruction. Calling
20820 functions using @code{jal} is more efficient but requires the caller
20821 and callee to be in the same 256 megabyte segment.
20822
20823 This option has no effect on abicalls code. The default is
20824 @option{-mno-long-calls}.
20825
20826 @item -mmad
20827 @itemx -mno-mad
20828 @opindex mmad
20829 @opindex mno-mad
20830 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
20831 instructions, as provided by the R4650 ISA@.
20832
20833 @item -mimadd
20834 @itemx -mno-imadd
20835 @opindex mimadd
20836 @opindex mno-imadd
20837 Enable (disable) use of the @code{madd} and @code{msub} integer
20838 instructions. The default is @option{-mimadd} on architectures
20839 that support @code{madd} and @code{msub} except for the 74k
20840 architecture where it was found to generate slower code.
20841
20842 @item -mfused-madd
20843 @itemx -mno-fused-madd
20844 @opindex mfused-madd
20845 @opindex mno-fused-madd
20846 Enable (disable) use of the floating-point multiply-accumulate
20847 instructions, when they are available. The default is
20848 @option{-mfused-madd}.
20849
20850 On the R8000 CPU when multiply-accumulate instructions are used,
20851 the intermediate product is calculated to infinite precision
20852 and is not subject to the FCSR Flush to Zero bit. This may be
20853 undesirable in some circumstances. On other processors the result
20854 is numerically identical to the equivalent computation using
20855 separate multiply, add, subtract and negate instructions.
20856
20857 @item -nocpp
20858 @opindex nocpp
20859 Tell the MIPS assembler to not run its preprocessor over user
20860 assembler files (with a @samp{.s} suffix) when assembling them.
20861
20862 @item -mfix-24k
20863 @itemx -mno-fix-24k
20864 @opindex mfix-24k
20865 @opindex mno-fix-24k
20866 Work around the 24K E48 (lost data on stores during refill) errata.
20867 The workarounds are implemented by the assembler rather than by GCC@.
20868
20869 @item -mfix-r4000
20870 @itemx -mno-fix-r4000
20871 @opindex mfix-r4000
20872 @opindex mno-fix-r4000
20873 Work around certain R4000 CPU errata:
20874 @itemize @minus
20875 @item
20876 A double-word or a variable shift may give an incorrect result if executed
20877 immediately after starting an integer division.
20878 @item
20879 A double-word or a variable shift may give an incorrect result if executed
20880 while an integer multiplication is in progress.
20881 @item
20882 An integer division may give an incorrect result if started in a delay slot
20883 of a taken branch or a jump.
20884 @end itemize
20885
20886 @item -mfix-r4400
20887 @itemx -mno-fix-r4400
20888 @opindex mfix-r4400
20889 @opindex mno-fix-r4400
20890 Work around certain R4400 CPU errata:
20891 @itemize @minus
20892 @item
20893 A double-word or a variable shift may give an incorrect result if executed
20894 immediately after starting an integer division.
20895 @end itemize
20896
20897 @item -mfix-r10000
20898 @itemx -mno-fix-r10000
20899 @opindex mfix-r10000
20900 @opindex mno-fix-r10000
20901 Work around certain R10000 errata:
20902 @itemize @minus
20903 @item
20904 @code{ll}/@code{sc} sequences may not behave atomically on revisions
20905 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
20906 @end itemize
20907
20908 This option can only be used if the target architecture supports
20909 branch-likely instructions. @option{-mfix-r10000} is the default when
20910 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
20911 otherwise.
20912
20913 @item -mfix-rm7000
20914 @itemx -mno-fix-rm7000
20915 @opindex mfix-rm7000
20916 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
20917 workarounds are implemented by the assembler rather than by GCC@.
20918
20919 @item -mfix-vr4120
20920 @itemx -mno-fix-vr4120
20921 @opindex mfix-vr4120
20922 Work around certain VR4120 errata:
20923 @itemize @minus
20924 @item
20925 @code{dmultu} does not always produce the correct result.
20926 @item
20927 @code{div} and @code{ddiv} do not always produce the correct result if one
20928 of the operands is negative.
20929 @end itemize
20930 The workarounds for the division errata rely on special functions in
20931 @file{libgcc.a}. At present, these functions are only provided by
20932 the @code{mips64vr*-elf} configurations.
20933
20934 Other VR4120 errata require a NOP to be inserted between certain pairs of
20935 instructions. These errata are handled by the assembler, not by GCC itself.
20936
20937 @item -mfix-vr4130
20938 @opindex mfix-vr4130
20939 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
20940 workarounds are implemented by the assembler rather than by GCC,
20941 although GCC avoids using @code{mflo} and @code{mfhi} if the
20942 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
20943 instructions are available instead.
20944
20945 @item -mfix-sb1
20946 @itemx -mno-fix-sb1
20947 @opindex mfix-sb1
20948 Work around certain SB-1 CPU core errata.
20949 (This flag currently works around the SB-1 revision 2
20950 ``F1'' and ``F2'' floating-point errata.)
20951
20952 @item -mr10k-cache-barrier=@var{setting}
20953 @opindex mr10k-cache-barrier
20954 Specify whether GCC should insert cache barriers to avoid the
20955 side effects of speculation on R10K processors.
20956
20957 In common with many processors, the R10K tries to predict the outcome
20958 of a conditional branch and speculatively executes instructions from
20959 the ``taken'' branch. It later aborts these instructions if the
20960 predicted outcome is wrong. However, on the R10K, even aborted
20961 instructions can have side effects.
20962
20963 This problem only affects kernel stores and, depending on the system,
20964 kernel loads. As an example, a speculatively-executed store may load
20965 the target memory into cache and mark the cache line as dirty, even if
20966 the store itself is later aborted. If a DMA operation writes to the
20967 same area of memory before the ``dirty'' line is flushed, the cached
20968 data overwrites the DMA-ed data. See the R10K processor manual
20969 for a full description, including other potential problems.
20970
20971 One workaround is to insert cache barrier instructions before every memory
20972 access that might be speculatively executed and that might have side
20973 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
20974 controls GCC's implementation of this workaround. It assumes that
20975 aborted accesses to any byte in the following regions does not have
20976 side effects:
20977
20978 @enumerate
20979 @item
20980 the memory occupied by the current function's stack frame;
20981
20982 @item
20983 the memory occupied by an incoming stack argument;
20984
20985 @item
20986 the memory occupied by an object with a link-time-constant address.
20987 @end enumerate
20988
20989 It is the kernel's responsibility to ensure that speculative
20990 accesses to these regions are indeed safe.
20991
20992 If the input program contains a function declaration such as:
20993
20994 @smallexample
20995 void foo (void);
20996 @end smallexample
20997
20998 then the implementation of @code{foo} must allow @code{j foo} and
20999 @code{jal foo} to be executed speculatively. GCC honors this
21000 restriction for functions it compiles itself. It expects non-GCC
21001 functions (such as hand-written assembly code) to do the same.
21002
21003 The option has three forms:
21004
21005 @table @gcctabopt
21006 @item -mr10k-cache-barrier=load-store
21007 Insert a cache barrier before a load or store that might be
21008 speculatively executed and that might have side effects even
21009 if aborted.
21010
21011 @item -mr10k-cache-barrier=store
21012 Insert a cache barrier before a store that might be speculatively
21013 executed and that might have side effects even if aborted.
21014
21015 @item -mr10k-cache-barrier=none
21016 Disable the insertion of cache barriers. This is the default setting.
21017 @end table
21018
21019 @item -mflush-func=@var{func}
21020 @itemx -mno-flush-func
21021 @opindex mflush-func
21022 Specifies the function to call to flush the I and D caches, or to not
21023 call any such function. If called, the function must take the same
21024 arguments as the common @code{_flush_func}, that is, the address of the
21025 memory range for which the cache is being flushed, the size of the
21026 memory range, and the number 3 (to flush both caches). The default
21027 depends on the target GCC was configured for, but commonly is either
21028 @code{_flush_func} or @code{__cpu_flush}.
21029
21030 @item mbranch-cost=@var{num}
21031 @opindex mbranch-cost
21032 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21033 This cost is only a heuristic and is not guaranteed to produce
21034 consistent results across releases. A zero cost redundantly selects
21035 the default, which is based on the @option{-mtune} setting.
21036
21037 @item -mbranch-likely
21038 @itemx -mno-branch-likely
21039 @opindex mbranch-likely
21040 @opindex mno-branch-likely
21041 Enable or disable use of Branch Likely instructions, regardless of the
21042 default for the selected architecture. By default, Branch Likely
21043 instructions may be generated if they are supported by the selected
21044 architecture. An exception is for the MIPS32 and MIPS64 architectures
21045 and processors that implement those architectures; for those, Branch
21046 Likely instructions are not be generated by default because the MIPS32
21047 and MIPS64 architectures specifically deprecate their use.
21048
21049 @item -mcompact-branches=never
21050 @itemx -mcompact-branches=optimal
21051 @itemx -mcompact-branches=always
21052 @opindex mcompact-branches=never
21053 @opindex mcompact-branches=optimal
21054 @opindex mcompact-branches=always
21055 These options control which form of branches will be generated. The
21056 default is @option{-mcompact-branches=optimal}.
21057
21058 The @option{-mcompact-branches=never} option ensures that compact branch
21059 instructions will never be generated.
21060
21061 The @option{-mcompact-branches=always} option ensures that a compact
21062 branch instruction will be generated if available. If a compact branch
21063 instruction is not available, a delay slot form of the branch will be
21064 used instead.
21065
21066 This option is supported from MIPS Release 6 onwards.
21067
21068 The @option{-mcompact-branches=optimal} option will cause a delay slot
21069 branch to be used if one is available in the current ISA and the delay
21070 slot is successfully filled. If the delay slot is not filled, a compact
21071 branch will be chosen if one is available.
21072
21073 @item -mfp-exceptions
21074 @itemx -mno-fp-exceptions
21075 @opindex mfp-exceptions
21076 Specifies whether FP exceptions are enabled. This affects how
21077 FP instructions are scheduled for some processors.
21078 The default is that FP exceptions are
21079 enabled.
21080
21081 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
21082 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
21083 FP pipe.
21084
21085 @item -mvr4130-align
21086 @itemx -mno-vr4130-align
21087 @opindex mvr4130-align
21088 The VR4130 pipeline is two-way superscalar, but can only issue two
21089 instructions together if the first one is 8-byte aligned. When this
21090 option is enabled, GCC aligns pairs of instructions that it
21091 thinks should execute in parallel.
21092
21093 This option only has an effect when optimizing for the VR4130.
21094 It normally makes code faster, but at the expense of making it bigger.
21095 It is enabled by default at optimization level @option{-O3}.
21096
21097 @item -msynci
21098 @itemx -mno-synci
21099 @opindex msynci
21100 Enable (disable) generation of @code{synci} instructions on
21101 architectures that support it. The @code{synci} instructions (if
21102 enabled) are generated when @code{__builtin___clear_cache} is
21103 compiled.
21104
21105 This option defaults to @option{-mno-synci}, but the default can be
21106 overridden by configuring GCC with @option{--with-synci}.
21107
21108 When compiling code for single processor systems, it is generally safe
21109 to use @code{synci}. However, on many multi-core (SMP) systems, it
21110 does not invalidate the instruction caches on all cores and may lead
21111 to undefined behavior.
21112
21113 @item -mrelax-pic-calls
21114 @itemx -mno-relax-pic-calls
21115 @opindex mrelax-pic-calls
21116 Try to turn PIC calls that are normally dispatched via register
21117 @code{$25} into direct calls. This is only possible if the linker can
21118 resolve the destination at link time and if the destination is within
21119 range for a direct call.
21120
21121 @option{-mrelax-pic-calls} is the default if GCC was configured to use
21122 an assembler and a linker that support the @code{.reloc} assembly
21123 directive and @option{-mexplicit-relocs} is in effect. With
21124 @option{-mno-explicit-relocs}, this optimization can be performed by the
21125 assembler and the linker alone without help from the compiler.
21126
21127 @item -mmcount-ra-address
21128 @itemx -mno-mcount-ra-address
21129 @opindex mmcount-ra-address
21130 @opindex mno-mcount-ra-address
21131 Emit (do not emit) code that allows @code{_mcount} to modify the
21132 calling function's return address. When enabled, this option extends
21133 the usual @code{_mcount} interface with a new @var{ra-address}
21134 parameter, which has type @code{intptr_t *} and is passed in register
21135 @code{$12}. @code{_mcount} can then modify the return address by
21136 doing both of the following:
21137 @itemize
21138 @item
21139 Returning the new address in register @code{$31}.
21140 @item
21141 Storing the new address in @code{*@var{ra-address}},
21142 if @var{ra-address} is nonnull.
21143 @end itemize
21144
21145 The default is @option{-mno-mcount-ra-address}.
21146
21147 @item -mframe-header-opt
21148 @itemx -mno-frame-header-opt
21149 @opindex mframe-header-opt
21150 Enable (disable) frame header optimization in the o32 ABI. When using the
21151 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
21152 function to write out register arguments. When enabled, this optimization
21153 will suppress the allocation of the frame header if it can be determined that
21154 it is unused.
21155
21156 This optimization is off by default at all optimization levels.
21157
21158 @item -mlxc1-sxc1
21159 @itemx -mno-lxc1-sxc1
21160 @opindex mlxc1-sxc1
21161 When applicable, enable (disable) the generation of @code{lwxc1},
21162 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
21163
21164 @item -mmadd4
21165 @itemx -mno-madd4
21166 @opindex mmadd4
21167 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
21168 @code{madd.d} and related instructions. Enabled by default.
21169
21170 @end table
21171
21172 @node MMIX Options
21173 @subsection MMIX Options
21174 @cindex MMIX Options
21175
21176 These options are defined for the MMIX:
21177
21178 @table @gcctabopt
21179 @item -mlibfuncs
21180 @itemx -mno-libfuncs
21181 @opindex mlibfuncs
21182 @opindex mno-libfuncs
21183 Specify that intrinsic library functions are being compiled, passing all
21184 values in registers, no matter the size.
21185
21186 @item -mepsilon
21187 @itemx -mno-epsilon
21188 @opindex mepsilon
21189 @opindex mno-epsilon
21190 Generate floating-point comparison instructions that compare with respect
21191 to the @code{rE} epsilon register.
21192
21193 @item -mabi=mmixware
21194 @itemx -mabi=gnu
21195 @opindex mabi=mmixware
21196 @opindex mabi=gnu
21197 Generate code that passes function parameters and return values that (in
21198 the called function) are seen as registers @code{$0} and up, as opposed to
21199 the GNU ABI which uses global registers @code{$231} and up.
21200
21201 @item -mzero-extend
21202 @itemx -mno-zero-extend
21203 @opindex mzero-extend
21204 @opindex mno-zero-extend
21205 When reading data from memory in sizes shorter than 64 bits, use (do not
21206 use) zero-extending load instructions by default, rather than
21207 sign-extending ones.
21208
21209 @item -mknuthdiv
21210 @itemx -mno-knuthdiv
21211 @opindex mknuthdiv
21212 @opindex mno-knuthdiv
21213 Make the result of a division yielding a remainder have the same sign as
21214 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
21215 remainder follows the sign of the dividend. Both methods are
21216 arithmetically valid, the latter being almost exclusively used.
21217
21218 @item -mtoplevel-symbols
21219 @itemx -mno-toplevel-symbols
21220 @opindex mtoplevel-symbols
21221 @opindex mno-toplevel-symbols
21222 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
21223 code can be used with the @code{PREFIX} assembly directive.
21224
21225 @item -melf
21226 @opindex melf
21227 Generate an executable in the ELF format, rather than the default
21228 @samp{mmo} format used by the @command{mmix} simulator.
21229
21230 @item -mbranch-predict
21231 @itemx -mno-branch-predict
21232 @opindex mbranch-predict
21233 @opindex mno-branch-predict
21234 Use (do not use) the probable-branch instructions, when static branch
21235 prediction indicates a probable branch.
21236
21237 @item -mbase-addresses
21238 @itemx -mno-base-addresses
21239 @opindex mbase-addresses
21240 @opindex mno-base-addresses
21241 Generate (do not generate) code that uses @emph{base addresses}. Using a
21242 base address automatically generates a request (handled by the assembler
21243 and the linker) for a constant to be set up in a global register. The
21244 register is used for one or more base address requests within the range 0
21245 to 255 from the value held in the register. The generally leads to short
21246 and fast code, but the number of different data items that can be
21247 addressed is limited. This means that a program that uses lots of static
21248 data may require @option{-mno-base-addresses}.
21249
21250 @item -msingle-exit
21251 @itemx -mno-single-exit
21252 @opindex msingle-exit
21253 @opindex mno-single-exit
21254 Force (do not force) generated code to have a single exit point in each
21255 function.
21256 @end table
21257
21258 @node MN10300 Options
21259 @subsection MN10300 Options
21260 @cindex MN10300 options
21261
21262 These @option{-m} options are defined for Matsushita MN10300 architectures:
21263
21264 @table @gcctabopt
21265 @item -mmult-bug
21266 @opindex mmult-bug
21267 Generate code to avoid bugs in the multiply instructions for the MN10300
21268 processors. This is the default.
21269
21270 @item -mno-mult-bug
21271 @opindex mno-mult-bug
21272 Do not generate code to avoid bugs in the multiply instructions for the
21273 MN10300 processors.
21274
21275 @item -mam33
21276 @opindex mam33
21277 Generate code using features specific to the AM33 processor.
21278
21279 @item -mno-am33
21280 @opindex mno-am33
21281 Do not generate code using features specific to the AM33 processor. This
21282 is the default.
21283
21284 @item -mam33-2
21285 @opindex mam33-2
21286 Generate code using features specific to the AM33/2.0 processor.
21287
21288 @item -mam34
21289 @opindex mam34
21290 Generate code using features specific to the AM34 processor.
21291
21292 @item -mtune=@var{cpu-type}
21293 @opindex mtune
21294 Use the timing characteristics of the indicated CPU type when
21295 scheduling instructions. This does not change the targeted processor
21296 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
21297 @samp{am33-2} or @samp{am34}.
21298
21299 @item -mreturn-pointer-on-d0
21300 @opindex mreturn-pointer-on-d0
21301 When generating a function that returns a pointer, return the pointer
21302 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
21303 only in @code{a0}, and attempts to call such functions without a prototype
21304 result in errors. Note that this option is on by default; use
21305 @option{-mno-return-pointer-on-d0} to disable it.
21306
21307 @item -mno-crt0
21308 @opindex mno-crt0
21309 Do not link in the C run-time initialization object file.
21310
21311 @item -mrelax
21312 @opindex mrelax
21313 Indicate to the linker that it should perform a relaxation optimization pass
21314 to shorten branches, calls and absolute memory addresses. This option only
21315 has an effect when used on the command line for the final link step.
21316
21317 This option makes symbolic debugging impossible.
21318
21319 @item -mliw
21320 @opindex mliw
21321 Allow the compiler to generate @emph{Long Instruction Word}
21322 instructions if the target is the @samp{AM33} or later. This is the
21323 default. This option defines the preprocessor macro @code{__LIW__}.
21324
21325 @item -mnoliw
21326 @opindex mnoliw
21327 Do not allow the compiler to generate @emph{Long Instruction Word}
21328 instructions. This option defines the preprocessor macro
21329 @code{__NO_LIW__}.
21330
21331 @item -msetlb
21332 @opindex msetlb
21333 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
21334 instructions if the target is the @samp{AM33} or later. This is the
21335 default. This option defines the preprocessor macro @code{__SETLB__}.
21336
21337 @item -mnosetlb
21338 @opindex mnosetlb
21339 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
21340 instructions. This option defines the preprocessor macro
21341 @code{__NO_SETLB__}.
21342
21343 @end table
21344
21345 @node Moxie Options
21346 @subsection Moxie Options
21347 @cindex Moxie Options
21348
21349 @table @gcctabopt
21350
21351 @item -meb
21352 @opindex meb
21353 Generate big-endian code. This is the default for @samp{moxie-*-*}
21354 configurations.
21355
21356 @item -mel
21357 @opindex mel
21358 Generate little-endian code.
21359
21360 @item -mmul.x
21361 @opindex mmul.x
21362 Generate mul.x and umul.x instructions. This is the default for
21363 @samp{moxiebox-*-*} configurations.
21364
21365 @item -mno-crt0
21366 @opindex mno-crt0
21367 Do not link in the C run-time initialization object file.
21368
21369 @end table
21370
21371 @node MSP430 Options
21372 @subsection MSP430 Options
21373 @cindex MSP430 Options
21374
21375 These options are defined for the MSP430:
21376
21377 @table @gcctabopt
21378
21379 @item -masm-hex
21380 @opindex masm-hex
21381 Force assembly output to always use hex constants. Normally such
21382 constants are signed decimals, but this option is available for
21383 testsuite and/or aesthetic purposes.
21384
21385 @item -mmcu=
21386 @opindex mmcu=
21387 Select the MCU to target. This is used to create a C preprocessor
21388 symbol based upon the MCU name, converted to upper case and pre- and
21389 post-fixed with @samp{__}. This in turn is used by the
21390 @file{msp430.h} header file to select an MCU-specific supplementary
21391 header file.
21392
21393 The option also sets the ISA to use. If the MCU name is one that is
21394 known to only support the 430 ISA then that is selected, otherwise the
21395 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
21396 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
21397 name selects the 430X ISA.
21398
21399 In addition an MCU-specific linker script is added to the linker
21400 command line. The script's name is the name of the MCU with
21401 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
21402 command line defines the C preprocessor symbol @code{__XXX__} and
21403 cause the linker to search for a script called @file{xxx.ld}.
21404
21405 This option is also passed on to the assembler.
21406
21407 @item -mwarn-mcu
21408 @itemx -mno-warn-mcu
21409 @opindex mwarn-mcu
21410 @opindex mno-warn-mcu
21411 This option enables or disables warnings about conflicts between the
21412 MCU name specified by the @option{-mmcu} option and the ISA set by the
21413 @option{-mcpu} option and/or the hardware multiply support set by the
21414 @option{-mhwmult} option. It also toggles warnings about unrecognized
21415 MCU names. This option is on by default.
21416
21417 @item -mcpu=
21418 @opindex mcpu=
21419 Specifies the ISA to use. Accepted values are @samp{msp430},
21420 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
21421 @option{-mmcu=} option should be used to select the ISA.
21422
21423 @item -msim
21424 @opindex msim
21425 Link to the simulator runtime libraries and linker script. Overrides
21426 any scripts that would be selected by the @option{-mmcu=} option.
21427
21428 @item -mlarge
21429 @opindex mlarge
21430 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
21431
21432 @item -msmall
21433 @opindex msmall
21434 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
21435
21436 @item -mrelax
21437 @opindex mrelax
21438 This option is passed to the assembler and linker, and allows the
21439 linker to perform certain optimizations that cannot be done until
21440 the final link.
21441
21442 @item mhwmult=
21443 @opindex mhwmult=
21444 Describes the type of hardware multiply supported by the target.
21445 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
21446 for the original 16-bit-only multiply supported by early MCUs.
21447 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
21448 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
21449 A value of @samp{auto} can also be given. This tells GCC to deduce
21450 the hardware multiply support based upon the MCU name provided by the
21451 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
21452 the MCU name is not recognized then no hardware multiply support is
21453 assumed. @code{auto} is the default setting.
21454
21455 Hardware multiplies are normally performed by calling a library
21456 routine. This saves space in the generated code. When compiling at
21457 @option{-O3} or higher however the hardware multiplier is invoked
21458 inline. This makes for bigger, but faster code.
21459
21460 The hardware multiply routines disable interrupts whilst running and
21461 restore the previous interrupt state when they finish. This makes
21462 them safe to use inside interrupt handlers as well as in normal code.
21463
21464 @item -minrt
21465 @opindex minrt
21466 Enable the use of a minimum runtime environment - no static
21467 initializers or constructors. This is intended for memory-constrained
21468 devices. The compiler includes special symbols in some objects
21469 that tell the linker and runtime which code fragments are required.
21470
21471 @item -mcode-region=
21472 @itemx -mdata-region=
21473 @opindex mcode-region
21474 @opindex mdata-region
21475 These options tell the compiler where to place functions and data that
21476 do not have one of the @code{lower}, @code{upper}, @code{either} or
21477 @code{section} attributes. Possible values are @code{lower},
21478 @code{upper}, @code{either} or @code{any}. The first three behave
21479 like the corresponding attribute. The fourth possible value -
21480 @code{any} - is the default. It leaves placement entirely up to the
21481 linker script and how it assigns the standard sections
21482 (@code{.text}, @code{.data}, etc) to the memory regions.
21483
21484 @item -msilicon-errata=
21485 @opindex msilicon-errata
21486 This option passes on a request to assembler to enable the fixes for
21487 the named silicon errata.
21488
21489 @item -msilicon-errata-warn=
21490 @opindex msilicon-errata-warn
21491 This option passes on a request to the assembler to enable warning
21492 messages when a silicon errata might need to be applied.
21493
21494 @end table
21495
21496 @node NDS32 Options
21497 @subsection NDS32 Options
21498 @cindex NDS32 Options
21499
21500 These options are defined for NDS32 implementations:
21501
21502 @table @gcctabopt
21503
21504 @item -mbig-endian
21505 @opindex mbig-endian
21506 Generate code in big-endian mode.
21507
21508 @item -mlittle-endian
21509 @opindex mlittle-endian
21510 Generate code in little-endian mode.
21511
21512 @item -mreduced-regs
21513 @opindex mreduced-regs
21514 Use reduced-set registers for register allocation.
21515
21516 @item -mfull-regs
21517 @opindex mfull-regs
21518 Use full-set registers for register allocation.
21519
21520 @item -mcmov
21521 @opindex mcmov
21522 Generate conditional move instructions.
21523
21524 @item -mno-cmov
21525 @opindex mno-cmov
21526 Do not generate conditional move instructions.
21527
21528 @item -mext-perf
21529 @opindex mperf-ext
21530 Generate performance extension instructions.
21531
21532 @item -mno-ext-perf
21533 @opindex mno-perf-ext
21534 Do not generate performance extension instructions.
21535
21536 @item -mext-perf2
21537 @opindex mperf-ext
21538 Generate performance extension 2 instructions.
21539
21540 @item -mno-ext-perf2
21541 @opindex mno-perf-ext
21542 Do not generate performance extension 2 instructions.
21543
21544 @item -mext-string
21545 @opindex mperf-ext
21546 Generate string extension instructions.
21547
21548 @item -mno-ext-string
21549 @opindex mno-perf-ext
21550 Do not generate string extension instructions.
21551
21552 @item -mv3push
21553 @opindex mv3push
21554 Generate v3 push25/pop25 instructions.
21555
21556 @item -mno-v3push
21557 @opindex mno-v3push
21558 Do not generate v3 push25/pop25 instructions.
21559
21560 @item -m16-bit
21561 @opindex m16-bit
21562 Generate 16-bit instructions.
21563
21564 @item -mno-16-bit
21565 @opindex mno-16-bit
21566 Do not generate 16-bit instructions.
21567
21568 @item -misr-vector-size=@var{num}
21569 @opindex misr-vector-size
21570 Specify the size of each interrupt vector, which must be 4 or 16.
21571
21572 @item -mcache-block-size=@var{num}
21573 @opindex mcache-block-size
21574 Specify the size of each cache block,
21575 which must be a power of 2 between 4 and 512.
21576
21577 @item -march=@var{arch}
21578 @opindex march
21579 Specify the name of the target architecture.
21580
21581 @item -mcmodel=@var{code-model}
21582 @opindex mcmodel
21583 Set the code model to one of
21584 @table @asis
21585 @item @samp{small}
21586 All the data and read-only data segments must be within 512KB addressing space.
21587 The text segment must be within 16MB addressing space.
21588 @item @samp{medium}
21589 The data segment must be within 512KB while the read-only data segment can be
21590 within 4GB addressing space. The text segment should be still within 16MB
21591 addressing space.
21592 @item @samp{large}
21593 All the text and data segments can be within 4GB addressing space.
21594 @end table
21595
21596 @item -mctor-dtor
21597 @opindex mctor-dtor
21598 Enable constructor/destructor feature.
21599
21600 @item -mrelax
21601 @opindex mrelax
21602 Guide linker to relax instructions.
21603
21604 @end table
21605
21606 @node Nios II Options
21607 @subsection Nios II Options
21608 @cindex Nios II options
21609 @cindex Altera Nios II options
21610
21611 These are the options defined for the Altera Nios II processor.
21612
21613 @table @gcctabopt
21614
21615 @item -G @var{num}
21616 @opindex G
21617 @cindex smaller data references
21618 Put global and static objects less than or equal to @var{num} bytes
21619 into the small data or BSS sections instead of the normal data or BSS
21620 sections. The default value of @var{num} is 8.
21621
21622 @item -mgpopt=@var{option}
21623 @itemx -mgpopt
21624 @itemx -mno-gpopt
21625 @opindex mgpopt
21626 @opindex mno-gpopt
21627 Generate (do not generate) GP-relative accesses. The following
21628 @var{option} names are recognized:
21629
21630 @table @samp
21631
21632 @item none
21633 Do not generate GP-relative accesses.
21634
21635 @item local
21636 Generate GP-relative accesses for small data objects that are not
21637 external, weak, or uninitialized common symbols.
21638 Also use GP-relative addressing for objects that
21639 have been explicitly placed in a small data section via a @code{section}
21640 attribute.
21641
21642 @item global
21643 As for @samp{local}, but also generate GP-relative accesses for
21644 small data objects that are external, weak, or common. If you use this option,
21645 you must ensure that all parts of your program (including libraries) are
21646 compiled with the same @option{-G} setting.
21647
21648 @item data
21649 Generate GP-relative accesses for all data objects in the program. If you
21650 use this option, the entire data and BSS segments
21651 of your program must fit in 64K of memory and you must use an appropriate
21652 linker script to allocate them within the addressable range of the
21653 global pointer.
21654
21655 @item all
21656 Generate GP-relative addresses for function pointers as well as data
21657 pointers. If you use this option, the entire text, data, and BSS segments
21658 of your program must fit in 64K of memory and you must use an appropriate
21659 linker script to allocate them within the addressable range of the
21660 global pointer.
21661
21662 @end table
21663
21664 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
21665 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
21666
21667 The default is @option{-mgpopt} except when @option{-fpic} or
21668 @option{-fPIC} is specified to generate position-independent code.
21669 Note that the Nios II ABI does not permit GP-relative accesses from
21670 shared libraries.
21671
21672 You may need to specify @option{-mno-gpopt} explicitly when building
21673 programs that include large amounts of small data, including large
21674 GOT data sections. In this case, the 16-bit offset for GP-relative
21675 addressing may not be large enough to allow access to the entire
21676 small data section.
21677
21678 @item -mgprel-sec=@var{regexp}
21679 @opindex mgprel-sec
21680 This option specifies additional section names that can be accessed via
21681 GP-relative addressing. It is most useful in conjunction with
21682 @code{section} attributes on variable declarations
21683 (@pxref{Common Variable Attributes}) and a custom linker script.
21684 The @var{regexp} is a POSIX Extended Regular Expression.
21685
21686 This option does not affect the behavior of the @option{-G} option, and
21687 and the specified sections are in addition to the standard @code{.sdata}
21688 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
21689
21690 @item -mr0rel-sec=@var{regexp}
21691 @opindex mr0rel-sec
21692 This option specifies names of sections that can be accessed via a
21693 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
21694 of the 32-bit address space. It is most useful in conjunction with
21695 @code{section} attributes on variable declarations
21696 (@pxref{Common Variable Attributes}) and a custom linker script.
21697 The @var{regexp} is a POSIX Extended Regular Expression.
21698
21699 In contrast to the use of GP-relative addressing for small data,
21700 zero-based addressing is never generated by default and there are no
21701 conventional section names used in standard linker scripts for sections
21702 in the low or high areas of memory.
21703
21704 @item -mel
21705 @itemx -meb
21706 @opindex mel
21707 @opindex meb
21708 Generate little-endian (default) or big-endian (experimental) code,
21709 respectively.
21710
21711 @item -march=@var{arch}
21712 @opindex march
21713 This specifies the name of the target Nios II architecture. GCC uses this
21714 name to determine what kind of instructions it can emit when generating
21715 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
21716
21717 The preprocessor macro @code{__nios2_arch__} is available to programs,
21718 with value 1 or 2, indicating the targeted ISA level.
21719
21720 @item -mbypass-cache
21721 @itemx -mno-bypass-cache
21722 @opindex mno-bypass-cache
21723 @opindex mbypass-cache
21724 Force all load and store instructions to always bypass cache by
21725 using I/O variants of the instructions. The default is not to
21726 bypass the cache.
21727
21728 @item -mno-cache-volatile
21729 @itemx -mcache-volatile
21730 @opindex mcache-volatile
21731 @opindex mno-cache-volatile
21732 Volatile memory access bypass the cache using the I/O variants of
21733 the load and store instructions. The default is not to bypass the cache.
21734
21735 @item -mno-fast-sw-div
21736 @itemx -mfast-sw-div
21737 @opindex mno-fast-sw-div
21738 @opindex mfast-sw-div
21739 Do not use table-based fast divide for small numbers. The default
21740 is to use the fast divide at @option{-O3} and above.
21741
21742 @item -mno-hw-mul
21743 @itemx -mhw-mul
21744 @itemx -mno-hw-mulx
21745 @itemx -mhw-mulx
21746 @itemx -mno-hw-div
21747 @itemx -mhw-div
21748 @opindex mno-hw-mul
21749 @opindex mhw-mul
21750 @opindex mno-hw-mulx
21751 @opindex mhw-mulx
21752 @opindex mno-hw-div
21753 @opindex mhw-div
21754 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
21755 instructions by the compiler. The default is to emit @code{mul}
21756 and not emit @code{div} and @code{mulx}.
21757
21758 @item -mbmx
21759 @itemx -mno-bmx
21760 @itemx -mcdx
21761 @itemx -mno-cdx
21762 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
21763 CDX (code density) instructions. Enabling these instructions also
21764 requires @option{-march=r2}. Since these instructions are optional
21765 extensions to the R2 architecture, the default is not to emit them.
21766
21767 @item -mcustom-@var{insn}=@var{N}
21768 @itemx -mno-custom-@var{insn}
21769 @opindex mcustom-@var{insn}
21770 @opindex mno-custom-@var{insn}
21771 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
21772 custom instruction with encoding @var{N} when generating code that uses
21773 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
21774 instruction 253 for single-precision floating-point add operations instead
21775 of the default behavior of using a library call.
21776
21777 The following values of @var{insn} are supported. Except as otherwise
21778 noted, floating-point operations are expected to be implemented with
21779 normal IEEE 754 semantics and correspond directly to the C operators or the
21780 equivalent GCC built-in functions (@pxref{Other Builtins}).
21781
21782 Single-precision floating point:
21783 @table @asis
21784
21785 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
21786 Binary arithmetic operations.
21787
21788 @item @samp{fnegs}
21789 Unary negation.
21790
21791 @item @samp{fabss}
21792 Unary absolute value.
21793
21794 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
21795 Comparison operations.
21796
21797 @item @samp{fmins}, @samp{fmaxs}
21798 Floating-point minimum and maximum. These instructions are only
21799 generated if @option{-ffinite-math-only} is specified.
21800
21801 @item @samp{fsqrts}
21802 Unary square root operation.
21803
21804 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
21805 Floating-point trigonometric and exponential functions. These instructions
21806 are only generated if @option{-funsafe-math-optimizations} is also specified.
21807
21808 @end table
21809
21810 Double-precision floating point:
21811 @table @asis
21812
21813 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
21814 Binary arithmetic operations.
21815
21816 @item @samp{fnegd}
21817 Unary negation.
21818
21819 @item @samp{fabsd}
21820 Unary absolute value.
21821
21822 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
21823 Comparison operations.
21824
21825 @item @samp{fmind}, @samp{fmaxd}
21826 Double-precision minimum and maximum. These instructions are only
21827 generated if @option{-ffinite-math-only} is specified.
21828
21829 @item @samp{fsqrtd}
21830 Unary square root operation.
21831
21832 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
21833 Double-precision trigonometric and exponential functions. These instructions
21834 are only generated if @option{-funsafe-math-optimizations} is also specified.
21835
21836 @end table
21837
21838 Conversions:
21839 @table @asis
21840 @item @samp{fextsd}
21841 Conversion from single precision to double precision.
21842
21843 @item @samp{ftruncds}
21844 Conversion from double precision to single precision.
21845
21846 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
21847 Conversion from floating point to signed or unsigned integer types, with
21848 truncation towards zero.
21849
21850 @item @samp{round}
21851 Conversion from single-precision floating point to signed integer,
21852 rounding to the nearest integer and ties away from zero.
21853 This corresponds to the @code{__builtin_lroundf} function when
21854 @option{-fno-math-errno} is used.
21855
21856 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
21857 Conversion from signed or unsigned integer types to floating-point types.
21858
21859 @end table
21860
21861 In addition, all of the following transfer instructions for internal
21862 registers X and Y must be provided to use any of the double-precision
21863 floating-point instructions. Custom instructions taking two
21864 double-precision source operands expect the first operand in the
21865 64-bit register X. The other operand (or only operand of a unary
21866 operation) is given to the custom arithmetic instruction with the
21867 least significant half in source register @var{src1} and the most
21868 significant half in @var{src2}. A custom instruction that returns a
21869 double-precision result returns the most significant 32 bits in the
21870 destination register and the other half in 32-bit register Y.
21871 GCC automatically generates the necessary code sequences to write
21872 register X and/or read register Y when double-precision floating-point
21873 instructions are used.
21874
21875 @table @asis
21876
21877 @item @samp{fwrx}
21878 Write @var{src1} into the least significant half of X and @var{src2} into
21879 the most significant half of X.
21880
21881 @item @samp{fwry}
21882 Write @var{src1} into Y.
21883
21884 @item @samp{frdxhi}, @samp{frdxlo}
21885 Read the most or least (respectively) significant half of X and store it in
21886 @var{dest}.
21887
21888 @item @samp{frdy}
21889 Read the value of Y and store it into @var{dest}.
21890 @end table
21891
21892 Note that you can gain more local control over generation of Nios II custom
21893 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
21894 and @code{target("no-custom-@var{insn}")} function attributes
21895 (@pxref{Function Attributes})
21896 or pragmas (@pxref{Function Specific Option Pragmas}).
21897
21898 @item -mcustom-fpu-cfg=@var{name}
21899 @opindex mcustom-fpu-cfg
21900
21901 This option enables a predefined, named set of custom instruction encodings
21902 (see @option{-mcustom-@var{insn}} above).
21903 Currently, the following sets are defined:
21904
21905 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
21906 @gccoptlist{-mcustom-fmuls=252 @gol
21907 -mcustom-fadds=253 @gol
21908 -mcustom-fsubs=254 @gol
21909 -fsingle-precision-constant}
21910
21911 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
21912 @gccoptlist{-mcustom-fmuls=252 @gol
21913 -mcustom-fadds=253 @gol
21914 -mcustom-fsubs=254 @gol
21915 -mcustom-fdivs=255 @gol
21916 -fsingle-precision-constant}
21917
21918 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
21919 @gccoptlist{-mcustom-floatus=243 @gol
21920 -mcustom-fixsi=244 @gol
21921 -mcustom-floatis=245 @gol
21922 -mcustom-fcmpgts=246 @gol
21923 -mcustom-fcmples=249 @gol
21924 -mcustom-fcmpeqs=250 @gol
21925 -mcustom-fcmpnes=251 @gol
21926 -mcustom-fmuls=252 @gol
21927 -mcustom-fadds=253 @gol
21928 -mcustom-fsubs=254 @gol
21929 -mcustom-fdivs=255 @gol
21930 -fsingle-precision-constant}
21931
21932 Custom instruction assignments given by individual
21933 @option{-mcustom-@var{insn}=} options override those given by
21934 @option{-mcustom-fpu-cfg=}, regardless of the
21935 order of the options on the command line.
21936
21937 Note that you can gain more local control over selection of a FPU
21938 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
21939 function attribute (@pxref{Function Attributes})
21940 or pragma (@pxref{Function Specific Option Pragmas}).
21941
21942 @end table
21943
21944 These additional @samp{-m} options are available for the Altera Nios II
21945 ELF (bare-metal) target:
21946
21947 @table @gcctabopt
21948
21949 @item -mhal
21950 @opindex mhal
21951 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
21952 startup and termination code, and is typically used in conjunction with
21953 @option{-msys-crt0=} to specify the location of the alternate startup code
21954 provided by the HAL BSP.
21955
21956 @item -msmallc
21957 @opindex msmallc
21958 Link with a limited version of the C library, @option{-lsmallc}, rather than
21959 Newlib.
21960
21961 @item -msys-crt0=@var{startfile}
21962 @opindex msys-crt0
21963 @var{startfile} is the file name of the startfile (crt0) to use
21964 when linking. This option is only useful in conjunction with @option{-mhal}.
21965
21966 @item -msys-lib=@var{systemlib}
21967 @opindex msys-lib
21968 @var{systemlib} is the library name of the library that provides
21969 low-level system calls required by the C library,
21970 e.g. @code{read} and @code{write}.
21971 This option is typically used to link with a library provided by a HAL BSP.
21972
21973 @end table
21974
21975 @node Nvidia PTX Options
21976 @subsection Nvidia PTX Options
21977 @cindex Nvidia PTX options
21978 @cindex nvptx options
21979
21980 These options are defined for Nvidia PTX:
21981
21982 @table @gcctabopt
21983
21984 @item -m32
21985 @itemx -m64
21986 @opindex m32
21987 @opindex m64
21988 Generate code for 32-bit or 64-bit ABI.
21989
21990 @item -mmainkernel
21991 @opindex mmainkernel
21992 Link in code for a __main kernel. This is for stand-alone instead of
21993 offloading execution.
21994
21995 @item -moptimize
21996 @opindex moptimize
21997 Apply partitioned execution optimizations. This is the default when any
21998 level of optimization is selected.
21999
22000 @item -msoft-stack
22001 @opindex msoft-stack
22002 Generate code that does not use @code{.local} memory
22003 directly for stack storage. Instead, a per-warp stack pointer is
22004 maintained explicitly. This enables variable-length stack allocation (with
22005 variable-length arrays or @code{alloca}), and when global memory is used for
22006 underlying storage, makes it possible to access automatic variables from other
22007 threads, or with atomic instructions. This code generation variant is used
22008 for OpenMP offloading, but the option is exposed on its own for the purpose
22009 of testing the compiler; to generate code suitable for linking into programs
22010 using OpenMP offloading, use option @option{-mgomp}.
22011
22012 @item -muniform-simt
22013 @opindex muniform-simt
22014 Switch to code generation variant that allows to execute all threads in each
22015 warp, while maintaining memory state and side effects as if only one thread
22016 in each warp was active outside of OpenMP SIMD regions. All atomic operations
22017 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
22018 current lane index equals the master lane index), and the register being
22019 assigned is copied via a shuffle instruction from the master lane. Outside of
22020 SIMD regions lane 0 is the master; inside, each thread sees itself as the
22021 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
22022 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
22023 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
22024 with current lane index to compute the master lane index.
22025
22026 @item -mgomp
22027 @opindex mgomp
22028 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
22029 @option{-muniform-simt} options, and selects corresponding multilib variant.
22030
22031 @end table
22032
22033 @node PDP-11 Options
22034 @subsection PDP-11 Options
22035 @cindex PDP-11 Options
22036
22037 These options are defined for the PDP-11:
22038
22039 @table @gcctabopt
22040 @item -mfpu
22041 @opindex mfpu
22042 Use hardware FPP floating point. This is the default. (FIS floating
22043 point on the PDP-11/40 is not supported.)
22044
22045 @item -msoft-float
22046 @opindex msoft-float
22047 Do not use hardware floating point.
22048
22049 @item -mac0
22050 @opindex mac0
22051 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
22052
22053 @item -mno-ac0
22054 @opindex mno-ac0
22055 Return floating-point results in memory. This is the default.
22056
22057 @item -m40
22058 @opindex m40
22059 Generate code for a PDP-11/40.
22060
22061 @item -m45
22062 @opindex m45
22063 Generate code for a PDP-11/45. This is the default.
22064
22065 @item -m10
22066 @opindex m10
22067 Generate code for a PDP-11/10.
22068
22069 @item -mbcopy-builtin
22070 @opindex mbcopy-builtin
22071 Use inline @code{movmemhi} patterns for copying memory. This is the
22072 default.
22073
22074 @item -mbcopy
22075 @opindex mbcopy
22076 Do not use inline @code{movmemhi} patterns for copying memory.
22077
22078 @item -mint16
22079 @itemx -mno-int32
22080 @opindex mint16
22081 @opindex mno-int32
22082 Use 16-bit @code{int}. This is the default.
22083
22084 @item -mint32
22085 @itemx -mno-int16
22086 @opindex mint32
22087 @opindex mno-int16
22088 Use 32-bit @code{int}.
22089
22090 @item -mfloat64
22091 @itemx -mno-float32
22092 @opindex mfloat64
22093 @opindex mno-float32
22094 Use 64-bit @code{float}. This is the default.
22095
22096 @item -mfloat32
22097 @itemx -mno-float64
22098 @opindex mfloat32
22099 @opindex mno-float64
22100 Use 32-bit @code{float}.
22101
22102 @item -mabshi
22103 @opindex mabshi
22104 Use @code{abshi2} pattern. This is the default.
22105
22106 @item -mno-abshi
22107 @opindex mno-abshi
22108 Do not use @code{abshi2} pattern.
22109
22110 @item -mbranch-expensive
22111 @opindex mbranch-expensive
22112 Pretend that branches are expensive. This is for experimenting with
22113 code generation only.
22114
22115 @item -mbranch-cheap
22116 @opindex mbranch-cheap
22117 Do not pretend that branches are expensive. This is the default.
22118
22119 @item -munix-asm
22120 @opindex munix-asm
22121 Use Unix assembler syntax. This is the default when configured for
22122 @samp{pdp11-*-bsd}.
22123
22124 @item -mdec-asm
22125 @opindex mdec-asm
22126 Use DEC assembler syntax. This is the default when configured for any
22127 PDP-11 target other than @samp{pdp11-*-bsd}.
22128 @end table
22129
22130 @node picoChip Options
22131 @subsection picoChip Options
22132 @cindex picoChip options
22133
22134 These @samp{-m} options are defined for picoChip implementations:
22135
22136 @table @gcctabopt
22137
22138 @item -mae=@var{ae_type}
22139 @opindex mcpu
22140 Set the instruction set, register set, and instruction scheduling
22141 parameters for array element type @var{ae_type}. Supported values
22142 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
22143
22144 @option{-mae=ANY} selects a completely generic AE type. Code
22145 generated with this option runs on any of the other AE types. The
22146 code is not as efficient as it would be if compiled for a specific
22147 AE type, and some types of operation (e.g., multiplication) do not
22148 work properly on all types of AE.
22149
22150 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
22151 for compiled code, and is the default.
22152
22153 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
22154 option may suffer from poor performance of byte (char) manipulation,
22155 since the DSP AE does not provide hardware support for byte load/stores.
22156
22157 @item -msymbol-as-address
22158 Enable the compiler to directly use a symbol name as an address in a
22159 load/store instruction, without first loading it into a
22160 register. Typically, the use of this option generates larger
22161 programs, which run faster than when the option isn't used. However, the
22162 results vary from program to program, so it is left as a user option,
22163 rather than being permanently enabled.
22164
22165 @item -mno-inefficient-warnings
22166 Disables warnings about the generation of inefficient code. These
22167 warnings can be generated, for example, when compiling code that
22168 performs byte-level memory operations on the MAC AE type. The MAC AE has
22169 no hardware support for byte-level memory operations, so all byte
22170 load/stores must be synthesized from word load/store operations. This is
22171 inefficient and a warning is generated to indicate
22172 that you should rewrite the code to avoid byte operations, or to target
22173 an AE type that has the necessary hardware support. This option disables
22174 these warnings.
22175
22176 @end table
22177
22178 @node PowerPC Options
22179 @subsection PowerPC Options
22180 @cindex PowerPC options
22181
22182 These are listed under @xref{RS/6000 and PowerPC Options}.
22183
22184 @node PowerPC SPE Options
22185 @subsection PowerPC SPE Options
22186 @cindex PowerPC SPE options
22187
22188 These @samp{-m} options are defined for PowerPC SPE:
22189 @table @gcctabopt
22190 @item -mmfcrf
22191 @itemx -mno-mfcrf
22192 @itemx -mpopcntb
22193 @itemx -mno-popcntb
22194 @opindex mmfcrf
22195 @opindex mno-mfcrf
22196 @opindex mpopcntb
22197 @opindex mno-popcntb
22198 You use these options to specify which instructions are available on the
22199 processor you are using. The default value of these options is
22200 determined when configuring GCC@. Specifying the
22201 @option{-mcpu=@var{cpu_type}} overrides the specification of these
22202 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
22203 rather than the options listed above.
22204
22205 The @option{-mmfcrf} option allows GCC to generate the move from
22206 condition register field instruction implemented on the POWER4
22207 processor and other processors that support the PowerPC V2.01
22208 architecture.
22209 The @option{-mpopcntb} option allows GCC to generate the popcount and
22210 double-precision FP reciprocal estimate instruction implemented on the
22211 POWER5 processor and other processors that support the PowerPC V2.02
22212 architecture.
22213
22214 @item -mcpu=@var{cpu_type}
22215 @opindex mcpu
22216 Set architecture type, register usage, and
22217 instruction scheduling parameters for machine type @var{cpu_type}.
22218 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
22219 and @samp{native}.
22220
22221 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
22222 endian), with an appropriate, generic processor model assumed for
22223 scheduling purposes.
22224
22225 Specifying @samp{native} as cpu type detects and selects the
22226 architecture option that corresponds to the host processor of the
22227 system performing the compilation.
22228 @option{-mcpu=native} has no effect if GCC does not recognize the
22229 processor.
22230
22231 The other options specify a specific processor. Code generated under
22232 those options runs best on that processor, and may not run at all on
22233 others.
22234
22235 The @option{-mcpu} options automatically enable or disable the
22236 following options:
22237
22238 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
22239 -mpopcntb -mpopcntd @gol
22240 -msingle-float -mdouble-float @gol
22241 -mfloat128}
22242
22243 The particular options set for any particular CPU varies between
22244 compiler versions, depending on what setting seems to produce optimal
22245 code for that CPU; it doesn't necessarily reflect the actual hardware's
22246 capabilities. If you wish to set an individual option to a particular
22247 value, you may specify it after the @option{-mcpu} option, like
22248 @option{-mcpu=8548}.
22249
22250 @item -mtune=@var{cpu_type}
22251 @opindex mtune
22252 Set the instruction scheduling parameters for machine type
22253 @var{cpu_type}, but do not set the architecture type or register usage,
22254 as @option{-mcpu=@var{cpu_type}} does. The same
22255 values for @var{cpu_type} are used for @option{-mtune} as for
22256 @option{-mcpu}. If both are specified, the code generated uses the
22257 architecture and registers set by @option{-mcpu}, but the
22258 scheduling parameters set by @option{-mtune}.
22259
22260 @item -msecure-plt
22261 @opindex msecure-plt
22262 Generate code that allows @command{ld} and @command{ld.so}
22263 to build executables and shared
22264 libraries with non-executable @code{.plt} and @code{.got} sections.
22265 This is a PowerPC
22266 32-bit SYSV ABI option.
22267
22268 @item -mbss-plt
22269 @opindex mbss-plt
22270 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
22271 fills in, and
22272 requires @code{.plt} and @code{.got}
22273 sections that are both writable and executable.
22274 This is a PowerPC 32-bit SYSV ABI option.
22275
22276 @item -misel
22277 @itemx -mno-isel
22278 @opindex misel
22279 @opindex mno-isel
22280 This switch enables or disables the generation of ISEL instructions.
22281
22282 @item -misel=@var{yes/no}
22283 This switch has been deprecated. Use @option{-misel} and
22284 @option{-mno-isel} instead.
22285
22286 @item -mspe
22287 @itemx -mno-spe
22288 @opindex mspe
22289 @opindex mno-spe
22290 This switch enables or disables the generation of SPE simd
22291 instructions.
22292
22293 @item -mspe=@var{yes/no}
22294 This option has been deprecated. Use @option{-mspe} and
22295 @option{-mno-spe} instead.
22296
22297 @item -mfloat128
22298 @itemx -mno-float128
22299 @opindex mfloat128
22300 @opindex mno-float128
22301 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
22302 and use either software emulation for IEEE 128-bit floating point or
22303 hardware instructions.
22304
22305 @item -mfloat-gprs=@var{yes/single/double/no}
22306 @itemx -mfloat-gprs
22307 @opindex mfloat-gprs
22308 This switch enables or disables the generation of floating-point
22309 operations on the general-purpose registers for architectures that
22310 support it.
22311
22312 The argument @samp{yes} or @samp{single} enables the use of
22313 single-precision floating-point operations.
22314
22315 The argument @samp{double} enables the use of single and
22316 double-precision floating-point operations.
22317
22318 The argument @samp{no} disables floating-point operations on the
22319 general-purpose registers.
22320
22321 This option is currently only available on the MPC854x.
22322
22323 @item -mfull-toc
22324 @itemx -mno-fp-in-toc
22325 @itemx -mno-sum-in-toc
22326 @itemx -mminimal-toc
22327 @opindex mfull-toc
22328 @opindex mno-fp-in-toc
22329 @opindex mno-sum-in-toc
22330 @opindex mminimal-toc
22331 Modify generation of the TOC (Table Of Contents), which is created for
22332 every executable file. The @option{-mfull-toc} option is selected by
22333 default. In that case, GCC allocates at least one TOC entry for
22334 each unique non-automatic variable reference in your program. GCC
22335 also places floating-point constants in the TOC@. However, only
22336 16,384 entries are available in the TOC@.
22337
22338 If you receive a linker error message that saying you have overflowed
22339 the available TOC space, you can reduce the amount of TOC space used
22340 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
22341 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
22342 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
22343 generate code to calculate the sum of an address and a constant at
22344 run time instead of putting that sum into the TOC@. You may specify one
22345 or both of these options. Each causes GCC to produce very slightly
22346 slower and larger code at the expense of conserving TOC space.
22347
22348 If you still run out of space in the TOC even when you specify both of
22349 these options, specify @option{-mminimal-toc} instead. This option causes
22350 GCC to make only one TOC entry for every file. When you specify this
22351 option, GCC produces code that is slower and larger but which
22352 uses extremely little TOC space. You may wish to use this option
22353 only on files that contain less frequently-executed code.
22354
22355 @item -maix32
22356 @opindex maix32
22357 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
22358
22359 @item -mxl-compat
22360 @itemx -mno-xl-compat
22361 @opindex mxl-compat
22362 @opindex mno-xl-compat
22363 Produce code that conforms more closely to IBM XL compiler semantics
22364 when using AIX-compatible ABI@. Pass floating-point arguments to
22365 prototyped functions beyond the register save area (RSA) on the stack
22366 in addition to argument FPRs. Do not assume that most significant
22367 double in 128-bit long double value is properly rounded when comparing
22368 values and converting to double. Use XL symbol names for long double
22369 support routines.
22370
22371 The AIX calling convention was extended but not initially documented to
22372 handle an obscure K&R C case of calling a function that takes the
22373 address of its arguments with fewer arguments than declared. IBM XL
22374 compilers access floating-point arguments that do not fit in the
22375 RSA from the stack when a subroutine is compiled without
22376 optimization. Because always storing floating-point arguments on the
22377 stack is inefficient and rarely needed, this option is not enabled by
22378 default and only is necessary when calling subroutines compiled by IBM
22379 XL compilers without optimization.
22380
22381 @item -malign-natural
22382 @itemx -malign-power
22383 @opindex malign-natural
22384 @opindex malign-power
22385 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22386 @option{-malign-natural} overrides the ABI-defined alignment of larger
22387 types, such as floating-point doubles, on their natural size-based boundary.
22388 The option @option{-malign-power} instructs GCC to follow the ABI-specified
22389 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
22390
22391 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
22392 is not supported.
22393
22394 @item -msoft-float
22395 @itemx -mhard-float
22396 @opindex msoft-float
22397 @opindex mhard-float
22398 Generate code that does not use (uses) the floating-point register set.
22399 Software floating-point emulation is provided if you use the
22400 @option{-msoft-float} option, and pass the option to GCC when linking.
22401
22402 @item -msingle-float
22403 @itemx -mdouble-float
22404 @opindex msingle-float
22405 @opindex mdouble-float
22406 Generate code for single- or double-precision floating-point operations.
22407 @option{-mdouble-float} implies @option{-msingle-float}.
22408
22409 @item -mmultiple
22410 @itemx -mno-multiple
22411 @opindex mmultiple
22412 @opindex mno-multiple
22413 Generate code that uses (does not use) the load multiple word
22414 instructions and the store multiple word instructions. These
22415 instructions are generated by default on POWER systems, and not
22416 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
22417 PowerPC systems, since those instructions do not work when the
22418 processor is in little-endian mode. The exceptions are PPC740 and
22419 PPC750 which permit these instructions in little-endian mode.
22420
22421 @item -mupdate
22422 @itemx -mno-update
22423 @opindex mupdate
22424 @opindex mno-update
22425 Generate code that uses (does not use) the load or store instructions
22426 that update the base register to the address of the calculated memory
22427 location. These instructions are generated by default. If you use
22428 @option{-mno-update}, there is a small window between the time that the
22429 stack pointer is updated and the address of the previous frame is
22430 stored, which means code that walks the stack frame across interrupts or
22431 signals may get corrupted data.
22432
22433 @item -mavoid-indexed-addresses
22434 @itemx -mno-avoid-indexed-addresses
22435 @opindex mavoid-indexed-addresses
22436 @opindex mno-avoid-indexed-addresses
22437 Generate code that tries to avoid (not avoid) the use of indexed load
22438 or store instructions. These instructions can incur a performance
22439 penalty on Power6 processors in certain situations, such as when
22440 stepping through large arrays that cross a 16M boundary. This option
22441 is enabled by default when targeting Power6 and disabled otherwise.
22442
22443 @item -mfused-madd
22444 @itemx -mno-fused-madd
22445 @opindex mfused-madd
22446 @opindex mno-fused-madd
22447 Generate code that uses (does not use) the floating-point multiply and
22448 accumulate instructions. These instructions are generated by default
22449 if hardware floating point is used. The machine-dependent
22450 @option{-mfused-madd} option is now mapped to the machine-independent
22451 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22452 mapped to @option{-ffp-contract=off}.
22453
22454 @item -mno-strict-align
22455 @itemx -mstrict-align
22456 @opindex mno-strict-align
22457 @opindex mstrict-align
22458 On System V.4 and embedded PowerPC systems do not (do) assume that
22459 unaligned memory references are handled by the system.
22460
22461 @item -mrelocatable
22462 @itemx -mno-relocatable
22463 @opindex mrelocatable
22464 @opindex mno-relocatable
22465 Generate code that allows (does not allow) a static executable to be
22466 relocated to a different address at run time. A simple embedded
22467 PowerPC system loader should relocate the entire contents of
22468 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
22469 a table of 32-bit addresses generated by this option. For this to
22470 work, all objects linked together must be compiled with
22471 @option{-mrelocatable} or @option{-mrelocatable-lib}.
22472 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
22473
22474 @item -mrelocatable-lib
22475 @itemx -mno-relocatable-lib
22476 @opindex mrelocatable-lib
22477 @opindex mno-relocatable-lib
22478 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
22479 @code{.fixup} section to allow static executables to be relocated at
22480 run time, but @option{-mrelocatable-lib} does not use the smaller stack
22481 alignment of @option{-mrelocatable}. Objects compiled with
22482 @option{-mrelocatable-lib} may be linked with objects compiled with
22483 any combination of the @option{-mrelocatable} options.
22484
22485 @item -mno-toc
22486 @itemx -mtoc
22487 @opindex mno-toc
22488 @opindex mtoc
22489 On System V.4 and embedded PowerPC systems do not (do) assume that
22490 register 2 contains a pointer to a global area pointing to the addresses
22491 used in the program.
22492
22493 @item -mlittle
22494 @itemx -mlittle-endian
22495 @opindex mlittle
22496 @opindex mlittle-endian
22497 On System V.4 and embedded PowerPC systems compile code for the
22498 processor in little-endian mode. The @option{-mlittle-endian} option is
22499 the same as @option{-mlittle}.
22500
22501 @item -mbig
22502 @itemx -mbig-endian
22503 @opindex mbig
22504 @opindex mbig-endian
22505 On System V.4 and embedded PowerPC systems compile code for the
22506 processor in big-endian mode. The @option{-mbig-endian} option is
22507 the same as @option{-mbig}.
22508
22509 @item -mdynamic-no-pic
22510 @opindex mdynamic-no-pic
22511 On Darwin and Mac OS X systems, compile code so that it is not
22512 relocatable, but that its external references are relocatable. The
22513 resulting code is suitable for applications, but not shared
22514 libraries.
22515
22516 @item -msingle-pic-base
22517 @opindex msingle-pic-base
22518 Treat the register used for PIC addressing as read-only, rather than
22519 loading it in the prologue for each function. The runtime system is
22520 responsible for initializing this register with an appropriate value
22521 before execution begins.
22522
22523 @item -mprioritize-restricted-insns=@var{priority}
22524 @opindex mprioritize-restricted-insns
22525 This option controls the priority that is assigned to
22526 dispatch-slot restricted instructions during the second scheduling
22527 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
22528 or @samp{2} to assign no, highest, or second-highest (respectively)
22529 priority to dispatch-slot restricted
22530 instructions.
22531
22532 @item -msched-costly-dep=@var{dependence_type}
22533 @opindex msched-costly-dep
22534 This option controls which dependences are considered costly
22535 by the target during instruction scheduling. The argument
22536 @var{dependence_type} takes one of the following values:
22537
22538 @table @asis
22539 @item @samp{no}
22540 No dependence is costly.
22541
22542 @item @samp{all}
22543 All dependences are costly.
22544
22545 @item @samp{true_store_to_load}
22546 A true dependence from store to load is costly.
22547
22548 @item @samp{store_to_load}
22549 Any dependence from store to load is costly.
22550
22551 @item @var{number}
22552 Any dependence for which the latency is greater than or equal to
22553 @var{number} is costly.
22554 @end table
22555
22556 @item -minsert-sched-nops=@var{scheme}
22557 @opindex minsert-sched-nops
22558 This option controls which NOP insertion scheme is used during
22559 the second scheduling pass. The argument @var{scheme} takes one of the
22560 following values:
22561
22562 @table @asis
22563 @item @samp{no}
22564 Don't insert NOPs.
22565
22566 @item @samp{pad}
22567 Pad with NOPs any dispatch group that has vacant issue slots,
22568 according to the scheduler's grouping.
22569
22570 @item @samp{regroup_exact}
22571 Insert NOPs to force costly dependent insns into
22572 separate groups. Insert exactly as many NOPs as needed to force an insn
22573 to a new group, according to the estimated processor grouping.
22574
22575 @item @var{number}
22576 Insert NOPs to force costly dependent insns into
22577 separate groups. Insert @var{number} NOPs to force an insn to a new group.
22578 @end table
22579
22580 @item -mcall-sysv
22581 @opindex mcall-sysv
22582 On System V.4 and embedded PowerPC systems compile code using calling
22583 conventions that adhere to the March 1995 draft of the System V
22584 Application Binary Interface, PowerPC processor supplement. This is the
22585 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
22586
22587 @item -mcall-sysv-eabi
22588 @itemx -mcall-eabi
22589 @opindex mcall-sysv-eabi
22590 @opindex mcall-eabi
22591 Specify both @option{-mcall-sysv} and @option{-meabi} options.
22592
22593 @item -mcall-sysv-noeabi
22594 @opindex mcall-sysv-noeabi
22595 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
22596
22597 @item -mcall-aixdesc
22598 @opindex m
22599 On System V.4 and embedded PowerPC systems compile code for the AIX
22600 operating system.
22601
22602 @item -mcall-linux
22603 @opindex mcall-linux
22604 On System V.4 and embedded PowerPC systems compile code for the
22605 Linux-based GNU system.
22606
22607 @item -mcall-freebsd
22608 @opindex mcall-freebsd
22609 On System V.4 and embedded PowerPC systems compile code for the
22610 FreeBSD operating system.
22611
22612 @item -mcall-netbsd
22613 @opindex mcall-netbsd
22614 On System V.4 and embedded PowerPC systems compile code for the
22615 NetBSD operating system.
22616
22617 @item -mcall-openbsd
22618 @opindex mcall-netbsd
22619 On System V.4 and embedded PowerPC systems compile code for the
22620 OpenBSD operating system.
22621
22622 @item -maix-struct-return
22623 @opindex maix-struct-return
22624 Return all structures in memory (as specified by the AIX ABI)@.
22625
22626 @item -msvr4-struct-return
22627 @opindex msvr4-struct-return
22628 Return structures smaller than 8 bytes in registers (as specified by the
22629 SVR4 ABI)@.
22630
22631 @item -mabi=@var{abi-type}
22632 @opindex mabi
22633 Extend the current ABI with a particular extension, or remove such extension.
22634 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
22635 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
22636 @samp{elfv1}, @samp{elfv2}@.
22637
22638 @item -mabi=spe
22639 @opindex mabi=spe
22640 Extend the current ABI with SPE ABI extensions. This does not change
22641 the default ABI, instead it adds the SPE ABI extensions to the current
22642 ABI@.
22643
22644 @item -mabi=no-spe
22645 @opindex mabi=no-spe
22646 Disable Book-E SPE ABI extensions for the current ABI@.
22647
22648 @item -mabi=ibmlongdouble
22649 @opindex mabi=ibmlongdouble
22650 Change the current ABI to use IBM extended-precision long double.
22651 This is not likely to work if your system defaults to using IEEE
22652 extended-precision long double. If you change the long double type
22653 from IEEE extended-precision, the compiler will issue a warning unless
22654 you use the @option{-Wno-psabi} option.
22655
22656 @item -mabi=ieeelongdouble
22657 @opindex mabi=ieeelongdouble
22658 Change the current ABI to use IEEE extended-precision long double.
22659 This is not likely to work if your system defaults to using IBM
22660 extended-precision long double. If you change the long double type
22661 from IBM extended-precision, the compiler will issue a warning unless
22662 you use the @option{-Wno-psabi} option.
22663
22664 @item -mabi=elfv1
22665 @opindex mabi=elfv1
22666 Change the current ABI to use the ELFv1 ABI.
22667 This is the default ABI for big-endian PowerPC 64-bit Linux.
22668 Overriding the default ABI requires special system support and is
22669 likely to fail in spectacular ways.
22670
22671 @item -mabi=elfv2
22672 @opindex mabi=elfv2
22673 Change the current ABI to use the ELFv2 ABI.
22674 This is the default ABI for little-endian PowerPC 64-bit Linux.
22675 Overriding the default ABI requires special system support and is
22676 likely to fail in spectacular ways.
22677
22678 @item -mgnu-attribute
22679 @itemx -mno-gnu-attribute
22680 @opindex mgnu-attribute
22681 @opindex mno-gnu-attribute
22682 Emit .gnu_attribute assembly directives to set tag/value pairs in a
22683 .gnu.attributes section that specify ABI variations in function
22684 parameters or return values.
22685
22686 @item -mprototype
22687 @itemx -mno-prototype
22688 @opindex mprototype
22689 @opindex mno-prototype
22690 On System V.4 and embedded PowerPC systems assume that all calls to
22691 variable argument functions are properly prototyped. Otherwise, the
22692 compiler must insert an instruction before every non-prototyped call to
22693 set or clear bit 6 of the condition code register (@code{CR}) to
22694 indicate whether floating-point values are passed in the floating-point
22695 registers in case the function takes variable arguments. With
22696 @option{-mprototype}, only calls to prototyped variable argument functions
22697 set or clear the bit.
22698
22699 @item -msim
22700 @opindex msim
22701 On embedded PowerPC systems, assume that the startup module is called
22702 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
22703 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
22704 configurations.
22705
22706 @item -mmvme
22707 @opindex mmvme
22708 On embedded PowerPC systems, assume that the startup module is called
22709 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
22710 @file{libc.a}.
22711
22712 @item -mads
22713 @opindex mads
22714 On embedded PowerPC systems, assume that the startup module is called
22715 @file{crt0.o} and the standard C libraries are @file{libads.a} and
22716 @file{libc.a}.
22717
22718 @item -myellowknife
22719 @opindex myellowknife
22720 On embedded PowerPC systems, assume that the startup module is called
22721 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
22722 @file{libc.a}.
22723
22724 @item -mvxworks
22725 @opindex mvxworks
22726 On System V.4 and embedded PowerPC systems, specify that you are
22727 compiling for a VxWorks system.
22728
22729 @item -memb
22730 @opindex memb
22731 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
22732 header to indicate that @samp{eabi} extended relocations are used.
22733
22734 @item -meabi
22735 @itemx -mno-eabi
22736 @opindex meabi
22737 @opindex mno-eabi
22738 On System V.4 and embedded PowerPC systems do (do not) adhere to the
22739 Embedded Applications Binary Interface (EABI), which is a set of
22740 modifications to the System V.4 specifications. Selecting @option{-meabi}
22741 means that the stack is aligned to an 8-byte boundary, a function
22742 @code{__eabi} is called from @code{main} to set up the EABI
22743 environment, and the @option{-msdata} option can use both @code{r2} and
22744 @code{r13} to point to two separate small data areas. Selecting
22745 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
22746 no EABI initialization function is called from @code{main}, and the
22747 @option{-msdata} option only uses @code{r13} to point to a single
22748 small data area. The @option{-meabi} option is on by default if you
22749 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
22750
22751 @item -msdata=eabi
22752 @opindex msdata=eabi
22753 On System V.4 and embedded PowerPC systems, put small initialized
22754 @code{const} global and static data in the @code{.sdata2} section, which
22755 is pointed to by register @code{r2}. Put small initialized
22756 non-@code{const} global and static data in the @code{.sdata} section,
22757 which is pointed to by register @code{r13}. Put small uninitialized
22758 global and static data in the @code{.sbss} section, which is adjacent to
22759 the @code{.sdata} section. The @option{-msdata=eabi} option is
22760 incompatible with the @option{-mrelocatable} option. The
22761 @option{-msdata=eabi} option also sets the @option{-memb} option.
22762
22763 @item -msdata=sysv
22764 @opindex msdata=sysv
22765 On System V.4 and embedded PowerPC systems, put small global and static
22766 data in the @code{.sdata} section, which is pointed to by register
22767 @code{r13}. Put small uninitialized global and static data in the
22768 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
22769 The @option{-msdata=sysv} option is incompatible with the
22770 @option{-mrelocatable} option.
22771
22772 @item -msdata=default
22773 @itemx -msdata
22774 @opindex msdata=default
22775 @opindex msdata
22776 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
22777 compile code the same as @option{-msdata=eabi}, otherwise compile code the
22778 same as @option{-msdata=sysv}.
22779
22780 @item -msdata=data
22781 @opindex msdata=data
22782 On System V.4 and embedded PowerPC systems, put small global
22783 data in the @code{.sdata} section. Put small uninitialized global
22784 data in the @code{.sbss} section. Do not use register @code{r13}
22785 to address small data however. This is the default behavior unless
22786 other @option{-msdata} options are used.
22787
22788 @item -msdata=none
22789 @itemx -mno-sdata
22790 @opindex msdata=none
22791 @opindex mno-sdata
22792 On embedded PowerPC systems, put all initialized global and static data
22793 in the @code{.data} section, and all uninitialized data in the
22794 @code{.bss} section.
22795
22796 @item -mblock-move-inline-limit=@var{num}
22797 @opindex mblock-move-inline-limit
22798 Inline all block moves (such as calls to @code{memcpy} or structure
22799 copies) less than or equal to @var{num} bytes. The minimum value for
22800 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
22801 targets. The default value is target-specific.
22802
22803 @item -G @var{num}
22804 @opindex G
22805 @cindex smaller data references (PowerPC)
22806 @cindex .sdata/.sdata2 references (PowerPC)
22807 On embedded PowerPC systems, put global and static items less than or
22808 equal to @var{num} bytes into the small data or BSS sections instead of
22809 the normal data or BSS section. By default, @var{num} is 8. The
22810 @option{-G @var{num}} switch is also passed to the linker.
22811 All modules should be compiled with the same @option{-G @var{num}} value.
22812
22813 @item -mregnames
22814 @itemx -mno-regnames
22815 @opindex mregnames
22816 @opindex mno-regnames
22817 On System V.4 and embedded PowerPC systems do (do not) emit register
22818 names in the assembly language output using symbolic forms.
22819
22820 @item -mlongcall
22821 @itemx -mno-longcall
22822 @opindex mlongcall
22823 @opindex mno-longcall
22824 By default assume that all calls are far away so that a longer and more
22825 expensive calling sequence is required. This is required for calls
22826 farther than 32 megabytes (33,554,432 bytes) from the current location.
22827 A short call is generated if the compiler knows
22828 the call cannot be that far away. This setting can be overridden by
22829 the @code{shortcall} function attribute, or by @code{#pragma
22830 longcall(0)}.
22831
22832 Some linkers are capable of detecting out-of-range calls and generating
22833 glue code on the fly. On these systems, long calls are unnecessary and
22834 generate slower code. As of this writing, the AIX linker can do this,
22835 as can the GNU linker for PowerPC/64. It is planned to add this feature
22836 to the GNU linker for 32-bit PowerPC systems as well.
22837
22838 In the future, GCC may ignore all longcall specifications
22839 when the linker is known to generate glue.
22840
22841 @item -mtls-markers
22842 @itemx -mno-tls-markers
22843 @opindex mtls-markers
22844 @opindex mno-tls-markers
22845 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
22846 specifying the function argument. The relocation allows the linker to
22847 reliably associate function call with argument setup instructions for
22848 TLS optimization, which in turn allows GCC to better schedule the
22849 sequence.
22850
22851 @item -mrecip
22852 @itemx -mno-recip
22853 @opindex mrecip
22854 This option enables use of the reciprocal estimate and
22855 reciprocal square root estimate instructions with additional
22856 Newton-Raphson steps to increase precision instead of doing a divide or
22857 square root and divide for floating-point arguments. You should use
22858 the @option{-ffast-math} option when using @option{-mrecip} (or at
22859 least @option{-funsafe-math-optimizations},
22860 @option{-ffinite-math-only}, @option{-freciprocal-math} and
22861 @option{-fno-trapping-math}). Note that while the throughput of the
22862 sequence is generally higher than the throughput of the non-reciprocal
22863 instruction, the precision of the sequence can be decreased by up to 2
22864 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
22865 roots.
22866
22867 @item -mrecip=@var{opt}
22868 @opindex mrecip=opt
22869 This option controls which reciprocal estimate instructions
22870 may be used. @var{opt} is a comma-separated list of options, which may
22871 be preceded by a @code{!} to invert the option:
22872
22873 @table @samp
22874
22875 @item all
22876 Enable all estimate instructions.
22877
22878 @item default
22879 Enable the default instructions, equivalent to @option{-mrecip}.
22880
22881 @item none
22882 Disable all estimate instructions, equivalent to @option{-mno-recip}.
22883
22884 @item div
22885 Enable the reciprocal approximation instructions for both
22886 single and double precision.
22887
22888 @item divf
22889 Enable the single-precision reciprocal approximation instructions.
22890
22891 @item divd
22892 Enable the double-precision reciprocal approximation instructions.
22893
22894 @item rsqrt
22895 Enable the reciprocal square root approximation instructions for both
22896 single and double precision.
22897
22898 @item rsqrtf
22899 Enable the single-precision reciprocal square root approximation instructions.
22900
22901 @item rsqrtd
22902 Enable the double-precision reciprocal square root approximation instructions.
22903
22904 @end table
22905
22906 So, for example, @option{-mrecip=all,!rsqrtd} enables
22907 all of the reciprocal estimate instructions, except for the
22908 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
22909 which handle the double-precision reciprocal square root calculations.
22910
22911 @item -mrecip-precision
22912 @itemx -mno-recip-precision
22913 @opindex mrecip-precision
22914 Assume (do not assume) that the reciprocal estimate instructions
22915 provide higher-precision estimates than is mandated by the PowerPC
22916 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
22917 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
22918 The double-precision square root estimate instructions are not generated by
22919 default on low-precision machines, since they do not provide an
22920 estimate that converges after three steps.
22921
22922 @item -mpointers-to-nested-functions
22923 @itemx -mno-pointers-to-nested-functions
22924 @opindex mpointers-to-nested-functions
22925 Generate (do not generate) code to load up the static chain register
22926 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
22927 systems where a function pointer points to a 3-word descriptor giving
22928 the function address, TOC value to be loaded in register @code{r2}, and
22929 static chain value to be loaded in register @code{r11}. The
22930 @option{-mpointers-to-nested-functions} is on by default. You cannot
22931 call through pointers to nested functions or pointers
22932 to functions compiled in other languages that use the static chain if
22933 you use @option{-mno-pointers-to-nested-functions}.
22934
22935 @item -msave-toc-indirect
22936 @itemx -mno-save-toc-indirect
22937 @opindex msave-toc-indirect
22938 Generate (do not generate) code to save the TOC value in the reserved
22939 stack location in the function prologue if the function calls through
22940 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
22941 saved in the prologue, it is saved just before the call through the
22942 pointer. The @option{-mno-save-toc-indirect} option is the default.
22943
22944 @item -mcompat-align-parm
22945 @itemx -mno-compat-align-parm
22946 @opindex mcompat-align-parm
22947 Generate (do not generate) code to pass structure parameters with a
22948 maximum alignment of 64 bits, for compatibility with older versions
22949 of GCC.
22950
22951 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
22952 structure parameter on a 128-bit boundary when that structure contained
22953 a member requiring 128-bit alignment. This is corrected in more
22954 recent versions of GCC. This option may be used to generate code
22955 that is compatible with functions compiled with older versions of
22956 GCC.
22957
22958 The @option{-mno-compat-align-parm} option is the default.
22959
22960 @item -mstack-protector-guard=@var{guard}
22961 @itemx -mstack-protector-guard-reg=@var{reg}
22962 @itemx -mstack-protector-guard-offset=@var{offset}
22963 @itemx -mstack-protector-guard-symbol=@var{symbol}
22964 @opindex mstack-protector-guard
22965 @opindex mstack-protector-guard-reg
22966 @opindex mstack-protector-guard-offset
22967 @opindex mstack-protector-guard-symbol
22968 Generate stack protection code using canary at @var{guard}. Supported
22969 locations are @samp{global} for global canary or @samp{tls} for per-thread
22970 canary in the TLS block (the default with GNU libc version 2.4 or later).
22971
22972 With the latter choice the options
22973 @option{-mstack-protector-guard-reg=@var{reg}} and
22974 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
22975 which register to use as base register for reading the canary, and from what
22976 offset from that base register. The default for those is as specified in the
22977 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
22978 the offset with a symbol reference to a canary in the TLS block.
22979 @end table
22980
22981
22982 @node RISC-V Options
22983 @subsection RISC-V Options
22984 @cindex RISC-V Options
22985
22986 These command-line options are defined for RISC-V targets:
22987
22988 @table @gcctabopt
22989 @item -mbranch-cost=@var{n}
22990 @opindex mbranch-cost
22991 Set the cost of branches to roughly @var{n} instructions.
22992
22993 @item -mplt
22994 @itemx -mno-plt
22995 @opindex plt
22996 When generating PIC code, do or don't allow the use of PLTs. Ignored for
22997 non-PIC. The default is @option{-mplt}.
22998
22999 @item -mabi=@var{ABI-string}
23000 @opindex mabi
23001 Specify integer and floating-point calling convention. @var{ABI-string}
23002 contains two parts: the size of integer types and the registers used for
23003 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23004 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23005 32-bit), and that floating-point values up to 64 bits wide are passed in F
23006 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23007 allows the compiler to generate code that uses the F and D extensions but only
23008 allows floating-point values up to 32 bits long to be passed in registers; or
23009 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23010 passed in registers.
23011
23012 The default for this argument is system dependent, users who want a specific
23013 calling convention should specify one explicitly. The valid calling
23014 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23015 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23016 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23017 invalid because the ABI requires 64-bit values be passed in F registers, but F
23018 registers are only 32 bits wide.
23019
23020 @item -mfdiv
23021 @itemx -mno-fdiv
23022 @opindex mfdiv
23023 Do or don't use hardware floating-point divide and square root instructions.
23024 This requires the F or D extensions for floating-point registers. The default
23025 is to use them if the specified architecture has these instructions.
23026
23027 @item -mdiv
23028 @itemx -mno-div
23029 @opindex mdiv
23030 Do or don't use hardware instructions for integer division. This requires the
23031 M extension. The default is to use them if the specified architecture has
23032 these instructions.
23033
23034 @item -march=@var{ISA-string}
23035 @opindex march
23036 Generate code for given RISC-V ISA (e.g.@ @samp{rv64im}). ISA strings must be
23037 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, and @samp{rv32imaf}.
23038
23039 @item -mtune=@var{processor-string}
23040 @opindex mtune
23041 Optimize the output for the given processor, specified by microarchitecture
23042 name.
23043
23044 @item -mpreferred-stack-boundary=@var{num}
23045 @opindex mpreferred-stack-boundary
23046 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23047 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23048 the default is 4 (16 bytes or 128-bits).
23049
23050 @strong{Warning:} If you use this switch, then you must build all modules with
23051 the same value, including any libraries. This includes the system libraries
23052 and startup modules.
23053
23054 @item -msmall-data-limit=@var{n}
23055 @opindex msmall-data-limit
23056 Put global and static data smaller than @var{n} bytes into a special section
23057 (on some targets).
23058
23059 @item -msave-restore
23060 @itemx -mno-save-restore
23061 @opindex msave-restore
23062 Do or don't use smaller but slower prologue and epilogue code that uses
23063 library function calls. The default is to use fast inline prologues and
23064 epilogues.
23065
23066 @item -mstrict-align
23067 @itemx -mno-strict-align
23068 @opindex mstrict-align
23069 Do not or do generate unaligned memory accesses. The default is set depending
23070 on whether the processor we are optimizing for supports fast unaligned access
23071 or not.
23072
23073 @item -mcmodel=medlow
23074 @opindex mcmodel=medlow
23075 Generate code for the medium-low code model. The program and its statically
23076 defined symbols must lie within a single 2 GiB address range and must lie
23077 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23078 statically or dynamically linked. This is the default code model.
23079
23080 @item -mcmodel=medany
23081 @opindex mcmodel=medany
23082 Generate code for the medium-any code model. The program and its statically
23083 defined symbols must be within any single 2 GiB address range. Programs can be
23084 statically or dynamically linked.
23085
23086 @item -mexplicit-relocs
23087 @itemx -mno-exlicit-relocs
23088 Use or do not use assembler relocation operators when dealing with symbolic
23089 addresses. The alternative is to use assembler macros instead, which may
23090 limit optimization.
23091
23092 @item -mrelax
23093 @itemx -mno-relax
23094 Take advantage of linker relaxations to reduce the number of instructions
23095 required to materialize symbol addresses. The default is to take advantage of
23096 linker relaxations.
23097
23098 @end table
23099
23100 @node RL78 Options
23101 @subsection RL78 Options
23102 @cindex RL78 Options
23103
23104 @table @gcctabopt
23105
23106 @item -msim
23107 @opindex msim
23108 Links in additional target libraries to support operation within a
23109 simulator.
23110
23111 @item -mmul=none
23112 @itemx -mmul=g10
23113 @itemx -mmul=g13
23114 @itemx -mmul=g14
23115 @itemx -mmul=rl78
23116 @opindex mmul
23117 Specifies the type of hardware multiplication and division support to
23118 be used. The simplest is @code{none}, which uses software for both
23119 multiplication and division. This is the default. The @code{g13}
23120 value is for the hardware multiply/divide peripheral found on the
23121 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23122 the multiplication and division instructions supported by the RL78/G14
23123 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
23124 the value @code{mg10} is an alias for @code{none}.
23125
23126 In addition a C preprocessor macro is defined, based upon the setting
23127 of this option. Possible values are: @code{__RL78_MUL_NONE__},
23128 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23129
23130 @item -mcpu=g10
23131 @itemx -mcpu=g13
23132 @itemx -mcpu=g14
23133 @itemx -mcpu=rl78
23134 @opindex mcpu
23135 Specifies the RL78 core to target. The default is the G14 core, also
23136 known as an S3 core or just RL78. The G13 or S2 core does not have
23137 multiply or divide instructions, instead it uses a hardware peripheral
23138 for these operations. The G10 or S1 core does not have register
23139 banks, so it uses a different calling convention.
23140
23141 If this option is set it also selects the type of hardware multiply
23142 support to use, unless this is overridden by an explicit
23143 @option{-mmul=none} option on the command line. Thus specifying
23144 @option{-mcpu=g13} enables the use of the G13 hardware multiply
23145 peripheral and specifying @option{-mcpu=g10} disables the use of
23146 hardware multiplications altogether.
23147
23148 Note, although the RL78/G14 core is the default target, specifying
23149 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23150 change the behavior of the toolchain since it also enables G14
23151 hardware multiply support. If these options are not specified on the
23152 command line then software multiplication routines will be used even
23153 though the code targets the RL78 core. This is for backwards
23154 compatibility with older toolchains which did not have hardware
23155 multiply and divide support.
23156
23157 In addition a C preprocessor macro is defined, based upon the setting
23158 of this option. Possible values are: @code{__RL78_G10__},
23159 @code{__RL78_G13__} or @code{__RL78_G14__}.
23160
23161 @item -mg10
23162 @itemx -mg13
23163 @itemx -mg14
23164 @itemx -mrl78
23165 @opindex mg10
23166 @opindex mg13
23167 @opindex mg14
23168 @opindex mrl78
23169 These are aliases for the corresponding @option{-mcpu=} option. They
23170 are provided for backwards compatibility.
23171
23172 @item -mallregs
23173 @opindex mallregs
23174 Allow the compiler to use all of the available registers. By default
23175 registers @code{r24..r31} are reserved for use in interrupt handlers.
23176 With this option enabled these registers can be used in ordinary
23177 functions as well.
23178
23179 @item -m64bit-doubles
23180 @itemx -m32bit-doubles
23181 @opindex m64bit-doubles
23182 @opindex m32bit-doubles
23183 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23184 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23185 @option{-m32bit-doubles}.
23186
23187 @item -msave-mduc-in-interrupts
23188 @itemx -mno-save-mduc-in-interrupts
23189 @opindex msave-mduc-in-interrupts
23190 @opindex mno-save-mduc-in-interrupts
23191 Specifies that interrupt handler functions should preserve the
23192 MDUC registers. This is only necessary if normal code might use
23193 the MDUC registers, for example because it performs multiplication
23194 and division operations. The default is to ignore the MDUC registers
23195 as this makes the interrupt handlers faster. The target option -mg13
23196 needs to be passed for this to work as this feature is only available
23197 on the G13 target (S2 core). The MDUC registers will only be saved
23198 if the interrupt handler performs a multiplication or division
23199 operation or it calls another function.
23200
23201 @end table
23202
23203 @node RS/6000 and PowerPC Options
23204 @subsection IBM RS/6000 and PowerPC Options
23205 @cindex RS/6000 and PowerPC Options
23206 @cindex IBM RS/6000 and PowerPC Options
23207
23208 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
23209 @table @gcctabopt
23210 @item -mpowerpc-gpopt
23211 @itemx -mno-powerpc-gpopt
23212 @itemx -mpowerpc-gfxopt
23213 @itemx -mno-powerpc-gfxopt
23214 @need 800
23215 @itemx -mpowerpc64
23216 @itemx -mno-powerpc64
23217 @itemx -mmfcrf
23218 @itemx -mno-mfcrf
23219 @itemx -mpopcntb
23220 @itemx -mno-popcntb
23221 @itemx -mpopcntd
23222 @itemx -mno-popcntd
23223 @itemx -mfprnd
23224 @itemx -mno-fprnd
23225 @need 800
23226 @itemx -mcmpb
23227 @itemx -mno-cmpb
23228 @itemx -mmfpgpr
23229 @itemx -mno-mfpgpr
23230 @itemx -mhard-dfp
23231 @itemx -mno-hard-dfp
23232 @opindex mpowerpc-gpopt
23233 @opindex mno-powerpc-gpopt
23234 @opindex mpowerpc-gfxopt
23235 @opindex mno-powerpc-gfxopt
23236 @opindex mpowerpc64
23237 @opindex mno-powerpc64
23238 @opindex mmfcrf
23239 @opindex mno-mfcrf
23240 @opindex mpopcntb
23241 @opindex mno-popcntb
23242 @opindex mpopcntd
23243 @opindex mno-popcntd
23244 @opindex mfprnd
23245 @opindex mno-fprnd
23246 @opindex mcmpb
23247 @opindex mno-cmpb
23248 @opindex mmfpgpr
23249 @opindex mno-mfpgpr
23250 @opindex mhard-dfp
23251 @opindex mno-hard-dfp
23252 You use these options to specify which instructions are available on the
23253 processor you are using. The default value of these options is
23254 determined when configuring GCC@. Specifying the
23255 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23256 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23257 rather than the options listed above.
23258
23259 Specifying @option{-mpowerpc-gpopt} allows
23260 GCC to use the optional PowerPC architecture instructions in the
23261 General Purpose group, including floating-point square root. Specifying
23262 @option{-mpowerpc-gfxopt} allows GCC to
23263 use the optional PowerPC architecture instructions in the Graphics
23264 group, including floating-point select.
23265
23266 The @option{-mmfcrf} option allows GCC to generate the move from
23267 condition register field instruction implemented on the POWER4
23268 processor and other processors that support the PowerPC V2.01
23269 architecture.
23270 The @option{-mpopcntb} option allows GCC to generate the popcount and
23271 double-precision FP reciprocal estimate instruction implemented on the
23272 POWER5 processor and other processors that support the PowerPC V2.02
23273 architecture.
23274 The @option{-mpopcntd} option allows GCC to generate the popcount
23275 instruction implemented on the POWER7 processor and other processors
23276 that support the PowerPC V2.06 architecture.
23277 The @option{-mfprnd} option allows GCC to generate the FP round to
23278 integer instructions implemented on the POWER5+ processor and other
23279 processors that support the PowerPC V2.03 architecture.
23280 The @option{-mcmpb} option allows GCC to generate the compare bytes
23281 instruction implemented on the POWER6 processor and other processors
23282 that support the PowerPC V2.05 architecture.
23283 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
23284 general-purpose register instructions implemented on the POWER6X
23285 processor and other processors that support the extended PowerPC V2.05
23286 architecture.
23287 The @option{-mhard-dfp} option allows GCC to generate the decimal
23288 floating-point instructions implemented on some POWER processors.
23289
23290 The @option{-mpowerpc64} option allows GCC to generate the additional
23291 64-bit instructions that are found in the full PowerPC64 architecture
23292 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23293 @option{-mno-powerpc64}.
23294
23295 @item -mcpu=@var{cpu_type}
23296 @opindex mcpu
23297 Set architecture type, register usage, and
23298 instruction scheduling parameters for machine type @var{cpu_type}.
23299 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
23300 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
23301 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
23302 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
23303 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
23304 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
23305 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
23306 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
23307 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
23308 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
23309 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
23310 @samp{rs64}, and @samp{native}.
23311
23312 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
23313 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
23314 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
23315 architecture machine types, with an appropriate, generic processor
23316 model assumed for scheduling purposes.
23317
23318 Specifying @samp{native} as cpu type detects and selects the
23319 architecture option that corresponds to the host processor of the
23320 system performing the compilation.
23321 @option{-mcpu=native} has no effect if GCC does not recognize the
23322 processor.
23323
23324 The other options specify a specific processor. Code generated under
23325 those options runs best on that processor, and may not run at all on
23326 others.
23327
23328 The @option{-mcpu} options automatically enable or disable the
23329 following options:
23330
23331 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
23332 -mpopcntb -mpopcntd -mpowerpc64 @gol
23333 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
23334 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
23335 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
23336 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
23337
23338 The particular options set for any particular CPU varies between
23339 compiler versions, depending on what setting seems to produce optimal
23340 code for that CPU; it doesn't necessarily reflect the actual hardware's
23341 capabilities. If you wish to set an individual option to a particular
23342 value, you may specify it after the @option{-mcpu} option, like
23343 @option{-mcpu=970 -mno-altivec}.
23344
23345 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
23346 not enabled or disabled by the @option{-mcpu} option at present because
23347 AIX does not have full support for these options. You may still
23348 enable or disable them individually if you're sure it'll work in your
23349 environment.
23350
23351 @item -mtune=@var{cpu_type}
23352 @opindex mtune
23353 Set the instruction scheduling parameters for machine type
23354 @var{cpu_type}, but do not set the architecture type or register usage,
23355 as @option{-mcpu=@var{cpu_type}} does. The same
23356 values for @var{cpu_type} are used for @option{-mtune} as for
23357 @option{-mcpu}. If both are specified, the code generated uses the
23358 architecture and registers set by @option{-mcpu}, but the
23359 scheduling parameters set by @option{-mtune}.
23360
23361 @item -mcmodel=small
23362 @opindex mcmodel=small
23363 Generate PowerPC64 code for the small model: The TOC is limited to
23364 64k.
23365
23366 @item -mcmodel=medium
23367 @opindex mcmodel=medium
23368 Generate PowerPC64 code for the medium model: The TOC and other static
23369 data may be up to a total of 4G in size. This is the default for 64-bit
23370 Linux.
23371
23372 @item -mcmodel=large
23373 @opindex mcmodel=large
23374 Generate PowerPC64 code for the large model: The TOC may be up to 4G
23375 in size. Other data and code is only limited by the 64-bit address
23376 space.
23377
23378 @item -maltivec
23379 @itemx -mno-altivec
23380 @opindex maltivec
23381 @opindex mno-altivec
23382 Generate code that uses (does not use) AltiVec instructions, and also
23383 enable the use of built-in functions that allow more direct access to
23384 the AltiVec instruction set. You may also need to set
23385 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
23386 enhancements.
23387
23388 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
23389 @option{-maltivec=be}, the element order for AltiVec intrinsics such
23390 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
23391 match array element order corresponding to the endianness of the
23392 target. That is, element zero identifies the leftmost element in a
23393 vector register when targeting a big-endian platform, and identifies
23394 the rightmost element in a vector register when targeting a
23395 little-endian platform.
23396
23397 @item -maltivec=be
23398 @opindex maltivec=be
23399 Generate AltiVec instructions using big-endian element order,
23400 regardless of whether the target is big- or little-endian. This is
23401 the default when targeting a big-endian platform. Using this option
23402 is currently deprecated. Support for this feature will be removed in
23403 GCC 9.
23404
23405 The element order is used to interpret element numbers in AltiVec
23406 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23407 @code{vec_insert}. By default, these match array element order
23408 corresponding to the endianness for the target.
23409
23410 @item -maltivec=le
23411 @opindex maltivec=le
23412 Generate AltiVec instructions using little-endian element order,
23413 regardless of whether the target is big- or little-endian. This is
23414 the default when targeting a little-endian platform. This option is
23415 currently ignored when targeting a big-endian platform.
23416
23417 The element order is used to interpret element numbers in AltiVec
23418 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23419 @code{vec_insert}. By default, these match array element order
23420 corresponding to the endianness for the target.
23421
23422 @item -mvrsave
23423 @itemx -mno-vrsave
23424 @opindex mvrsave
23425 @opindex mno-vrsave
23426 Generate VRSAVE instructions when generating AltiVec code.
23427
23428 @item -msecure-plt
23429 @opindex msecure-plt
23430 Generate code that allows @command{ld} and @command{ld.so}
23431 to build executables and shared
23432 libraries with non-executable @code{.plt} and @code{.got} sections.
23433 This is a PowerPC
23434 32-bit SYSV ABI option.
23435
23436 @item -mbss-plt
23437 @opindex mbss-plt
23438 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23439 fills in, and
23440 requires @code{.plt} and @code{.got}
23441 sections that are both writable and executable.
23442 This is a PowerPC 32-bit SYSV ABI option.
23443
23444 @item -misel
23445 @itemx -mno-isel
23446 @opindex misel
23447 @opindex mno-isel
23448 This switch enables or disables the generation of ISEL instructions.
23449
23450 @item -misel=@var{yes/no}
23451 This switch has been deprecated. Use @option{-misel} and
23452 @option{-mno-isel} instead.
23453
23454 @item -mvsx
23455 @itemx -mno-vsx
23456 @opindex mvsx
23457 @opindex mno-vsx
23458 Generate code that uses (does not use) vector/scalar (VSX)
23459 instructions, and also enable the use of built-in functions that allow
23460 more direct access to the VSX instruction set.
23461
23462 @item -mcrypto
23463 @itemx -mno-crypto
23464 @opindex mcrypto
23465 @opindex mno-crypto
23466 Enable the use (disable) of the built-in functions that allow direct
23467 access to the cryptographic instructions that were added in version
23468 2.07 of the PowerPC ISA.
23469
23470 @item -mhtm
23471 @itemx -mno-htm
23472 @opindex mhtm
23473 @opindex mno-htm
23474 Enable (disable) the use of the built-in functions that allow direct
23475 access to the Hardware Transactional Memory (HTM) instructions that
23476 were added in version 2.07 of the PowerPC ISA.
23477
23478 @item -mpower8-fusion
23479 @itemx -mno-power8-fusion
23480 @opindex mpower8-fusion
23481 @opindex mno-power8-fusion
23482 Generate code that keeps (does not keeps) some integer operations
23483 adjacent so that the instructions can be fused together on power8 and
23484 later processors.
23485
23486 @item -mpower8-vector
23487 @itemx -mno-power8-vector
23488 @opindex mpower8-vector
23489 @opindex mno-power8-vector
23490 Generate code that uses (does not use) the vector and scalar
23491 instructions that were added in version 2.07 of the PowerPC ISA. Also
23492 enable the use of built-in functions that allow more direct access to
23493 the vector instructions.
23494
23495 @item -mquad-memory
23496 @itemx -mno-quad-memory
23497 @opindex mquad-memory
23498 @opindex mno-quad-memory
23499 Generate code that uses (does not use) the non-atomic quad word memory
23500 instructions. The @option{-mquad-memory} option requires use of
23501 64-bit mode.
23502
23503 @item -mquad-memory-atomic
23504 @itemx -mno-quad-memory-atomic
23505 @opindex mquad-memory-atomic
23506 @opindex mno-quad-memory-atomic
23507 Generate code that uses (does not use) the atomic quad word memory
23508 instructions. The @option{-mquad-memory-atomic} option requires use of
23509 64-bit mode.
23510
23511 @item -mfloat128
23512 @itemx -mno-float128
23513 @opindex mfloat128
23514 @opindex mno-float128
23515 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
23516 and use either software emulation for IEEE 128-bit floating point or
23517 hardware instructions.
23518
23519 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
23520 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
23521 use the IEEE 128-bit floating point support. The IEEE 128-bit
23522 floating point support only works on PowerPC Linux systems.
23523
23524 The default for @option{-mfloat128} is enabled on PowerPC Linux
23525 systems using the VSX instruction set, and disabled on other systems.
23526
23527 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
23528 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
23529 point support will also enable the generation of ISA 3.0 IEEE 128-bit
23530 floating point instructions. Otherwise, if you do not specify to
23531 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
23532 system, IEEE 128-bit floating point will be done with software
23533 emulation.
23534
23535 @item -mfloat128-hardware
23536 @itemx -mno-float128-hardware
23537 @opindex mfloat128-hardware
23538 @opindex mno-float128-hardware
23539 Enable/disable using ISA 3.0 hardware instructions to support the
23540 @var{__float128} data type.
23541
23542 The default for @option{-mfloat128-hardware} is enabled on PowerPC
23543 Linux systems using the ISA 3.0 instruction set, and disabled on other
23544 systems.
23545
23546 @item -m32
23547 @itemx -m64
23548 @opindex m32
23549 @opindex m64
23550 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
23551 targets (including GNU/Linux). The 32-bit environment sets int, long
23552 and pointer to 32 bits and generates code that runs on any PowerPC
23553 variant. The 64-bit environment sets int to 32 bits and long and
23554 pointer to 64 bits, and generates code for PowerPC64, as for
23555 @option{-mpowerpc64}.
23556
23557 @item -mfull-toc
23558 @itemx -mno-fp-in-toc
23559 @itemx -mno-sum-in-toc
23560 @itemx -mminimal-toc
23561 @opindex mfull-toc
23562 @opindex mno-fp-in-toc
23563 @opindex mno-sum-in-toc
23564 @opindex mminimal-toc
23565 Modify generation of the TOC (Table Of Contents), which is created for
23566 every executable file. The @option{-mfull-toc} option is selected by
23567 default. In that case, GCC allocates at least one TOC entry for
23568 each unique non-automatic variable reference in your program. GCC
23569 also places floating-point constants in the TOC@. However, only
23570 16,384 entries are available in the TOC@.
23571
23572 If you receive a linker error message that saying you have overflowed
23573 the available TOC space, you can reduce the amount of TOC space used
23574 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
23575 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
23576 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
23577 generate code to calculate the sum of an address and a constant at
23578 run time instead of putting that sum into the TOC@. You may specify one
23579 or both of these options. Each causes GCC to produce very slightly
23580 slower and larger code at the expense of conserving TOC space.
23581
23582 If you still run out of space in the TOC even when you specify both of
23583 these options, specify @option{-mminimal-toc} instead. This option causes
23584 GCC to make only one TOC entry for every file. When you specify this
23585 option, GCC produces code that is slower and larger but which
23586 uses extremely little TOC space. You may wish to use this option
23587 only on files that contain less frequently-executed code.
23588
23589 @item -maix64
23590 @itemx -maix32
23591 @opindex maix64
23592 @opindex maix32
23593 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
23594 @code{long} type, and the infrastructure needed to support them.
23595 Specifying @option{-maix64} implies @option{-mpowerpc64},
23596 while @option{-maix32} disables the 64-bit ABI and
23597 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
23598
23599 @item -mxl-compat
23600 @itemx -mno-xl-compat
23601 @opindex mxl-compat
23602 @opindex mno-xl-compat
23603 Produce code that conforms more closely to IBM XL compiler semantics
23604 when using AIX-compatible ABI@. Pass floating-point arguments to
23605 prototyped functions beyond the register save area (RSA) on the stack
23606 in addition to argument FPRs. Do not assume that most significant
23607 double in 128-bit long double value is properly rounded when comparing
23608 values and converting to double. Use XL symbol names for long double
23609 support routines.
23610
23611 The AIX calling convention was extended but not initially documented to
23612 handle an obscure K&R C case of calling a function that takes the
23613 address of its arguments with fewer arguments than declared. IBM XL
23614 compilers access floating-point arguments that do not fit in the
23615 RSA from the stack when a subroutine is compiled without
23616 optimization. Because always storing floating-point arguments on the
23617 stack is inefficient and rarely needed, this option is not enabled by
23618 default and only is necessary when calling subroutines compiled by IBM
23619 XL compilers without optimization.
23620
23621 @item -mpe
23622 @opindex mpe
23623 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
23624 application written to use message passing with special startup code to
23625 enable the application to run. The system must have PE installed in the
23626 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
23627 must be overridden with the @option{-specs=} option to specify the
23628 appropriate directory location. The Parallel Environment does not
23629 support threads, so the @option{-mpe} option and the @option{-pthread}
23630 option are incompatible.
23631
23632 @item -malign-natural
23633 @itemx -malign-power
23634 @opindex malign-natural
23635 @opindex malign-power
23636 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23637 @option{-malign-natural} overrides the ABI-defined alignment of larger
23638 types, such as floating-point doubles, on their natural size-based boundary.
23639 The option @option{-malign-power} instructs GCC to follow the ABI-specified
23640 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
23641
23642 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
23643 is not supported.
23644
23645 @item -msoft-float
23646 @itemx -mhard-float
23647 @opindex msoft-float
23648 @opindex mhard-float
23649 Generate code that does not use (uses) the floating-point register set.
23650 Software floating-point emulation is provided if you use the
23651 @option{-msoft-float} option, and pass the option to GCC when linking.
23652
23653 @item -mmultiple
23654 @itemx -mno-multiple
23655 @opindex mmultiple
23656 @opindex mno-multiple
23657 Generate code that uses (does not use) the load multiple word
23658 instructions and the store multiple word instructions. These
23659 instructions are generated by default on POWER systems, and not
23660 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
23661 PowerPC systems, since those instructions do not work when the
23662 processor is in little-endian mode. The exceptions are PPC740 and
23663 PPC750 which permit these instructions in little-endian mode.
23664
23665 @item -mupdate
23666 @itemx -mno-update
23667 @opindex mupdate
23668 @opindex mno-update
23669 Generate code that uses (does not use) the load or store instructions
23670 that update the base register to the address of the calculated memory
23671 location. These instructions are generated by default. If you use
23672 @option{-mno-update}, there is a small window between the time that the
23673 stack pointer is updated and the address of the previous frame is
23674 stored, which means code that walks the stack frame across interrupts or
23675 signals may get corrupted data.
23676
23677 @item -mavoid-indexed-addresses
23678 @itemx -mno-avoid-indexed-addresses
23679 @opindex mavoid-indexed-addresses
23680 @opindex mno-avoid-indexed-addresses
23681 Generate code that tries to avoid (not avoid) the use of indexed load
23682 or store instructions. These instructions can incur a performance
23683 penalty on Power6 processors in certain situations, such as when
23684 stepping through large arrays that cross a 16M boundary. This option
23685 is enabled by default when targeting Power6 and disabled otherwise.
23686
23687 @item -mfused-madd
23688 @itemx -mno-fused-madd
23689 @opindex mfused-madd
23690 @opindex mno-fused-madd
23691 Generate code that uses (does not use) the floating-point multiply and
23692 accumulate instructions. These instructions are generated by default
23693 if hardware floating point is used. The machine-dependent
23694 @option{-mfused-madd} option is now mapped to the machine-independent
23695 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23696 mapped to @option{-ffp-contract=off}.
23697
23698 @item -mmulhw
23699 @itemx -mno-mulhw
23700 @opindex mmulhw
23701 @opindex mno-mulhw
23702 Generate code that uses (does not use) the half-word multiply and
23703 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
23704 These instructions are generated by default when targeting those
23705 processors.
23706
23707 @item -mdlmzb
23708 @itemx -mno-dlmzb
23709 @opindex mdlmzb
23710 @opindex mno-dlmzb
23711 Generate code that uses (does not use) the string-search @samp{dlmzb}
23712 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
23713 generated by default when targeting those processors.
23714
23715 @item -mno-bit-align
23716 @itemx -mbit-align
23717 @opindex mno-bit-align
23718 @opindex mbit-align
23719 On System V.4 and embedded PowerPC systems do not (do) force structures
23720 and unions that contain bit-fields to be aligned to the base type of the
23721 bit-field.
23722
23723 For example, by default a structure containing nothing but 8
23724 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
23725 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
23726 the structure is aligned to a 1-byte boundary and is 1 byte in
23727 size.
23728
23729 @item -mno-strict-align
23730 @itemx -mstrict-align
23731 @opindex mno-strict-align
23732 @opindex mstrict-align
23733 On System V.4 and embedded PowerPC systems do not (do) assume that
23734 unaligned memory references are handled by the system.
23735
23736 @item -mrelocatable
23737 @itemx -mno-relocatable
23738 @opindex mrelocatable
23739 @opindex mno-relocatable
23740 Generate code that allows (does not allow) a static executable to be
23741 relocated to a different address at run time. A simple embedded
23742 PowerPC system loader should relocate the entire contents of
23743 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
23744 a table of 32-bit addresses generated by this option. For this to
23745 work, all objects linked together must be compiled with
23746 @option{-mrelocatable} or @option{-mrelocatable-lib}.
23747 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
23748
23749 @item -mrelocatable-lib
23750 @itemx -mno-relocatable-lib
23751 @opindex mrelocatable-lib
23752 @opindex mno-relocatable-lib
23753 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
23754 @code{.fixup} section to allow static executables to be relocated at
23755 run time, but @option{-mrelocatable-lib} does not use the smaller stack
23756 alignment of @option{-mrelocatable}. Objects compiled with
23757 @option{-mrelocatable-lib} may be linked with objects compiled with
23758 any combination of the @option{-mrelocatable} options.
23759
23760 @item -mno-toc
23761 @itemx -mtoc
23762 @opindex mno-toc
23763 @opindex mtoc
23764 On System V.4 and embedded PowerPC systems do not (do) assume that
23765 register 2 contains a pointer to a global area pointing to the addresses
23766 used in the program.
23767
23768 @item -mlittle
23769 @itemx -mlittle-endian
23770 @opindex mlittle
23771 @opindex mlittle-endian
23772 On System V.4 and embedded PowerPC systems compile code for the
23773 processor in little-endian mode. The @option{-mlittle-endian} option is
23774 the same as @option{-mlittle}.
23775
23776 @item -mbig
23777 @itemx -mbig-endian
23778 @opindex mbig
23779 @opindex mbig-endian
23780 On System V.4 and embedded PowerPC systems compile code for the
23781 processor in big-endian mode. The @option{-mbig-endian} option is
23782 the same as @option{-mbig}.
23783
23784 @item -mdynamic-no-pic
23785 @opindex mdynamic-no-pic
23786 On Darwin and Mac OS X systems, compile code so that it is not
23787 relocatable, but that its external references are relocatable. The
23788 resulting code is suitable for applications, but not shared
23789 libraries.
23790
23791 @item -msingle-pic-base
23792 @opindex msingle-pic-base
23793 Treat the register used for PIC addressing as read-only, rather than
23794 loading it in the prologue for each function. The runtime system is
23795 responsible for initializing this register with an appropriate value
23796 before execution begins.
23797
23798 @item -mprioritize-restricted-insns=@var{priority}
23799 @opindex mprioritize-restricted-insns
23800 This option controls the priority that is assigned to
23801 dispatch-slot restricted instructions during the second scheduling
23802 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23803 or @samp{2} to assign no, highest, or second-highest (respectively)
23804 priority to dispatch-slot restricted
23805 instructions.
23806
23807 @item -msched-costly-dep=@var{dependence_type}
23808 @opindex msched-costly-dep
23809 This option controls which dependences are considered costly
23810 by the target during instruction scheduling. The argument
23811 @var{dependence_type} takes one of the following values:
23812
23813 @table @asis
23814 @item @samp{no}
23815 No dependence is costly.
23816
23817 @item @samp{all}
23818 All dependences are costly.
23819
23820 @item @samp{true_store_to_load}
23821 A true dependence from store to load is costly.
23822
23823 @item @samp{store_to_load}
23824 Any dependence from store to load is costly.
23825
23826 @item @var{number}
23827 Any dependence for which the latency is greater than or equal to
23828 @var{number} is costly.
23829 @end table
23830
23831 @item -minsert-sched-nops=@var{scheme}
23832 @opindex minsert-sched-nops
23833 This option controls which NOP insertion scheme is used during
23834 the second scheduling pass. The argument @var{scheme} takes one of the
23835 following values:
23836
23837 @table @asis
23838 @item @samp{no}
23839 Don't insert NOPs.
23840
23841 @item @samp{pad}
23842 Pad with NOPs any dispatch group that has vacant issue slots,
23843 according to the scheduler's grouping.
23844
23845 @item @samp{regroup_exact}
23846 Insert NOPs to force costly dependent insns into
23847 separate groups. Insert exactly as many NOPs as needed to force an insn
23848 to a new group, according to the estimated processor grouping.
23849
23850 @item @var{number}
23851 Insert NOPs to force costly dependent insns into
23852 separate groups. Insert @var{number} NOPs to force an insn to a new group.
23853 @end table
23854
23855 @item -mcall-sysv
23856 @opindex mcall-sysv
23857 On System V.4 and embedded PowerPC systems compile code using calling
23858 conventions that adhere to the March 1995 draft of the System V
23859 Application Binary Interface, PowerPC processor supplement. This is the
23860 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
23861
23862 @item -mcall-sysv-eabi
23863 @itemx -mcall-eabi
23864 @opindex mcall-sysv-eabi
23865 @opindex mcall-eabi
23866 Specify both @option{-mcall-sysv} and @option{-meabi} options.
23867
23868 @item -mcall-sysv-noeabi
23869 @opindex mcall-sysv-noeabi
23870 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
23871
23872 @item -mcall-aixdesc
23873 @opindex m
23874 On System V.4 and embedded PowerPC systems compile code for the AIX
23875 operating system.
23876
23877 @item -mcall-linux
23878 @opindex mcall-linux
23879 On System V.4 and embedded PowerPC systems compile code for the
23880 Linux-based GNU system.
23881
23882 @item -mcall-freebsd
23883 @opindex mcall-freebsd
23884 On System V.4 and embedded PowerPC systems compile code for the
23885 FreeBSD operating system.
23886
23887 @item -mcall-netbsd
23888 @opindex mcall-netbsd
23889 On System V.4 and embedded PowerPC systems compile code for the
23890 NetBSD operating system.
23891
23892 @item -mcall-openbsd
23893 @opindex mcall-netbsd
23894 On System V.4 and embedded PowerPC systems compile code for the
23895 OpenBSD operating system.
23896
23897 @item -mtraceback=@var{traceback_type}
23898 @opindex mtraceback
23899 Select the type of traceback table. Valid values for @var{traceback_type}
23900 are @samp{full}, @samp{part}, and @samp{no}.
23901
23902 @item -maix-struct-return
23903 @opindex maix-struct-return
23904 Return all structures in memory (as specified by the AIX ABI)@.
23905
23906 @item -msvr4-struct-return
23907 @opindex msvr4-struct-return
23908 Return structures smaller than 8 bytes in registers (as specified by the
23909 SVR4 ABI)@.
23910
23911 @item -mabi=@var{abi-type}
23912 @opindex mabi
23913 Extend the current ABI with a particular extension, or remove such extension.
23914 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
23915 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
23916 @samp{elfv1}, @samp{elfv2}@.
23917
23918 @item -mabi=ibmlongdouble
23919 @opindex mabi=ibmlongdouble
23920 Change the current ABI to use IBM extended-precision long double.
23921 This is not likely to work if your system defaults to using IEEE
23922 extended-precision long double. If you change the long double type
23923 from IEEE extended-precision, the compiler will issue a warning unless
23924 you use the @option{-Wno-psabi} option.
23925
23926 @item -mabi=ieeelongdouble
23927 @opindex mabi=ieeelongdouble
23928 Change the current ABI to use IEEE extended-precision long double.
23929 This is not likely to work if your system defaults to using IBM
23930 extended-precision long double. If you change the long double type
23931 from IBM extended-precision, the compiler will issue a warning unless
23932 you use the @option{-Wno-psabi} option.
23933
23934 @item -mabi=elfv1
23935 @opindex mabi=elfv1
23936 Change the current ABI to use the ELFv1 ABI.
23937 This is the default ABI for big-endian PowerPC 64-bit Linux.
23938 Overriding the default ABI requires special system support and is
23939 likely to fail in spectacular ways.
23940
23941 @item -mabi=elfv2
23942 @opindex mabi=elfv2
23943 Change the current ABI to use the ELFv2 ABI.
23944 This is the default ABI for little-endian PowerPC 64-bit Linux.
23945 Overriding the default ABI requires special system support and is
23946 likely to fail in spectacular ways.
23947
23948 @item -mgnu-attribute
23949 @itemx -mno-gnu-attribute
23950 @opindex mgnu-attribute
23951 @opindex mno-gnu-attribute
23952 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23953 .gnu.attributes section that specify ABI variations in function
23954 parameters or return values.
23955
23956 @item -mprototype
23957 @itemx -mno-prototype
23958 @opindex mprototype
23959 @opindex mno-prototype
23960 On System V.4 and embedded PowerPC systems assume that all calls to
23961 variable argument functions are properly prototyped. Otherwise, the
23962 compiler must insert an instruction before every non-prototyped call to
23963 set or clear bit 6 of the condition code register (@code{CR}) to
23964 indicate whether floating-point values are passed in the floating-point
23965 registers in case the function takes variable arguments. With
23966 @option{-mprototype}, only calls to prototyped variable argument functions
23967 set or clear the bit.
23968
23969 @item -msim
23970 @opindex msim
23971 On embedded PowerPC systems, assume that the startup module is called
23972 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
23973 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
23974 configurations.
23975
23976 @item -mmvme
23977 @opindex mmvme
23978 On embedded PowerPC systems, assume that the startup module is called
23979 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
23980 @file{libc.a}.
23981
23982 @item -mads
23983 @opindex mads
23984 On embedded PowerPC systems, assume that the startup module is called
23985 @file{crt0.o} and the standard C libraries are @file{libads.a} and
23986 @file{libc.a}.
23987
23988 @item -myellowknife
23989 @opindex myellowknife
23990 On embedded PowerPC systems, assume that the startup module is called
23991 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
23992 @file{libc.a}.
23993
23994 @item -mvxworks
23995 @opindex mvxworks
23996 On System V.4 and embedded PowerPC systems, specify that you are
23997 compiling for a VxWorks system.
23998
23999 @item -memb
24000 @opindex memb
24001 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24002 header to indicate that @samp{eabi} extended relocations are used.
24003
24004 @item -meabi
24005 @itemx -mno-eabi
24006 @opindex meabi
24007 @opindex mno-eabi
24008 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24009 Embedded Applications Binary Interface (EABI), which is a set of
24010 modifications to the System V.4 specifications. Selecting @option{-meabi}
24011 means that the stack is aligned to an 8-byte boundary, a function
24012 @code{__eabi} is called from @code{main} to set up the EABI
24013 environment, and the @option{-msdata} option can use both @code{r2} and
24014 @code{r13} to point to two separate small data areas. Selecting
24015 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24016 no EABI initialization function is called from @code{main}, and the
24017 @option{-msdata} option only uses @code{r13} to point to a single
24018 small data area. The @option{-meabi} option is on by default if you
24019 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24020
24021 @item -msdata=eabi
24022 @opindex msdata=eabi
24023 On System V.4 and embedded PowerPC systems, put small initialized
24024 @code{const} global and static data in the @code{.sdata2} section, which
24025 is pointed to by register @code{r2}. Put small initialized
24026 non-@code{const} global and static data in the @code{.sdata} section,
24027 which is pointed to by register @code{r13}. Put small uninitialized
24028 global and static data in the @code{.sbss} section, which is adjacent to
24029 the @code{.sdata} section. The @option{-msdata=eabi} option is
24030 incompatible with the @option{-mrelocatable} option. The
24031 @option{-msdata=eabi} option also sets the @option{-memb} option.
24032
24033 @item -msdata=sysv
24034 @opindex msdata=sysv
24035 On System V.4 and embedded PowerPC systems, put small global and static
24036 data in the @code{.sdata} section, which is pointed to by register
24037 @code{r13}. Put small uninitialized global and static data in the
24038 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24039 The @option{-msdata=sysv} option is incompatible with the
24040 @option{-mrelocatable} option.
24041
24042 @item -msdata=default
24043 @itemx -msdata
24044 @opindex msdata=default
24045 @opindex msdata
24046 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24047 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24048 same as @option{-msdata=sysv}.
24049
24050 @item -msdata=data
24051 @opindex msdata=data
24052 On System V.4 and embedded PowerPC systems, put small global
24053 data in the @code{.sdata} section. Put small uninitialized global
24054 data in the @code{.sbss} section. Do not use register @code{r13}
24055 to address small data however. This is the default behavior unless
24056 other @option{-msdata} options are used.
24057
24058 @item -msdata=none
24059 @itemx -mno-sdata
24060 @opindex msdata=none
24061 @opindex mno-sdata
24062 On embedded PowerPC systems, put all initialized global and static data
24063 in the @code{.data} section, and all uninitialized data in the
24064 @code{.bss} section.
24065
24066 @item -mreadonly-in-sdata
24067 @opindex mreadonly-in-sdata
24068 @opindex mno-readonly-in-sdata
24069 Put read-only objects in the @code{.sdata} section as well. This is the
24070 default.
24071
24072 @item -mblock-move-inline-limit=@var{num}
24073 @opindex mblock-move-inline-limit
24074 Inline all block moves (such as calls to @code{memcpy} or structure
24075 copies) less than or equal to @var{num} bytes. The minimum value for
24076 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24077 targets. The default value is target-specific.
24078
24079 @item -mblock-compare-inline-limit=@var{num}
24080 @opindex mblock-compare-inline-limit
24081 Generate non-looping inline code for all block compares (such as calls
24082 to @code{memcmp} or structure compares) less than or equal to @var{num}
24083 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24084 block compare is disabled. The default value is target-specific.
24085
24086 @item -mblock-compare-inline-loop-limit=@var{num}
24087 @opindex mblock-compare-inline-loop-limit
24088 Generate an inline expansion using loop code for all block compares that
24089 are less than or equal to @var{num} bytes, but greater than the limit
24090 for non-loop inline block compare expansion. If the block length is not
24091 constant, at most @var{num} bytes will be compared before @code{memcmp}
24092 is called to compare the remainder of the block. The default value is
24093 target-specific.
24094
24095 @item -mstring-compare-inline-limit=@var{num}
24096 @opindex mstring-compare-inline-limit
24097 Generate at most @var{num} pairs of load instructions to compare the
24098 string inline. If the difference or end of string is not found at the
24099 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24100 take care of the rest of the comparison. The default is 8 pairs of
24101 loads, which will compare 64 bytes on a 64-bit target and 32 bytes on a
24102 32-bit target.
24103
24104 @item -G @var{num}
24105 @opindex G
24106 @cindex smaller data references (PowerPC)
24107 @cindex .sdata/.sdata2 references (PowerPC)
24108 On embedded PowerPC systems, put global and static items less than or
24109 equal to @var{num} bytes into the small data or BSS sections instead of
24110 the normal data or BSS section. By default, @var{num} is 8. The
24111 @option{-G @var{num}} switch is also passed to the linker.
24112 All modules should be compiled with the same @option{-G @var{num}} value.
24113
24114 @item -mregnames
24115 @itemx -mno-regnames
24116 @opindex mregnames
24117 @opindex mno-regnames
24118 On System V.4 and embedded PowerPC systems do (do not) emit register
24119 names in the assembly language output using symbolic forms.
24120
24121 @item -mlongcall
24122 @itemx -mno-longcall
24123 @opindex mlongcall
24124 @opindex mno-longcall
24125 By default assume that all calls are far away so that a longer and more
24126 expensive calling sequence is required. This is required for calls
24127 farther than 32 megabytes (33,554,432 bytes) from the current location.
24128 A short call is generated if the compiler knows
24129 the call cannot be that far away. This setting can be overridden by
24130 the @code{shortcall} function attribute, or by @code{#pragma
24131 longcall(0)}.
24132
24133 Some linkers are capable of detecting out-of-range calls and generating
24134 glue code on the fly. On these systems, long calls are unnecessary and
24135 generate slower code. As of this writing, the AIX linker can do this,
24136 as can the GNU linker for PowerPC/64. It is planned to add this feature
24137 to the GNU linker for 32-bit PowerPC systems as well.
24138
24139 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24140 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24141 addresses represent the callee and the branch island. The
24142 Darwin/PPC linker prefers the first address and generates a @code{bl
24143 callee} if the PPC @code{bl} instruction reaches the callee directly;
24144 otherwise, the linker generates @code{bl L42} to call the branch
24145 island. The branch island is appended to the body of the
24146 calling function; it computes the full 32-bit address of the callee
24147 and jumps to it.
24148
24149 On Mach-O (Darwin) systems, this option directs the compiler emit to
24150 the glue for every direct call, and the Darwin linker decides whether
24151 to use or discard it.
24152
24153 In the future, GCC may ignore all longcall specifications
24154 when the linker is known to generate glue.
24155
24156 @item -mtls-markers
24157 @itemx -mno-tls-markers
24158 @opindex mtls-markers
24159 @opindex mno-tls-markers
24160 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24161 specifying the function argument. The relocation allows the linker to
24162 reliably associate function call with argument setup instructions for
24163 TLS optimization, which in turn allows GCC to better schedule the
24164 sequence.
24165
24166 @item -mrecip
24167 @itemx -mno-recip
24168 @opindex mrecip
24169 This option enables use of the reciprocal estimate and
24170 reciprocal square root estimate instructions with additional
24171 Newton-Raphson steps to increase precision instead of doing a divide or
24172 square root and divide for floating-point arguments. You should use
24173 the @option{-ffast-math} option when using @option{-mrecip} (or at
24174 least @option{-funsafe-math-optimizations},
24175 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24176 @option{-fno-trapping-math}). Note that while the throughput of the
24177 sequence is generally higher than the throughput of the non-reciprocal
24178 instruction, the precision of the sequence can be decreased by up to 2
24179 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24180 roots.
24181
24182 @item -mrecip=@var{opt}
24183 @opindex mrecip=opt
24184 This option controls which reciprocal estimate instructions
24185 may be used. @var{opt} is a comma-separated list of options, which may
24186 be preceded by a @code{!} to invert the option:
24187
24188 @table @samp
24189
24190 @item all
24191 Enable all estimate instructions.
24192
24193 @item default
24194 Enable the default instructions, equivalent to @option{-mrecip}.
24195
24196 @item none
24197 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24198
24199 @item div
24200 Enable the reciprocal approximation instructions for both
24201 single and double precision.
24202
24203 @item divf
24204 Enable the single-precision reciprocal approximation instructions.
24205
24206 @item divd
24207 Enable the double-precision reciprocal approximation instructions.
24208
24209 @item rsqrt
24210 Enable the reciprocal square root approximation instructions for both
24211 single and double precision.
24212
24213 @item rsqrtf
24214 Enable the single-precision reciprocal square root approximation instructions.
24215
24216 @item rsqrtd
24217 Enable the double-precision reciprocal square root approximation instructions.
24218
24219 @end table
24220
24221 So, for example, @option{-mrecip=all,!rsqrtd} enables
24222 all of the reciprocal estimate instructions, except for the
24223 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24224 which handle the double-precision reciprocal square root calculations.
24225
24226 @item -mrecip-precision
24227 @itemx -mno-recip-precision
24228 @opindex mrecip-precision
24229 Assume (do not assume) that the reciprocal estimate instructions
24230 provide higher-precision estimates than is mandated by the PowerPC
24231 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24232 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24233 The double-precision square root estimate instructions are not generated by
24234 default on low-precision machines, since they do not provide an
24235 estimate that converges after three steps.
24236
24237 @item -mveclibabi=@var{type}
24238 @opindex mveclibabi
24239 Specifies the ABI type to use for vectorizing intrinsics using an
24240 external library. The only type supported at present is @samp{mass},
24241 which specifies to use IBM's Mathematical Acceleration Subsystem
24242 (MASS) libraries for vectorizing intrinsics using external libraries.
24243 GCC currently emits calls to @code{acosd2}, @code{acosf4},
24244 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
24245 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
24246 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
24247 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
24248 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
24249 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
24250 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
24251 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
24252 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
24253 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
24254 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
24255 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
24256 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
24257 for power7. Both @option{-ftree-vectorize} and
24258 @option{-funsafe-math-optimizations} must also be enabled. The MASS
24259 libraries must be specified at link time.
24260
24261 @item -mfriz
24262 @itemx -mno-friz
24263 @opindex mfriz
24264 Generate (do not generate) the @code{friz} instruction when the
24265 @option{-funsafe-math-optimizations} option is used to optimize
24266 rounding of floating-point values to 64-bit integer and back to floating
24267 point. The @code{friz} instruction does not return the same value if
24268 the floating-point number is too large to fit in an integer.
24269
24270 @item -mpointers-to-nested-functions
24271 @itemx -mno-pointers-to-nested-functions
24272 @opindex mpointers-to-nested-functions
24273 Generate (do not generate) code to load up the static chain register
24274 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24275 systems where a function pointer points to a 3-word descriptor giving
24276 the function address, TOC value to be loaded in register @code{r2}, and
24277 static chain value to be loaded in register @code{r11}. The
24278 @option{-mpointers-to-nested-functions} is on by default. You cannot
24279 call through pointers to nested functions or pointers
24280 to functions compiled in other languages that use the static chain if
24281 you use @option{-mno-pointers-to-nested-functions}.
24282
24283 @item -msave-toc-indirect
24284 @itemx -mno-save-toc-indirect
24285 @opindex msave-toc-indirect
24286 Generate (do not generate) code to save the TOC value in the reserved
24287 stack location in the function prologue if the function calls through
24288 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24289 saved in the prologue, it is saved just before the call through the
24290 pointer. The @option{-mno-save-toc-indirect} option is the default.
24291
24292 @item -mcompat-align-parm
24293 @itemx -mno-compat-align-parm
24294 @opindex mcompat-align-parm
24295 Generate (do not generate) code to pass structure parameters with a
24296 maximum alignment of 64 bits, for compatibility with older versions
24297 of GCC.
24298
24299 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24300 structure parameter on a 128-bit boundary when that structure contained
24301 a member requiring 128-bit alignment. This is corrected in more
24302 recent versions of GCC. This option may be used to generate code
24303 that is compatible with functions compiled with older versions of
24304 GCC.
24305
24306 The @option{-mno-compat-align-parm} option is the default.
24307
24308 @item -mstack-protector-guard=@var{guard}
24309 @itemx -mstack-protector-guard-reg=@var{reg}
24310 @itemx -mstack-protector-guard-offset=@var{offset}
24311 @itemx -mstack-protector-guard-symbol=@var{symbol}
24312 @opindex mstack-protector-guard
24313 @opindex mstack-protector-guard-reg
24314 @opindex mstack-protector-guard-offset
24315 @opindex mstack-protector-guard-symbol
24316 Generate stack protection code using canary at @var{guard}. Supported
24317 locations are @samp{global} for global canary or @samp{tls} for per-thread
24318 canary in the TLS block (the default with GNU libc version 2.4 or later).
24319
24320 With the latter choice the options
24321 @option{-mstack-protector-guard-reg=@var{reg}} and
24322 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
24323 which register to use as base register for reading the canary, and from what
24324 offset from that base register. The default for those is as specified in the
24325 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
24326 the offset with a symbol reference to a canary in the TLS block.
24327 @end table
24328
24329 @node RX Options
24330 @subsection RX Options
24331 @cindex RX Options
24332
24333 These command-line options are defined for RX targets:
24334
24335 @table @gcctabopt
24336 @item -m64bit-doubles
24337 @itemx -m32bit-doubles
24338 @opindex m64bit-doubles
24339 @opindex m32bit-doubles
24340 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24341 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24342 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
24343 works on 32-bit values, which is why the default is
24344 @option{-m32bit-doubles}.
24345
24346 @item -fpu
24347 @itemx -nofpu
24348 @opindex fpu
24349 @opindex nofpu
24350 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
24351 floating-point hardware. The default is enabled for the RX600
24352 series and disabled for the RX200 series.
24353
24354 Floating-point instructions are only generated for 32-bit floating-point
24355 values, however, so the FPU hardware is not used for doubles if the
24356 @option{-m64bit-doubles} option is used.
24357
24358 @emph{Note} If the @option{-fpu} option is enabled then
24359 @option{-funsafe-math-optimizations} is also enabled automatically.
24360 This is because the RX FPU instructions are themselves unsafe.
24361
24362 @item -mcpu=@var{name}
24363 @opindex mcpu
24364 Selects the type of RX CPU to be targeted. Currently three types are
24365 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
24366 the specific @samp{RX610} CPU. The default is @samp{RX600}.
24367
24368 The only difference between @samp{RX600} and @samp{RX610} is that the
24369 @samp{RX610} does not support the @code{MVTIPL} instruction.
24370
24371 The @samp{RX200} series does not have a hardware floating-point unit
24372 and so @option{-nofpu} is enabled by default when this type is
24373 selected.
24374
24375 @item -mbig-endian-data
24376 @itemx -mlittle-endian-data
24377 @opindex mbig-endian-data
24378 @opindex mlittle-endian-data
24379 Store data (but not code) in the big-endian format. The default is
24380 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
24381 format.
24382
24383 @item -msmall-data-limit=@var{N}
24384 @opindex msmall-data-limit
24385 Specifies the maximum size in bytes of global and static variables
24386 which can be placed into the small data area. Using the small data
24387 area can lead to smaller and faster code, but the size of area is
24388 limited and it is up to the programmer to ensure that the area does
24389 not overflow. Also when the small data area is used one of the RX's
24390 registers (usually @code{r13}) is reserved for use pointing to this
24391 area, so it is no longer available for use by the compiler. This
24392 could result in slower and/or larger code if variables are pushed onto
24393 the stack instead of being held in this register.
24394
24395 Note, common variables (variables that have not been initialized) and
24396 constants are not placed into the small data area as they are assigned
24397 to other sections in the output executable.
24398
24399 The default value is zero, which disables this feature. Note, this
24400 feature is not enabled by default with higher optimization levels
24401 (@option{-O2} etc) because of the potentially detrimental effects of
24402 reserving a register. It is up to the programmer to experiment and
24403 discover whether this feature is of benefit to their program. See the
24404 description of the @option{-mpid} option for a description of how the
24405 actual register to hold the small data area pointer is chosen.
24406
24407 @item -msim
24408 @itemx -mno-sim
24409 @opindex msim
24410 @opindex mno-sim
24411 Use the simulator runtime. The default is to use the libgloss
24412 board-specific runtime.
24413
24414 @item -mas100-syntax
24415 @itemx -mno-as100-syntax
24416 @opindex mas100-syntax
24417 @opindex mno-as100-syntax
24418 When generating assembler output use a syntax that is compatible with
24419 Renesas's AS100 assembler. This syntax can also be handled by the GAS
24420 assembler, but it has some restrictions so it is not generated by default.
24421
24422 @item -mmax-constant-size=@var{N}
24423 @opindex mmax-constant-size
24424 Specifies the maximum size, in bytes, of a constant that can be used as
24425 an operand in a RX instruction. Although the RX instruction set does
24426 allow constants of up to 4 bytes in length to be used in instructions,
24427 a longer value equates to a longer instruction. Thus in some
24428 circumstances it can be beneficial to restrict the size of constants
24429 that are used in instructions. Constants that are too big are instead
24430 placed into a constant pool and referenced via register indirection.
24431
24432 The value @var{N} can be between 0 and 4. A value of 0 (the default)
24433 or 4 means that constants of any size are allowed.
24434
24435 @item -mrelax
24436 @opindex mrelax
24437 Enable linker relaxation. Linker relaxation is a process whereby the
24438 linker attempts to reduce the size of a program by finding shorter
24439 versions of various instructions. Disabled by default.
24440
24441 @item -mint-register=@var{N}
24442 @opindex mint-register
24443 Specify the number of registers to reserve for fast interrupt handler
24444 functions. The value @var{N} can be between 0 and 4. A value of 1
24445 means that register @code{r13} is reserved for the exclusive use
24446 of fast interrupt handlers. A value of 2 reserves @code{r13} and
24447 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
24448 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
24449 A value of 0, the default, does not reserve any registers.
24450
24451 @item -msave-acc-in-interrupts
24452 @opindex msave-acc-in-interrupts
24453 Specifies that interrupt handler functions should preserve the
24454 accumulator register. This is only necessary if normal code might use
24455 the accumulator register, for example because it performs 64-bit
24456 multiplications. The default is to ignore the accumulator as this
24457 makes the interrupt handlers faster.
24458
24459 @item -mpid
24460 @itemx -mno-pid
24461 @opindex mpid
24462 @opindex mno-pid
24463 Enables the generation of position independent data. When enabled any
24464 access to constant data is done via an offset from a base address
24465 held in a register. This allows the location of constant data to be
24466 determined at run time without requiring the executable to be
24467 relocated, which is a benefit to embedded applications with tight
24468 memory constraints. Data that can be modified is not affected by this
24469 option.
24470
24471 Note, using this feature reserves a register, usually @code{r13}, for
24472 the constant data base address. This can result in slower and/or
24473 larger code, especially in complicated functions.
24474
24475 The actual register chosen to hold the constant data base address
24476 depends upon whether the @option{-msmall-data-limit} and/or the
24477 @option{-mint-register} command-line options are enabled. Starting
24478 with register @code{r13} and proceeding downwards, registers are
24479 allocated first to satisfy the requirements of @option{-mint-register},
24480 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
24481 is possible for the small data area register to be @code{r8} if both
24482 @option{-mint-register=4} and @option{-mpid} are specified on the
24483 command line.
24484
24485 By default this feature is not enabled. The default can be restored
24486 via the @option{-mno-pid} command-line option.
24487
24488 @item -mno-warn-multiple-fast-interrupts
24489 @itemx -mwarn-multiple-fast-interrupts
24490 @opindex mno-warn-multiple-fast-interrupts
24491 @opindex mwarn-multiple-fast-interrupts
24492 Prevents GCC from issuing a warning message if it finds more than one
24493 fast interrupt handler when it is compiling a file. The default is to
24494 issue a warning for each extra fast interrupt handler found, as the RX
24495 only supports one such interrupt.
24496
24497 @item -mallow-string-insns
24498 @itemx -mno-allow-string-insns
24499 @opindex mallow-string-insns
24500 @opindex mno-allow-string-insns
24501 Enables or disables the use of the string manipulation instructions
24502 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
24503 @code{SWHILE} and also the @code{RMPA} instruction. These
24504 instructions may prefetch data, which is not safe to do if accessing
24505 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
24506 for more information).
24507
24508 The default is to allow these instructions, but it is not possible for
24509 GCC to reliably detect all circumstances where a string instruction
24510 might be used to access an I/O register, so their use cannot be
24511 disabled automatically. Instead it is reliant upon the programmer to
24512 use the @option{-mno-allow-string-insns} option if their program
24513 accesses I/O space.
24514
24515 When the instructions are enabled GCC defines the C preprocessor
24516 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
24517 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
24518
24519 @item -mjsr
24520 @itemx -mno-jsr
24521 @opindex mjsr
24522 @opindex mno-jsr
24523 Use only (or not only) @code{JSR} instructions to access functions.
24524 This option can be used when code size exceeds the range of @code{BSR}
24525 instructions. Note that @option{-mno-jsr} does not mean to not use
24526 @code{JSR} but instead means that any type of branch may be used.
24527 @end table
24528
24529 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
24530 has special significance to the RX port when used with the
24531 @code{interrupt} function attribute. This attribute indicates a
24532 function intended to process fast interrupts. GCC ensures
24533 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
24534 and/or @code{r13} and only provided that the normal use of the
24535 corresponding registers have been restricted via the
24536 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
24537 options.
24538
24539 @node S/390 and zSeries Options
24540 @subsection S/390 and zSeries Options
24541 @cindex S/390 and zSeries Options
24542
24543 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
24544
24545 @table @gcctabopt
24546 @item -mhard-float
24547 @itemx -msoft-float
24548 @opindex mhard-float
24549 @opindex msoft-float
24550 Use (do not use) the hardware floating-point instructions and registers
24551 for floating-point operations. When @option{-msoft-float} is specified,
24552 functions in @file{libgcc.a} are used to perform floating-point
24553 operations. When @option{-mhard-float} is specified, the compiler
24554 generates IEEE floating-point instructions. This is the default.
24555
24556 @item -mhard-dfp
24557 @itemx -mno-hard-dfp
24558 @opindex mhard-dfp
24559 @opindex mno-hard-dfp
24560 Use (do not use) the hardware decimal-floating-point instructions for
24561 decimal-floating-point operations. When @option{-mno-hard-dfp} is
24562 specified, functions in @file{libgcc.a} are used to perform
24563 decimal-floating-point operations. When @option{-mhard-dfp} is
24564 specified, the compiler generates decimal-floating-point hardware
24565 instructions. This is the default for @option{-march=z9-ec} or higher.
24566
24567 @item -mlong-double-64
24568 @itemx -mlong-double-128
24569 @opindex mlong-double-64
24570 @opindex mlong-double-128
24571 These switches control the size of @code{long double} type. A size
24572 of 64 bits makes the @code{long double} type equivalent to the @code{double}
24573 type. This is the default.
24574
24575 @item -mbackchain
24576 @itemx -mno-backchain
24577 @opindex mbackchain
24578 @opindex mno-backchain
24579 Store (do not store) the address of the caller's frame as backchain pointer
24580 into the callee's stack frame.
24581 A backchain may be needed to allow debugging using tools that do not understand
24582 DWARF call frame information.
24583 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
24584 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
24585 the backchain is placed into the topmost word of the 96/160 byte register
24586 save area.
24587
24588 In general, code compiled with @option{-mbackchain} is call-compatible with
24589 code compiled with @option{-mmo-backchain}; however, use of the backchain
24590 for debugging purposes usually requires that the whole binary is built with
24591 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
24592 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
24593 to build a linux kernel use @option{-msoft-float}.
24594
24595 The default is to not maintain the backchain.
24596
24597 @item -mpacked-stack
24598 @itemx -mno-packed-stack
24599 @opindex mpacked-stack
24600 @opindex mno-packed-stack
24601 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
24602 specified, the compiler uses the all fields of the 96/160 byte register save
24603 area only for their default purpose; unused fields still take up stack space.
24604 When @option{-mpacked-stack} is specified, register save slots are densely
24605 packed at the top of the register save area; unused space is reused for other
24606 purposes, allowing for more efficient use of the available stack space.
24607 However, when @option{-mbackchain} is also in effect, the topmost word of
24608 the save area is always used to store the backchain, and the return address
24609 register is always saved two words below the backchain.
24610
24611 As long as the stack frame backchain is not used, code generated with
24612 @option{-mpacked-stack} is call-compatible with code generated with
24613 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
24614 S/390 or zSeries generated code that uses the stack frame backchain at run
24615 time, not just for debugging purposes. Such code is not call-compatible
24616 with code compiled with @option{-mpacked-stack}. Also, note that the
24617 combination of @option{-mbackchain},
24618 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
24619 to build a linux kernel use @option{-msoft-float}.
24620
24621 The default is to not use the packed stack layout.
24622
24623 @item -msmall-exec
24624 @itemx -mno-small-exec
24625 @opindex msmall-exec
24626 @opindex mno-small-exec
24627 Generate (or do not generate) code using the @code{bras} instruction
24628 to do subroutine calls.
24629 This only works reliably if the total executable size does not
24630 exceed 64k. The default is to use the @code{basr} instruction instead,
24631 which does not have this limitation.
24632
24633 @item -m64
24634 @itemx -m31
24635 @opindex m64
24636 @opindex m31
24637 When @option{-m31} is specified, generate code compliant to the
24638 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
24639 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
24640 particular to generate 64-bit instructions. For the @samp{s390}
24641 targets, the default is @option{-m31}, while the @samp{s390x}
24642 targets default to @option{-m64}.
24643
24644 @item -mzarch
24645 @itemx -mesa
24646 @opindex mzarch
24647 @opindex mesa
24648 When @option{-mzarch} is specified, generate code using the
24649 instructions available on z/Architecture.
24650 When @option{-mesa} is specified, generate code using the
24651 instructions available on ESA/390. Note that @option{-mesa} is
24652 not possible with @option{-m64}.
24653 When generating code compliant to the GNU/Linux for S/390 ABI,
24654 the default is @option{-mesa}. When generating code compliant
24655 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
24656
24657 @item -mhtm
24658 @itemx -mno-htm
24659 @opindex mhtm
24660 @opindex mno-htm
24661 The @option{-mhtm} option enables a set of builtins making use of
24662 instructions available with the transactional execution facility
24663 introduced with the IBM zEnterprise EC12 machine generation
24664 @ref{S/390 System z Built-in Functions}.
24665 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
24666
24667 @item -mvx
24668 @itemx -mno-vx
24669 @opindex mvx
24670 @opindex mno-vx
24671 When @option{-mvx} is specified, generate code using the instructions
24672 available with the vector extension facility introduced with the IBM
24673 z13 machine generation.
24674 This option changes the ABI for some vector type values with regard to
24675 alignment and calling conventions. In case vector type values are
24676 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
24677 command will be added to mark the resulting binary with the ABI used.
24678 @option{-mvx} is enabled by default when using @option{-march=z13}.
24679
24680 @item -mzvector
24681 @itemx -mno-zvector
24682 @opindex mzvector
24683 @opindex mno-zvector
24684 The @option{-mzvector} option enables vector language extensions and
24685 builtins using instructions available with the vector extension
24686 facility introduced with the IBM z13 machine generation.
24687 This option adds support for @samp{vector} to be used as a keyword to
24688 define vector type variables and arguments. @samp{vector} is only
24689 available when GNU extensions are enabled. It will not be expanded
24690 when requesting strict standard compliance e.g. with @option{-std=c99}.
24691 In addition to the GCC low-level builtins @option{-mzvector} enables
24692 a set of builtins added for compatibility with AltiVec-style
24693 implementations like Power and Cell. In order to make use of these
24694 builtins the header file @file{vecintrin.h} needs to be included.
24695 @option{-mzvector} is disabled by default.
24696
24697 @item -mmvcle
24698 @itemx -mno-mvcle
24699 @opindex mmvcle
24700 @opindex mno-mvcle
24701 Generate (or do not generate) code using the @code{mvcle} instruction
24702 to perform block moves. When @option{-mno-mvcle} is specified,
24703 use a @code{mvc} loop instead. This is the default unless optimizing for
24704 size.
24705
24706 @item -mdebug
24707 @itemx -mno-debug
24708 @opindex mdebug
24709 @opindex mno-debug
24710 Print (or do not print) additional debug information when compiling.
24711 The default is to not print debug information.
24712
24713 @item -march=@var{cpu-type}
24714 @opindex march
24715 Generate code that runs on @var{cpu-type}, which is the name of a
24716 system representing a certain processor type. Possible values for
24717 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
24718 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
24719 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
24720 @samp{native}.
24721
24722 The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and
24723 @samp{g6} are deprecated and will be removed with future releases.
24724
24725 Specifying @samp{native} as cpu type can be used to select the best
24726 architecture option for the host processor.
24727 @option{-march=native} has no effect if GCC does not recognize the
24728 processor.
24729
24730 @item -mtune=@var{cpu-type}
24731 @opindex mtune
24732 Tune to @var{cpu-type} everything applicable about the generated code,
24733 except for the ABI and the set of available instructions.
24734 The list of @var{cpu-type} values is the same as for @option{-march}.
24735 The default is the value used for @option{-march}.
24736
24737 @item -mtpf-trace
24738 @itemx -mno-tpf-trace
24739 @opindex mtpf-trace
24740 @opindex mno-tpf-trace
24741 Generate code that adds (does not add) in TPF OS specific branches to trace
24742 routines in the operating system. This option is off by default, even
24743 when compiling for the TPF OS@.
24744
24745 @item -mfused-madd
24746 @itemx -mno-fused-madd
24747 @opindex mfused-madd
24748 @opindex mno-fused-madd
24749 Generate code that uses (does not use) the floating-point multiply and
24750 accumulate instructions. These instructions are generated by default if
24751 hardware floating point is used.
24752
24753 @item -mwarn-framesize=@var{framesize}
24754 @opindex mwarn-framesize
24755 Emit a warning if the current function exceeds the given frame size. Because
24756 this is a compile-time check it doesn't need to be a real problem when the program
24757 runs. It is intended to identify functions that most probably cause
24758 a stack overflow. It is useful to be used in an environment with limited stack
24759 size e.g.@: the linux kernel.
24760
24761 @item -mwarn-dynamicstack
24762 @opindex mwarn-dynamicstack
24763 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
24764 arrays. This is generally a bad idea with a limited stack size.
24765
24766 @item -mstack-guard=@var{stack-guard}
24767 @itemx -mstack-size=@var{stack-size}
24768 @opindex mstack-guard
24769 @opindex mstack-size
24770 If these options are provided the S/390 back end emits additional instructions in
24771 the function prologue that trigger a trap if the stack size is @var{stack-guard}
24772 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
24773 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
24774 the frame size of the compiled function is chosen.
24775 These options are intended to be used to help debugging stack overflow problems.
24776 The additionally emitted code causes only little overhead and hence can also be
24777 used in production-like systems without greater performance degradation. The given
24778 values have to be exact powers of 2 and @var{stack-size} has to be greater than
24779 @var{stack-guard} without exceeding 64k.
24780 In order to be efficient the extra code makes the assumption that the stack starts
24781 at an address aligned to the value given by @var{stack-size}.
24782 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
24783
24784 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
24785 @opindex mhotpatch
24786 If the hotpatch option is enabled, a ``hot-patching'' function
24787 prologue is generated for all functions in the compilation unit.
24788 The funtion label is prepended with the given number of two-byte
24789 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
24790 the label, 2 * @var{post-halfwords} bytes are appended, using the
24791 largest NOP like instructions the architecture allows (maximum
24792 1000000).
24793
24794 If both arguments are zero, hotpatching is disabled.
24795
24796 This option can be overridden for individual functions with the
24797 @code{hotpatch} attribute.
24798 @end table
24799
24800 @node Score Options
24801 @subsection Score Options
24802 @cindex Score Options
24803
24804 These options are defined for Score implementations:
24805
24806 @table @gcctabopt
24807 @item -meb
24808 @opindex meb
24809 Compile code for big-endian mode. This is the default.
24810
24811 @item -mel
24812 @opindex mel
24813 Compile code for little-endian mode.
24814
24815 @item -mnhwloop
24816 @opindex mnhwloop
24817 Disable generation of @code{bcnz} instructions.
24818
24819 @item -muls
24820 @opindex muls
24821 Enable generation of unaligned load and store instructions.
24822
24823 @item -mmac
24824 @opindex mmac
24825 Enable the use of multiply-accumulate instructions. Disabled by default.
24826
24827 @item -mscore5
24828 @opindex mscore5
24829 Specify the SCORE5 as the target architecture.
24830
24831 @item -mscore5u
24832 @opindex mscore5u
24833 Specify the SCORE5U of the target architecture.
24834
24835 @item -mscore7
24836 @opindex mscore7
24837 Specify the SCORE7 as the target architecture. This is the default.
24838
24839 @item -mscore7d
24840 @opindex mscore7d
24841 Specify the SCORE7D as the target architecture.
24842 @end table
24843
24844 @node SH Options
24845 @subsection SH Options
24846
24847 These @samp{-m} options are defined for the SH implementations:
24848
24849 @table @gcctabopt
24850 @item -m1
24851 @opindex m1
24852 Generate code for the SH1.
24853
24854 @item -m2
24855 @opindex m2
24856 Generate code for the SH2.
24857
24858 @item -m2e
24859 Generate code for the SH2e.
24860
24861 @item -m2a-nofpu
24862 @opindex m2a-nofpu
24863 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
24864 that the floating-point unit is not used.
24865
24866 @item -m2a-single-only
24867 @opindex m2a-single-only
24868 Generate code for the SH2a-FPU, in such a way that no double-precision
24869 floating-point operations are used.
24870
24871 @item -m2a-single
24872 @opindex m2a-single
24873 Generate code for the SH2a-FPU assuming the floating-point unit is in
24874 single-precision mode by default.
24875
24876 @item -m2a
24877 @opindex m2a
24878 Generate code for the SH2a-FPU assuming the floating-point unit is in
24879 double-precision mode by default.
24880
24881 @item -m3
24882 @opindex m3
24883 Generate code for the SH3.
24884
24885 @item -m3e
24886 @opindex m3e
24887 Generate code for the SH3e.
24888
24889 @item -m4-nofpu
24890 @opindex m4-nofpu
24891 Generate code for the SH4 without a floating-point unit.
24892
24893 @item -m4-single-only
24894 @opindex m4-single-only
24895 Generate code for the SH4 with a floating-point unit that only
24896 supports single-precision arithmetic.
24897
24898 @item -m4-single
24899 @opindex m4-single
24900 Generate code for the SH4 assuming the floating-point unit is in
24901 single-precision mode by default.
24902
24903 @item -m4
24904 @opindex m4
24905 Generate code for the SH4.
24906
24907 @item -m4-100
24908 @opindex m4-100
24909 Generate code for SH4-100.
24910
24911 @item -m4-100-nofpu
24912 @opindex m4-100-nofpu
24913 Generate code for SH4-100 in such a way that the
24914 floating-point unit is not used.
24915
24916 @item -m4-100-single
24917 @opindex m4-100-single
24918 Generate code for SH4-100 assuming the floating-point unit is in
24919 single-precision mode by default.
24920
24921 @item -m4-100-single-only
24922 @opindex m4-100-single-only
24923 Generate code for SH4-100 in such a way that no double-precision
24924 floating-point operations are used.
24925
24926 @item -m4-200
24927 @opindex m4-200
24928 Generate code for SH4-200.
24929
24930 @item -m4-200-nofpu
24931 @opindex m4-200-nofpu
24932 Generate code for SH4-200 without in such a way that the
24933 floating-point unit is not used.
24934
24935 @item -m4-200-single
24936 @opindex m4-200-single
24937 Generate code for SH4-200 assuming the floating-point unit is in
24938 single-precision mode by default.
24939
24940 @item -m4-200-single-only
24941 @opindex m4-200-single-only
24942 Generate code for SH4-200 in such a way that no double-precision
24943 floating-point operations are used.
24944
24945 @item -m4-300
24946 @opindex m4-300
24947 Generate code for SH4-300.
24948
24949 @item -m4-300-nofpu
24950 @opindex m4-300-nofpu
24951 Generate code for SH4-300 without in such a way that the
24952 floating-point unit is not used.
24953
24954 @item -m4-300-single
24955 @opindex m4-300-single
24956 Generate code for SH4-300 in such a way that no double-precision
24957 floating-point operations are used.
24958
24959 @item -m4-300-single-only
24960 @opindex m4-300-single-only
24961 Generate code for SH4-300 in such a way that no double-precision
24962 floating-point operations are used.
24963
24964 @item -m4-340
24965 @opindex m4-340
24966 Generate code for SH4-340 (no MMU, no FPU).
24967
24968 @item -m4-500
24969 @opindex m4-500
24970 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
24971 assembler.
24972
24973 @item -m4a-nofpu
24974 @opindex m4a-nofpu
24975 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
24976 floating-point unit is not used.
24977
24978 @item -m4a-single-only
24979 @opindex m4a-single-only
24980 Generate code for the SH4a, in such a way that no double-precision
24981 floating-point operations are used.
24982
24983 @item -m4a-single
24984 @opindex m4a-single
24985 Generate code for the SH4a assuming the floating-point unit is in
24986 single-precision mode by default.
24987
24988 @item -m4a
24989 @opindex m4a
24990 Generate code for the SH4a.
24991
24992 @item -m4al
24993 @opindex m4al
24994 Same as @option{-m4a-nofpu}, except that it implicitly passes
24995 @option{-dsp} to the assembler. GCC doesn't generate any DSP
24996 instructions at the moment.
24997
24998 @item -mb
24999 @opindex mb
25000 Compile code for the processor in big-endian mode.
25001
25002 @item -ml
25003 @opindex ml
25004 Compile code for the processor in little-endian mode.
25005
25006 @item -mdalign
25007 @opindex mdalign
25008 Align doubles at 64-bit boundaries. Note that this changes the calling
25009 conventions, and thus some functions from the standard C library do
25010 not work unless you recompile it first with @option{-mdalign}.
25011
25012 @item -mrelax
25013 @opindex mrelax
25014 Shorten some address references at link time, when possible; uses the
25015 linker option @option{-relax}.
25016
25017 @item -mbigtable
25018 @opindex mbigtable
25019 Use 32-bit offsets in @code{switch} tables. The default is to use
25020 16-bit offsets.
25021
25022 @item -mbitops
25023 @opindex mbitops
25024 Enable the use of bit manipulation instructions on SH2A.
25025
25026 @item -mfmovd
25027 @opindex mfmovd
25028 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25029 alignment constraints.
25030
25031 @item -mrenesas
25032 @opindex mrenesas
25033 Comply with the calling conventions defined by Renesas.
25034
25035 @item -mno-renesas
25036 @opindex mno-renesas
25037 Comply with the calling conventions defined for GCC before the Renesas
25038 conventions were available. This option is the default for all
25039 targets of the SH toolchain.
25040
25041 @item -mnomacsave
25042 @opindex mnomacsave
25043 Mark the @code{MAC} register as call-clobbered, even if
25044 @option{-mrenesas} is given.
25045
25046 @item -mieee
25047 @itemx -mno-ieee
25048 @opindex mieee
25049 @opindex mno-ieee
25050 Control the IEEE compliance of floating-point comparisons, which affects the
25051 handling of cases where the result of a comparison is unordered. By default
25052 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25053 enabled @option{-mno-ieee} is implicitly set, which results in faster
25054 floating-point greater-equal and less-equal comparisons. The implicit settings
25055 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25056
25057 @item -minline-ic_invalidate
25058 @opindex minline-ic_invalidate
25059 Inline code to invalidate instruction cache entries after setting up
25060 nested function trampolines.
25061 This option has no effect if @option{-musermode} is in effect and the selected
25062 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
25063 instruction.
25064 If the selected code generation option does not allow the use of the @code{icbi}
25065 instruction, and @option{-musermode} is not in effect, the inlined code
25066 manipulates the instruction cache address array directly with an associative
25067 write. This not only requires privileged mode at run time, but it also
25068 fails if the cache line had been mapped via the TLB and has become unmapped.
25069
25070 @item -misize
25071 @opindex misize
25072 Dump instruction size and location in the assembly code.
25073
25074 @item -mpadstruct
25075 @opindex mpadstruct
25076 This option is deprecated. It pads structures to multiple of 4 bytes,
25077 which is incompatible with the SH ABI@.
25078
25079 @item -matomic-model=@var{model}
25080 @opindex matomic-model=@var{model}
25081 Sets the model of atomic operations and additional parameters as a comma
25082 separated list. For details on the atomic built-in functions see
25083 @ref{__atomic Builtins}. The following models and parameters are supported:
25084
25085 @table @samp
25086
25087 @item none
25088 Disable compiler generated atomic sequences and emit library calls for atomic
25089 operations. This is the default if the target is not @code{sh*-*-linux*}.
25090
25091 @item soft-gusa
25092 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25093 built-in functions. The generated atomic sequences require additional support
25094 from the interrupt/exception handling code of the system and are only suitable
25095 for SH3* and SH4* single-core systems. This option is enabled by default when
25096 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25097 this option also partially utilizes the hardware atomic instructions
25098 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25099 @samp{strict} is specified.
25100
25101 @item soft-tcb
25102 Generate software atomic sequences that use a variable in the thread control
25103 block. This is a variation of the gUSA sequences which can also be used on
25104 SH1* and SH2* targets. The generated atomic sequences require additional
25105 support from the interrupt/exception handling code of the system and are only
25106 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25107 parameter has to be specified as well.
25108
25109 @item soft-imask
25110 Generate software atomic sequences that temporarily disable interrupts by
25111 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25112 in privileged mode and is only suitable for single-core systems. Additional
25113 support from the interrupt/exception handling code of the system is not
25114 required. This model is enabled by default when the target is
25115 @code{sh*-*-linux*} and SH1* or SH2*.
25116
25117 @item hard-llcs
25118 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25119 instructions only. This is only available on SH4A and is suitable for
25120 multi-core systems. Since the hardware instructions support only 32 bit atomic
25121 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25122 Code compiled with this option is also compatible with other software
25123 atomic model interrupt/exception handling systems if executed on an SH4A
25124 system. Additional support from the interrupt/exception handling code of the
25125 system is not required for this model.
25126
25127 @item gbr-offset=
25128 This parameter specifies the offset in bytes of the variable in the thread
25129 control block structure that should be used by the generated atomic sequences
25130 when the @samp{soft-tcb} model has been selected. For other models this
25131 parameter is ignored. The specified value must be an integer multiple of four
25132 and in the range 0-1020.
25133
25134 @item strict
25135 This parameter prevents mixed usage of multiple atomic models, even if they
25136 are compatible, and makes the compiler generate atomic sequences of the
25137 specified model only.
25138
25139 @end table
25140
25141 @item -mtas
25142 @opindex mtas
25143 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25144 Notice that depending on the particular hardware and software configuration
25145 this can degrade overall performance due to the operand cache line flushes
25146 that are implied by the @code{tas.b} instruction. On multi-core SH4A
25147 processors the @code{tas.b} instruction must be used with caution since it
25148 can result in data corruption for certain cache configurations.
25149
25150 @item -mprefergot
25151 @opindex mprefergot
25152 When generating position-independent code, emit function calls using
25153 the Global Offset Table instead of the Procedure Linkage Table.
25154
25155 @item -musermode
25156 @itemx -mno-usermode
25157 @opindex musermode
25158 @opindex mno-usermode
25159 Don't allow (allow) the compiler generating privileged mode code. Specifying
25160 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25161 inlined code would not work in user mode. @option{-musermode} is the default
25162 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
25163 @option{-musermode} has no effect, since there is no user mode.
25164
25165 @item -multcost=@var{number}
25166 @opindex multcost=@var{number}
25167 Set the cost to assume for a multiply insn.
25168
25169 @item -mdiv=@var{strategy}
25170 @opindex mdiv=@var{strategy}
25171 Set the division strategy to be used for integer division operations.
25172 @var{strategy} can be one of:
25173
25174 @table @samp
25175
25176 @item call-div1
25177 Calls a library function that uses the single-step division instruction
25178 @code{div1} to perform the operation. Division by zero calculates an
25179 unspecified result and does not trap. This is the default except for SH4,
25180 SH2A and SHcompact.
25181
25182 @item call-fp
25183 Calls a library function that performs the operation in double precision
25184 floating point. Division by zero causes a floating-point exception. This is
25185 the default for SHcompact with FPU. Specifying this for targets that do not
25186 have a double precision FPU defaults to @code{call-div1}.
25187
25188 @item call-table
25189 Calls a library function that uses a lookup table for small divisors and
25190 the @code{div1} instruction with case distinction for larger divisors. Division
25191 by zero calculates an unspecified result and does not trap. This is the default
25192 for SH4. Specifying this for targets that do not have dynamic shift
25193 instructions defaults to @code{call-div1}.
25194
25195 @end table
25196
25197 When a division strategy has not been specified the default strategy is
25198 selected based on the current target. For SH2A the default strategy is to
25199 use the @code{divs} and @code{divu} instructions instead of library function
25200 calls.
25201
25202 @item -maccumulate-outgoing-args
25203 @opindex maccumulate-outgoing-args
25204 Reserve space once for outgoing arguments in the function prologue rather
25205 than around each call. Generally beneficial for performance and size. Also
25206 needed for unwinding to avoid changing the stack frame around conditional code.
25207
25208 @item -mdivsi3_libfunc=@var{name}
25209 @opindex mdivsi3_libfunc=@var{name}
25210 Set the name of the library function used for 32-bit signed division to
25211 @var{name}.
25212 This only affects the name used in the @samp{call} division strategies, and
25213 the compiler still expects the same sets of input/output/clobbered registers as
25214 if this option were not present.
25215
25216 @item -mfixed-range=@var{register-range}
25217 @opindex mfixed-range
25218 Generate code treating the given register range as fixed registers.
25219 A fixed register is one that the register allocator can not use. This is
25220 useful when compiling kernel code. A register range is specified as
25221 two registers separated by a dash. Multiple register ranges can be
25222 specified separated by a comma.
25223
25224 @item -mbranch-cost=@var{num}
25225 @opindex mbranch-cost=@var{num}
25226 Assume @var{num} to be the cost for a branch instruction. Higher numbers
25227 make the compiler try to generate more branch-free code if possible.
25228 If not specified the value is selected depending on the processor type that
25229 is being compiled for.
25230
25231 @item -mzdcbranch
25232 @itemx -mno-zdcbranch
25233 @opindex mzdcbranch
25234 @opindex mno-zdcbranch
25235 Assume (do not assume) that zero displacement conditional branch instructions
25236 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
25237 compiler prefers zero displacement branch code sequences. This is
25238 enabled by default when generating code for SH4 and SH4A. It can be explicitly
25239 disabled by specifying @option{-mno-zdcbranch}.
25240
25241 @item -mcbranch-force-delay-slot
25242 @opindex mcbranch-force-delay-slot
25243 Force the usage of delay slots for conditional branches, which stuffs the delay
25244 slot with a @code{nop} if a suitable instruction cannot be found. By default
25245 this option is disabled. It can be enabled to work around hardware bugs as
25246 found in the original SH7055.
25247
25248 @item -mfused-madd
25249 @itemx -mno-fused-madd
25250 @opindex mfused-madd
25251 @opindex mno-fused-madd
25252 Generate code that uses (does not use) the floating-point multiply and
25253 accumulate instructions. These instructions are generated by default
25254 if hardware floating point is used. The machine-dependent
25255 @option{-mfused-madd} option is now mapped to the machine-independent
25256 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25257 mapped to @option{-ffp-contract=off}.
25258
25259 @item -mfsca
25260 @itemx -mno-fsca
25261 @opindex mfsca
25262 @opindex mno-fsca
25263 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
25264 and cosine approximations. The option @option{-mfsca} must be used in
25265 combination with @option{-funsafe-math-optimizations}. It is enabled by default
25266 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
25267 approximations even if @option{-funsafe-math-optimizations} is in effect.
25268
25269 @item -mfsrra
25270 @itemx -mno-fsrra
25271 @opindex mfsrra
25272 @opindex mno-fsrra
25273 Allow or disallow the compiler to emit the @code{fsrra} instruction for
25274 reciprocal square root approximations. The option @option{-mfsrra} must be used
25275 in combination with @option{-funsafe-math-optimizations} and
25276 @option{-ffinite-math-only}. It is enabled by default when generating code for
25277 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
25278 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
25279 in effect.
25280
25281 @item -mpretend-cmove
25282 @opindex mpretend-cmove
25283 Prefer zero-displacement conditional branches for conditional move instruction
25284 patterns. This can result in faster code on the SH4 processor.
25285
25286 @item -mfdpic
25287 @opindex fdpic
25288 Generate code using the FDPIC ABI.
25289
25290 @end table
25291
25292 @node Solaris 2 Options
25293 @subsection Solaris 2 Options
25294 @cindex Solaris 2 options
25295
25296 These @samp{-m} options are supported on Solaris 2:
25297
25298 @table @gcctabopt
25299 @item -mclear-hwcap
25300 @opindex mclear-hwcap
25301 @option{-mclear-hwcap} tells the compiler to remove the hardware
25302 capabilities generated by the Solaris assembler. This is only necessary
25303 when object files use ISA extensions not supported by the current
25304 machine, but check at runtime whether or not to use them.
25305
25306 @item -mimpure-text
25307 @opindex mimpure-text
25308 @option{-mimpure-text}, used in addition to @option{-shared}, tells
25309 the compiler to not pass @option{-z text} to the linker when linking a
25310 shared object. Using this option, you can link position-dependent
25311 code into a shared object.
25312
25313 @option{-mimpure-text} suppresses the ``relocations remain against
25314 allocatable but non-writable sections'' linker error message.
25315 However, the necessary relocations trigger copy-on-write, and the
25316 shared object is not actually shared across processes. Instead of
25317 using @option{-mimpure-text}, you should compile all source code with
25318 @option{-fpic} or @option{-fPIC}.
25319
25320 @end table
25321
25322 These switches are supported in addition to the above on Solaris 2:
25323
25324 @table @gcctabopt
25325 @item -pthreads
25326 @opindex pthreads
25327 This is a synonym for @option{-pthread}.
25328 @end table
25329
25330 @node SPARC Options
25331 @subsection SPARC Options
25332 @cindex SPARC options
25333
25334 These @samp{-m} options are supported on the SPARC:
25335
25336 @table @gcctabopt
25337 @item -mno-app-regs
25338 @itemx -mapp-regs
25339 @opindex mno-app-regs
25340 @opindex mapp-regs
25341 Specify @option{-mapp-regs} to generate output using the global registers
25342 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
25343 global register 1, each global register 2 through 4 is then treated as an
25344 allocable register that is clobbered by function calls. This is the default.
25345
25346 To be fully SVR4 ABI-compliant at the cost of some performance loss,
25347 specify @option{-mno-app-regs}. You should compile libraries and system
25348 software with this option.
25349
25350 @item -mflat
25351 @itemx -mno-flat
25352 @opindex mflat
25353 @opindex mno-flat
25354 With @option{-mflat}, the compiler does not generate save/restore instructions
25355 and uses a ``flat'' or single register window model. This model is compatible
25356 with the regular register window model. The local registers and the input
25357 registers (0--5) are still treated as ``call-saved'' registers and are
25358 saved on the stack as needed.
25359
25360 With @option{-mno-flat} (the default), the compiler generates save/restore
25361 instructions (except for leaf functions). This is the normal operating mode.
25362
25363 @item -mfpu
25364 @itemx -mhard-float
25365 @opindex mfpu
25366 @opindex mhard-float
25367 Generate output containing floating-point instructions. This is the
25368 default.
25369
25370 @item -mno-fpu
25371 @itemx -msoft-float
25372 @opindex mno-fpu
25373 @opindex msoft-float
25374 Generate output containing library calls for floating point.
25375 @strong{Warning:} the requisite libraries are not available for all SPARC
25376 targets. Normally the facilities of the machine's usual C compiler are
25377 used, but this cannot be done directly in cross-compilation. You must make
25378 your own arrangements to provide suitable library functions for
25379 cross-compilation. The embedded targets @samp{sparc-*-aout} and
25380 @samp{sparclite-*-*} do provide software floating-point support.
25381
25382 @option{-msoft-float} changes the calling convention in the output file;
25383 therefore, it is only useful if you compile @emph{all} of a program with
25384 this option. In particular, you need to compile @file{libgcc.a}, the
25385 library that comes with GCC, with @option{-msoft-float} in order for
25386 this to work.
25387
25388 @item -mhard-quad-float
25389 @opindex mhard-quad-float
25390 Generate output containing quad-word (long double) floating-point
25391 instructions.
25392
25393 @item -msoft-quad-float
25394 @opindex msoft-quad-float
25395 Generate output containing library calls for quad-word (long double)
25396 floating-point instructions. The functions called are those specified
25397 in the SPARC ABI@. This is the default.
25398
25399 As of this writing, there are no SPARC implementations that have hardware
25400 support for the quad-word floating-point instructions. They all invoke
25401 a trap handler for one of these instructions, and then the trap handler
25402 emulates the effect of the instruction. Because of the trap handler overhead,
25403 this is much slower than calling the ABI library routines. Thus the
25404 @option{-msoft-quad-float} option is the default.
25405
25406 @item -mno-unaligned-doubles
25407 @itemx -munaligned-doubles
25408 @opindex mno-unaligned-doubles
25409 @opindex munaligned-doubles
25410 Assume that doubles have 8-byte alignment. This is the default.
25411
25412 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
25413 alignment only if they are contained in another type, or if they have an
25414 absolute address. Otherwise, it assumes they have 4-byte alignment.
25415 Specifying this option avoids some rare compatibility problems with code
25416 generated by other compilers. It is not the default because it results
25417 in a performance loss, especially for floating-point code.
25418
25419 @item -muser-mode
25420 @itemx -mno-user-mode
25421 @opindex muser-mode
25422 @opindex mno-user-mode
25423 Do not generate code that can only run in supervisor mode. This is relevant
25424 only for the @code{casa} instruction emitted for the LEON3 processor. This
25425 is the default.
25426
25427 @item -mfaster-structs
25428 @itemx -mno-faster-structs
25429 @opindex mfaster-structs
25430 @opindex mno-faster-structs
25431 With @option{-mfaster-structs}, the compiler assumes that structures
25432 should have 8-byte alignment. This enables the use of pairs of
25433 @code{ldd} and @code{std} instructions for copies in structure
25434 assignment, in place of twice as many @code{ld} and @code{st} pairs.
25435 However, the use of this changed alignment directly violates the SPARC
25436 ABI@. Thus, it's intended only for use on targets where the developer
25437 acknowledges that their resulting code is not directly in line with
25438 the rules of the ABI@.
25439
25440 @item -mstd-struct-return
25441 @itemx -mno-std-struct-return
25442 @opindex mstd-struct-return
25443 @opindex mno-std-struct-return
25444 With @option{-mstd-struct-return}, the compiler generates checking code
25445 in functions returning structures or unions to detect size mismatches
25446 between the two sides of function calls, as per the 32-bit ABI@.
25447
25448 The default is @option{-mno-std-struct-return}. This option has no effect
25449 in 64-bit mode.
25450
25451 @item -mlra
25452 @itemx -mno-lra
25453 @opindex mlra
25454 @opindex mno-lra
25455 Enable Local Register Allocation. This is the default for SPARC since GCC 7
25456 so @option{-mno-lra} needs to be passed to get old Reload.
25457
25458 @item -mcpu=@var{cpu_type}
25459 @opindex mcpu
25460 Set the instruction set, register set, and instruction scheduling parameters
25461 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
25462 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
25463 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
25464 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
25465 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
25466 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
25467
25468 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
25469 which selects the best architecture option for the host processor.
25470 @option{-mcpu=native} has no effect if GCC does not recognize
25471 the processor.
25472
25473 Default instruction scheduling parameters are used for values that select
25474 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
25475 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
25476
25477 Here is a list of each supported architecture and their supported
25478 implementations.
25479
25480 @table @asis
25481 @item v7
25482 cypress, leon3v7
25483
25484 @item v8
25485 supersparc, hypersparc, leon, leon3
25486
25487 @item sparclite
25488 f930, f934, sparclite86x
25489
25490 @item sparclet
25491 tsc701
25492
25493 @item v9
25494 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
25495 niagara7, m8
25496 @end table
25497
25498 By default (unless configured otherwise), GCC generates code for the V7
25499 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
25500 additionally optimizes it for the Cypress CY7C602 chip, as used in the
25501 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
25502 SPARCStation 1, 2, IPX etc.
25503
25504 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
25505 architecture. The only difference from V7 code is that the compiler emits
25506 the integer multiply and integer divide instructions which exist in SPARC-V8
25507 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
25508 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
25509 2000 series.
25510
25511 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
25512 the SPARC architecture. This adds the integer multiply, integer divide step
25513 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
25514 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
25515 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
25516 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
25517 MB86934 chip, which is the more recent SPARClite with FPU@.
25518
25519 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
25520 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
25521 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
25522 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
25523 optimizes it for the TEMIC SPARClet chip.
25524
25525 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
25526 architecture. This adds 64-bit integer and floating-point move instructions,
25527 3 additional floating-point condition code registers and conditional move
25528 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
25529 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
25530 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
25531 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
25532 @option{-mcpu=niagara}, the compiler additionally optimizes it for
25533 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
25534 additionally optimizes it for Sun UltraSPARC T2 chips. With
25535 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
25536 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
25537 additionally optimizes it for Sun UltraSPARC T4 chips. With
25538 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
25539 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
25540 additionally optimizes it for Oracle M8 chips.
25541
25542 @item -mtune=@var{cpu_type}
25543 @opindex mtune
25544 Set the instruction scheduling parameters for machine type
25545 @var{cpu_type}, but do not set the instruction set or register set that the
25546 option @option{-mcpu=@var{cpu_type}} does.
25547
25548 The same values for @option{-mcpu=@var{cpu_type}} can be used for
25549 @option{-mtune=@var{cpu_type}}, but the only useful values are those
25550 that select a particular CPU implementation. Those are
25551 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
25552 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
25553 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
25554 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
25555 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
25556 and GNU/Linux toolchains, @samp{native} can also be used.
25557
25558 @item -mv8plus
25559 @itemx -mno-v8plus
25560 @opindex mv8plus
25561 @opindex mno-v8plus
25562 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
25563 difference from the V8 ABI is that the global and out registers are
25564 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
25565 mode for all SPARC-V9 processors.
25566
25567 @item -mvis
25568 @itemx -mno-vis
25569 @opindex mvis
25570 @opindex mno-vis
25571 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
25572 Visual Instruction Set extensions. The default is @option{-mno-vis}.
25573
25574 @item -mvis2
25575 @itemx -mno-vis2
25576 @opindex mvis2
25577 @opindex mno-vis2
25578 With @option{-mvis2}, GCC generates code that takes advantage of
25579 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
25580 default is @option{-mvis2} when targeting a cpu that supports such
25581 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
25582 also sets @option{-mvis}.
25583
25584 @item -mvis3
25585 @itemx -mno-vis3
25586 @opindex mvis3
25587 @opindex mno-vis3
25588 With @option{-mvis3}, GCC generates code that takes advantage of
25589 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
25590 default is @option{-mvis3} when targeting a cpu that supports such
25591 instructions, such as niagara-3 and later. Setting @option{-mvis3}
25592 also sets @option{-mvis2} and @option{-mvis}.
25593
25594 @item -mvis4
25595 @itemx -mno-vis4
25596 @opindex mvis4
25597 @opindex mno-vis4
25598 With @option{-mvis4}, GCC generates code that takes advantage of
25599 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
25600 default is @option{-mvis4} when targeting a cpu that supports such
25601 instructions, such as niagara-7 and later. Setting @option{-mvis4}
25602 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
25603
25604 @item -mvis4b
25605 @itemx -mno-vis4b
25606 @opindex mvis4b
25607 @opindex mno-vis4b
25608 With @option{-mvis4b}, GCC generates code that takes advantage of
25609 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
25610 the additional VIS instructions introduced in the Oracle SPARC
25611 Architecture 2017. The default is @option{-mvis4b} when targeting a
25612 cpu that supports such instructions, such as m8 and later. Setting
25613 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
25614 @option{-mvis2} and @option{-mvis}.
25615
25616 @item -mcbcond
25617 @itemx -mno-cbcond
25618 @opindex mcbcond
25619 @opindex mno-cbcond
25620 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
25621 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
25622 when targeting a CPU that supports such instructions, such as Niagara-4 and
25623 later.
25624
25625 @item -mfmaf
25626 @itemx -mno-fmaf
25627 @opindex mfmaf
25628 @opindex mno-fmaf
25629 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
25630 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
25631 when targeting a CPU that supports such instructions, such as Niagara-3 and
25632 later.
25633
25634 @item -mfsmuld
25635 @itemx -mno-fsmuld
25636 @opindex mfsmuld
25637 @opindex mno-fsmuld
25638 With @option{-mfsmuld}, GCC generates code that takes advantage of the
25639 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
25640 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
25641 or V9 with FPU except @option{-mcpu=leon}.
25642
25643 @item -mpopc
25644 @itemx -mno-popc
25645 @opindex mpopc
25646 @opindex mno-popc
25647 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
25648 Population Count instruction. The default is @option{-mpopc}
25649 when targeting a CPU that supports such an instruction, such as Niagara-2 and
25650 later.
25651
25652 @item -msubxc
25653 @itemx -mno-subxc
25654 @opindex msubxc
25655 @opindex mno-subxc
25656 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
25657 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
25658 when targeting a CPU that supports such an instruction, such as Niagara-7 and
25659 later.
25660
25661 @item -mfix-at697f
25662 @opindex mfix-at697f
25663 Enable the documented workaround for the single erratum of the Atmel AT697F
25664 processor (which corresponds to erratum #13 of the AT697E processor).
25665
25666 @item -mfix-ut699
25667 @opindex mfix-ut699
25668 Enable the documented workarounds for the floating-point errata and the data
25669 cache nullify errata of the UT699 processor.
25670
25671 @item -mfix-ut700
25672 @opindex mfix-ut700
25673 Enable the documented workaround for the back-to-back store errata of
25674 the UT699E/UT700 processor.
25675
25676 @item -mfix-gr712rc
25677 @opindex mfix-gr712rc
25678 Enable the documented workaround for the back-to-back store errata of
25679 the GR712RC processor.
25680 @end table
25681
25682 These @samp{-m} options are supported in addition to the above
25683 on SPARC-V9 processors in 64-bit environments:
25684
25685 @table @gcctabopt
25686 @item -m32
25687 @itemx -m64
25688 @opindex m32
25689 @opindex m64
25690 Generate code for a 32-bit or 64-bit environment.
25691 The 32-bit environment sets int, long and pointer to 32 bits.
25692 The 64-bit environment sets int to 32 bits and long and pointer
25693 to 64 bits.
25694
25695 @item -mcmodel=@var{which}
25696 @opindex mcmodel
25697 Set the code model to one of
25698
25699 @table @samp
25700 @item medlow
25701 The Medium/Low code model: 64-bit addresses, programs
25702 must be linked in the low 32 bits of memory. Programs can be statically
25703 or dynamically linked.
25704
25705 @item medmid
25706 The Medium/Middle code model: 64-bit addresses, programs
25707 must be linked in the low 44 bits of memory, the text and data segments must
25708 be less than 2GB in size and the data segment must be located within 2GB of
25709 the text segment.
25710
25711 @item medany
25712 The Medium/Anywhere code model: 64-bit addresses, programs
25713 may be linked anywhere in memory, the text and data segments must be less
25714 than 2GB in size and the data segment must be located within 2GB of the
25715 text segment.
25716
25717 @item embmedany
25718 The Medium/Anywhere code model for embedded systems:
25719 64-bit addresses, the text and data segments must be less than 2GB in
25720 size, both starting anywhere in memory (determined at link time). The
25721 global register %g4 points to the base of the data segment. Programs
25722 are statically linked and PIC is not supported.
25723 @end table
25724
25725 @item -mmemory-model=@var{mem-model}
25726 @opindex mmemory-model
25727 Set the memory model in force on the processor to one of
25728
25729 @table @samp
25730 @item default
25731 The default memory model for the processor and operating system.
25732
25733 @item rmo
25734 Relaxed Memory Order
25735
25736 @item pso
25737 Partial Store Order
25738
25739 @item tso
25740 Total Store Order
25741
25742 @item sc
25743 Sequential Consistency
25744 @end table
25745
25746 These memory models are formally defined in Appendix D of the SPARC-V9
25747 architecture manual, as set in the processor's @code{PSTATE.MM} field.
25748
25749 @item -mstack-bias
25750 @itemx -mno-stack-bias
25751 @opindex mstack-bias
25752 @opindex mno-stack-bias
25753 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
25754 frame pointer if present, are offset by @minus{}2047 which must be added back
25755 when making stack frame references. This is the default in 64-bit mode.
25756 Otherwise, assume no such offset is present.
25757 @end table
25758
25759 @node SPU Options
25760 @subsection SPU Options
25761 @cindex SPU options
25762
25763 These @samp{-m} options are supported on the SPU:
25764
25765 @table @gcctabopt
25766 @item -mwarn-reloc
25767 @itemx -merror-reloc
25768 @opindex mwarn-reloc
25769 @opindex merror-reloc
25770
25771 The loader for SPU does not handle dynamic relocations. By default, GCC
25772 gives an error when it generates code that requires a dynamic
25773 relocation. @option{-mno-error-reloc} disables the error,
25774 @option{-mwarn-reloc} generates a warning instead.
25775
25776 @item -msafe-dma
25777 @itemx -munsafe-dma
25778 @opindex msafe-dma
25779 @opindex munsafe-dma
25780
25781 Instructions that initiate or test completion of DMA must not be
25782 reordered with respect to loads and stores of the memory that is being
25783 accessed.
25784 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
25785 memory accesses, but that can lead to inefficient code in places where the
25786 memory is known to not change. Rather than mark the memory as volatile,
25787 you can use @option{-msafe-dma} to tell the compiler to treat
25788 the DMA instructions as potentially affecting all memory.
25789
25790 @item -mbranch-hints
25791 @opindex mbranch-hints
25792
25793 By default, GCC generates a branch hint instruction to avoid
25794 pipeline stalls for always-taken or probably-taken branches. A hint
25795 is not generated closer than 8 instructions away from its branch.
25796 There is little reason to disable them, except for debugging purposes,
25797 or to make an object a little bit smaller.
25798
25799 @item -msmall-mem
25800 @itemx -mlarge-mem
25801 @opindex msmall-mem
25802 @opindex mlarge-mem
25803
25804 By default, GCC generates code assuming that addresses are never larger
25805 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
25806 a full 32-bit address.
25807
25808 @item -mstdmain
25809 @opindex mstdmain
25810
25811 By default, GCC links against startup code that assumes the SPU-style
25812 main function interface (which has an unconventional parameter list).
25813 With @option{-mstdmain}, GCC links your program against startup
25814 code that assumes a C99-style interface to @code{main}, including a
25815 local copy of @code{argv} strings.
25816
25817 @item -mfixed-range=@var{register-range}
25818 @opindex mfixed-range
25819 Generate code treating the given register range as fixed registers.
25820 A fixed register is one that the register allocator cannot use. This is
25821 useful when compiling kernel code. A register range is specified as
25822 two registers separated by a dash. Multiple register ranges can be
25823 specified separated by a comma.
25824
25825 @item -mea32
25826 @itemx -mea64
25827 @opindex mea32
25828 @opindex mea64
25829 Compile code assuming that pointers to the PPU address space accessed
25830 via the @code{__ea} named address space qualifier are either 32 or 64
25831 bits wide. The default is 32 bits. As this is an ABI-changing option,
25832 all object code in an executable must be compiled with the same setting.
25833
25834 @item -maddress-space-conversion
25835 @itemx -mno-address-space-conversion
25836 @opindex maddress-space-conversion
25837 @opindex mno-address-space-conversion
25838 Allow/disallow treating the @code{__ea} address space as superset
25839 of the generic address space. This enables explicit type casts
25840 between @code{__ea} and generic pointer as well as implicit
25841 conversions of generic pointers to @code{__ea} pointers. The
25842 default is to allow address space pointer conversions.
25843
25844 @item -mcache-size=@var{cache-size}
25845 @opindex mcache-size
25846 This option controls the version of libgcc that the compiler links to an
25847 executable and selects a software-managed cache for accessing variables
25848 in the @code{__ea} address space with a particular cache size. Possible
25849 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
25850 and @samp{128}. The default cache size is 64KB.
25851
25852 @item -matomic-updates
25853 @itemx -mno-atomic-updates
25854 @opindex matomic-updates
25855 @opindex mno-atomic-updates
25856 This option controls the version of libgcc that the compiler links to an
25857 executable and selects whether atomic updates to the software-managed
25858 cache of PPU-side variables are used. If you use atomic updates, changes
25859 to a PPU variable from SPU code using the @code{__ea} named address space
25860 qualifier do not interfere with changes to other PPU variables residing
25861 in the same cache line from PPU code. If you do not use atomic updates,
25862 such interference may occur; however, writing back cache lines is
25863 more efficient. The default behavior is to use atomic updates.
25864
25865 @item -mdual-nops
25866 @itemx -mdual-nops=@var{n}
25867 @opindex mdual-nops
25868 By default, GCC inserts NOPs to increase dual issue when it expects
25869 it to increase performance. @var{n} can be a value from 0 to 10. A
25870 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
25871 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
25872
25873 @item -mhint-max-nops=@var{n}
25874 @opindex mhint-max-nops
25875 Maximum number of NOPs to insert for a branch hint. A branch hint must
25876 be at least 8 instructions away from the branch it is affecting. GCC
25877 inserts up to @var{n} NOPs to enforce this, otherwise it does not
25878 generate the branch hint.
25879
25880 @item -mhint-max-distance=@var{n}
25881 @opindex mhint-max-distance
25882 The encoding of the branch hint instruction limits the hint to be within
25883 256 instructions of the branch it is affecting. By default, GCC makes
25884 sure it is within 125.
25885
25886 @item -msafe-hints
25887 @opindex msafe-hints
25888 Work around a hardware bug that causes the SPU to stall indefinitely.
25889 By default, GCC inserts the @code{hbrp} instruction to make sure
25890 this stall won't happen.
25891
25892 @end table
25893
25894 @node System V Options
25895 @subsection Options for System V
25896
25897 These additional options are available on System V Release 4 for
25898 compatibility with other compilers on those systems:
25899
25900 @table @gcctabopt
25901 @item -G
25902 @opindex G
25903 Create a shared object.
25904 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
25905
25906 @item -Qy
25907 @opindex Qy
25908 Identify the versions of each tool used by the compiler, in a
25909 @code{.ident} assembler directive in the output.
25910
25911 @item -Qn
25912 @opindex Qn
25913 Refrain from adding @code{.ident} directives to the output file (this is
25914 the default).
25915
25916 @item -YP,@var{dirs}
25917 @opindex YP
25918 Search the directories @var{dirs}, and no others, for libraries
25919 specified with @option{-l}.
25920
25921 @item -Ym,@var{dir}
25922 @opindex Ym
25923 Look in the directory @var{dir} to find the M4 preprocessor.
25924 The assembler uses this option.
25925 @c This is supposed to go with a -Yd for predefined M4 macro files, but
25926 @c the generic assembler that comes with Solaris takes just -Ym.
25927 @end table
25928
25929 @node TILE-Gx Options
25930 @subsection TILE-Gx Options
25931 @cindex TILE-Gx options
25932
25933 These @samp{-m} options are supported on the TILE-Gx:
25934
25935 @table @gcctabopt
25936 @item -mcmodel=small
25937 @opindex mcmodel=small
25938 Generate code for the small model. The distance for direct calls is
25939 limited to 500M in either direction. PC-relative addresses are 32
25940 bits. Absolute addresses support the full address range.
25941
25942 @item -mcmodel=large
25943 @opindex mcmodel=large
25944 Generate code for the large model. There is no limitation on call
25945 distance, pc-relative addresses, or absolute addresses.
25946
25947 @item -mcpu=@var{name}
25948 @opindex mcpu
25949 Selects the type of CPU to be targeted. Currently the only supported
25950 type is @samp{tilegx}.
25951
25952 @item -m32
25953 @itemx -m64
25954 @opindex m32
25955 @opindex m64
25956 Generate code for a 32-bit or 64-bit environment. The 32-bit
25957 environment sets int, long, and pointer to 32 bits. The 64-bit
25958 environment sets int to 32 bits and long and pointer to 64 bits.
25959
25960 @item -mbig-endian
25961 @itemx -mlittle-endian
25962 @opindex mbig-endian
25963 @opindex mlittle-endian
25964 Generate code in big/little endian mode, respectively.
25965 @end table
25966
25967 @node TILEPro Options
25968 @subsection TILEPro Options
25969 @cindex TILEPro options
25970
25971 These @samp{-m} options are supported on the TILEPro:
25972
25973 @table @gcctabopt
25974 @item -mcpu=@var{name}
25975 @opindex mcpu
25976 Selects the type of CPU to be targeted. Currently the only supported
25977 type is @samp{tilepro}.
25978
25979 @item -m32
25980 @opindex m32
25981 Generate code for a 32-bit environment, which sets int, long, and
25982 pointer to 32 bits. This is the only supported behavior so the flag
25983 is essentially ignored.
25984 @end table
25985
25986 @node V850 Options
25987 @subsection V850 Options
25988 @cindex V850 Options
25989
25990 These @samp{-m} options are defined for V850 implementations:
25991
25992 @table @gcctabopt
25993 @item -mlong-calls
25994 @itemx -mno-long-calls
25995 @opindex mlong-calls
25996 @opindex mno-long-calls
25997 Treat all calls as being far away (near). If calls are assumed to be
25998 far away, the compiler always loads the function's address into a
25999 register, and calls indirect through the pointer.
26000
26001 @item -mno-ep
26002 @itemx -mep
26003 @opindex mno-ep
26004 @opindex mep
26005 Do not optimize (do optimize) basic blocks that use the same index
26006 pointer 4 or more times to copy pointer into the @code{ep} register, and
26007 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26008 option is on by default if you optimize.
26009
26010 @item -mno-prolog-function
26011 @itemx -mprolog-function
26012 @opindex mno-prolog-function
26013 @opindex mprolog-function
26014 Do not use (do use) external functions to save and restore registers
26015 at the prologue and epilogue of a function. The external functions
26016 are slower, but use less code space if more than one function saves
26017 the same number of registers. The @option{-mprolog-function} option
26018 is on by default if you optimize.
26019
26020 @item -mspace
26021 @opindex mspace
26022 Try to make the code as small as possible. At present, this just turns
26023 on the @option{-mep} and @option{-mprolog-function} options.
26024
26025 @item -mtda=@var{n}
26026 @opindex mtda
26027 Put static or global variables whose size is @var{n} bytes or less into
26028 the tiny data area that register @code{ep} points to. The tiny data
26029 area can hold up to 256 bytes in total (128 bytes for byte references).
26030
26031 @item -msda=@var{n}
26032 @opindex msda
26033 Put static or global variables whose size is @var{n} bytes or less into
26034 the small data area that register @code{gp} points to. The small data
26035 area can hold up to 64 kilobytes.
26036
26037 @item -mzda=@var{n}
26038 @opindex mzda
26039 Put static or global variables whose size is @var{n} bytes or less into
26040 the first 32 kilobytes of memory.
26041
26042 @item -mv850
26043 @opindex mv850
26044 Specify that the target processor is the V850.
26045
26046 @item -mv850e3v5
26047 @opindex mv850e3v5
26048 Specify that the target processor is the V850E3V5. The preprocessor
26049 constant @code{__v850e3v5__} is defined if this option is used.
26050
26051 @item -mv850e2v4
26052 @opindex mv850e2v4
26053 Specify that the target processor is the V850E3V5. This is an alias for
26054 the @option{-mv850e3v5} option.
26055
26056 @item -mv850e2v3
26057 @opindex mv850e2v3
26058 Specify that the target processor is the V850E2V3. The preprocessor
26059 constant @code{__v850e2v3__} is defined if this option is used.
26060
26061 @item -mv850e2
26062 @opindex mv850e2
26063 Specify that the target processor is the V850E2. The preprocessor
26064 constant @code{__v850e2__} is defined if this option is used.
26065
26066 @item -mv850e1
26067 @opindex mv850e1
26068 Specify that the target processor is the V850E1. The preprocessor
26069 constants @code{__v850e1__} and @code{__v850e__} are defined if
26070 this option is used.
26071
26072 @item -mv850es
26073 @opindex mv850es
26074 Specify that the target processor is the V850ES. This is an alias for
26075 the @option{-mv850e1} option.
26076
26077 @item -mv850e
26078 @opindex mv850e
26079 Specify that the target processor is the V850E@. The preprocessor
26080 constant @code{__v850e__} is defined if this option is used.
26081
26082 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26083 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26084 are defined then a default target processor is chosen and the
26085 relevant @samp{__v850*__} preprocessor constant is defined.
26086
26087 The preprocessor constants @code{__v850} and @code{__v851__} are always
26088 defined, regardless of which processor variant is the target.
26089
26090 @item -mdisable-callt
26091 @itemx -mno-disable-callt
26092 @opindex mdisable-callt
26093 @opindex mno-disable-callt
26094 This option suppresses generation of the @code{CALLT} instruction for the
26095 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26096 architecture.
26097
26098 This option is enabled by default when the RH850 ABI is
26099 in use (see @option{-mrh850-abi}), and disabled by default when the
26100 GCC ABI is in use. If @code{CALLT} instructions are being generated
26101 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26102
26103 @item -mrelax
26104 @itemx -mno-relax
26105 @opindex mrelax
26106 @opindex mno-relax
26107 Pass on (or do not pass on) the @option{-mrelax} command-line option
26108 to the assembler.
26109
26110 @item -mlong-jumps
26111 @itemx -mno-long-jumps
26112 @opindex mlong-jumps
26113 @opindex mno-long-jumps
26114 Disable (or re-enable) the generation of PC-relative jump instructions.
26115
26116 @item -msoft-float
26117 @itemx -mhard-float
26118 @opindex msoft-float
26119 @opindex mhard-float
26120 Disable (or re-enable) the generation of hardware floating point
26121 instructions. This option is only significant when the target
26122 architecture is @samp{V850E2V3} or higher. If hardware floating point
26123 instructions are being generated then the C preprocessor symbol
26124 @code{__FPU_OK__} is defined, otherwise the symbol
26125 @code{__NO_FPU__} is defined.
26126
26127 @item -mloop
26128 @opindex mloop
26129 Enables the use of the e3v5 LOOP instruction. The use of this
26130 instruction is not enabled by default when the e3v5 architecture is
26131 selected because its use is still experimental.
26132
26133 @item -mrh850-abi
26134 @itemx -mghs
26135 @opindex mrh850-abi
26136 @opindex mghs
26137 Enables support for the RH850 version of the V850 ABI. This is the
26138 default. With this version of the ABI the following rules apply:
26139
26140 @itemize
26141 @item
26142 Integer sized structures and unions are returned via a memory pointer
26143 rather than a register.
26144
26145 @item
26146 Large structures and unions (more than 8 bytes in size) are passed by
26147 value.
26148
26149 @item
26150 Functions are aligned to 16-bit boundaries.
26151
26152 @item
26153 The @option{-m8byte-align} command-line option is supported.
26154
26155 @item
26156 The @option{-mdisable-callt} command-line option is enabled by
26157 default. The @option{-mno-disable-callt} command-line option is not
26158 supported.
26159 @end itemize
26160
26161 When this version of the ABI is enabled the C preprocessor symbol
26162 @code{__V850_RH850_ABI__} is defined.
26163
26164 @item -mgcc-abi
26165 @opindex mgcc-abi
26166 Enables support for the old GCC version of the V850 ABI. With this
26167 version of the ABI the following rules apply:
26168
26169 @itemize
26170 @item
26171 Integer sized structures and unions are returned in register @code{r10}.
26172
26173 @item
26174 Large structures and unions (more than 8 bytes in size) are passed by
26175 reference.
26176
26177 @item
26178 Functions are aligned to 32-bit boundaries, unless optimizing for
26179 size.
26180
26181 @item
26182 The @option{-m8byte-align} command-line option is not supported.
26183
26184 @item
26185 The @option{-mdisable-callt} command-line option is supported but not
26186 enabled by default.
26187 @end itemize
26188
26189 When this version of the ABI is enabled the C preprocessor symbol
26190 @code{__V850_GCC_ABI__} is defined.
26191
26192 @item -m8byte-align
26193 @itemx -mno-8byte-align
26194 @opindex m8byte-align
26195 @opindex mno-8byte-align
26196 Enables support for @code{double} and @code{long long} types to be
26197 aligned on 8-byte boundaries. The default is to restrict the
26198 alignment of all objects to at most 4-bytes. When
26199 @option{-m8byte-align} is in effect the C preprocessor symbol
26200 @code{__V850_8BYTE_ALIGN__} is defined.
26201
26202 @item -mbig-switch
26203 @opindex mbig-switch
26204 Generate code suitable for big switch tables. Use this option only if
26205 the assembler/linker complain about out of range branches within a switch
26206 table.
26207
26208 @item -mapp-regs
26209 @opindex mapp-regs
26210 This option causes r2 and r5 to be used in the code generated by
26211 the compiler. This setting is the default.
26212
26213 @item -mno-app-regs
26214 @opindex mno-app-regs
26215 This option causes r2 and r5 to be treated as fixed registers.
26216
26217 @end table
26218
26219 @node VAX Options
26220 @subsection VAX Options
26221 @cindex VAX options
26222
26223 These @samp{-m} options are defined for the VAX:
26224
26225 @table @gcctabopt
26226 @item -munix
26227 @opindex munix
26228 Do not output certain jump instructions (@code{aobleq} and so on)
26229 that the Unix assembler for the VAX cannot handle across long
26230 ranges.
26231
26232 @item -mgnu
26233 @opindex mgnu
26234 Do output those jump instructions, on the assumption that the
26235 GNU assembler is being used.
26236
26237 @item -mg
26238 @opindex mg
26239 Output code for G-format floating-point numbers instead of D-format.
26240 @end table
26241
26242 @node Visium Options
26243 @subsection Visium Options
26244 @cindex Visium options
26245
26246 @table @gcctabopt
26247
26248 @item -mdebug
26249 @opindex mdebug
26250 A program which performs file I/O and is destined to run on an MCM target
26251 should be linked with this option. It causes the libraries libc.a and
26252 libdebug.a to be linked. The program should be run on the target under
26253 the control of the GDB remote debugging stub.
26254
26255 @item -msim
26256 @opindex msim
26257 A program which performs file I/O and is destined to run on the simulator
26258 should be linked with option. This causes libraries libc.a and libsim.a to
26259 be linked.
26260
26261 @item -mfpu
26262 @itemx -mhard-float
26263 @opindex mfpu
26264 @opindex mhard-float
26265 Generate code containing floating-point instructions. This is the
26266 default.
26267
26268 @item -mno-fpu
26269 @itemx -msoft-float
26270 @opindex mno-fpu
26271 @opindex msoft-float
26272 Generate code containing library calls for floating-point.
26273
26274 @option{-msoft-float} changes the calling convention in the output file;
26275 therefore, it is only useful if you compile @emph{all} of a program with
26276 this option. In particular, you need to compile @file{libgcc.a}, the
26277 library that comes with GCC, with @option{-msoft-float} in order for
26278 this to work.
26279
26280 @item -mcpu=@var{cpu_type}
26281 @opindex mcpu
26282 Set the instruction set, register set, and instruction scheduling parameters
26283 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26284 @samp{mcm}, @samp{gr5} and @samp{gr6}.
26285
26286 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
26287
26288 By default (unless configured otherwise), GCC generates code for the GR5
26289 variant of the Visium architecture.
26290
26291 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
26292 architecture. The only difference from GR5 code is that the compiler will
26293 generate block move instructions.
26294
26295 @item -mtune=@var{cpu_type}
26296 @opindex mtune
26297 Set the instruction scheduling parameters for machine type @var{cpu_type},
26298 but do not set the instruction set or register set that the option
26299 @option{-mcpu=@var{cpu_type}} would.
26300
26301 @item -msv-mode
26302 @opindex msv-mode
26303 Generate code for the supervisor mode, where there are no restrictions on
26304 the access to general registers. This is the default.
26305
26306 @item -muser-mode
26307 @opindex muser-mode
26308 Generate code for the user mode, where the access to some general registers
26309 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
26310 mode; on the GR6, only registers r29 to r31 are affected.
26311 @end table
26312
26313 @node VMS Options
26314 @subsection VMS Options
26315
26316 These @samp{-m} options are defined for the VMS implementations:
26317
26318 @table @gcctabopt
26319 @item -mvms-return-codes
26320 @opindex mvms-return-codes
26321 Return VMS condition codes from @code{main}. The default is to return POSIX-style
26322 condition (e.g.@ error) codes.
26323
26324 @item -mdebug-main=@var{prefix}
26325 @opindex mdebug-main=@var{prefix}
26326 Flag the first routine whose name starts with @var{prefix} as the main
26327 routine for the debugger.
26328
26329 @item -mmalloc64
26330 @opindex mmalloc64
26331 Default to 64-bit memory allocation routines.
26332
26333 @item -mpointer-size=@var{size}
26334 @opindex mpointer-size=@var{size}
26335 Set the default size of pointers. Possible options for @var{size} are
26336 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
26337 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
26338 The later option disables @code{pragma pointer_size}.
26339 @end table
26340
26341 @node VxWorks Options
26342 @subsection VxWorks Options
26343 @cindex VxWorks Options
26344
26345 The options in this section are defined for all VxWorks targets.
26346 Options specific to the target hardware are listed with the other
26347 options for that target.
26348
26349 @table @gcctabopt
26350 @item -mrtp
26351 @opindex mrtp
26352 GCC can generate code for both VxWorks kernels and real time processes
26353 (RTPs). This option switches from the former to the latter. It also
26354 defines the preprocessor macro @code{__RTP__}.
26355
26356 @item -non-static
26357 @opindex non-static
26358 Link an RTP executable against shared libraries rather than static
26359 libraries. The options @option{-static} and @option{-shared} can
26360 also be used for RTPs (@pxref{Link Options}); @option{-static}
26361 is the default.
26362
26363 @item -Bstatic
26364 @itemx -Bdynamic
26365 @opindex Bstatic
26366 @opindex Bdynamic
26367 These options are passed down to the linker. They are defined for
26368 compatibility with Diab.
26369
26370 @item -Xbind-lazy
26371 @opindex Xbind-lazy
26372 Enable lazy binding of function calls. This option is equivalent to
26373 @option{-Wl,-z,now} and is defined for compatibility with Diab.
26374
26375 @item -Xbind-now
26376 @opindex Xbind-now
26377 Disable lazy binding of function calls. This option is the default and
26378 is defined for compatibility with Diab.
26379 @end table
26380
26381 @node x86 Options
26382 @subsection x86 Options
26383 @cindex x86 Options
26384
26385 These @samp{-m} options are defined for the x86 family of computers.
26386
26387 @table @gcctabopt
26388
26389 @item -march=@var{cpu-type}
26390 @opindex march
26391 Generate instructions for the machine type @var{cpu-type}. In contrast to
26392 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26393 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26394 to generate code that may not run at all on processors other than the one
26395 indicated. Specifying @option{-march=@var{cpu-type}} implies
26396 @option{-mtune=@var{cpu-type}}.
26397
26398 The choices for @var{cpu-type} are:
26399
26400 @table @samp
26401 @item native
26402 This selects the CPU to generate code for at compilation time by determining
26403 the processor type of the compiling machine. Using @option{-march=native}
26404 enables all instruction subsets supported by the local machine (hence
26405 the result might not run on different machines). Using @option{-mtune=native}
26406 produces code optimized for the local machine under the constraints
26407 of the selected instruction set.
26408
26409 @item x86-64
26410 A generic CPU with 64-bit extensions.
26411
26412 @item i386
26413 Original Intel i386 CPU@.
26414
26415 @item i486
26416 Intel i486 CPU@. (No scheduling is implemented for this chip.)
26417
26418 @item i586
26419 @itemx pentium
26420 Intel Pentium CPU with no MMX support.
26421
26422 @item lakemont
26423 Intel Lakemont MCU, based on Intel Pentium CPU.
26424
26425 @item pentium-mmx
26426 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
26427
26428 @item pentiumpro
26429 Intel Pentium Pro CPU@.
26430
26431 @item i686
26432 When used with @option{-march}, the Pentium Pro
26433 instruction set is used, so the code runs on all i686 family chips.
26434 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
26435
26436 @item pentium2
26437 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
26438 support.
26439
26440 @item pentium3
26441 @itemx pentium3m
26442 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
26443 set support.
26444
26445 @item pentium-m
26446 Intel Pentium M; low-power version of Intel Pentium III CPU
26447 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
26448
26449 @item pentium4
26450 @itemx pentium4m
26451 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
26452
26453 @item prescott
26454 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
26455 set support.
26456
26457 @item nocona
26458 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
26459 SSE2 and SSE3 instruction set support.
26460
26461 @item core2
26462 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
26463 instruction set support.
26464
26465 @item nehalem
26466 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26467 SSE4.1, SSE4.2 and POPCNT instruction set support.
26468
26469 @item westmere
26470 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26471 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
26472
26473 @item sandybridge
26474 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26475 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
26476
26477 @item ivybridge
26478 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26479 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
26480 instruction set support.
26481
26482 @item haswell
26483 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26484 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26485 BMI, BMI2 and F16C instruction set support.
26486
26487 @item broadwell
26488 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26489 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26490 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
26491
26492 @item skylake
26493 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26494 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26495 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
26496 XSAVES instruction set support.
26497
26498 @item bonnell
26499 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
26500 instruction set support.
26501
26502 @item silvermont
26503 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26504 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
26505
26506 @item goldmont
26507 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26508 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
26509 instruction set support.
26510
26511 @item goldmont-plus
26512 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26513 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
26514 PTWRITE, RDPID, SGX and UMIP instruction set support.
26515
26516 @item knl
26517 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26518 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26519 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
26520 AVX512CD instruction set support.
26521
26522 @item knm
26523 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26524 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26525 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
26526 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
26527
26528 @item skylake-avx512
26529 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26530 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26531 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
26532 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
26533
26534 @item cannonlake
26535 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26536 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26537 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26538 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26539 AVX512IFMA, SHA and UMIP instruction set support.
26540
26541 @item icelake-client
26542 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26543 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26544 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26545 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26546 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
26547 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
26548
26549 @item icelake-server
26550 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
26551 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
26552 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
26553 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
26554 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
26555 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
26556 set support.
26557
26558 @item k6
26559 AMD K6 CPU with MMX instruction set support.
26560
26561 @item k6-2
26562 @itemx k6-3
26563 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
26564
26565 @item athlon
26566 @itemx athlon-tbird
26567 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
26568 support.
26569
26570 @item athlon-4
26571 @itemx athlon-xp
26572 @itemx athlon-mp
26573 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
26574 instruction set support.
26575
26576 @item k8
26577 @itemx opteron
26578 @itemx athlon64
26579 @itemx athlon-fx
26580 Processors based on the AMD K8 core with x86-64 instruction set support,
26581 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
26582 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
26583 instruction set extensions.)
26584
26585 @item k8-sse3
26586 @itemx opteron-sse3
26587 @itemx athlon64-sse3
26588 Improved versions of AMD K8 cores with SSE3 instruction set support.
26589
26590 @item amdfam10
26591 @itemx barcelona
26592 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
26593 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
26594 instruction set extensions.)
26595
26596 @item bdver1
26597 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
26598 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
26599 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
26600 @item bdver2
26601 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26602 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
26603 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
26604 extensions.)
26605 @item bdver3
26606 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26607 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
26608 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
26609 64-bit instruction set extensions.
26610 @item bdver4
26611 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
26612 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
26613 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
26614 SSE4.2, ABM and 64-bit instruction set extensions.
26615
26616 @item znver1
26617 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
26618 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
26619 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
26620 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
26621 instruction set extensions.
26622
26623 @item btver1
26624 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
26625 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
26626 instruction set extensions.)
26627
26628 @item btver2
26629 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
26630 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
26631 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
26632
26633 @item winchip-c6
26634 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
26635 set support.
26636
26637 @item winchip2
26638 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
26639 instruction set support.
26640
26641 @item c3
26642 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
26643 (No scheduling is implemented for this chip.)
26644
26645 @item c3-2
26646 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
26647 (No scheduling is implemented for this chip.)
26648
26649 @item c7
26650 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
26651 (No scheduling is implemented for this chip.)
26652
26653 @item samuel-2
26654 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
26655 (No scheduling is implemented for this chip.)
26656
26657 @item nehemiah
26658 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
26659 (No scheduling is implemented for this chip.)
26660
26661 @item esther
26662 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
26663 (No scheduling is implemented for this chip.)
26664
26665 @item eden-x2
26666 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
26667 (No scheduling is implemented for this chip.)
26668
26669 @item eden-x4
26670 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
26671 AVX and AVX2 instruction set support.
26672 (No scheduling is implemented for this chip.)
26673
26674 @item nano
26675 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26676 instruction set support.
26677 (No scheduling is implemented for this chip.)
26678
26679 @item nano-1000
26680 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26681 instruction set support.
26682 (No scheduling is implemented for this chip.)
26683
26684 @item nano-2000
26685 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
26686 instruction set support.
26687 (No scheduling is implemented for this chip.)
26688
26689 @item nano-3000
26690 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26691 instruction set support.
26692 (No scheduling is implemented for this chip.)
26693
26694 @item nano-x2
26695 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26696 instruction set support.
26697 (No scheduling is implemented for this chip.)
26698
26699 @item nano-x4
26700 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
26701 instruction set support.
26702 (No scheduling is implemented for this chip.)
26703
26704 @item geode
26705 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
26706 @end table
26707
26708 @item -mtune=@var{cpu-type}
26709 @opindex mtune
26710 Tune to @var{cpu-type} everything applicable about the generated code, except
26711 for the ABI and the set of available instructions.
26712 While picking a specific @var{cpu-type} schedules things appropriately
26713 for that particular chip, the compiler does not generate any code that
26714 cannot run on the default machine type unless you use a
26715 @option{-march=@var{cpu-type}} option.
26716 For example, if GCC is configured for i686-pc-linux-gnu
26717 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
26718 but still runs on i686 machines.
26719
26720 The choices for @var{cpu-type} are the same as for @option{-march}.
26721 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
26722
26723 @table @samp
26724 @item generic
26725 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
26726 If you know the CPU on which your code will run, then you should use
26727 the corresponding @option{-mtune} or @option{-march} option instead of
26728 @option{-mtune=generic}. But, if you do not know exactly what CPU users
26729 of your application will have, then you should use this option.
26730
26731 As new processors are deployed in the marketplace, the behavior of this
26732 option will change. Therefore, if you upgrade to a newer version of
26733 GCC, code generation controlled by this option will change to reflect
26734 the processors
26735 that are most common at the time that version of GCC is released.
26736
26737 There is no @option{-march=generic} option because @option{-march}
26738 indicates the instruction set the compiler can use, and there is no
26739 generic instruction set applicable to all processors. In contrast,
26740 @option{-mtune} indicates the processor (or, in this case, collection of
26741 processors) for which the code is optimized.
26742
26743 @item intel
26744 Produce code optimized for the most current Intel processors, which are
26745 Haswell and Silvermont for this version of GCC. If you know the CPU
26746 on which your code will run, then you should use the corresponding
26747 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
26748 But, if you want your application performs better on both Haswell and
26749 Silvermont, then you should use this option.
26750
26751 As new Intel processors are deployed in the marketplace, the behavior of
26752 this option will change. Therefore, if you upgrade to a newer version of
26753 GCC, code generation controlled by this option will change to reflect
26754 the most current Intel processors at the time that version of GCC is
26755 released.
26756
26757 There is no @option{-march=intel} option because @option{-march} indicates
26758 the instruction set the compiler can use, and there is no common
26759 instruction set applicable to all processors. In contrast,
26760 @option{-mtune} indicates the processor (or, in this case, collection of
26761 processors) for which the code is optimized.
26762 @end table
26763
26764 @item -mcpu=@var{cpu-type}
26765 @opindex mcpu
26766 A deprecated synonym for @option{-mtune}.
26767
26768 @item -mfpmath=@var{unit}
26769 @opindex mfpmath
26770 Generate floating-point arithmetic for selected unit @var{unit}. The choices
26771 for @var{unit} are:
26772
26773 @table @samp
26774 @item 387
26775 Use the standard 387 floating-point coprocessor present on the majority of chips and
26776 emulated otherwise. Code compiled with this option runs almost everywhere.
26777 The temporary results are computed in 80-bit precision instead of the precision
26778 specified by the type, resulting in slightly different results compared to most
26779 of other chips. See @option{-ffloat-store} for more detailed description.
26780
26781 This is the default choice for non-Darwin x86-32 targets.
26782
26783 @item sse
26784 Use scalar floating-point instructions present in the SSE instruction set.
26785 This instruction set is supported by Pentium III and newer chips,
26786 and in the AMD line
26787 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
26788 instruction set supports only single-precision arithmetic, thus the double and
26789 extended-precision arithmetic are still done using 387. A later version, present
26790 only in Pentium 4 and AMD x86-64 chips, supports double-precision
26791 arithmetic too.
26792
26793 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
26794 or @option{-msse2} switches to enable SSE extensions and make this option
26795 effective. For the x86-64 compiler, these extensions are enabled by default.
26796
26797 The resulting code should be considerably faster in the majority of cases and avoid
26798 the numerical instability problems of 387 code, but may break some existing
26799 code that expects temporaries to be 80 bits.
26800
26801 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
26802 and the default choice for x86-32 targets with the SSE2 instruction set
26803 when @option{-ffast-math} is enabled.
26804
26805 @item sse,387
26806 @itemx sse+387
26807 @itemx both
26808 Attempt to utilize both instruction sets at once. This effectively doubles the
26809 amount of available registers, and on chips with separate execution units for
26810 387 and SSE the execution resources too. Use this option with care, as it is
26811 still experimental, because the GCC register allocator does not model separate
26812 functional units well, resulting in unstable performance.
26813 @end table
26814
26815 @item -masm=@var{dialect}
26816 @opindex masm=@var{dialect}
26817 Output assembly instructions using selected @var{dialect}. Also affects
26818 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
26819 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
26820 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
26821 not support @samp{intel}.
26822
26823 @item -mieee-fp
26824 @itemx -mno-ieee-fp
26825 @opindex mieee-fp
26826 @opindex mno-ieee-fp
26827 Control whether or not the compiler uses IEEE floating-point
26828 comparisons. These correctly handle the case where the result of a
26829 comparison is unordered.
26830
26831 @item -m80387
26832 @itemx -mhard-float
26833 @opindex 80387
26834 @opindex mhard-float
26835 Generate output containing 80387 instructions for floating point.
26836
26837 @item -mno-80387
26838 @itemx -msoft-float
26839 @opindex no-80387
26840 @opindex msoft-float
26841 Generate output containing library calls for floating point.
26842
26843 @strong{Warning:} the requisite libraries are not part of GCC@.
26844 Normally the facilities of the machine's usual C compiler are used, but
26845 this cannot be done directly in cross-compilation. You must make your
26846 own arrangements to provide suitable library functions for
26847 cross-compilation.
26848
26849 On machines where a function returns floating-point results in the 80387
26850 register stack, some floating-point opcodes may be emitted even if
26851 @option{-msoft-float} is used.
26852
26853 @item -mno-fp-ret-in-387
26854 @opindex mno-fp-ret-in-387
26855 Do not use the FPU registers for return values of functions.
26856
26857 The usual calling convention has functions return values of types
26858 @code{float} and @code{double} in an FPU register, even if there
26859 is no FPU@. The idea is that the operating system should emulate
26860 an FPU@.
26861
26862 The option @option{-mno-fp-ret-in-387} causes such values to be returned
26863 in ordinary CPU registers instead.
26864
26865 @item -mno-fancy-math-387
26866 @opindex mno-fancy-math-387
26867 Some 387 emulators do not support the @code{sin}, @code{cos} and
26868 @code{sqrt} instructions for the 387. Specify this option to avoid
26869 generating those instructions. This option is the default on
26870 OpenBSD and NetBSD@. This option is overridden when @option{-march}
26871 indicates that the target CPU always has an FPU and so the
26872 instruction does not need emulation. These
26873 instructions are not generated unless you also use the
26874 @option{-funsafe-math-optimizations} switch.
26875
26876 @item -malign-double
26877 @itemx -mno-align-double
26878 @opindex malign-double
26879 @opindex mno-align-double
26880 Control whether GCC aligns @code{double}, @code{long double}, and
26881 @code{long long} variables on a two-word boundary or a one-word
26882 boundary. Aligning @code{double} variables on a two-word boundary
26883 produces code that runs somewhat faster on a Pentium at the
26884 expense of more memory.
26885
26886 On x86-64, @option{-malign-double} is enabled by default.
26887
26888 @strong{Warning:} if you use the @option{-malign-double} switch,
26889 structures containing the above types are aligned differently than
26890 the published application binary interface specifications for the x86-32
26891 and are not binary compatible with structures in code compiled
26892 without that switch.
26893
26894 @item -m96bit-long-double
26895 @itemx -m128bit-long-double
26896 @opindex m96bit-long-double
26897 @opindex m128bit-long-double
26898 These switches control the size of @code{long double} type. The x86-32
26899 application binary interface specifies the size to be 96 bits,
26900 so @option{-m96bit-long-double} is the default in 32-bit mode.
26901
26902 Modern architectures (Pentium and newer) prefer @code{long double}
26903 to be aligned to an 8- or 16-byte boundary. In arrays or structures
26904 conforming to the ABI, this is not possible. So specifying
26905 @option{-m128bit-long-double} aligns @code{long double}
26906 to a 16-byte boundary by padding the @code{long double} with an additional
26907 32-bit zero.
26908
26909 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
26910 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
26911
26912 Notice that neither of these options enable any extra precision over the x87
26913 standard of 80 bits for a @code{long double}.
26914
26915 @strong{Warning:} if you override the default value for your target ABI, this
26916 changes the size of
26917 structures and arrays containing @code{long double} variables,
26918 as well as modifying the function calling convention for functions taking
26919 @code{long double}. Hence they are not binary-compatible
26920 with code compiled without that switch.
26921
26922 @item -mlong-double-64
26923 @itemx -mlong-double-80
26924 @itemx -mlong-double-128
26925 @opindex mlong-double-64
26926 @opindex mlong-double-80
26927 @opindex mlong-double-128
26928 These switches control the size of @code{long double} type. A size
26929 of 64 bits makes the @code{long double} type equivalent to the @code{double}
26930 type. This is the default for 32-bit Bionic C library. A size
26931 of 128 bits makes the @code{long double} type equivalent to the
26932 @code{__float128} type. This is the default for 64-bit Bionic C library.
26933
26934 @strong{Warning:} if you override the default value for your target ABI, this
26935 changes the size of
26936 structures and arrays containing @code{long double} variables,
26937 as well as modifying the function calling convention for functions taking
26938 @code{long double}. Hence they are not binary-compatible
26939 with code compiled without that switch.
26940
26941 @item -malign-data=@var{type}
26942 @opindex malign-data
26943 Control how GCC aligns variables. Supported values for @var{type} are
26944 @samp{compat} uses increased alignment value compatible uses GCC 4.8
26945 and earlier, @samp{abi} uses alignment value as specified by the
26946 psABI, and @samp{cacheline} uses increased alignment value to match
26947 the cache line size. @samp{compat} is the default.
26948
26949 @item -mlarge-data-threshold=@var{threshold}
26950 @opindex mlarge-data-threshold
26951 When @option{-mcmodel=medium} is specified, data objects larger than
26952 @var{threshold} are placed in the large data section. This value must be the
26953 same across all objects linked into the binary, and defaults to 65535.
26954
26955 @item -mrtd
26956 @opindex mrtd
26957 Use a different function-calling convention, in which functions that
26958 take a fixed number of arguments return with the @code{ret @var{num}}
26959 instruction, which pops their arguments while returning. This saves one
26960 instruction in the caller since there is no need to pop the arguments
26961 there.
26962
26963 You can specify that an individual function is called with this calling
26964 sequence with the function attribute @code{stdcall}. You can also
26965 override the @option{-mrtd} option by using the function attribute
26966 @code{cdecl}. @xref{Function Attributes}.
26967
26968 @strong{Warning:} this calling convention is incompatible with the one
26969 normally used on Unix, so you cannot use it if you need to call
26970 libraries compiled with the Unix compiler.
26971
26972 Also, you must provide function prototypes for all functions that
26973 take variable numbers of arguments (including @code{printf});
26974 otherwise incorrect code is generated for calls to those
26975 functions.
26976
26977 In addition, seriously incorrect code results if you call a
26978 function with too many arguments. (Normally, extra arguments are
26979 harmlessly ignored.)
26980
26981 @item -mregparm=@var{num}
26982 @opindex mregparm
26983 Control how many registers are used to pass integer arguments. By
26984 default, no registers are used to pass arguments, and at most 3
26985 registers can be used. You can control this behavior for a specific
26986 function by using the function attribute @code{regparm}.
26987 @xref{Function Attributes}.
26988
26989 @strong{Warning:} if you use this switch, and
26990 @var{num} is nonzero, then you must build all modules with the same
26991 value, including any libraries. This includes the system libraries and
26992 startup modules.
26993
26994 @item -msseregparm
26995 @opindex msseregparm
26996 Use SSE register passing conventions for float and double arguments
26997 and return values. You can control this behavior for a specific
26998 function by using the function attribute @code{sseregparm}.
26999 @xref{Function Attributes}.
27000
27001 @strong{Warning:} if you use this switch then you must build all
27002 modules with the same value, including any libraries. This includes
27003 the system libraries and startup modules.
27004
27005 @item -mvect8-ret-in-mem
27006 @opindex mvect8-ret-in-mem
27007 Return 8-byte vectors in memory instead of MMX registers. This is the
27008 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27009 Studio compilers until version 12. Later compiler versions (starting
27010 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27011 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
27012 you need to remain compatible with existing code produced by those
27013 previous compiler versions or older versions of GCC@.
27014
27015 @item -mpc32
27016 @itemx -mpc64
27017 @itemx -mpc80
27018 @opindex mpc32
27019 @opindex mpc64
27020 @opindex mpc80
27021
27022 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27023 is specified, the significands of results of floating-point operations are
27024 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27025 significands of results of floating-point operations to 53 bits (double
27026 precision) and @option{-mpc80} rounds the significands of results of
27027 floating-point operations to 64 bits (extended double precision), which is
27028 the default. When this option is used, floating-point operations in higher
27029 precisions are not available to the programmer without setting the FPU
27030 control word explicitly.
27031
27032 Setting the rounding of floating-point operations to less than the default
27033 80 bits can speed some programs by 2% or more. Note that some mathematical
27034 libraries assume that extended-precision (80-bit) floating-point operations
27035 are enabled by default; routines in such libraries could suffer significant
27036 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27037 when this option is used to set the precision to less than extended precision.
27038
27039 @item -mstackrealign
27040 @opindex mstackrealign
27041 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27042 option generates an alternate prologue and epilogue that realigns the
27043 run-time stack if necessary. This supports mixing legacy codes that keep
27044 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27045 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27046 applicable to individual functions.
27047
27048 @item -mpreferred-stack-boundary=@var{num}
27049 @opindex mpreferred-stack-boundary
27050 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27051 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27052 the default is 4 (16 bytes or 128 bits).
27053
27054 @strong{Warning:} When generating code for the x86-64 architecture with
27055 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27056 used to keep the stack boundary aligned to 8 byte boundary. Since
27057 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27058 intended to be used in controlled environment where stack space is
27059 important limitation. This option leads to wrong code when functions
27060 compiled with 16 byte stack alignment (such as functions from a standard
27061 library) are called with misaligned stack. In this case, SSE
27062 instructions may lead to misaligned memory access traps. In addition,
27063 variable arguments are handled incorrectly for 16 byte aligned
27064 objects (including x87 long double and __int128), leading to wrong
27065 results. You must build all modules with
27066 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27067 includes the system libraries and startup modules.
27068
27069 @item -mincoming-stack-boundary=@var{num}
27070 @opindex mincoming-stack-boundary
27071 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27072 boundary. If @option{-mincoming-stack-boundary} is not specified,
27073 the one specified by @option{-mpreferred-stack-boundary} is used.
27074
27075 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27076 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27077 suffer significant run time performance penalties. On Pentium III, the
27078 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27079 properly if it is not 16-byte aligned.
27080
27081 To ensure proper alignment of this values on the stack, the stack boundary
27082 must be as aligned as that required by any value stored on the stack.
27083 Further, every function must be generated such that it keeps the stack
27084 aligned. Thus calling a function compiled with a higher preferred
27085 stack boundary from a function compiled with a lower preferred stack
27086 boundary most likely misaligns the stack. It is recommended that
27087 libraries that use callbacks always use the default setting.
27088
27089 This extra alignment does consume extra stack space, and generally
27090 increases code size. Code that is sensitive to stack space usage, such
27091 as embedded systems and operating system kernels, may want to reduce the
27092 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27093
27094 @need 200
27095 @item -mmmx
27096 @opindex mmmx
27097 @need 200
27098 @itemx -msse
27099 @opindex msse
27100 @need 200
27101 @itemx -msse2
27102 @opindex msse2
27103 @need 200
27104 @itemx -msse3
27105 @opindex msse3
27106 @need 200
27107 @itemx -mssse3
27108 @opindex mssse3
27109 @need 200
27110 @itemx -msse4
27111 @opindex msse4
27112 @need 200
27113 @itemx -msse4a
27114 @opindex msse4a
27115 @need 200
27116 @itemx -msse4.1
27117 @opindex msse4.1
27118 @need 200
27119 @itemx -msse4.2
27120 @opindex msse4.2
27121 @need 200
27122 @itemx -mavx
27123 @opindex mavx
27124 @need 200
27125 @itemx -mavx2
27126 @opindex mavx2
27127 @need 200
27128 @itemx -mavx512f
27129 @opindex mavx512f
27130 @need 200
27131 @itemx -mavx512pf
27132 @opindex mavx512pf
27133 @need 200
27134 @itemx -mavx512er
27135 @opindex mavx512er
27136 @need 200
27137 @itemx -mavx512cd
27138 @opindex mavx512cd
27139 @need 200
27140 @itemx -mavx512vl
27141 @opindex mavx512vl
27142 @need 200
27143 @itemx -mavx512bw
27144 @opindex mavx512bw
27145 @need 200
27146 @itemx -mavx512dq
27147 @opindex mavx512dq
27148 @need 200
27149 @itemx -mavx512ifma
27150 @opindex mavx512ifma
27151 @need 200
27152 @itemx -mavx512vbmi
27153 @opindex mavx512vbmi
27154 @need 200
27155 @itemx -msha
27156 @opindex msha
27157 @need 200
27158 @itemx -maes
27159 @opindex maes
27160 @need 200
27161 @itemx -mpclmul
27162 @opindex mpclmul
27163 @need 200
27164 @itemx -mclflushopt
27165 @opindex mclflushopt
27166 @need 200
27167 @itemx -mfsgsbase
27168 @opindex mfsgsbase
27169 @need 200
27170 @itemx -mrdrnd
27171 @opindex mrdrnd
27172 @need 200
27173 @itemx -mf16c
27174 @opindex mf16c
27175 @need 200
27176 @itemx -mfma
27177 @opindex mfma
27178 @need 200
27179 @itemx -mpconfig
27180 @opindex mpconfig
27181 @need 200
27182 @itemx -mwbnoinvd
27183 @opindex mwbnoinvd
27184 @need 200
27185 @itemx -mfma4
27186 @opindex mfma4
27187 @need 200
27188 @itemx -mprefetchwt1
27189 @opindex mprefetchwt1
27190 @need 200
27191 @itemx -mxop
27192 @opindex mxop
27193 @need 200
27194 @itemx -mlwp
27195 @opindex mlwp
27196 @need 200
27197 @itemx -m3dnow
27198 @opindex m3dnow
27199 @need 200
27200 @itemx -m3dnowa
27201 @opindex m3dnowa
27202 @need 200
27203 @itemx -mpopcnt
27204 @opindex mpopcnt
27205 @need 200
27206 @itemx -mabm
27207 @opindex mabm
27208 @need 200
27209 @itemx -mbmi
27210 @opindex mbmi
27211 @need 200
27212 @itemx -mbmi2
27213 @need 200
27214 @itemx -mlzcnt
27215 @opindex mlzcnt
27216 @need 200
27217 @itemx -mfxsr
27218 @opindex mfxsr
27219 @need 200
27220 @itemx -mxsave
27221 @opindex mxsave
27222 @need 200
27223 @itemx -mxsaveopt
27224 @opindex mxsaveopt
27225 @need 200
27226 @itemx -mxsavec
27227 @opindex mxsavec
27228 @need 200
27229 @itemx -mxsaves
27230 @opindex mxsaves
27231 @need 200
27232 @itemx -mrtm
27233 @opindex mrtm
27234 @need 200
27235 @itemx -mtbm
27236 @opindex mtbm
27237 @need 200
27238 @itemx -mmpx
27239 @opindex mmpx
27240 @need 200
27241 @itemx -mmwaitx
27242 @opindex mmwaitx
27243 @need 200
27244 @itemx -mclzero
27245 @opindex mclzero
27246 @need 200
27247 @itemx -mpku
27248 @opindex mpku
27249 @need 200
27250 @itemx -mavx512vbmi2
27251 @opindex mavx512vbmi2
27252 @need 200
27253 @itemx -mgfni
27254 @opindex mgfni
27255 @need 200
27256 @itemx -mvaes
27257 @opindex mvaes
27258 @need 200
27259 @itemx -mwaitpkg
27260 @opindex -mwaitpkg
27261 @need 200
27262 @itemx -mvpclmulqdq
27263 @opindex mvpclmulqdq
27264 @need 200
27265 @itemx -mavx512bitalg
27266 @opindex mavx512bitalg
27267 @need 200
27268 @itemx -mmovdiri
27269 @opindex mmovdiri
27270 @need 200
27271 @itemx -mmovdir64b
27272 @opindex mmovdir64b
27273 @need 200
27274 @itemx -mavx512vpopcntdq
27275 @opindex mavx512vpopcntdq
27276 @need 200
27277 @itemx -mcldemote
27278 @opindex mcldemote
27279 These switches enable the use of instructions in the MMX, SSE,
27280 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27281 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
27282 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
27283 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
27284 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
27285 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
27286 sets. Each has a corresponding @option{-mno-} option to disable use of these
27287 instructions.
27288
27289 These extensions are also available as built-in functions: see
27290 @ref{x86 Built-in Functions}, for details of the functions enabled and
27291 disabled by these switches.
27292
27293 To generate SSE/SSE2 instructions automatically from floating-point
27294 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
27295
27296 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
27297 generates new AVX instructions or AVX equivalence for all SSEx instructions
27298 when needed.
27299
27300 These options enable GCC to use these extended instructions in
27301 generated code, even without @option{-mfpmath=sse}. Applications that
27302 perform run-time CPU detection must compile separate files for each
27303 supported architecture, using the appropriate flags. In particular,
27304 the file containing the CPU detection code should be compiled without
27305 these options.
27306
27307 @item -mdump-tune-features
27308 @opindex mdump-tune-features
27309 This option instructs GCC to dump the names of the x86 performance
27310 tuning features and default settings. The names can be used in
27311 @option{-mtune-ctrl=@var{feature-list}}.
27312
27313 @item -mtune-ctrl=@var{feature-list}
27314 @opindex mtune-ctrl=@var{feature-list}
27315 This option is used to do fine grain control of x86 code generation features.
27316 @var{feature-list} is a comma separated list of @var{feature} names. See also
27317 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
27318 on if it is not preceded with @samp{^}, otherwise, it is turned off.
27319 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
27320 developers. Using it may lead to code paths not covered by testing and can
27321 potentially result in compiler ICEs or runtime errors.
27322
27323 @item -mno-default
27324 @opindex mno-default
27325 This option instructs GCC to turn off all tunable features. See also
27326 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
27327
27328 @item -mcld
27329 @opindex mcld
27330 This option instructs GCC to emit a @code{cld} instruction in the prologue
27331 of functions that use string instructions. String instructions depend on
27332 the DF flag to select between autoincrement or autodecrement mode. While the
27333 ABI specifies the DF flag to be cleared on function entry, some operating
27334 systems violate this specification by not clearing the DF flag in their
27335 exception dispatchers. The exception handler can be invoked with the DF flag
27336 set, which leads to wrong direction mode when string instructions are used.
27337 This option can be enabled by default on 32-bit x86 targets by configuring
27338 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
27339 instructions can be suppressed with the @option{-mno-cld} compiler option
27340 in this case.
27341
27342 @item -mvzeroupper
27343 @opindex mvzeroupper
27344 This option instructs GCC to emit a @code{vzeroupper} instruction
27345 before a transfer of control flow out of the function to minimize
27346 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
27347 intrinsics.
27348
27349 @item -mprefer-avx128
27350 @opindex mprefer-avx128
27351 This option instructs GCC to use 128-bit AVX instructions instead of
27352 256-bit AVX instructions in the auto-vectorizer.
27353
27354 @item -mprefer-vector-width=@var{opt}
27355 @opindex mprefer-vector-width
27356 This option instructs GCC to use @var{opt}-bit vector width in instructions
27357 instead of default on the selected platform.
27358
27359 @table @samp
27360 @item none
27361 No extra limitations applied to GCC other than defined by the selected platform.
27362
27363 @item 128
27364 Prefer 128-bit vector width for instructions.
27365
27366 @item 256
27367 Prefer 256-bit vector width for instructions.
27368
27369 @item 512
27370 Prefer 512-bit vector width for instructions.
27371 @end table
27372
27373 @item -mcx16
27374 @opindex mcx16
27375 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
27376 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
27377 objects. This is useful for atomic updates of data structures exceeding one
27378 machine word in size. The compiler uses this instruction to implement
27379 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
27380 128-bit integers, a library call is always used.
27381
27382 @item -msahf
27383 @opindex msahf
27384 This option enables generation of @code{SAHF} instructions in 64-bit code.
27385 Early Intel Pentium 4 CPUs with Intel 64 support,
27386 prior to the introduction of Pentium 4 G1 step in December 2005,
27387 lacked the @code{LAHF} and @code{SAHF} instructions
27388 which are supported by AMD64.
27389 These are load and store instructions, respectively, for certain status flags.
27390 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
27391 @code{drem}, and @code{remainder} built-in functions;
27392 see @ref{Other Builtins} for details.
27393
27394 @item -mmovbe
27395 @opindex mmovbe
27396 This option enables use of the @code{movbe} instruction to implement
27397 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
27398
27399 @item -mshstk
27400 @opindex mshstk
27401 The @option{-mshstk} option enables shadow stack built-in functions
27402 from x86 Control-flow Enforcement Technology (CET).
27403
27404 @item -mcrc32
27405 @opindex mcrc32
27406 This option enables built-in functions @code{__builtin_ia32_crc32qi},
27407 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
27408 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
27409
27410 @item -mrecip
27411 @opindex mrecip
27412 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
27413 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
27414 with an additional Newton-Raphson step
27415 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
27416 (and their vectorized
27417 variants) for single-precision floating-point arguments. These instructions
27418 are generated only when @option{-funsafe-math-optimizations} is enabled
27419 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
27420 Note that while the throughput of the sequence is higher than the throughput
27421 of the non-reciprocal instruction, the precision of the sequence can be
27422 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
27423
27424 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
27425 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
27426 combination), and doesn't need @option{-mrecip}.
27427
27428 Also note that GCC emits the above sequence with additional Newton-Raphson step
27429 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
27430 already with @option{-ffast-math} (or the above option combination), and
27431 doesn't need @option{-mrecip}.
27432
27433 @item -mrecip=@var{opt}
27434 @opindex mrecip=opt
27435 This option controls which reciprocal estimate instructions
27436 may be used. @var{opt} is a comma-separated list of options, which may
27437 be preceded by a @samp{!} to invert the option:
27438
27439 @table @samp
27440 @item all
27441 Enable all estimate instructions.
27442
27443 @item default
27444 Enable the default instructions, equivalent to @option{-mrecip}.
27445
27446 @item none
27447 Disable all estimate instructions, equivalent to @option{-mno-recip}.
27448
27449 @item div
27450 Enable the approximation for scalar division.
27451
27452 @item vec-div
27453 Enable the approximation for vectorized division.
27454
27455 @item sqrt
27456 Enable the approximation for scalar square root.
27457
27458 @item vec-sqrt
27459 Enable the approximation for vectorized square root.
27460 @end table
27461
27462 So, for example, @option{-mrecip=all,!sqrt} enables
27463 all of the reciprocal approximations, except for square root.
27464
27465 @item -mveclibabi=@var{type}
27466 @opindex mveclibabi
27467 Specifies the ABI type to use for vectorizing intrinsics using an
27468 external library. Supported values for @var{type} are @samp{svml}
27469 for the Intel short
27470 vector math library and @samp{acml} for the AMD math core library.
27471 To use this option, both @option{-ftree-vectorize} and
27472 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
27473 ABI-compatible library must be specified at link time.
27474
27475 GCC currently emits calls to @code{vmldExp2},
27476 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
27477 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
27478 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
27479 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
27480 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
27481 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
27482 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
27483 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
27484 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
27485 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
27486 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
27487 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
27488 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
27489 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
27490 when @option{-mveclibabi=acml} is used.
27491
27492 @item -mabi=@var{name}
27493 @opindex mabi
27494 Generate code for the specified calling convention. Permissible values
27495 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
27496 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
27497 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
27498 You can control this behavior for specific functions by
27499 using the function attributes @code{ms_abi} and @code{sysv_abi}.
27500 @xref{Function Attributes}.
27501
27502 @item -mforce-indirect-call
27503 @opindex mforce-indirect-call
27504 Force all calls to functions to be indirect. This is useful
27505 when using Intel Processor Trace where it generates more precise timing
27506 information for function calls.
27507
27508 @item -mcall-ms2sysv-xlogues
27509 @opindex mcall-ms2sysv-xlogues
27510 @opindex mno-call-ms2sysv-xlogues
27511 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
27512 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
27513 default, the code for saving and restoring these registers is emitted inline,
27514 resulting in fairly lengthy prologues and epilogues. Using
27515 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
27516 use stubs in the static portion of libgcc to perform these saves and restores,
27517 thus reducing function size at the cost of a few extra instructions.
27518
27519 @item -mtls-dialect=@var{type}
27520 @opindex mtls-dialect
27521 Generate code to access thread-local storage using the @samp{gnu} or
27522 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
27523 @samp{gnu2} is more efficient, but it may add compile- and run-time
27524 requirements that cannot be satisfied on all systems.
27525
27526 @item -mpush-args
27527 @itemx -mno-push-args
27528 @opindex mpush-args
27529 @opindex mno-push-args
27530 Use PUSH operations to store outgoing parameters. This method is shorter
27531 and usually equally fast as method using SUB/MOV operations and is enabled
27532 by default. In some cases disabling it may improve performance because of
27533 improved scheduling and reduced dependencies.
27534
27535 @item -maccumulate-outgoing-args
27536 @opindex maccumulate-outgoing-args
27537 If enabled, the maximum amount of space required for outgoing arguments is
27538 computed in the function prologue. This is faster on most modern CPUs
27539 because of reduced dependencies, improved scheduling and reduced stack usage
27540 when the preferred stack boundary is not equal to 2. The drawback is a notable
27541 increase in code size. This switch implies @option{-mno-push-args}.
27542
27543 @item -mthreads
27544 @opindex mthreads
27545 Support thread-safe exception handling on MinGW. Programs that rely
27546 on thread-safe exception handling must compile and link all code with the
27547 @option{-mthreads} option. When compiling, @option{-mthreads} defines
27548 @option{-D_MT}; when linking, it links in a special thread helper library
27549 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
27550
27551 @item -mms-bitfields
27552 @itemx -mno-ms-bitfields
27553 @opindex mms-bitfields
27554 @opindex mno-ms-bitfields
27555
27556 Enable/disable bit-field layout compatible with the native Microsoft
27557 Windows compiler.
27558
27559 If @code{packed} is used on a structure, or if bit-fields are used,
27560 it may be that the Microsoft ABI lays out the structure differently
27561 than the way GCC normally does. Particularly when moving packed
27562 data between functions compiled with GCC and the native Microsoft compiler
27563 (either via function call or as data in a file), it may be necessary to access
27564 either format.
27565
27566 This option is enabled by default for Microsoft Windows
27567 targets. This behavior can also be controlled locally by use of variable
27568 or type attributes. For more information, see @ref{x86 Variable Attributes}
27569 and @ref{x86 Type Attributes}.
27570
27571 The Microsoft structure layout algorithm is fairly simple with the exception
27572 of the bit-field packing.
27573 The padding and alignment of members of structures and whether a bit-field
27574 can straddle a storage-unit boundary are determine by these rules:
27575
27576 @enumerate
27577 @item Structure members are stored sequentially in the order in which they are
27578 declared: the first member has the lowest memory address and the last member
27579 the highest.
27580
27581 @item Every data object has an alignment requirement. The alignment requirement
27582 for all data except structures, unions, and arrays is either the size of the
27583 object or the current packing size (specified with either the
27584 @code{aligned} attribute or the @code{pack} pragma),
27585 whichever is less. For structures, unions, and arrays,
27586 the alignment requirement is the largest alignment requirement of its members.
27587 Every object is allocated an offset so that:
27588
27589 @smallexample
27590 offset % alignment_requirement == 0
27591 @end smallexample
27592
27593 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
27594 unit if the integral types are the same size and if the next bit-field fits
27595 into the current allocation unit without crossing the boundary imposed by the
27596 common alignment requirements of the bit-fields.
27597 @end enumerate
27598
27599 MSVC interprets zero-length bit-fields in the following ways:
27600
27601 @enumerate
27602 @item If a zero-length bit-field is inserted between two bit-fields that
27603 are normally coalesced, the bit-fields are not coalesced.
27604
27605 For example:
27606
27607 @smallexample
27608 struct
27609 @{
27610 unsigned long bf_1 : 12;
27611 unsigned long : 0;
27612 unsigned long bf_2 : 12;
27613 @} t1;
27614 @end smallexample
27615
27616 @noindent
27617 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
27618 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
27619
27620 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
27621 alignment of the zero-length bit-field is greater than the member that follows it,
27622 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
27623
27624 For example:
27625
27626 @smallexample
27627 struct
27628 @{
27629 char foo : 4;
27630 short : 0;
27631 char bar;
27632 @} t2;
27633
27634 struct
27635 @{
27636 char foo : 4;
27637 short : 0;
27638 double bar;
27639 @} t3;
27640 @end smallexample
27641
27642 @noindent
27643 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
27644 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
27645 bit-field does not affect the alignment of @code{bar} or, as a result, the size
27646 of the structure.
27647
27648 Taking this into account, it is important to note the following:
27649
27650 @enumerate
27651 @item If a zero-length bit-field follows a normal bit-field, the type of the
27652 zero-length bit-field may affect the alignment of the structure as whole. For
27653 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
27654 normal bit-field, and is of type short.
27655
27656 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
27657 still affect the alignment of the structure:
27658
27659 @smallexample
27660 struct
27661 @{
27662 char foo : 6;
27663 long : 0;
27664 @} t4;
27665 @end smallexample
27666
27667 @noindent
27668 Here, @code{t4} takes up 4 bytes.
27669 @end enumerate
27670
27671 @item Zero-length bit-fields following non-bit-field members are ignored:
27672
27673 @smallexample
27674 struct
27675 @{
27676 char foo;
27677 long : 0;
27678 char bar;
27679 @} t5;
27680 @end smallexample
27681
27682 @noindent
27683 Here, @code{t5} takes up 2 bytes.
27684 @end enumerate
27685
27686
27687 @item -mno-align-stringops
27688 @opindex mno-align-stringops
27689 Do not align the destination of inlined string operations. This switch reduces
27690 code size and improves performance in case the destination is already aligned,
27691 but GCC doesn't know about it.
27692
27693 @item -minline-all-stringops
27694 @opindex minline-all-stringops
27695 By default GCC inlines string operations only when the destination is
27696 known to be aligned to least a 4-byte boundary.
27697 This enables more inlining and increases code
27698 size, but may improve performance of code that depends on fast
27699 @code{memcpy}, @code{strlen},
27700 and @code{memset} for short lengths.
27701
27702 @item -minline-stringops-dynamically
27703 @opindex minline-stringops-dynamically
27704 For string operations of unknown size, use run-time checks with
27705 inline code for small blocks and a library call for large blocks.
27706
27707 @item -mstringop-strategy=@var{alg}
27708 @opindex mstringop-strategy=@var{alg}
27709 Override the internal decision heuristic for the particular algorithm to use
27710 for inlining string operations. The allowed values for @var{alg} are:
27711
27712 @table @samp
27713 @item rep_byte
27714 @itemx rep_4byte
27715 @itemx rep_8byte
27716 Expand using i386 @code{rep} prefix of the specified size.
27717
27718 @item byte_loop
27719 @itemx loop
27720 @itemx unrolled_loop
27721 Expand into an inline loop.
27722
27723 @item libcall
27724 Always use a library call.
27725 @end table
27726
27727 @item -mmemcpy-strategy=@var{strategy}
27728 @opindex mmemcpy-strategy=@var{strategy}
27729 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
27730 should be inlined and what inline algorithm to use when the expected size
27731 of the copy operation is known. @var{strategy}
27732 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
27733 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
27734 the max byte size with which inline algorithm @var{alg} is allowed. For the last
27735 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
27736 in the list must be specified in increasing order. The minimal byte size for
27737 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
27738 preceding range.
27739
27740 @item -mmemset-strategy=@var{strategy}
27741 @opindex mmemset-strategy=@var{strategy}
27742 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
27743 @code{__builtin_memset} expansion.
27744
27745 @item -momit-leaf-frame-pointer
27746 @opindex momit-leaf-frame-pointer
27747 Don't keep the frame pointer in a register for leaf functions. This
27748 avoids the instructions to save, set up, and restore frame pointers and
27749 makes an extra register available in leaf functions. The option
27750 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
27751 which might make debugging harder.
27752
27753 @item -mtls-direct-seg-refs
27754 @itemx -mno-tls-direct-seg-refs
27755 @opindex mtls-direct-seg-refs
27756 Controls whether TLS variables may be accessed with offsets from the
27757 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
27758 or whether the thread base pointer must be added. Whether or not this
27759 is valid depends on the operating system, and whether it maps the
27760 segment to cover the entire TLS area.
27761
27762 For systems that use the GNU C Library, the default is on.
27763
27764 @item -msse2avx
27765 @itemx -mno-sse2avx
27766 @opindex msse2avx
27767 Specify that the assembler should encode SSE instructions with VEX
27768 prefix. The option @option{-mavx} turns this on by default.
27769
27770 @item -mfentry
27771 @itemx -mno-fentry
27772 @opindex mfentry
27773 If profiling is active (@option{-pg}), put the profiling
27774 counter call before the prologue.
27775 Note: On x86 architectures the attribute @code{ms_hook_prologue}
27776 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
27777
27778 @item -mrecord-mcount
27779 @itemx -mno-record-mcount
27780 @opindex mrecord-mcount
27781 If profiling is active (@option{-pg}), generate a __mcount_loc section
27782 that contains pointers to each profiling call. This is useful for
27783 automatically patching and out calls.
27784
27785 @item -mnop-mcount
27786 @itemx -mno-nop-mcount
27787 @opindex mnop-mcount
27788 If profiling is active (@option{-pg}), generate the calls to
27789 the profiling functions as NOPs. This is useful when they
27790 should be patched in later dynamically. This is likely only
27791 useful together with @option{-mrecord-mcount}.
27792
27793 @item -mskip-rax-setup
27794 @itemx -mno-skip-rax-setup
27795 @opindex mskip-rax-setup
27796 When generating code for the x86-64 architecture with SSE extensions
27797 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
27798 register when there are no variable arguments passed in vector registers.
27799
27800 @strong{Warning:} Since RAX register is used to avoid unnecessarily
27801 saving vector registers on stack when passing variable arguments, the
27802 impacts of this option are callees may waste some stack space,
27803 misbehave or jump to a random location. GCC 4.4 or newer don't have
27804 those issues, regardless the RAX register value.
27805
27806 @item -m8bit-idiv
27807 @itemx -mno-8bit-idiv
27808 @opindex m8bit-idiv
27809 On some processors, like Intel Atom, 8-bit unsigned integer divide is
27810 much faster than 32-bit/64-bit integer divide. This option generates a
27811 run-time check. If both dividend and divisor are within range of 0
27812 to 255, 8-bit unsigned integer divide is used instead of
27813 32-bit/64-bit integer divide.
27814
27815 @item -mavx256-split-unaligned-load
27816 @itemx -mavx256-split-unaligned-store
27817 @opindex mavx256-split-unaligned-load
27818 @opindex mavx256-split-unaligned-store
27819 Split 32-byte AVX unaligned load and store.
27820
27821 @item -mstack-protector-guard=@var{guard}
27822 @itemx -mstack-protector-guard-reg=@var{reg}
27823 @itemx -mstack-protector-guard-offset=@var{offset}
27824 @opindex mstack-protector-guard
27825 @opindex mstack-protector-guard-reg
27826 @opindex mstack-protector-guard-offset
27827 Generate stack protection code using canary at @var{guard}. Supported
27828 locations are @samp{global} for global canary or @samp{tls} for per-thread
27829 canary in the TLS block (the default). This option has effect only when
27830 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
27831
27832 With the latter choice the options
27833 @option{-mstack-protector-guard-reg=@var{reg}} and
27834 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
27835 which segment register (@code{%fs} or @code{%gs}) to use as base register
27836 for reading the canary, and from what offset from that base register.
27837 The default for those is as specified in the relevant ABI.
27838
27839 @item -mmitigate-rop
27840 @opindex mmitigate-rop
27841 Try to avoid generating code sequences that contain unintended return
27842 opcodes, to mitigate against certain forms of attack. At the moment,
27843 this option is limited in what it can do and should not be relied
27844 on to provide serious protection.
27845
27846 @item -mgeneral-regs-only
27847 @opindex mgeneral-regs-only
27848 Generate code that uses only the general-purpose registers. This
27849 prevents the compiler from using floating-point, vector, mask and bound
27850 registers.
27851
27852 @item -mindirect-branch=@var{choice}
27853 @opindex -mindirect-branch
27854 Convert indirect call and jump with @var{choice}. The default is
27855 @samp{keep}, which keeps indirect call and jump unmodified.
27856 @samp{thunk} converts indirect call and jump to call and return thunk.
27857 @samp{thunk-inline} converts indirect call and jump to inlined call
27858 and return thunk. @samp{thunk-extern} converts indirect call and jump
27859 to external call and return thunk provided in a separate object file.
27860 You can control this behavior for a specific function by using the
27861 function attribute @code{indirect_branch}. @xref{Function Attributes}.
27862
27863 Note that @option{-mcmodel=large} is incompatible with
27864 @option{-mindirect-branch=thunk} and
27865 @option{-mindirect-branch=thunk-extern} since the thunk function may
27866 not be reachable in the large code model.
27867
27868 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
27869 @option{-fcf-protection=branch} and @option{-fcheck-pointer-bounds}
27870 since the external thunk can not be modified to disable control-flow
27871 check.
27872
27873 @item -mfunction-return=@var{choice}
27874 @opindex -mfunction-return
27875 Convert function return with @var{choice}. The default is @samp{keep},
27876 which keeps function return unmodified. @samp{thunk} converts function
27877 return to call and return thunk. @samp{thunk-inline} converts function
27878 return to inlined call and return thunk. @samp{thunk-extern} converts
27879 function return to external call and return thunk provided in a separate
27880 object file. You can control this behavior for a specific function by
27881 using the function attribute @code{function_return}.
27882 @xref{Function Attributes}.
27883
27884 Note that @option{-mcmodel=large} is incompatible with
27885 @option{-mfunction-return=thunk} and
27886 @option{-mfunction-return=thunk-extern} since the thunk function may
27887 not be reachable in the large code model.
27888
27889
27890 @item -mindirect-branch-register
27891 @opindex -mindirect-branch-register
27892 Force indirect call and jump via register.
27893
27894 @end table
27895
27896 These @samp{-m} switches are supported in addition to the above
27897 on x86-64 processors in 64-bit environments.
27898
27899 @table @gcctabopt
27900 @item -m32
27901 @itemx -m64
27902 @itemx -mx32
27903 @itemx -m16
27904 @itemx -miamcu
27905 @opindex m32
27906 @opindex m64
27907 @opindex mx32
27908 @opindex m16
27909 @opindex miamcu
27910 Generate code for a 16-bit, 32-bit or 64-bit environment.
27911 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
27912 to 32 bits, and
27913 generates code that runs on any i386 system.
27914
27915 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
27916 types to 64 bits, and generates code for the x86-64 architecture.
27917 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
27918 and @option{-mdynamic-no-pic} options.
27919
27920 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
27921 to 32 bits, and
27922 generates code for the x86-64 architecture.
27923
27924 The @option{-m16} option is the same as @option{-m32}, except for that
27925 it outputs the @code{.code16gcc} assembly directive at the beginning of
27926 the assembly output so that the binary can run in 16-bit mode.
27927
27928 The @option{-miamcu} option generates code which conforms to Intel MCU
27929 psABI. It requires the @option{-m32} option to be turned on.
27930
27931 @item -mno-red-zone
27932 @opindex mno-red-zone
27933 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
27934 by the x86-64 ABI; it is a 128-byte area beyond the location of the
27935 stack pointer that is not modified by signal or interrupt handlers
27936 and therefore can be used for temporary data without adjusting the stack
27937 pointer. The flag @option{-mno-red-zone} disables this red zone.
27938
27939 @item -mcmodel=small
27940 @opindex mcmodel=small
27941 Generate code for the small code model: the program and its symbols must
27942 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
27943 Programs can be statically or dynamically linked. This is the default
27944 code model.
27945
27946 @item -mcmodel=kernel
27947 @opindex mcmodel=kernel
27948 Generate code for the kernel code model. The kernel runs in the
27949 negative 2 GB of the address space.
27950 This model has to be used for Linux kernel code.
27951
27952 @item -mcmodel=medium
27953 @opindex mcmodel=medium
27954 Generate code for the medium model: the program is linked in the lower 2
27955 GB of the address space. Small symbols are also placed there. Symbols
27956 with sizes larger than @option{-mlarge-data-threshold} are put into
27957 large data or BSS sections and can be located above 2GB. Programs can
27958 be statically or dynamically linked.
27959
27960 @item -mcmodel=large
27961 @opindex mcmodel=large
27962 Generate code for the large model. This model makes no assumptions
27963 about addresses and sizes of sections.
27964
27965 @item -maddress-mode=long
27966 @opindex maddress-mode=long
27967 Generate code for long address mode. This is only supported for 64-bit
27968 and x32 environments. It is the default address mode for 64-bit
27969 environments.
27970
27971 @item -maddress-mode=short
27972 @opindex maddress-mode=short
27973 Generate code for short address mode. This is only supported for 32-bit
27974 and x32 environments. It is the default address mode for 32-bit and
27975 x32 environments.
27976 @end table
27977
27978 @node x86 Windows Options
27979 @subsection x86 Windows Options
27980 @cindex x86 Windows Options
27981 @cindex Windows Options for x86
27982
27983 These additional options are available for Microsoft Windows targets:
27984
27985 @table @gcctabopt
27986 @item -mconsole
27987 @opindex mconsole
27988 This option
27989 specifies that a console application is to be generated, by
27990 instructing the linker to set the PE header subsystem type
27991 required for console applications.
27992 This option is available for Cygwin and MinGW targets and is
27993 enabled by default on those targets.
27994
27995 @item -mdll
27996 @opindex mdll
27997 This option is available for Cygwin and MinGW targets. It
27998 specifies that a DLL---a dynamic link library---is to be
27999 generated, enabling the selection of the required runtime
28000 startup object and entry point.
28001
28002 @item -mnop-fun-dllimport
28003 @opindex mnop-fun-dllimport
28004 This option is available for Cygwin and MinGW targets. It
28005 specifies that the @code{dllimport} attribute should be ignored.
28006
28007 @item -mthread
28008 @opindex mthread
28009 This option is available for MinGW targets. It specifies
28010 that MinGW-specific thread support is to be used.
28011
28012 @item -municode
28013 @opindex municode
28014 This option is available for MinGW-w64 targets. It causes
28015 the @code{UNICODE} preprocessor macro to be predefined, and
28016 chooses Unicode-capable runtime startup code.
28017
28018 @item -mwin32
28019 @opindex mwin32
28020 This option is available for Cygwin and MinGW targets. It
28021 specifies that the typical Microsoft Windows predefined macros are to
28022 be set in the pre-processor, but does not influence the choice
28023 of runtime library/startup code.
28024
28025 @item -mwindows
28026 @opindex mwindows
28027 This option is available for Cygwin and MinGW targets. It
28028 specifies that a GUI application is to be generated by
28029 instructing the linker to set the PE header subsystem type
28030 appropriately.
28031
28032 @item -fno-set-stack-executable
28033 @opindex fno-set-stack-executable
28034 This option is available for MinGW targets. It specifies that
28035 the executable flag for the stack used by nested functions isn't
28036 set. This is necessary for binaries running in kernel mode of
28037 Microsoft Windows, as there the User32 API, which is used to set executable
28038 privileges, isn't available.
28039
28040 @item -fwritable-relocated-rdata
28041 @opindex fno-writable-relocated-rdata
28042 This option is available for MinGW and Cygwin targets. It specifies
28043 that relocated-data in read-only section is put into the @code{.data}
28044 section. This is a necessary for older runtimes not supporting
28045 modification of @code{.rdata} sections for pseudo-relocation.
28046
28047 @item -mpe-aligned-commons
28048 @opindex mpe-aligned-commons
28049 This option is available for Cygwin and MinGW targets. It
28050 specifies that the GNU extension to the PE file format that
28051 permits the correct alignment of COMMON variables should be
28052 used when generating code. It is enabled by default if
28053 GCC detects that the target assembler found during configuration
28054 supports the feature.
28055 @end table
28056
28057 See also under @ref{x86 Options} for standard options.
28058
28059 @node Xstormy16 Options
28060 @subsection Xstormy16 Options
28061 @cindex Xstormy16 Options
28062
28063 These options are defined for Xstormy16:
28064
28065 @table @gcctabopt
28066 @item -msim
28067 @opindex msim
28068 Choose startup files and linker script suitable for the simulator.
28069 @end table
28070
28071 @node Xtensa Options
28072 @subsection Xtensa Options
28073 @cindex Xtensa Options
28074
28075 These options are supported for Xtensa targets:
28076
28077 @table @gcctabopt
28078 @item -mconst16
28079 @itemx -mno-const16
28080 @opindex mconst16
28081 @opindex mno-const16
28082 Enable or disable use of @code{CONST16} instructions for loading
28083 constant values. The @code{CONST16} instruction is currently not a
28084 standard option from Tensilica. When enabled, @code{CONST16}
28085 instructions are always used in place of the standard @code{L32R}
28086 instructions. The use of @code{CONST16} is enabled by default only if
28087 the @code{L32R} instruction is not available.
28088
28089 @item -mfused-madd
28090 @itemx -mno-fused-madd
28091 @opindex mfused-madd
28092 @opindex mno-fused-madd
28093 Enable or disable use of fused multiply/add and multiply/subtract
28094 instructions in the floating-point option. This has no effect if the
28095 floating-point option is not also enabled. Disabling fused multiply/add
28096 and multiply/subtract instructions forces the compiler to use separate
28097 instructions for the multiply and add/subtract operations. This may be
28098 desirable in some cases where strict IEEE 754-compliant results are
28099 required: the fused multiply add/subtract instructions do not round the
28100 intermediate result, thereby producing results with @emph{more} bits of
28101 precision than specified by the IEEE standard. Disabling fused multiply
28102 add/subtract instructions also ensures that the program output is not
28103 sensitive to the compiler's ability to combine multiply and add/subtract
28104 operations.
28105
28106 @item -mserialize-volatile
28107 @itemx -mno-serialize-volatile
28108 @opindex mserialize-volatile
28109 @opindex mno-serialize-volatile
28110 When this option is enabled, GCC inserts @code{MEMW} instructions before
28111 @code{volatile} memory references to guarantee sequential consistency.
28112 The default is @option{-mserialize-volatile}. Use
28113 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
28114
28115 @item -mforce-no-pic
28116 @opindex mforce-no-pic
28117 For targets, like GNU/Linux, where all user-mode Xtensa code must be
28118 position-independent code (PIC), this option disables PIC for compiling
28119 kernel code.
28120
28121 @item -mtext-section-literals
28122 @itemx -mno-text-section-literals
28123 @opindex mtext-section-literals
28124 @opindex mno-text-section-literals
28125 These options control the treatment of literal pools. The default is
28126 @option{-mno-text-section-literals}, which places literals in a separate
28127 section in the output file. This allows the literal pool to be placed
28128 in a data RAM/ROM, and it also allows the linker to combine literal
28129 pools from separate object files to remove redundant literals and
28130 improve code size. With @option{-mtext-section-literals}, the literals
28131 are interspersed in the text section in order to keep them as close as
28132 possible to their references. This may be necessary for large assembly
28133 files. Literals for each function are placed right before that function.
28134
28135 @item -mauto-litpools
28136 @itemx -mno-auto-litpools
28137 @opindex mauto-litpools
28138 @opindex mno-auto-litpools
28139 These options control the treatment of literal pools. The default is
28140 @option{-mno-auto-litpools}, which places literals in a separate
28141 section in the output file unless @option{-mtext-section-literals} is
28142 used. With @option{-mauto-litpools} the literals are interspersed in
28143 the text section by the assembler. Compiler does not produce explicit
28144 @code{.literal} directives and loads literals into registers with
28145 @code{MOVI} instructions instead of @code{L32R} to let the assembler
28146 do relaxation and place literals as necessary. This option allows
28147 assembler to create several literal pools per function and assemble
28148 very big functions, which may not be possible with
28149 @option{-mtext-section-literals}.
28150
28151 @item -mtarget-align
28152 @itemx -mno-target-align
28153 @opindex mtarget-align
28154 @opindex mno-target-align
28155 When this option is enabled, GCC instructs the assembler to
28156 automatically align instructions to reduce branch penalties at the
28157 expense of some code density. The assembler attempts to widen density
28158 instructions to align branch targets and the instructions following call
28159 instructions. If there are not enough preceding safe density
28160 instructions to align a target, no widening is performed. The
28161 default is @option{-mtarget-align}. These options do not affect the
28162 treatment of auto-aligned instructions like @code{LOOP}, which the
28163 assembler always aligns, either by widening density instructions or
28164 by inserting NOP instructions.
28165
28166 @item -mlongcalls
28167 @itemx -mno-longcalls
28168 @opindex mlongcalls
28169 @opindex mno-longcalls
28170 When this option is enabled, GCC instructs the assembler to translate
28171 direct calls to indirect calls unless it can determine that the target
28172 of a direct call is in the range allowed by the call instruction. This
28173 translation typically occurs for calls to functions in other source
28174 files. Specifically, the assembler translates a direct @code{CALL}
28175 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
28176 The default is @option{-mno-longcalls}. This option should be used in
28177 programs where the call target can potentially be out of range. This
28178 option is implemented in the assembler, not the compiler, so the
28179 assembly code generated by GCC still shows direct call
28180 instructions---look at the disassembled object code to see the actual
28181 instructions. Note that the assembler uses an indirect call for
28182 every cross-file call, not just those that really are out of range.
28183 @end table
28184
28185 @node zSeries Options
28186 @subsection zSeries Options
28187 @cindex zSeries options
28188
28189 These are listed under @xref{S/390 and zSeries Options}.
28190
28191
28192 @c man end
28193
28194 @node Spec Files
28195 @section Specifying Subprocesses and the Switches to Pass to Them
28196 @cindex Spec Files
28197
28198 @command{gcc} is a driver program. It performs its job by invoking a
28199 sequence of other programs to do the work of compiling, assembling and
28200 linking. GCC interprets its command-line parameters and uses these to
28201 deduce which programs it should invoke, and which command-line options
28202 it ought to place on their command lines. This behavior is controlled
28203 by @dfn{spec strings}. In most cases there is one spec string for each
28204 program that GCC can invoke, but a few programs have multiple spec
28205 strings to control their behavior. The spec strings built into GCC can
28206 be overridden by using the @option{-specs=} command-line switch to specify
28207 a spec file.
28208
28209 @dfn{Spec files} are plain-text files that are used to construct spec
28210 strings. They consist of a sequence of directives separated by blank
28211 lines. The type of directive is determined by the first non-whitespace
28212 character on the line, which can be one of the following:
28213
28214 @table @code
28215 @item %@var{command}
28216 Issues a @var{command} to the spec file processor. The commands that can
28217 appear here are:
28218
28219 @table @code
28220 @item %include <@var{file}>
28221 @cindex @code{%include}
28222 Search for @var{file} and insert its text at the current point in the
28223 specs file.
28224
28225 @item %include_noerr <@var{file}>
28226 @cindex @code{%include_noerr}
28227 Just like @samp{%include}, but do not generate an error message if the include
28228 file cannot be found.
28229
28230 @item %rename @var{old_name} @var{new_name}
28231 @cindex @code{%rename}
28232 Rename the spec string @var{old_name} to @var{new_name}.
28233
28234 @end table
28235
28236 @item *[@var{spec_name}]:
28237 This tells the compiler to create, override or delete the named spec
28238 string. All lines after this directive up to the next directive or
28239 blank line are considered to be the text for the spec string. If this
28240 results in an empty string then the spec is deleted. (Or, if the
28241 spec did not exist, then nothing happens.) Otherwise, if the spec
28242 does not currently exist a new spec is created. If the spec does
28243 exist then its contents are overridden by the text of this
28244 directive, unless the first character of that text is the @samp{+}
28245 character, in which case the text is appended to the spec.
28246
28247 @item [@var{suffix}]:
28248 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
28249 and up to the next directive or blank line are considered to make up the
28250 spec string for the indicated suffix. When the compiler encounters an
28251 input file with the named suffix, it processes the spec string in
28252 order to work out how to compile that file. For example:
28253
28254 @smallexample
28255 .ZZ:
28256 z-compile -input %i
28257 @end smallexample
28258
28259 This says that any input file whose name ends in @samp{.ZZ} should be
28260 passed to the program @samp{z-compile}, which should be invoked with the
28261 command-line switch @option{-input} and with the result of performing the
28262 @samp{%i} substitution. (See below.)
28263
28264 As an alternative to providing a spec string, the text following a
28265 suffix directive can be one of the following:
28266
28267 @table @code
28268 @item @@@var{language}
28269 This says that the suffix is an alias for a known @var{language}. This is
28270 similar to using the @option{-x} command-line switch to GCC to specify a
28271 language explicitly. For example:
28272
28273 @smallexample
28274 .ZZ:
28275 @@c++
28276 @end smallexample
28277
28278 Says that .ZZ files are, in fact, C++ source files.
28279
28280 @item #@var{name}
28281 This causes an error messages saying:
28282
28283 @smallexample
28284 @var{name} compiler not installed on this system.
28285 @end smallexample
28286 @end table
28287
28288 GCC already has an extensive list of suffixes built into it.
28289 This directive adds an entry to the end of the list of suffixes, but
28290 since the list is searched from the end backwards, it is effectively
28291 possible to override earlier entries using this technique.
28292
28293 @end table
28294
28295 GCC has the following spec strings built into it. Spec files can
28296 override these strings or create their own. Note that individual
28297 targets can also add their own spec strings to this list.
28298
28299 @smallexample
28300 asm Options to pass to the assembler
28301 asm_final Options to pass to the assembler post-processor
28302 cpp Options to pass to the C preprocessor
28303 cc1 Options to pass to the C compiler
28304 cc1plus Options to pass to the C++ compiler
28305 endfile Object files to include at the end of the link
28306 link Options to pass to the linker
28307 lib Libraries to include on the command line to the linker
28308 libgcc Decides which GCC support library to pass to the linker
28309 linker Sets the name of the linker
28310 predefines Defines to be passed to the C preprocessor
28311 signed_char Defines to pass to CPP to say whether @code{char} is signed
28312 by default
28313 startfile Object files to include at the start of the link
28314 @end smallexample
28315
28316 Here is a small example of a spec file:
28317
28318 @smallexample
28319 %rename lib old_lib
28320
28321 *lib:
28322 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
28323 @end smallexample
28324
28325 This example renames the spec called @samp{lib} to @samp{old_lib} and
28326 then overrides the previous definition of @samp{lib} with a new one.
28327 The new definition adds in some extra command-line options before
28328 including the text of the old definition.
28329
28330 @dfn{Spec strings} are a list of command-line options to be passed to their
28331 corresponding program. In addition, the spec strings can contain
28332 @samp{%}-prefixed sequences to substitute variable text or to
28333 conditionally insert text into the command line. Using these constructs
28334 it is possible to generate quite complex command lines.
28335
28336 Here is a table of all defined @samp{%}-sequences for spec
28337 strings. Note that spaces are not generated automatically around the
28338 results of expanding these sequences. Therefore you can concatenate them
28339 together or combine them with constant text in a single argument.
28340
28341 @table @code
28342 @item %%
28343 Substitute one @samp{%} into the program name or argument.
28344
28345 @item %i
28346 Substitute the name of the input file being processed.
28347
28348 @item %b
28349 Substitute the basename of the input file being processed.
28350 This is the substring up to (and not including) the last period
28351 and not including the directory.
28352
28353 @item %B
28354 This is the same as @samp{%b}, but include the file suffix (text after
28355 the last period).
28356
28357 @item %d
28358 Marks the argument containing or following the @samp{%d} as a
28359 temporary file name, so that that file is deleted if GCC exits
28360 successfully. Unlike @samp{%g}, this contributes no text to the
28361 argument.
28362
28363 @item %g@var{suffix}
28364 Substitute a file name that has suffix @var{suffix} and is chosen
28365 once per compilation, and mark the argument in the same way as
28366 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
28367 name is now chosen in a way that is hard to predict even when previously
28368 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
28369 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
28370 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
28371 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
28372 was simply substituted with a file name chosen once per compilation,
28373 without regard to any appended suffix (which was therefore treated
28374 just like ordinary text), making such attacks more likely to succeed.
28375
28376 @item %u@var{suffix}
28377 Like @samp{%g}, but generates a new temporary file name
28378 each time it appears instead of once per compilation.
28379
28380 @item %U@var{suffix}
28381 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
28382 new one if there is no such last file name. In the absence of any
28383 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
28384 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
28385 involves the generation of two distinct file names, one
28386 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
28387 simply substituted with a file name chosen for the previous @samp{%u},
28388 without regard to any appended suffix.
28389
28390 @item %j@var{suffix}
28391 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
28392 writable, and if @option{-save-temps} is not used;
28393 otherwise, substitute the name
28394 of a temporary file, just like @samp{%u}. This temporary file is not
28395 meant for communication between processes, but rather as a junk
28396 disposal mechanism.
28397
28398 @item %|@var{suffix}
28399 @itemx %m@var{suffix}
28400 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
28401 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
28402 all. These are the two most common ways to instruct a program that it
28403 should read from standard input or write to standard output. If you
28404 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
28405 construct: see for example @file{f/lang-specs.h}.
28406
28407 @item %.@var{SUFFIX}
28408 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
28409 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
28410 terminated by the next space or %.
28411
28412 @item %w
28413 Marks the argument containing or following the @samp{%w} as the
28414 designated output file of this compilation. This puts the argument
28415 into the sequence of arguments that @samp{%o} substitutes.
28416
28417 @item %o
28418 Substitutes the names of all the output files, with spaces
28419 automatically placed around them. You should write spaces
28420 around the @samp{%o} as well or the results are undefined.
28421 @samp{%o} is for use in the specs for running the linker.
28422 Input files whose names have no recognized suffix are not compiled
28423 at all, but they are included among the output files, so they are
28424 linked.
28425
28426 @item %O
28427 Substitutes the suffix for object files. Note that this is
28428 handled specially when it immediately follows @samp{%g, %u, or %U},
28429 because of the need for those to form complete file names. The
28430 handling is such that @samp{%O} is treated exactly as if it had already
28431 been substituted, except that @samp{%g, %u, and %U} do not currently
28432 support additional @var{suffix} characters following @samp{%O} as they do
28433 following, for example, @samp{.o}.
28434
28435 @item %p
28436 Substitutes the standard macro predefinitions for the
28437 current target machine. Use this when running @command{cpp}.
28438
28439 @item %P
28440 Like @samp{%p}, but puts @samp{__} before and after the name of each
28441 predefined macro, except for macros that start with @samp{__} or with
28442 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
28443 C@.
28444
28445 @item %I
28446 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
28447 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
28448 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
28449 and @option{-imultilib} as necessary.
28450
28451 @item %s
28452 Current argument is the name of a library or startup file of some sort.
28453 Search for that file in a standard list of directories and substitute
28454 the full name found. The current working directory is included in the
28455 list of directories scanned.
28456
28457 @item %T
28458 Current argument is the name of a linker script. Search for that file
28459 in the current list of directories to scan for libraries. If the file
28460 is located insert a @option{--script} option into the command line
28461 followed by the full path name found. If the file is not found then
28462 generate an error message. Note: the current working directory is not
28463 searched.
28464
28465 @item %e@var{str}
28466 Print @var{str} as an error message. @var{str} is terminated by a newline.
28467 Use this when inconsistent options are detected.
28468
28469 @item %(@var{name})
28470 Substitute the contents of spec string @var{name} at this point.
28471
28472 @item %x@{@var{option}@}
28473 Accumulate an option for @samp{%X}.
28474
28475 @item %X
28476 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
28477 spec string.
28478
28479 @item %Y
28480 Output the accumulated assembler options specified by @option{-Wa}.
28481
28482 @item %Z
28483 Output the accumulated preprocessor options specified by @option{-Wp}.
28484
28485 @item %a
28486 Process the @code{asm} spec. This is used to compute the
28487 switches to be passed to the assembler.
28488
28489 @item %A
28490 Process the @code{asm_final} spec. This is a spec string for
28491 passing switches to an assembler post-processor, if such a program is
28492 needed.
28493
28494 @item %l
28495 Process the @code{link} spec. This is the spec for computing the
28496 command line passed to the linker. Typically it makes use of the
28497 @samp{%L %G %S %D and %E} sequences.
28498
28499 @item %D
28500 Dump out a @option{-L} option for each directory that GCC believes might
28501 contain startup files. If the target supports multilibs then the
28502 current multilib directory is prepended to each of these paths.
28503
28504 @item %L
28505 Process the @code{lib} spec. This is a spec string for deciding which
28506 libraries are included on the command line to the linker.
28507
28508 @item %G
28509 Process the @code{libgcc} spec. This is a spec string for deciding
28510 which GCC support library is included on the command line to the linker.
28511
28512 @item %S
28513 Process the @code{startfile} spec. This is a spec for deciding which
28514 object files are the first ones passed to the linker. Typically
28515 this might be a file named @file{crt0.o}.
28516
28517 @item %E
28518 Process the @code{endfile} spec. This is a spec string that specifies
28519 the last object files that are passed to the linker.
28520
28521 @item %C
28522 Process the @code{cpp} spec. This is used to construct the arguments
28523 to be passed to the C preprocessor.
28524
28525 @item %1
28526 Process the @code{cc1} spec. This is used to construct the options to be
28527 passed to the actual C compiler (@command{cc1}).
28528
28529 @item %2
28530 Process the @code{cc1plus} spec. This is used to construct the options to be
28531 passed to the actual C++ compiler (@command{cc1plus}).
28532
28533 @item %*
28534 Substitute the variable part of a matched option. See below.
28535 Note that each comma in the substituted string is replaced by
28536 a single space.
28537
28538 @item %<S
28539 Remove all occurrences of @code{-S} from the command line. Note---this
28540 command is position dependent. @samp{%} commands in the spec string
28541 before this one see @code{-S}, @samp{%} commands in the spec string
28542 after this one do not.
28543
28544 @item %:@var{function}(@var{args})
28545 Call the named function @var{function}, passing it @var{args}.
28546 @var{args} is first processed as a nested spec string, then split
28547 into an argument vector in the usual fashion. The function returns
28548 a string which is processed as if it had appeared literally as part
28549 of the current spec.
28550
28551 The following built-in spec functions are provided:
28552
28553 @table @code
28554 @item @code{getenv}
28555 The @code{getenv} spec function takes two arguments: an environment
28556 variable name and a string. If the environment variable is not
28557 defined, a fatal error is issued. Otherwise, the return value is the
28558 value of the environment variable concatenated with the string. For
28559 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
28560
28561 @smallexample
28562 %:getenv(TOPDIR /include)
28563 @end smallexample
28564
28565 expands to @file{/path/to/top/include}.
28566
28567 @item @code{if-exists}
28568 The @code{if-exists} spec function takes one argument, an absolute
28569 pathname to a file. If the file exists, @code{if-exists} returns the
28570 pathname. Here is a small example of its usage:
28571
28572 @smallexample
28573 *startfile:
28574 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
28575 @end smallexample
28576
28577 @item @code{if-exists-else}
28578 The @code{if-exists-else} spec function is similar to the @code{if-exists}
28579 spec function, except that it takes two arguments. The first argument is
28580 an absolute pathname to a file. If the file exists, @code{if-exists-else}
28581 returns the pathname. If it does not exist, it returns the second argument.
28582 This way, @code{if-exists-else} can be used to select one file or another,
28583 based on the existence of the first. Here is a small example of its usage:
28584
28585 @smallexample
28586 *startfile:
28587 crt0%O%s %:if-exists(crti%O%s) \
28588 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
28589 @end smallexample
28590
28591 @item @code{replace-outfile}
28592 The @code{replace-outfile} spec function takes two arguments. It looks for the
28593 first argument in the outfiles array and replaces it with the second argument. Here
28594 is a small example of its usage:
28595
28596 @smallexample
28597 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
28598 @end smallexample
28599
28600 @item @code{remove-outfile}
28601 The @code{remove-outfile} spec function takes one argument. It looks for the
28602 first argument in the outfiles array and removes it. Here is a small example
28603 its usage:
28604
28605 @smallexample
28606 %:remove-outfile(-lm)
28607 @end smallexample
28608
28609 @item @code{pass-through-libs}
28610 The @code{pass-through-libs} spec function takes any number of arguments. It
28611 finds any @option{-l} options and any non-options ending in @file{.a} (which it
28612 assumes are the names of linker input library archive files) and returns a
28613 result containing all the found arguments each prepended by
28614 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
28615 intended to be passed to the LTO linker plugin.
28616
28617 @smallexample
28618 %:pass-through-libs(%G %L %G)
28619 @end smallexample
28620
28621 @item @code{print-asm-header}
28622 The @code{print-asm-header} function takes no arguments and simply
28623 prints a banner like:
28624
28625 @smallexample
28626 Assembler options
28627 =================
28628
28629 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
28630 @end smallexample
28631
28632 It is used to separate compiler options from assembler options
28633 in the @option{--target-help} output.
28634 @end table
28635
28636 @item %@{S@}
28637 Substitutes the @code{-S} switch, if that switch is given to GCC@.
28638 If that switch is not specified, this substitutes nothing. Note that
28639 the leading dash is omitted when specifying this option, and it is
28640 automatically inserted if the substitution is performed. Thus the spec
28641 string @samp{%@{foo@}} matches the command-line option @option{-foo}
28642 and outputs the command-line option @option{-foo}.
28643
28644 @item %W@{S@}
28645 Like %@{@code{S}@} but mark last argument supplied within as a file to be
28646 deleted on failure.
28647
28648 @item %@{S*@}
28649 Substitutes all the switches specified to GCC whose names start
28650 with @code{-S}, but which also take an argument. This is used for
28651 switches like @option{-o}, @option{-D}, @option{-I}, etc.
28652 GCC considers @option{-o foo} as being
28653 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
28654 text, including the space. Thus two arguments are generated.
28655
28656 @item %@{S*&T*@}
28657 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
28658 (the order of @code{S} and @code{T} in the spec is not significant).
28659 There can be any number of ampersand-separated variables; for each the
28660 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
28661
28662 @item %@{S:X@}
28663 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
28664
28665 @item %@{!S:X@}
28666 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
28667
28668 @item %@{S*:X@}
28669 Substitutes @code{X} if one or more switches whose names start with
28670 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
28671 once, no matter how many such switches appeared. However, if @code{%*}
28672 appears somewhere in @code{X}, then @code{X} is substituted once
28673 for each matching switch, with the @code{%*} replaced by the part of
28674 that switch matching the @code{*}.
28675
28676 If @code{%*} appears as the last part of a spec sequence then a space
28677 is added after the end of the last substitution. If there is more
28678 text in the sequence, however, then a space is not generated. This
28679 allows the @code{%*} substitution to be used as part of a larger
28680 string. For example, a spec string like this:
28681
28682 @smallexample
28683 %@{mcu=*:--script=%*/memory.ld@}
28684 @end smallexample
28685
28686 @noindent
28687 when matching an option like @option{-mcu=newchip} produces:
28688
28689 @smallexample
28690 --script=newchip/memory.ld
28691 @end smallexample
28692
28693 @item %@{.S:X@}
28694 Substitutes @code{X}, if processing a file with suffix @code{S}.
28695
28696 @item %@{!.S:X@}
28697 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
28698
28699 @item %@{,S:X@}
28700 Substitutes @code{X}, if processing a file for language @code{S}.
28701
28702 @item %@{!,S:X@}
28703 Substitutes @code{X}, if not processing a file for language @code{S}.
28704
28705 @item %@{S|P:X@}
28706 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
28707 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
28708 @code{*} sequences as well, although they have a stronger binding than
28709 the @samp{|}. If @code{%*} appears in @code{X}, all of the
28710 alternatives must be starred, and only the first matching alternative
28711 is substituted.
28712
28713 For example, a spec string like this:
28714
28715 @smallexample
28716 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
28717 @end smallexample
28718
28719 @noindent
28720 outputs the following command-line options from the following input
28721 command-line options:
28722
28723 @smallexample
28724 fred.c -foo -baz
28725 jim.d -bar -boggle
28726 -d fred.c -foo -baz -boggle
28727 -d jim.d -bar -baz -boggle
28728 @end smallexample
28729
28730 @item %@{S:X; T:Y; :D@}
28731
28732 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
28733 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
28734 be as many clauses as you need. This may be combined with @code{.},
28735 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
28736
28737
28738 @end table
28739
28740 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
28741 or similar construct can use a backslash to ignore the special meaning
28742 of the character following it, thus allowing literal matching of a
28743 character that is otherwise specially treated. For example,
28744 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
28745 @option{-std=iso9899:1999} option is given.
28746
28747 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
28748 construct may contain other nested @samp{%} constructs or spaces, or
28749 even newlines. They are processed as usual, as described above.
28750 Trailing white space in @code{X} is ignored. White space may also
28751 appear anywhere on the left side of the colon in these constructs,
28752 except between @code{.} or @code{*} and the corresponding word.
28753
28754 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
28755 handled specifically in these constructs. If another value of
28756 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
28757 @option{-W} switch is found later in the command line, the earlier
28758 switch value is ignored, except with @{@code{S}*@} where @code{S} is
28759 just one letter, which passes all matching options.
28760
28761 The character @samp{|} at the beginning of the predicate text is used to
28762 indicate that a command should be piped to the following command, but
28763 only if @option{-pipe} is specified.
28764
28765 It is built into GCC which switches take arguments and which do not.
28766 (You might think it would be useful to generalize this to allow each
28767 compiler's spec to say which switches take arguments. But this cannot
28768 be done in a consistent fashion. GCC cannot even decide which input
28769 files have been specified without knowing which switches take arguments,
28770 and it must know which input files to compile in order to tell which
28771 compilers to run).
28772
28773 GCC also knows implicitly that arguments starting in @option{-l} are to be
28774 treated as compiler output files, and passed to the linker in their
28775 proper position among the other output files.
28776
28777 @node Environment Variables
28778 @section Environment Variables Affecting GCC
28779 @cindex environment variables
28780
28781 @c man begin ENVIRONMENT
28782 This section describes several environment variables that affect how GCC
28783 operates. Some of them work by specifying directories or prefixes to use
28784 when searching for various kinds of files. Some are used to specify other
28785 aspects of the compilation environment.
28786
28787 Note that you can also specify places to search using options such as
28788 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
28789 take precedence over places specified using environment variables, which
28790 in turn take precedence over those specified by the configuration of GCC@.
28791 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
28792 GNU Compiler Collection (GCC) Internals}.
28793
28794 @table @env
28795 @item LANG
28796 @itemx LC_CTYPE
28797 @c @itemx LC_COLLATE
28798 @itemx LC_MESSAGES
28799 @c @itemx LC_MONETARY
28800 @c @itemx LC_NUMERIC
28801 @c @itemx LC_TIME
28802 @itemx LC_ALL
28803 @findex LANG
28804 @findex LC_CTYPE
28805 @c @findex LC_COLLATE
28806 @findex LC_MESSAGES
28807 @c @findex LC_MONETARY
28808 @c @findex LC_NUMERIC
28809 @c @findex LC_TIME
28810 @findex LC_ALL
28811 @cindex locale
28812 These environment variables control the way that GCC uses
28813 localization information which allows GCC to work with different
28814 national conventions. GCC inspects the locale categories
28815 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
28816 so. These locale categories can be set to any value supported by your
28817 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
28818 Kingdom encoded in UTF-8.
28819
28820 The @env{LC_CTYPE} environment variable specifies character
28821 classification. GCC uses it to determine the character boundaries in
28822 a string; this is needed for some multibyte encodings that contain quote
28823 and escape characters that are otherwise interpreted as a string
28824 end or escape.
28825
28826 The @env{LC_MESSAGES} environment variable specifies the language to
28827 use in diagnostic messages.
28828
28829 If the @env{LC_ALL} environment variable is set, it overrides the value
28830 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
28831 and @env{LC_MESSAGES} default to the value of the @env{LANG}
28832 environment variable. If none of these variables are set, GCC
28833 defaults to traditional C English behavior.
28834
28835 @item TMPDIR
28836 @findex TMPDIR
28837 If @env{TMPDIR} is set, it specifies the directory to use for temporary
28838 files. GCC uses temporary files to hold the output of one stage of
28839 compilation which is to be used as input to the next stage: for example,
28840 the output of the preprocessor, which is the input to the compiler
28841 proper.
28842
28843 @item GCC_COMPARE_DEBUG
28844 @findex GCC_COMPARE_DEBUG
28845 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
28846 @option{-fcompare-debug} to the compiler driver. See the documentation
28847 of this option for more details.
28848
28849 @item GCC_EXEC_PREFIX
28850 @findex GCC_EXEC_PREFIX
28851 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
28852 names of the subprograms executed by the compiler. No slash is added
28853 when this prefix is combined with the name of a subprogram, but you can
28854 specify a prefix that ends with a slash if you wish.
28855
28856 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
28857 an appropriate prefix to use based on the pathname it is invoked with.
28858
28859 If GCC cannot find the subprogram using the specified prefix, it
28860 tries looking in the usual places for the subprogram.
28861
28862 The default value of @env{GCC_EXEC_PREFIX} is
28863 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
28864 the installed compiler. In many cases @var{prefix} is the value
28865 of @code{prefix} when you ran the @file{configure} script.
28866
28867 Other prefixes specified with @option{-B} take precedence over this prefix.
28868
28869 This prefix is also used for finding files such as @file{crt0.o} that are
28870 used for linking.
28871
28872 In addition, the prefix is used in an unusual way in finding the
28873 directories to search for header files. For each of the standard
28874 directories whose name normally begins with @samp{/usr/local/lib/gcc}
28875 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
28876 replacing that beginning with the specified prefix to produce an
28877 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
28878 @file{foo/bar} just before it searches the standard directory
28879 @file{/usr/local/lib/bar}.
28880 If a standard directory begins with the configured
28881 @var{prefix} then the value of @var{prefix} is replaced by
28882 @env{GCC_EXEC_PREFIX} when looking for header files.
28883
28884 @item COMPILER_PATH
28885 @findex COMPILER_PATH
28886 The value of @env{COMPILER_PATH} is a colon-separated list of
28887 directories, much like @env{PATH}. GCC tries the directories thus
28888 specified when searching for subprograms, if it cannot find the
28889 subprograms using @env{GCC_EXEC_PREFIX}.
28890
28891 @item LIBRARY_PATH
28892 @findex LIBRARY_PATH
28893 The value of @env{LIBRARY_PATH} is a colon-separated list of
28894 directories, much like @env{PATH}. When configured as a native compiler,
28895 GCC tries the directories thus specified when searching for special
28896 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
28897 using GCC also uses these directories when searching for ordinary
28898 libraries for the @option{-l} option (but directories specified with
28899 @option{-L} come first).
28900
28901 @item LANG
28902 @findex LANG
28903 @cindex locale definition
28904 This variable is used to pass locale information to the compiler. One way in
28905 which this information is used is to determine the character set to be used
28906 when character literals, string literals and comments are parsed in C and C++.
28907 When the compiler is configured to allow multibyte characters,
28908 the following values for @env{LANG} are recognized:
28909
28910 @table @samp
28911 @item C-JIS
28912 Recognize JIS characters.
28913 @item C-SJIS
28914 Recognize SJIS characters.
28915 @item C-EUCJP
28916 Recognize EUCJP characters.
28917 @end table
28918
28919 If @env{LANG} is not defined, or if it has some other value, then the
28920 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
28921 recognize and translate multibyte characters.
28922 @end table
28923
28924 @noindent
28925 Some additional environment variables affect the behavior of the
28926 preprocessor.
28927
28928 @include cppenv.texi
28929
28930 @c man end
28931
28932 @node Precompiled Headers
28933 @section Using Precompiled Headers
28934 @cindex precompiled headers
28935 @cindex speed of compilation
28936
28937 Often large projects have many header files that are included in every
28938 source file. The time the compiler takes to process these header files
28939 over and over again can account for nearly all of the time required to
28940 build the project. To make builds faster, GCC allows you to
28941 @dfn{precompile} a header file.
28942
28943 To create a precompiled header file, simply compile it as you would any
28944 other file, if necessary using the @option{-x} option to make the driver
28945 treat it as a C or C++ header file. You may want to use a
28946 tool like @command{make} to keep the precompiled header up-to-date when
28947 the headers it contains change.
28948
28949 A precompiled header file is searched for when @code{#include} is
28950 seen in the compilation. As it searches for the included file
28951 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
28952 compiler looks for a precompiled header in each directory just before it
28953 looks for the include file in that directory. The name searched for is
28954 the name specified in the @code{#include} with @samp{.gch} appended. If
28955 the precompiled header file cannot be used, it is ignored.
28956
28957 For instance, if you have @code{#include "all.h"}, and you have
28958 @file{all.h.gch} in the same directory as @file{all.h}, then the
28959 precompiled header file is used if possible, and the original
28960 header is used otherwise.
28961
28962 Alternatively, you might decide to put the precompiled header file in a
28963 directory and use @option{-I} to ensure that directory is searched
28964 before (or instead of) the directory containing the original header.
28965 Then, if you want to check that the precompiled header file is always
28966 used, you can put a file of the same name as the original header in this
28967 directory containing an @code{#error} command.
28968
28969 This also works with @option{-include}. So yet another way to use
28970 precompiled headers, good for projects not designed with precompiled
28971 header files in mind, is to simply take most of the header files used by
28972 a project, include them from another header file, precompile that header
28973 file, and @option{-include} the precompiled header. If the header files
28974 have guards against multiple inclusion, they are skipped because
28975 they've already been included (in the precompiled header).
28976
28977 If you need to precompile the same header file for different
28978 languages, targets, or compiler options, you can instead make a
28979 @emph{directory} named like @file{all.h.gch}, and put each precompiled
28980 header in the directory, perhaps using @option{-o}. It doesn't matter
28981 what you call the files in the directory; every precompiled header in
28982 the directory is considered. The first precompiled header
28983 encountered in the directory that is valid for this compilation is
28984 used; they're searched in no particular order.
28985
28986 There are many other possibilities, limited only by your imagination,
28987 good sense, and the constraints of your build system.
28988
28989 A precompiled header file can be used only when these conditions apply:
28990
28991 @itemize
28992 @item
28993 Only one precompiled header can be used in a particular compilation.
28994
28995 @item
28996 A precompiled header cannot be used once the first C token is seen. You
28997 can have preprocessor directives before a precompiled header; you cannot
28998 include a precompiled header from inside another header.
28999
29000 @item
29001 The precompiled header file must be produced for the same language as
29002 the current compilation. You cannot use a C precompiled header for a C++
29003 compilation.
29004
29005 @item
29006 The precompiled header file must have been produced by the same compiler
29007 binary as the current compilation is using.
29008
29009 @item
29010 Any macros defined before the precompiled header is included must
29011 either be defined in the same way as when the precompiled header was
29012 generated, or must not affect the precompiled header, which usually
29013 means that they don't appear in the precompiled header at all.
29014
29015 The @option{-D} option is one way to define a macro before a
29016 precompiled header is included; using a @code{#define} can also do it.
29017 There are also some options that define macros implicitly, like
29018 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29019 defined this way.
29020
29021 @item If debugging information is output when using the precompiled
29022 header, using @option{-g} or similar, the same kind of debugging information
29023 must have been output when building the precompiled header. However,
29024 a precompiled header built using @option{-g} can be used in a compilation
29025 when no debugging information is being output.
29026
29027 @item The same @option{-m} options must generally be used when building
29028 and using the precompiled header. @xref{Submodel Options},
29029 for any cases where this rule is relaxed.
29030
29031 @item Each of the following options must be the same when building and using
29032 the precompiled header:
29033
29034 @gccoptlist{-fexceptions}
29035
29036 @item
29037 Some other command-line options starting with @option{-f},
29038 @option{-p}, or @option{-O} must be defined in the same way as when
29039 the precompiled header was generated. At present, it's not clear
29040 which options are safe to change and which are not; the safest choice
29041 is to use exactly the same options when generating and using the
29042 precompiled header. The following are known to be safe:
29043
29044 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29045 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29046 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29047 -pedantic-errors}
29048
29049 @end itemize
29050
29051 For all of these except the last, the compiler automatically
29052 ignores the precompiled header if the conditions aren't met. If you
29053 find an option combination that doesn't work and doesn't cause the
29054 precompiled header to be ignored, please consider filing a bug report,
29055 see @ref{Bugs}.
29056
29057 If you do use differing options when generating and using the
29058 precompiled header, the actual behavior is a mixture of the
29059 behavior for the options. For instance, if you use @option{-g} to
29060 generate the precompiled header but not when using it, you may or may
29061 not get debugging information for routines in the precompiled header.