]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
re PR tree-optimization/35503 (Warning about restricted pointers?)
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2016 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-2016 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), adb(1), dbx(1), sdb(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} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
176 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
177
178 @item C Language Options
179 @xref{C Dialect Options,,Options Controlling C Dialect}.
180 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
181 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
182 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
183 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
184 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness}
185 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
186 -fsigned-bitfields -fsigned-char @gol
187 -funsigned-bitfields -funsigned-char @gol
188 -trigraphs -traditional -traditional-cpp}
189
190 @item C++ Language Options
191 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
192 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
193 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
194 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
195 -ffriend-injection @gol
196 -fno-elide-constructors @gol
197 -fno-enforce-eh-specs @gol
198 -ffor-scope -fno-for-scope -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 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
204 -fno-optional-diags -fpermissive @gol
205 -fno-pretty-templates @gol
206 -frepo -fno-rtti -fsized-deallocation @gol
207 -ftemplate-backtrace-limit=@var{n} @gol
208 -ftemplate-depth=@var{n} @gol
209 -fno-threadsafe-statics -fuse-cxa-atexit @gol
210 -fno-weak -nostdinc++ @gol
211 -fvisibility-inlines-hidden @gol
212 -fvisibility-ms-compat @gol
213 -fext-numeric-literals @gol
214 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
215 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
216 -Wnamespaces -Wnarrowing @gol
217 -Wnoexcept -Wnon-virtual-dtor -Wreorder -Wregister @gol
218 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
219 -Wno-non-template-friend -Wold-style-cast @gol
220 -Woverloaded-virtual -Wno-pmf-conversions @gol
221 -Wsign-promo -Wvirtual-inheritance}
222
223 @item Objective-C and Objective-C++ Language Options
224 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
225 Objective-C and Objective-C++ Dialects}.
226 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
227 -fgnu-runtime -fnext-runtime @gol
228 -fno-nil-receivers @gol
229 -fobjc-abi-version=@var{n} @gol
230 -fobjc-call-cxx-cdtors @gol
231 -fobjc-direct-dispatch @gol
232 -fobjc-exceptions @gol
233 -fobjc-gc @gol
234 -fobjc-nilcheck @gol
235 -fobjc-std=objc1 @gol
236 -fno-local-ivars @gol
237 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
238 -freplace-objc-classes @gol
239 -fzero-link @gol
240 -gen-decls @gol
241 -Wassign-intercept @gol
242 -Wno-protocol -Wselector @gol
243 -Wstrict-selector-match @gol
244 -Wundeclared-selector}
245
246 @item Diagnostic Message Formatting Options
247 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
248 @gccoptlist{-fmessage-length=@var{n} @gol
249 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
250 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
251 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
252 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch}
253
254 @item Warning Options
255 @xref{Warning Options,,Options to Request or Suppress Warnings}.
256 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
257 -pedantic-errors @gol
258 -w -Wextra -Wall -Waddress -Waggregate-return @gol
259 -Walloca -Walloca-larger-than=@var{n} @gol
260 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
261 -Wno-attributes -Wbool-compare -Wbool-operation @gol
262 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
263 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
264 -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
265 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
266 -Wdelete-incomplete @gol
267 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
268 -Wdisabled-optimization @gol
269 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
270 -Wno-div-by-zero -Wdouble-promotion -Wduplicated-cond @gol
271 -Wempty-body -Wenum-compare -Wno-endif-labels @gol
272 -Werror -Werror=* -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
273 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-length=@var{n} @gol
274 -Wformat-nonliteral @gol
275 -Wformat-security -Wformat-signedness -Wformat-y2k -Wframe-address @gol
276 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
277 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
278 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
279 -Wimplicit-function-declaration -Wimplicit-int @gol
280 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
281 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
282 -Winvalid-pch -Wlarger-than=@var{len} @gol
283 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
284 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
285 -Wmisleading-indentation -Wmissing-braces @gol
286 -Wmissing-field-initializers -Wmissing-include-dirs @gol
287 -Wno-multichar -Wnonnull -Wnonnull-compare @gol
288 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
289 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
290 -Woverride-init-side-effects -Woverlength-strings @gol
291 -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
292 -Wparentheses -Wno-pedantic-ms-format @gol
293 -Wplacement-new -Wplacement-new=@var{n} @gol
294 -Wpointer-arith -Wno-pointer-to-int-cast @gol
295 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
296 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
297 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
298 -Wshift-overflow -Wshift-overflow=@var{n} @gol
299 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
300 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
301 -Wno-scalar-storage-order @gol
302 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
303 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
304 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
305 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
306 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
307 -Wmissing-format-attribute -Wsubobject-linkage @gol
308 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
309 -Wswitch-unreachable -Wsync-nand @gol
310 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
311 -Wtype-limits -Wundef @gol
312 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
313 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
314 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
315 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
316 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
317 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
318 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
319 -Wvla -Wvla-larger-than=@var{n} -Wvolatile-register-var -Wwrite-strings @gol
320 -Wzero-as-null-pointer-constant -Whsa}
321
322 @item C and Objective-C-only Warning Options
323 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
324 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
325 -Wold-style-declaration -Wold-style-definition @gol
326 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
327 -Wdeclaration-after-statement -Wpointer-sign}
328
329 @item Debugging Options
330 @xref{Debugging Options,,Options for Debugging Your Program}.
331 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
332 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
333 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
334 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
335 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
336 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
337 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
338 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
339 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
340 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
341 -fvar-tracking -fvar-tracking-assignments}
342
343 @item Optimization Options
344 @xref{Optimize Options,,Options that Control Optimization}.
345 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
346 -falign-jumps[=@var{n}] @gol
347 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
348 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
349 -fauto-inc-dec -fbranch-probabilities @gol
350 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
351 -fbtr-bb-exclusive -fcaller-saves @gol
352 -fcombine-stack-adjustments -fconserve-stack @gol
353 -fcompare-elim -fcprop-registers -fcrossjumping @gol
354 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
355 -fcx-limited-range @gol
356 -fdata-sections -fdce -fdelayed-branch @gol
357 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
358 -fdevirtualize-at-ltrans -fdse @gol
359 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
360 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
361 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
362 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
363 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
364 -fif-conversion2 -findirect-inlining @gol
365 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
366 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment -fipa-bit-cp @gol
367 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
368 -fira-algorithm=@var{algorithm} @gol
369 -fira-region=@var{region} -fira-hoist-pressure @gol
370 -fira-loop-pressure -fno-ira-share-save-slots @gol
371 -fno-ira-share-spill-slots @gol
372 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
373 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
374 -fkeep-static-consts -flive-range-shrinkage @gol
375 -floop-block -floop-interchange -floop-strip-mine @gol
376 -floop-unroll-and-jam -floop-nest-optimize @gol
377 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
378 -flto-partition=@var{alg} -fmerge-all-constants @gol
379 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
380 -fmove-loop-invariants -fno-branch-count-reg @gol
381 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
382 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
383 -fno-peephole2 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
384 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
385 -fomit-frame-pointer -foptimize-sibling-calls @gol
386 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
387 -fprefetch-loop-arrays -fprintf-return-value @gol
388 -fprofile-correction @gol
389 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
390 -fprofile-reorder-functions @gol
391 -freciprocal-math -free -frename-registers -freorder-blocks @gol
392 -freorder-blocks-algorithm=@var{algorithm} @gol
393 -freorder-blocks-and-partition -freorder-functions @gol
394 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
395 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
396 -fsched-spec-load -fsched-spec-load-dangerous @gol
397 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
398 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
399 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
400 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
401 -fschedule-fusion @gol
402 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
403 -fselective-scheduling -fselective-scheduling2 @gol
404 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
405 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
406 -fsignaling-nans @gol
407 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
408 -fsplit-paths @gol
409 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
410 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
411 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
412 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
413 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
414 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting -ftree-loop-if-convert @gol
415 -ftree-loop-if-convert-stores -ftree-loop-im @gol
416 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
417 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
418 -ftree-loop-vectorize @gol
419 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
420 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
421 -ftree-switch-conversion -ftree-tail-merge @gol
422 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
423 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
424 -funsafe-math-optimizations -funswitch-loops @gol
425 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
426 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
427 --param @var{name}=@var{value}
428 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
429
430 @item Program Instrumentation Options
431 @xref{Instrumentation Options,,Program Instrumentation Options}.
432 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
433 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
434 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
435 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
436 -fsanitize-undefined-trap-on-error -fbounds-check @gol
437 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
438 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
439 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
440 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
441 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
442 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
443 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
444 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
445 -fchkp-use-wrappers @gol
446 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
447 -fstack-protector-explicit -fstack-check @gol
448 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
449 -fno-stack-limit -fsplit-stack @gol
450 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
451 -fvtv-counts -fvtv-debug @gol
452 -finstrument-functions @gol
453 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
454 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
455
456 @item Preprocessor Options
457 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
458 @gccoptlist{-A@var{question}=@var{answer} @gol
459 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
460 -C -dD -dI -dM -dN @gol
461 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
462 -idirafter @var{dir} @gol
463 -include @var{file} -imacros @var{file} @gol
464 -iprefix @var{file} -iwithprefix @var{dir} @gol
465 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
466 -imultilib @var{dir} -isysroot @var{dir} @gol
467 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
468 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
469 -remap -trigraphs -undef -U@var{macro} @gol
470 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
471
472 @item Assembler Option
473 @xref{Assembler Options,,Passing Options to the Assembler}.
474 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
475
476 @item Linker Options
477 @xref{Link Options,,Options for Linking}.
478 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
479 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
480 -s -static -static-libgcc -static-libstdc++ @gol
481 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
482 -static-libmpx -static-libmpxwrappers @gol
483 -shared -shared-libgcc -symbolic @gol
484 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
485 -u @var{symbol} -z @var{keyword}}
486
487 @item Directory Options
488 @xref{Directory Options,,Options for Directory Search}.
489 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
490 -iquote@var{dir} -L@var{dir} -no-canonical-prefixes -I- @gol
491 --sysroot=@var{dir} --no-sysroot-suffix}
492
493 @item Code Generation Options
494 @xref{Code Gen Options,,Options for Code Generation Conventions}.
495 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
496 -ffixed-@var{reg} -fexceptions @gol
497 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
498 -fasynchronous-unwind-tables @gol
499 -fno-gnu-unique @gol
500 -finhibit-size-directive -fno-common -fno-ident @gol
501 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
502 -fno-jump-tables @gol
503 -frecord-gcc-switches @gol
504 -freg-struct-return -fshort-enums -fshort-wchar @gol
505 -fverbose-asm -fpack-struct[=@var{n}] @gol
506 -fleading-underscore -ftls-model=@var{model} @gol
507 -fstack-reuse=@var{reuse_level} @gol
508 -ftrampolines -ftrapv -fwrapv @gol
509 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
510 -fstrict-volatile-bitfields -fsync-libcalls}
511
512 @item Developer Options
513 @xref{Developer Options,,GCC Developer Options}.
514 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
515 -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
516 -fdbg-cnt=@var{counter-value-list} @gol
517 -fdisable-ipa-@var{pass_name} @gol
518 -fdisable-rtl-@var{pass_name} @gol
519 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
520 -fdisable-tree-@var{pass_name} @gol
521 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
522 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
523 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
524 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
525 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
526 -fdump-passes @gol
527 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
528 -fdump-statistics @gol
529 -fdump-tree-all @gol
530 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
531 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
532 -fdump-tree-cfg -fdump-tree-alias @gol
533 -fdump-tree-ch @gol
534 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
535 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
536 -fdump-tree-gimple@r{[}-raw@r{]} @gol
537 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
538 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
539 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
540 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
541 -fdump-tree-backprop@r{[}-@var{n}@r{]} @gol
542 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
543 -fdump-tree-nrv -fdump-tree-vect @gol
544 -fdump-tree-sink @gol
545 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
546 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
547 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
548 -fdump-tree-vtable-verify @gol
549 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
550 -fdump-tree-split-paths@r{[}-@var{n}@r{]} @gol
551 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
552 -fdump-final-insns=@var{file} @gol
553 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
554 -fenable-@var{kind}-@var{pass} @gol
555 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
556 -fira-verbose=@var{n} @gol
557 -flto-report -flto-report-wpa -fmem-report-wpa @gol
558 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
559 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
560 -fprofile-report @gol
561 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
562 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
563 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
564 -fvar-tracking-assignments-toggle -gtoggle @gol
565 -print-file-name=@var{library} -print-libgcc-file-name @gol
566 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
567 -print-prog-name=@var{program} -print-search-dirs -Q @gol
568 -print-sysroot -print-sysroot-headers-suffix @gol
569 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
570
571 @item Machine-Dependent Options
572 @xref{Submodel Options,,Machine-Dependent Options}.
573 @c This list is ordered alphanumerically by subsection name.
574 @c Try and put the significant identifier (CPU or system) first,
575 @c so users have a clue at guessing where the ones they want will be.
576
577 @emph{AArch64 Options}
578 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
579 -mgeneral-regs-only @gol
580 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
581 -mstrict-align @gol
582 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
583 -mtls-dialect=desc -mtls-dialect=traditional @gol
584 -mtls-size=@var{size} @gol
585 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
586 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol
587 -mlow-precision-recip-sqrt -mno-low-precision-recip-sqrt@gol
588 -mlow-precision-sqrt -mno-low-precision-sqrt@gol
589 -mlow-precision-div -mno-low-precision-div @gol
590 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
591
592 @emph{Adapteva Epiphany Options}
593 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
594 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
595 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
596 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
597 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
598 -msplit-vecmove-early -m1reg-@var{reg}}
599
600 @emph{ARC Options}
601 @gccoptlist{-mbarrel-shifter @gol
602 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
603 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
604 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
605 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
606 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
607 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
608 -mlong-calls -mmedium-calls -msdata @gol
609 -mucb-mcount -mvolatile-cache -mtp-regno=@var{regno} @gol
610 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
611 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
612 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
613 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
614 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
615 -mtune=@var{cpu} -mmultcost=@var{num} @gol
616 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
617 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
618
619 @emph{ARM Options}
620 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
621 -mabi=@var{name} @gol
622 -mapcs-stack-check -mno-apcs-stack-check @gol
623 -mapcs-float -mno-apcs-float @gol
624 -mapcs-reentrant -mno-apcs-reentrant @gol
625 -msched-prolog -mno-sched-prolog @gol
626 -mlittle-endian -mbig-endian @gol
627 -mfloat-abi=@var{name} @gol
628 -mfp16-format=@var{name}
629 -mthumb-interwork -mno-thumb-interwork @gol
630 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
631 -mtune=@var{name} -mprint-tune-info @gol
632 -mstructure-size-boundary=@var{n} @gol
633 -mabort-on-noreturn @gol
634 -mlong-calls -mno-long-calls @gol
635 -msingle-pic-base -mno-single-pic-base @gol
636 -mpic-register=@var{reg} @gol
637 -mnop-fun-dllimport @gol
638 -mpoke-function-name @gol
639 -mthumb -marm @gol
640 -mtpcs-frame -mtpcs-leaf-frame @gol
641 -mcaller-super-interworking -mcallee-super-interworking @gol
642 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
643 -mword-relocations @gol
644 -mfix-cortex-m3-ldrd @gol
645 -munaligned-access @gol
646 -mneon-for-64bits @gol
647 -mslow-flash-data @gol
648 -masm-syntax-unified @gol
649 -mrestrict-it @gol
650 -mpure-code}
651
652 @emph{AVR Options}
653 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
654 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
655 -mrelax -mrmw -mstrict-X -mtiny-stack -mfract-convert-truncate -nodevicelib @gol
656 -Waddr-space-convert -Wmisspelled-isr}
657
658 @emph{Blackfin Options}
659 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
660 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
661 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
662 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
663 -mno-id-shared-library -mshared-library-id=@var{n} @gol
664 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
665 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
666 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
667 -micplb}
668
669 @emph{C6X Options}
670 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
671 -msim -msdata=@var{sdata-type}}
672
673 @emph{CRIS Options}
674 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
675 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
676 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
677 -mstack-align -mdata-align -mconst-align @gol
678 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
679 -melf -maout -melinux -mlinux -sim -sim2 @gol
680 -mmul-bug-workaround -mno-mul-bug-workaround}
681
682 @emph{CR16 Options}
683 @gccoptlist{-mmac @gol
684 -mcr16cplus -mcr16c @gol
685 -msim -mint32 -mbit-ops
686 -mdata-model=@var{model}}
687
688 @emph{Darwin Options}
689 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
690 -arch_only -bind_at_load -bundle -bundle_loader @gol
691 -client_name -compatibility_version -current_version @gol
692 -dead_strip @gol
693 -dependency-file -dylib_file -dylinker_install_name @gol
694 -dynamic -dynamiclib -exported_symbols_list @gol
695 -filelist -flat_namespace -force_cpusubtype_ALL @gol
696 -force_flat_namespace -headerpad_max_install_names @gol
697 -iframework @gol
698 -image_base -init -install_name -keep_private_externs @gol
699 -multi_module -multiply_defined -multiply_defined_unused @gol
700 -noall_load -no_dead_strip_inits_and_terms @gol
701 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
702 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
703 -private_bundle -read_only_relocs -sectalign @gol
704 -sectobjectsymbols -whyload -seg1addr @gol
705 -sectcreate -sectobjectsymbols -sectorder @gol
706 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
707 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
708 -segprot -segs_read_only_addr -segs_read_write_addr @gol
709 -single_module -static -sub_library -sub_umbrella @gol
710 -twolevel_namespace -umbrella -undefined @gol
711 -unexported_symbols_list -weak_reference_mismatches @gol
712 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
713 -mkernel -mone-byte-bool}
714
715 @emph{DEC Alpha Options}
716 @gccoptlist{-mno-fp-regs -msoft-float @gol
717 -mieee -mieee-with-inexact -mieee-conformant @gol
718 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
719 -mtrap-precision=@var{mode} -mbuild-constants @gol
720 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
721 -mbwx -mmax -mfix -mcix @gol
722 -mfloat-vax -mfloat-ieee @gol
723 -mexplicit-relocs -msmall-data -mlarge-data @gol
724 -msmall-text -mlarge-text @gol
725 -mmemory-latency=@var{time}}
726
727 @emph{FR30 Options}
728 @gccoptlist{-msmall-model -mno-lsim}
729
730 @emph{FT32 Options}
731 @gccoptlist{-msim -mlra -mnodiv}
732
733 @emph{FRV Options}
734 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
735 -mhard-float -msoft-float @gol
736 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
737 -mdouble -mno-double @gol
738 -mmedia -mno-media -mmuladd -mno-muladd @gol
739 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
740 -mlinked-fp -mlong-calls -malign-labels @gol
741 -mlibrary-pic -macc-4 -macc-8 @gol
742 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
743 -moptimize-membar -mno-optimize-membar @gol
744 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
745 -mvliw-branch -mno-vliw-branch @gol
746 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
747 -mno-nested-cond-exec -mtomcat-stats @gol
748 -mTLS -mtls @gol
749 -mcpu=@var{cpu}}
750
751 @emph{GNU/Linux Options}
752 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
753 -tno-android-cc -tno-android-ld}
754
755 @emph{H8/300 Options}
756 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
757
758 @emph{HPPA Options}
759 @gccoptlist{-march=@var{architecture-type} @gol
760 -mdisable-fpregs -mdisable-indexing @gol
761 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
762 -mfixed-range=@var{register-range} @gol
763 -mjump-in-delay -mlinker-opt -mlong-calls @gol
764 -mlong-load-store -mno-disable-fpregs @gol
765 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
766 -mno-jump-in-delay -mno-long-load-store @gol
767 -mno-portable-runtime -mno-soft-float @gol
768 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
769 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
770 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
771 -munix=@var{unix-std} -nolibdld -static -threads}
772
773 @emph{IA-64 Options}
774 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
775 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
776 -mconstant-gp -mauto-pic -mfused-madd @gol
777 -minline-float-divide-min-latency @gol
778 -minline-float-divide-max-throughput @gol
779 -mno-inline-float-divide @gol
780 -minline-int-divide-min-latency @gol
781 -minline-int-divide-max-throughput @gol
782 -mno-inline-int-divide @gol
783 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
784 -mno-inline-sqrt @gol
785 -mdwarf2-asm -mearly-stop-bits @gol
786 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
787 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
788 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
789 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
790 -msched-spec-ldc -msched-spec-control-ldc @gol
791 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
792 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
793 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
794 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
795
796 @emph{LM32 Options}
797 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
798 -msign-extend-enabled -muser-enabled}
799
800 @emph{M32R/D Options}
801 @gccoptlist{-m32r2 -m32rx -m32r @gol
802 -mdebug @gol
803 -malign-loops -mno-align-loops @gol
804 -missue-rate=@var{number} @gol
805 -mbranch-cost=@var{number} @gol
806 -mmodel=@var{code-size-model-type} @gol
807 -msdata=@var{sdata-type} @gol
808 -mno-flush-func -mflush-func=@var{name} @gol
809 -mno-flush-trap -mflush-trap=@var{number} @gol
810 -G @var{num}}
811
812 @emph{M32C Options}
813 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
814
815 @emph{M680x0 Options}
816 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
817 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
818 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
819 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
820 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
821 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
822 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
823 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
824 -mxgot -mno-xgot}
825
826 @emph{MCore Options}
827 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
828 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
829 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
830 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
831 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
832
833 @emph{MeP Options}
834 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
835 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
836 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
837 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
838 -mtiny=@var{n}}
839
840 @emph{MicroBlaze Options}
841 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
842 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
843 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
844 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
845 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
846
847 @emph{MIPS Options}
848 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
849 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
850 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
851 -mips16 -mno-mips16 -mflip-mips16 @gol
852 -minterlink-compressed -mno-interlink-compressed @gol
853 -minterlink-mips16 -mno-interlink-mips16 @gol
854 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
855 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
856 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
857 -mno-float -msingle-float -mdouble-float @gol
858 -modd-spreg -mno-odd-spreg @gol
859 -mabs=@var{mode} -mnan=@var{encoding} @gol
860 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
861 -mmcu -mmno-mcu @gol
862 -meva -mno-eva @gol
863 -mvirt -mno-virt @gol
864 -mxpa -mno-xpa @gol
865 -mmicromips -mno-micromips @gol
866 -mmsa -mno-msa @gol
867 -mfpu=@var{fpu-type} @gol
868 -msmartmips -mno-smartmips @gol
869 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
870 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
871 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
872 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
873 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
874 -membedded-data -mno-embedded-data @gol
875 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
876 -mcode-readable=@var{setting} @gol
877 -msplit-addresses -mno-split-addresses @gol
878 -mexplicit-relocs -mno-explicit-relocs @gol
879 -mcheck-zero-division -mno-check-zero-division @gol
880 -mdivide-traps -mdivide-breaks @gol
881 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
882 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
883 -mfix-24k -mno-fix-24k @gol
884 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
885 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
886 -mfix-vr4120 -mno-fix-vr4120 @gol
887 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
888 -mflush-func=@var{func} -mno-flush-func @gol
889 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
890 -mcompact-branches=@var{policy} @gol
891 -mfp-exceptions -mno-fp-exceptions @gol
892 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
893 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
894 -mframe-header-opt -mno-frame-header-opt}
895
896 @emph{MMIX Options}
897 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
898 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
899 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
900 -mno-base-addresses -msingle-exit -mno-single-exit}
901
902 @emph{MN10300 Options}
903 @gccoptlist{-mmult-bug -mno-mult-bug @gol
904 -mno-am33 -mam33 -mam33-2 -mam34 @gol
905 -mtune=@var{cpu-type} @gol
906 -mreturn-pointer-on-d0 @gol
907 -mno-crt0 -mrelax -mliw -msetlb}
908
909 @emph{Moxie Options}
910 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
911
912 @emph{MSP430 Options}
913 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
914 -mwarn-mcu @gol
915 -mcode-region= -mdata-region= @gol
916 -msilicon-errata= -msilicon-errata-warn= @gol
917 -mhwmult= -minrt}
918
919 @emph{NDS32 Options}
920 @gccoptlist{-mbig-endian -mlittle-endian @gol
921 -mreduced-regs -mfull-regs @gol
922 -mcmov -mno-cmov @gol
923 -mperf-ext -mno-perf-ext @gol
924 -mv3push -mno-v3push @gol
925 -m16bit -mno-16bit @gol
926 -misr-vector-size=@var{num} @gol
927 -mcache-block-size=@var{num} @gol
928 -march=@var{arch} @gol
929 -mcmodel=@var{code-model} @gol
930 -mctor-dtor -mrelax}
931
932 @emph{Nios II Options}
933 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
934 -mel -meb @gol
935 -mno-bypass-cache -mbypass-cache @gol
936 -mno-cache-volatile -mcache-volatile @gol
937 -mno-fast-sw-div -mfast-sw-div @gol
938 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
939 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
940 -mcustom-fpu-cfg=@var{name} @gol
941 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
942 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
943
944 @emph{Nvidia PTX Options}
945 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
946
947 @emph{PDP-11 Options}
948 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
949 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
950 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
951 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
952 -mbranch-expensive -mbranch-cheap @gol
953 -munix-asm -mdec-asm}
954
955 @emph{picoChip Options}
956 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
957 -msymbol-as-address -mno-inefficient-warnings}
958
959 @emph{PowerPC Options}
960 See RS/6000 and PowerPC Options.
961
962 @emph{RL78 Options}
963 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
964 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
965 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
966
967 @emph{RS/6000 and PowerPC Options}
968 @gccoptlist{-mcpu=@var{cpu-type} @gol
969 -mtune=@var{cpu-type} @gol
970 -mcmodel=@var{code-model} @gol
971 -mpowerpc64 @gol
972 -maltivec -mno-altivec @gol
973 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
974 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
975 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
976 -mfprnd -mno-fprnd @gol
977 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
978 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
979 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
980 -malign-power -malign-natural @gol
981 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
982 -msingle-float -mdouble-float -msimple-fpu @gol
983 -mstring -mno-string -mupdate -mno-update @gol
984 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
985 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
986 -mstrict-align -mno-strict-align -mrelocatable @gol
987 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
988 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
989 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
990 -mprioritize-restricted-insns=@var{priority} @gol
991 -msched-costly-dep=@var{dependence_type} @gol
992 -minsert-sched-nops=@var{scheme} @gol
993 -mcall-sysv -mcall-netbsd @gol
994 -maix-struct-return -msvr4-struct-return @gol
995 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
996 -mblock-move-inline-limit=@var{num} @gol
997 -misel -mno-isel @gol
998 -misel=yes -misel=no @gol
999 -mspe -mno-spe @gol
1000 -mspe=yes -mspe=no @gol
1001 -mpaired @gol
1002 -mgen-cell-microcode -mwarn-cell-microcode @gol
1003 -mvrsave -mno-vrsave @gol
1004 -mmulhw -mno-mulhw @gol
1005 -mdlmzb -mno-dlmzb @gol
1006 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1007 -mprototype -mno-prototype @gol
1008 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1009 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
1010 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1011 -mno-recip-precision @gol
1012 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1013 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1014 -msave-toc-indirect -mno-save-toc-indirect @gol
1015 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1016 -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol
1017 -mquad-memory -mno-quad-memory @gol
1018 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1019 -mcompat-align-parm -mno-compat-align-parm @gol
1020 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
1021 -mupper-regs-di -mno-upper-regs-di @gol
1022 -mupper-regs -mno-upper-regs @gol
1023 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1024 -mgnu-attribute -mno-gnu-attribute @gol
1025 -mlra -mno-lra}
1026
1027 @emph{RX Options}
1028 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1029 -mcpu=@gol
1030 -mbig-endian-data -mlittle-endian-data @gol
1031 -msmall-data @gol
1032 -msim -mno-sim@gol
1033 -mas100-syntax -mno-as100-syntax@gol
1034 -mrelax@gol
1035 -mmax-constant-size=@gol
1036 -mint-register=@gol
1037 -mpid@gol
1038 -mallow-string-insns -mno-allow-string-insns@gol
1039 -mjsr@gol
1040 -mno-warn-multiple-fast-interrupts@gol
1041 -msave-acc-in-interrupts}
1042
1043 @emph{S/390 and zSeries Options}
1044 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1045 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1046 -mlong-double-64 -mlong-double-128 @gol
1047 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1048 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1049 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1050 -mhtm -mvx -mzvector @gol
1051 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1052 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1053 -mhotpatch=@var{halfwords},@var{halfwords}}
1054
1055 @emph{Score Options}
1056 @gccoptlist{-meb -mel @gol
1057 -mnhwloop @gol
1058 -muls @gol
1059 -mmac @gol
1060 -mscore5 -mscore5u -mscore7 -mscore7d}
1061
1062 @emph{SH Options}
1063 @gccoptlist{-m1 -m2 -m2e @gol
1064 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1065 -m3 -m3e @gol
1066 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1067 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1068 -mb -ml -mdalign -mrelax @gol
1069 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1070 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1071 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1072 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1073 -maccumulate-outgoing-args @gol
1074 -matomic-model=@var{atomic-model} @gol
1075 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1076 -mcbranch-force-delay-slot @gol
1077 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1078 -mpretend-cmove -mtas}
1079
1080 @emph{Solaris 2 Options}
1081 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1082 -pthreads -pthread}
1083
1084 @emph{SPARC Options}
1085 @gccoptlist{-mcpu=@var{cpu-type} @gol
1086 -mtune=@var{cpu-type} @gol
1087 -mcmodel=@var{code-model} @gol
1088 -mmemory-model=@var{mem-model} @gol
1089 -m32 -m64 -mapp-regs -mno-app-regs @gol
1090 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1091 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1092 -mhard-quad-float -msoft-quad-float @gol
1093 -mstack-bias -mno-stack-bias @gol
1094 -mstd-struct-return -mno-std-struct-return @gol
1095 -munaligned-doubles -mno-unaligned-doubles @gol
1096 -muser-mode -mno-user-mode @gol
1097 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1098 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1099 -mcbcond -mno-cbcond -mfmaf -mno-fmaf @gol
1100 -mpopc -mno-popc -msubxc -mno-subxc@gol
1101 -mfix-at697f -mfix-ut699}
1102
1103 @emph{SPU Options}
1104 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1105 -msafe-dma -munsafe-dma @gol
1106 -mbranch-hints @gol
1107 -msmall-mem -mlarge-mem -mstdmain @gol
1108 -mfixed-range=@var{register-range} @gol
1109 -mea32 -mea64 @gol
1110 -maddress-space-conversion -mno-address-space-conversion @gol
1111 -mcache-size=@var{cache-size} @gol
1112 -matomic-updates -mno-atomic-updates}
1113
1114 @emph{System V Options}
1115 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1116
1117 @emph{TILE-Gx Options}
1118 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1119 -mcmodel=@var{code-model}}
1120
1121 @emph{TILEPro Options}
1122 @gccoptlist{-mcpu=@var{cpu} -m32}
1123
1124 @emph{V850 Options}
1125 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1126 -mprolog-function -mno-prolog-function -mspace @gol
1127 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1128 -mapp-regs -mno-app-regs @gol
1129 -mdisable-callt -mno-disable-callt @gol
1130 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1131 -mv850e -mv850 -mv850e3v5 @gol
1132 -mloop @gol
1133 -mrelax @gol
1134 -mlong-jumps @gol
1135 -msoft-float @gol
1136 -mhard-float @gol
1137 -mgcc-abi @gol
1138 -mrh850-abi @gol
1139 -mbig-switch}
1140
1141 @emph{VAX Options}
1142 @gccoptlist{-mg -mgnu -munix}
1143
1144 @emph{Visium Options}
1145 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1146 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1147
1148 @emph{VMS Options}
1149 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1150 -mpointer-size=@var{size}}
1151
1152 @emph{VxWorks Options}
1153 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1154 -Xbind-lazy -Xbind-now}
1155
1156 @emph{x86 Options}
1157 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1158 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1159 -mfpmath=@var{unit} @gol
1160 -masm=@var{dialect} -mno-fancy-math-387 @gol
1161 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1162 -mno-wide-multiply -mrtd -malign-double @gol
1163 -mpreferred-stack-boundary=@var{num} @gol
1164 -mincoming-stack-boundary=@var{num} @gol
1165 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1166 -mrecip -mrecip=@var{opt} @gol
1167 -mvzeroupper -mprefer-avx128 @gol
1168 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1169 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1170 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1171 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1172 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1173 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
1174 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mclzero
1175 -mpku -mthreads @gol
1176 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1177 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1178 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1179 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1180 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1181 -mregparm=@var{num} -msseregparm @gol
1182 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1183 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1184 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1185 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1186 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1187 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1188 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1189 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1190 -mmitigate-rop -mgeneral-regs-only}
1191
1192 @emph{x86 Windows Options}
1193 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1194 -mnop-fun-dllimport -mthread @gol
1195 -municode -mwin32 -mwindows -fno-set-stack-executable}
1196
1197 @emph{Xstormy16 Options}
1198 @gccoptlist{-msim}
1199
1200 @emph{Xtensa Options}
1201 @gccoptlist{-mconst16 -mno-const16 @gol
1202 -mfused-madd -mno-fused-madd @gol
1203 -mforce-no-pic @gol
1204 -mserialize-volatile -mno-serialize-volatile @gol
1205 -mtext-section-literals -mno-text-section-literals @gol
1206 -mauto-litpools -mno-auto-litpools @gol
1207 -mtarget-align -mno-target-align @gol
1208 -mlongcalls -mno-longcalls}
1209
1210 @emph{zSeries Options}
1211 See S/390 and zSeries Options.
1212 @end table
1213
1214
1215 @node Overall Options
1216 @section Options Controlling the Kind of Output
1217
1218 Compilation can involve up to four stages: preprocessing, compilation
1219 proper, assembly and linking, always in that order. GCC is capable of
1220 preprocessing and compiling several files either into several
1221 assembler input files, or into one assembler input file; then each
1222 assembler input file produces an object file, and linking combines all
1223 the object files (those newly compiled, and those specified as input)
1224 into an executable file.
1225
1226 @cindex file name suffix
1227 For any given input file, the file name suffix determines what kind of
1228 compilation is done:
1229
1230 @table @gcctabopt
1231 @item @var{file}.c
1232 C source code that must be preprocessed.
1233
1234 @item @var{file}.i
1235 C source code that should not be preprocessed.
1236
1237 @item @var{file}.ii
1238 C++ source code that should not be preprocessed.
1239
1240 @item @var{file}.m
1241 Objective-C source code. Note that you must link with the @file{libobjc}
1242 library to make an Objective-C program work.
1243
1244 @item @var{file}.mi
1245 Objective-C source code that should not be preprocessed.
1246
1247 @item @var{file}.mm
1248 @itemx @var{file}.M
1249 Objective-C++ source code. Note that you must link with the @file{libobjc}
1250 library to make an Objective-C++ program work. Note that @samp{.M} refers
1251 to a literal capital M@.
1252
1253 @item @var{file}.mii
1254 Objective-C++ source code that should not be preprocessed.
1255
1256 @item @var{file}.h
1257 C, C++, Objective-C or Objective-C++ header file to be turned into a
1258 precompiled header (default), or C, C++ header file to be turned into an
1259 Ada spec (via the @option{-fdump-ada-spec} switch).
1260
1261 @item @var{file}.cc
1262 @itemx @var{file}.cp
1263 @itemx @var{file}.cxx
1264 @itemx @var{file}.cpp
1265 @itemx @var{file}.CPP
1266 @itemx @var{file}.c++
1267 @itemx @var{file}.C
1268 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1269 the last two letters must both be literally @samp{x}. Likewise,
1270 @samp{.C} refers to a literal capital C@.
1271
1272 @item @var{file}.mm
1273 @itemx @var{file}.M
1274 Objective-C++ source code that must be preprocessed.
1275
1276 @item @var{file}.mii
1277 Objective-C++ source code that should not be preprocessed.
1278
1279 @item @var{file}.hh
1280 @itemx @var{file}.H
1281 @itemx @var{file}.hp
1282 @itemx @var{file}.hxx
1283 @itemx @var{file}.hpp
1284 @itemx @var{file}.HPP
1285 @itemx @var{file}.h++
1286 @itemx @var{file}.tcc
1287 C++ header file to be turned into a precompiled header or Ada spec.
1288
1289 @item @var{file}.f
1290 @itemx @var{file}.for
1291 @itemx @var{file}.ftn
1292 Fixed form Fortran source code that should not be preprocessed.
1293
1294 @item @var{file}.F
1295 @itemx @var{file}.FOR
1296 @itemx @var{file}.fpp
1297 @itemx @var{file}.FPP
1298 @itemx @var{file}.FTN
1299 Fixed form Fortran source code that must be preprocessed (with the traditional
1300 preprocessor).
1301
1302 @item @var{file}.f90
1303 @itemx @var{file}.f95
1304 @itemx @var{file}.f03
1305 @itemx @var{file}.f08
1306 Free form Fortran source code that should not be preprocessed.
1307
1308 @item @var{file}.F90
1309 @itemx @var{file}.F95
1310 @itemx @var{file}.F03
1311 @itemx @var{file}.F08
1312 Free form Fortran source code that must be preprocessed (with the
1313 traditional preprocessor).
1314
1315 @item @var{file}.go
1316 Go source code.
1317
1318 @c FIXME: Descriptions of Java file types.
1319 @c @var{file}.java
1320 @c @var{file}.class
1321 @c @var{file}.zip
1322 @c @var{file}.jar
1323
1324 @item @var{file}.ads
1325 Ada source code file that contains a library unit declaration (a
1326 declaration of a package, subprogram, or generic, or a generic
1327 instantiation), or a library unit renaming declaration (a package,
1328 generic, or subprogram renaming declaration). Such files are also
1329 called @dfn{specs}.
1330
1331 @item @var{file}.adb
1332 Ada source code file containing a library unit body (a subprogram or
1333 package body). Such files are also called @dfn{bodies}.
1334
1335 @c GCC also knows about some suffixes for languages not yet included:
1336 @c Pascal:
1337 @c @var{file}.p
1338 @c @var{file}.pas
1339 @c Ratfor:
1340 @c @var{file}.r
1341
1342 @item @var{file}.s
1343 Assembler code.
1344
1345 @item @var{file}.S
1346 @itemx @var{file}.sx
1347 Assembler code that must be preprocessed.
1348
1349 @item @var{other}
1350 An object file to be fed straight into linking.
1351 Any file name with no recognized suffix is treated this way.
1352 @end table
1353
1354 @opindex x
1355 You can specify the input language explicitly with the @option{-x} option:
1356
1357 @table @gcctabopt
1358 @item -x @var{language}
1359 Specify explicitly the @var{language} for the following input files
1360 (rather than letting the compiler choose a default based on the file
1361 name suffix). This option applies to all following input files until
1362 the next @option{-x} option. Possible values for @var{language} are:
1363 @smallexample
1364 c c-header cpp-output
1365 c++ c++-header c++-cpp-output
1366 objective-c objective-c-header objective-c-cpp-output
1367 objective-c++ objective-c++-header objective-c++-cpp-output
1368 assembler assembler-with-cpp
1369 ada
1370 f77 f77-cpp-input f95 f95-cpp-input
1371 go
1372 java
1373 @end smallexample
1374
1375 @item -x none
1376 Turn off any specification of a language, so that subsequent files are
1377 handled according to their file name suffixes (as they are if @option{-x}
1378 has not been used at all).
1379 @end table
1380
1381 If you only want some of the stages of compilation, you can use
1382 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1383 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1384 @command{gcc} is to stop. Note that some combinations (for example,
1385 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1386
1387 @table @gcctabopt
1388 @item -c
1389 @opindex c
1390 Compile or assemble the source files, but do not link. The linking
1391 stage simply is not done. The ultimate output is in the form of an
1392 object file for each source file.
1393
1394 By default, the object file name for a source file is made by replacing
1395 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1396
1397 Unrecognized input files, not requiring compilation or assembly, are
1398 ignored.
1399
1400 @item -S
1401 @opindex S
1402 Stop after the stage of compilation proper; do not assemble. The output
1403 is in the form of an assembler code file for each non-assembler input
1404 file specified.
1405
1406 By default, the assembler file name for a source file is made by
1407 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1408
1409 Input files that don't require compilation are ignored.
1410
1411 @item -E
1412 @opindex E
1413 Stop after the preprocessing stage; do not run the compiler proper. The
1414 output is in the form of preprocessed source code, which is sent to the
1415 standard output.
1416
1417 Input files that don't require preprocessing are ignored.
1418
1419 @cindex output file option
1420 @item -o @var{file}
1421 @opindex o
1422 Place output in file @var{file}. This applies to whatever
1423 sort of output is being produced, whether it be an executable file,
1424 an object file, an assembler file or preprocessed C code.
1425
1426 If @option{-o} is not specified, the default is to put an executable
1427 file in @file{a.out}, the object file for
1428 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1429 assembler file in @file{@var{source}.s}, a precompiled header file in
1430 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1431 standard output.
1432
1433 @item -v
1434 @opindex v
1435 Print (on standard error output) the commands executed to run the stages
1436 of compilation. Also print the version number of the compiler driver
1437 program and of the preprocessor and the compiler proper.
1438
1439 @item -###
1440 @opindex ###
1441 Like @option{-v} except the commands are not executed and arguments
1442 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1443 This is useful for shell scripts to capture the driver-generated command lines.
1444
1445 @item --help
1446 @opindex help
1447 Print (on the standard output) a description of the command-line options
1448 understood by @command{gcc}. If the @option{-v} option is also specified
1449 then @option{--help} is also passed on to the various processes
1450 invoked by @command{gcc}, so that they can display the command-line options
1451 they accept. If the @option{-Wextra} option has also been specified
1452 (prior to the @option{--help} option), then command-line options that
1453 have no documentation associated with them are also displayed.
1454
1455 @item --target-help
1456 @opindex target-help
1457 Print (on the standard output) a description of target-specific command-line
1458 options for each tool. For some targets extra target-specific
1459 information may also be printed.
1460
1461 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1462 Print (on the standard output) a description of the command-line
1463 options understood by the compiler that fit into all specified classes
1464 and qualifiers. These are the supported classes:
1465
1466 @table @asis
1467 @item @samp{optimizers}
1468 Display all of the optimization options supported by the
1469 compiler.
1470
1471 @item @samp{warnings}
1472 Display all of the options controlling warning messages
1473 produced by the compiler.
1474
1475 @item @samp{target}
1476 Display target-specific options. Unlike the
1477 @option{--target-help} option however, target-specific options of the
1478 linker and assembler are not displayed. This is because those
1479 tools do not currently support the extended @option{--help=} syntax.
1480
1481 @item @samp{params}
1482 Display the values recognized by the @option{--param}
1483 option.
1484
1485 @item @var{language}
1486 Display the options supported for @var{language}, where
1487 @var{language} is the name of one of the languages supported in this
1488 version of GCC@.
1489
1490 @item @samp{common}
1491 Display the options that are common to all languages.
1492 @end table
1493
1494 These are the supported qualifiers:
1495
1496 @table @asis
1497 @item @samp{undocumented}
1498 Display only those options that are undocumented.
1499
1500 @item @samp{joined}
1501 Display options taking an argument that appears after an equal
1502 sign in the same continuous piece of text, such as:
1503 @samp{--help=target}.
1504
1505 @item @samp{separate}
1506 Display options taking an argument that appears as a separate word
1507 following the original option, such as: @samp{-o output-file}.
1508 @end table
1509
1510 Thus for example to display all the undocumented target-specific
1511 switches supported by the compiler, use:
1512
1513 @smallexample
1514 --help=target,undocumented
1515 @end smallexample
1516
1517 The sense of a qualifier can be inverted by prefixing it with the
1518 @samp{^} character, so for example to display all binary warning
1519 options (i.e., ones that are either on or off and that do not take an
1520 argument) that have a description, use:
1521
1522 @smallexample
1523 --help=warnings,^joined,^undocumented
1524 @end smallexample
1525
1526 The argument to @option{--help=} should not consist solely of inverted
1527 qualifiers.
1528
1529 Combining several classes is possible, although this usually
1530 restricts the output so much that there is nothing to display. One
1531 case where it does work, however, is when one of the classes is
1532 @var{target}. For example, to display all the target-specific
1533 optimization options, use:
1534
1535 @smallexample
1536 --help=target,optimizers
1537 @end smallexample
1538
1539 The @option{--help=} option can be repeated on the command line. Each
1540 successive use displays its requested class of options, skipping
1541 those that have already been displayed.
1542
1543 If the @option{-Q} option appears on the command line before the
1544 @option{--help=} option, then the descriptive text displayed by
1545 @option{--help=} is changed. Instead of describing the displayed
1546 options, an indication is given as to whether the option is enabled,
1547 disabled or set to a specific value (assuming that the compiler
1548 knows this at the point where the @option{--help=} option is used).
1549
1550 Here is a truncated example from the ARM port of @command{gcc}:
1551
1552 @smallexample
1553 % gcc -Q -mabi=2 --help=target -c
1554 The following options are target specific:
1555 -mabi= 2
1556 -mabort-on-noreturn [disabled]
1557 -mapcs [disabled]
1558 @end smallexample
1559
1560 The output is sensitive to the effects of previous command-line
1561 options, so for example it is possible to find out which optimizations
1562 are enabled at @option{-O2} by using:
1563
1564 @smallexample
1565 -Q -O2 --help=optimizers
1566 @end smallexample
1567
1568 Alternatively you can discover which binary optimizations are enabled
1569 by @option{-O3} by using:
1570
1571 @smallexample
1572 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1573 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1574 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1575 @end smallexample
1576
1577 @item --version
1578 @opindex version
1579 Display the version number and copyrights of the invoked GCC@.
1580
1581 @item -pass-exit-codes
1582 @opindex pass-exit-codes
1583 Normally the @command{gcc} program exits with the code of 1 if any
1584 phase of the compiler returns a non-success return code. If you specify
1585 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1586 the numerically highest error produced by any phase returning an error
1587 indication. The C, C++, and Fortran front ends return 4 if an internal
1588 compiler error is encountered.
1589
1590 @item -pipe
1591 @opindex pipe
1592 Use pipes rather than temporary files for communication between the
1593 various stages of compilation. This fails to work on some systems where
1594 the assembler is unable to read from a pipe; but the GNU assembler has
1595 no trouble.
1596
1597 @item -specs=@var{file}
1598 @opindex specs
1599 Process @var{file} after the compiler reads in the standard @file{specs}
1600 file, in order to override the defaults which the @command{gcc} driver
1601 program uses when determining what switches to pass to @command{cc1},
1602 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1603 @option{-specs=@var{file}} can be specified on the command line, and they
1604 are processed in order, from left to right. @xref{Spec Files}, for
1605 information about the format of the @var{file}.
1606
1607 @item -wrapper
1608 @opindex wrapper
1609 Invoke all subcommands under a wrapper program. The name of the
1610 wrapper program and its parameters are passed as a comma separated
1611 list.
1612
1613 @smallexample
1614 gcc -c t.c -wrapper gdb,--args
1615 @end smallexample
1616
1617 @noindent
1618 This invokes all subprograms of @command{gcc} under
1619 @samp{gdb --args}, thus the invocation of @command{cc1} is
1620 @samp{gdb --args cc1 @dots{}}.
1621
1622 @item -fplugin=@var{name}.so
1623 @opindex fplugin
1624 Load the plugin code in file @var{name}.so, assumed to be a
1625 shared object to be dlopen'd by the compiler. The base name of
1626 the shared object file is used to identify the plugin for the
1627 purposes of argument parsing (See
1628 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1629 Each plugin should define the callback functions specified in the
1630 Plugins API.
1631
1632 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1633 @opindex fplugin-arg
1634 Define an argument called @var{key} with a value of @var{value}
1635 for the plugin called @var{name}.
1636
1637 @item -fdump-ada-spec@r{[}-slim@r{]}
1638 @opindex fdump-ada-spec
1639 For C and C++ source and include files, generate corresponding Ada specs.
1640 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1641 GNAT User's Guide}, which provides detailed documentation on this feature.
1642
1643 @item -fada-spec-parent=@var{unit}
1644 @opindex fada-spec-parent
1645 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1646 Ada specs as child units of parent @var{unit}.
1647
1648 @item -fdump-go-spec=@var{file}
1649 @opindex fdump-go-spec
1650 For input files in any language, generate corresponding Go
1651 declarations in @var{file}. This generates Go @code{const},
1652 @code{type}, @code{var}, and @code{func} declarations which may be a
1653 useful way to start writing a Go interface to code written in some
1654 other language.
1655
1656 @include @value{srcdir}/../libiberty/at-file.texi
1657 @end table
1658
1659 @node Invoking G++
1660 @section Compiling C++ Programs
1661
1662 @cindex suffixes for C++ source
1663 @cindex C++ source file suffixes
1664 C++ source files conventionally use one of the suffixes @samp{.C},
1665 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1666 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1667 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1668 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1669 files with these names and compiles them as C++ programs even if you
1670 call the compiler the same way as for compiling C programs (usually
1671 with the name @command{gcc}).
1672
1673 @findex g++
1674 @findex c++
1675 However, the use of @command{gcc} does not add the C++ library.
1676 @command{g++} is a program that calls GCC and automatically specifies linking
1677 against the C++ library. It treats @samp{.c},
1678 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1679 files unless @option{-x} is used. This program is also useful when
1680 precompiling a C header file with a @samp{.h} extension for use in C++
1681 compilations. On many systems, @command{g++} is also installed with
1682 the name @command{c++}.
1683
1684 @cindex invoking @command{g++}
1685 When you compile C++ programs, you may specify many of the same
1686 command-line options that you use for compiling programs in any
1687 language; or command-line options meaningful for C and related
1688 languages; or options that are meaningful only for C++ programs.
1689 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1690 explanations of options for languages related to C@.
1691 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1692 explanations of options that are meaningful only for C++ programs.
1693
1694 @node C Dialect Options
1695 @section Options Controlling C Dialect
1696 @cindex dialect options
1697 @cindex language dialect options
1698 @cindex options, dialect
1699
1700 The following options control the dialect of C (or languages derived
1701 from C, such as C++, Objective-C and Objective-C++) that the compiler
1702 accepts:
1703
1704 @table @gcctabopt
1705 @cindex ANSI support
1706 @cindex ISO support
1707 @item -ansi
1708 @opindex ansi
1709 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1710 equivalent to @option{-std=c++98}.
1711
1712 This turns off certain features of GCC that are incompatible with ISO
1713 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1714 such as the @code{asm} and @code{typeof} keywords, and
1715 predefined macros such as @code{unix} and @code{vax} that identify the
1716 type of system you are using. It also enables the undesirable and
1717 rarely used ISO trigraph feature. For the C compiler,
1718 it disables recognition of C++ style @samp{//} comments as well as
1719 the @code{inline} keyword.
1720
1721 The alternate keywords @code{__asm__}, @code{__extension__},
1722 @code{__inline__} and @code{__typeof__} continue to work despite
1723 @option{-ansi}. You would not want to use them in an ISO C program, of
1724 course, but it is useful to put them in header files that might be included
1725 in compilations done with @option{-ansi}. Alternate predefined macros
1726 such as @code{__unix__} and @code{__vax__} are also available, with or
1727 without @option{-ansi}.
1728
1729 The @option{-ansi} option does not cause non-ISO programs to be
1730 rejected gratuitously. For that, @option{-Wpedantic} is required in
1731 addition to @option{-ansi}. @xref{Warning Options}.
1732
1733 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1734 option is used. Some header files may notice this macro and refrain
1735 from declaring certain functions or defining certain macros that the
1736 ISO standard doesn't call for; this is to avoid interfering with any
1737 programs that might use these names for other things.
1738
1739 Functions that are normally built in but do not have semantics
1740 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1741 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1742 built-in functions provided by GCC}, for details of the functions
1743 affected.
1744
1745 @item -std=
1746 @opindex std
1747 Determine the language standard. @xref{Standards,,Language Standards
1748 Supported by GCC}, for details of these standard versions. This option
1749 is currently only supported when compiling C or C++.
1750
1751 The compiler can accept several base standards, such as @samp{c90} or
1752 @samp{c++98}, and GNU dialects of those standards, such as
1753 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1754 compiler accepts all programs following that standard plus those
1755 using GNU extensions that do not contradict it. For example,
1756 @option{-std=c90} turns off certain features of GCC that are
1757 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1758 keywords, but not other GNU extensions that do not have a meaning in
1759 ISO C90, such as omitting the middle term of a @code{?:}
1760 expression. On the other hand, when a GNU dialect of a standard is
1761 specified, all features supported by the compiler are enabled, even when
1762 those features change the meaning of the base standard. As a result, some
1763 strict-conforming programs may be rejected. The particular standard
1764 is used by @option{-Wpedantic} to identify which features are GNU
1765 extensions given that version of the standard. For example
1766 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1767 comments, while @option{-std=gnu99 -Wpedantic} does not.
1768
1769 A value for this option must be provided; possible values are
1770
1771 @table @samp
1772 @item c90
1773 @itemx c89
1774 @itemx iso9899:1990
1775 Support all ISO C90 programs (certain GNU extensions that conflict
1776 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1777
1778 @item iso9899:199409
1779 ISO C90 as modified in amendment 1.
1780
1781 @item c99
1782 @itemx c9x
1783 @itemx iso9899:1999
1784 @itemx iso9899:199x
1785 ISO C99. This standard is substantially completely supported, modulo
1786 bugs and floating-point issues
1787 (mainly but not entirely relating to optional C99 features from
1788 Annexes F and G). See
1789 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1790 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1791
1792 @item c11
1793 @itemx c1x
1794 @itemx iso9899:2011
1795 ISO C11, the 2011 revision of the ISO C standard. This standard is
1796 substantially completely supported, modulo bugs, floating-point issues
1797 (mainly but not entirely relating to optional C11 features from
1798 Annexes F and G) and the optional Annexes K (Bounds-checking
1799 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1800
1801 @item gnu90
1802 @itemx gnu89
1803 GNU dialect of ISO C90 (including some C99 features).
1804
1805 @item gnu99
1806 @itemx gnu9x
1807 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1808
1809 @item gnu11
1810 @itemx gnu1x
1811 GNU dialect of ISO C11. This is the default for C code.
1812 The name @samp{gnu1x} is deprecated.
1813
1814 @item c++98
1815 @itemx c++03
1816 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1817 additional defect reports. Same as @option{-ansi} for C++ code.
1818
1819 @item gnu++98
1820 @itemx gnu++03
1821 GNU dialect of @option{-std=c++98}.
1822
1823 @item c++11
1824 @itemx c++0x
1825 The 2011 ISO C++ standard plus amendments.
1826 The name @samp{c++0x} is deprecated.
1827
1828 @item gnu++11
1829 @itemx gnu++0x
1830 GNU dialect of @option{-std=c++11}.
1831 The name @samp{gnu++0x} is deprecated.
1832
1833 @item c++14
1834 @itemx c++1y
1835 The 2014 ISO C++ standard plus amendments.
1836 The name @samp{c++1y} is deprecated.
1837
1838 @item gnu++14
1839 @itemx gnu++1y
1840 GNU dialect of @option{-std=c++14}.
1841 This is the default for C++ code.
1842 The name @samp{gnu++1y} is deprecated.
1843
1844 @item c++1z
1845 The next revision of the ISO C++ standard, tentatively planned for
1846 2017. Support is highly experimental, and will almost certainly
1847 change in incompatible ways in future releases.
1848
1849 @item gnu++1z
1850 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1851 and will almost certainly change in incompatible ways in future
1852 releases.
1853 @end table
1854
1855 @item -fgnu89-inline
1856 @opindex fgnu89-inline
1857 The option @option{-fgnu89-inline} tells GCC to use the traditional
1858 GNU semantics for @code{inline} functions when in C99 mode.
1859 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1860 Using this option is roughly equivalent to adding the
1861 @code{gnu_inline} function attribute to all inline functions
1862 (@pxref{Function Attributes}).
1863
1864 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1865 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1866 specifies the default behavior).
1867 This option is not supported in @option{-std=c90} or
1868 @option{-std=gnu90} mode.
1869
1870 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1871 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1872 in effect for @code{inline} functions. @xref{Common Predefined
1873 Macros,,,cpp,The C Preprocessor}.
1874
1875 @item -aux-info @var{filename}
1876 @opindex aux-info
1877 Output to the given filename prototyped declarations for all functions
1878 declared and/or defined in a translation unit, including those in header
1879 files. This option is silently ignored in any language other than C@.
1880
1881 Besides declarations, the file indicates, in comments, the origin of
1882 each declaration (source file and line), whether the declaration was
1883 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1884 @samp{O} for old, respectively, in the first character after the line
1885 number and the colon), and whether it came from a declaration or a
1886 definition (@samp{C} or @samp{F}, respectively, in the following
1887 character). In the case of function definitions, a K&R-style list of
1888 arguments followed by their declarations is also provided, inside
1889 comments, after the declaration.
1890
1891 @item -fallow-parameterless-variadic-functions
1892 @opindex fallow-parameterless-variadic-functions
1893 Accept variadic functions without named parameters.
1894
1895 Although it is possible to define such a function, this is not very
1896 useful as it is not possible to read the arguments. This is only
1897 supported for C as this construct is allowed by C++.
1898
1899 @item -fno-asm
1900 @opindex fno-asm
1901 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1902 keyword, so that code can use these words as identifiers. You can use
1903 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1904 instead. @option{-ansi} implies @option{-fno-asm}.
1905
1906 In C++, this switch only affects the @code{typeof} keyword, since
1907 @code{asm} and @code{inline} are standard keywords. You may want to
1908 use the @option{-fno-gnu-keywords} flag instead, which has the same
1909 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1910 switch only affects the @code{asm} and @code{typeof} keywords, since
1911 @code{inline} is a standard keyword in ISO C99.
1912
1913 @item -fno-builtin
1914 @itemx -fno-builtin-@var{function}
1915 @opindex fno-builtin
1916 @cindex built-in functions
1917 Don't recognize built-in functions that do not begin with
1918 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1919 functions provided by GCC}, for details of the functions affected,
1920 including those which are not built-in functions when @option{-ansi} or
1921 @option{-std} options for strict ISO C conformance are used because they
1922 do not have an ISO standard meaning.
1923
1924 GCC normally generates special code to handle certain built-in functions
1925 more efficiently; for instance, calls to @code{alloca} may become single
1926 instructions which adjust the stack directly, and calls to @code{memcpy}
1927 may become inline copy loops. The resulting code is often both smaller
1928 and faster, but since the function calls no longer appear as such, you
1929 cannot set a breakpoint on those calls, nor can you change the behavior
1930 of the functions by linking with a different library. In addition,
1931 when a function is recognized as a built-in function, GCC may use
1932 information about that function to warn about problems with calls to
1933 that function, or to generate more efficient code, even if the
1934 resulting code still contains calls to that function. For example,
1935 warnings are given with @option{-Wformat} for bad calls to
1936 @code{printf} when @code{printf} is built in and @code{strlen} is
1937 known not to modify global memory.
1938
1939 With the @option{-fno-builtin-@var{function}} option
1940 only the built-in function @var{function} is
1941 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1942 function is named that is not built-in in this version of GCC, this
1943 option is ignored. There is no corresponding
1944 @option{-fbuiltin-@var{function}} option; if you wish to enable
1945 built-in functions selectively when using @option{-fno-builtin} or
1946 @option{-ffreestanding}, you may define macros such as:
1947
1948 @smallexample
1949 #define abs(n) __builtin_abs ((n))
1950 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1951 @end smallexample
1952
1953 @item -fhosted
1954 @opindex fhosted
1955 @cindex hosted environment
1956
1957 Assert that compilation targets a hosted environment. This implies
1958 @option{-fbuiltin}. A hosted environment is one in which the
1959 entire standard library is available, and in which @code{main} has a return
1960 type of @code{int}. Examples are nearly everything except a kernel.
1961 This is equivalent to @option{-fno-freestanding}.
1962
1963 @item -ffreestanding
1964 @opindex ffreestanding
1965 @cindex hosted environment
1966
1967 Assert that compilation targets a freestanding environment. This
1968 implies @option{-fno-builtin}. A freestanding environment
1969 is one in which the standard library may not exist, and program startup may
1970 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1971 This is equivalent to @option{-fno-hosted}.
1972
1973 @xref{Standards,,Language Standards Supported by GCC}, for details of
1974 freestanding and hosted environments.
1975
1976 @item -fopenacc
1977 @opindex fopenacc
1978 @cindex OpenACC accelerator programming
1979 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
1980 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
1981 compiler generates accelerated code according to the OpenACC Application
1982 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
1983 implies @option{-pthread}, and thus is only supported on targets that
1984 have support for @option{-pthread}.
1985
1986 @item -fopenacc-dim=@var{geom}
1987 @opindex fopenacc-dim
1988 @cindex OpenACC accelerator programming
1989 Specify default compute dimensions for parallel offload regions that do
1990 not explicitly specify. The @var{geom} value is a triple of
1991 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
1992 can be omitted, to use a target-specific default value.
1993
1994 @item -fopenmp
1995 @opindex fopenmp
1996 @cindex OpenMP parallel
1997 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1998 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1999 compiler generates parallel code according to the OpenMP Application
2000 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
2001 implies @option{-pthread}, and thus is only supported on targets that
2002 have support for @option{-pthread}. @option{-fopenmp} implies
2003 @option{-fopenmp-simd}.
2004
2005 @item -fopenmp-simd
2006 @opindex fopenmp-simd
2007 @cindex OpenMP SIMD
2008 @cindex SIMD
2009 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2010 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2011 are ignored.
2012
2013 @item -fcilkplus
2014 @opindex fcilkplus
2015 @cindex Enable Cilk Plus
2016 Enable the usage of Cilk Plus language extension features for C/C++.
2017 When the option @option{-fcilkplus} is specified, enable the usage of
2018 the Cilk Plus Language extension features for C/C++. The present
2019 implementation follows ABI version 1.2. This is an experimental
2020 feature that is only partially complete, and whose interface may
2021 change in future versions of GCC as the official specification
2022 changes. Currently, all features but @code{_Cilk_for} have been
2023 implemented.
2024
2025 @item -fgnu-tm
2026 @opindex fgnu-tm
2027 When the option @option{-fgnu-tm} is specified, the compiler
2028 generates code for the Linux variant of Intel's current Transactional
2029 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2030 an experimental feature whose interface may change in future versions
2031 of GCC, as the official specification changes. Please note that not
2032 all architectures are supported for this feature.
2033
2034 For more information on GCC's support for transactional memory,
2035 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2036 Transactional Memory Library}.
2037
2038 Note that the transactional memory feature is not supported with
2039 non-call exceptions (@option{-fnon-call-exceptions}).
2040
2041 @item -fms-extensions
2042 @opindex fms-extensions
2043 Accept some non-standard constructs used in Microsoft header files.
2044
2045 In C++ code, this allows member names in structures to be similar
2046 to previous types declarations.
2047
2048 @smallexample
2049 typedef int UOW;
2050 struct ABC @{
2051 UOW UOW;
2052 @};
2053 @end smallexample
2054
2055 Some cases of unnamed fields in structures and unions are only
2056 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2057 fields within structs/unions}, for details.
2058
2059 Note that this option is off for all targets but x86
2060 targets using ms-abi.
2061
2062 @item -fplan9-extensions
2063 @opindex fplan9-extensions
2064 Accept some non-standard constructs used in Plan 9 code.
2065
2066 This enables @option{-fms-extensions}, permits passing pointers to
2067 structures with anonymous fields to functions that expect pointers to
2068 elements of the type of the field, and permits referring to anonymous
2069 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2070 struct/union fields within structs/unions}, for details. This is only
2071 supported for C, not C++.
2072
2073 @item -trigraphs
2074 @opindex trigraphs
2075 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
2076 options for strict ISO C conformance) implies @option{-trigraphs}.
2077
2078 @cindex traditional C language
2079 @cindex C language, traditional
2080 @item -traditional
2081 @itemx -traditional-cpp
2082 @opindex traditional-cpp
2083 @opindex traditional
2084 Formerly, these options caused GCC to attempt to emulate a pre-standard
2085 C compiler. They are now only supported with the @option{-E} switch.
2086 The preprocessor continues to support a pre-standard mode. See the GNU
2087 CPP manual for details.
2088
2089 @item -fcond-mismatch
2090 @opindex fcond-mismatch
2091 Allow conditional expressions with mismatched types in the second and
2092 third arguments. The value of such an expression is void. This option
2093 is not supported for C++.
2094
2095 @item -flax-vector-conversions
2096 @opindex flax-vector-conversions
2097 Allow implicit conversions between vectors with differing numbers of
2098 elements and/or incompatible element types. This option should not be
2099 used for new code.
2100
2101 @item -funsigned-char
2102 @opindex funsigned-char
2103 Let the type @code{char} be unsigned, like @code{unsigned char}.
2104
2105 Each kind of machine has a default for what @code{char} should
2106 be. It is either like @code{unsigned char} by default or like
2107 @code{signed char} by default.
2108
2109 Ideally, a portable program should always use @code{signed char} or
2110 @code{unsigned char} when it depends on the signedness of an object.
2111 But many programs have been written to use plain @code{char} and
2112 expect it to be signed, or expect it to be unsigned, depending on the
2113 machines they were written for. This option, and its inverse, let you
2114 make such a program work with the opposite default.
2115
2116 The type @code{char} is always a distinct type from each of
2117 @code{signed char} or @code{unsigned char}, even though its behavior
2118 is always just like one of those two.
2119
2120 @item -fsigned-char
2121 @opindex fsigned-char
2122 Let the type @code{char} be signed, like @code{signed char}.
2123
2124 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2125 the negative form of @option{-funsigned-char}. Likewise, the option
2126 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2127
2128 @item -fsigned-bitfields
2129 @itemx -funsigned-bitfields
2130 @itemx -fno-signed-bitfields
2131 @itemx -fno-unsigned-bitfields
2132 @opindex fsigned-bitfields
2133 @opindex funsigned-bitfields
2134 @opindex fno-signed-bitfields
2135 @opindex fno-unsigned-bitfields
2136 These options control whether a bit-field is signed or unsigned, when the
2137 declaration does not use either @code{signed} or @code{unsigned}. By
2138 default, such a bit-field is signed, because this is consistent: the
2139 basic integer types such as @code{int} are signed types.
2140
2141 @item -fsso-struct=@var{endianness}
2142 @opindex fsso-struct
2143 Set the default scalar storage order of structures and unions to the
2144 specified endianness. The accepted values are @samp{big-endian} and
2145 @samp{little-endian}. If the option is not passed, the compiler uses
2146 the native endianness of the target. This option is not supported for C++.
2147
2148 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2149 code that is not binary compatible with code generated without it if the
2150 specified endianness is not the native endianness of the target.
2151 @end table
2152
2153 @node C++ Dialect Options
2154 @section Options Controlling C++ Dialect
2155
2156 @cindex compiler options, C++
2157 @cindex C++ options, command-line
2158 @cindex options, C++
2159 This section describes the command-line options that are only meaningful
2160 for C++ programs. You can also use most of the GNU compiler options
2161 regardless of what language your program is in. For example, you
2162 might compile a file @file{firstClass.C} like this:
2163
2164 @smallexample
2165 g++ -g -fstrict-enums -O -c firstClass.C
2166 @end smallexample
2167
2168 @noindent
2169 In this example, only @option{-fstrict-enums} is an option meant
2170 only for C++ programs; you can use the other options with any
2171 language supported by GCC@.
2172
2173 Some options for compiling C programs, such as @option{-std}, are also
2174 relevant for C++ programs.
2175 @xref{C Dialect Options,,Options Controlling C Dialect}.
2176
2177 Here is a list of options that are @emph{only} for compiling C++ programs:
2178
2179 @table @gcctabopt
2180
2181 @item -fabi-version=@var{n}
2182 @opindex fabi-version
2183 Use version @var{n} of the C++ ABI@. The default is version 0.
2184
2185 Version 0 refers to the version conforming most closely to
2186 the C++ ABI specification. Therefore, the ABI obtained using version 0
2187 will change in different versions of G++ as ABI bugs are fixed.
2188
2189 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2190
2191 Version 2 is the version of the C++ ABI that first appeared in G++
2192 3.4, and was the default through G++ 4.9.
2193
2194 Version 3 corrects an error in mangling a constant address as a
2195 template argument.
2196
2197 Version 4, which first appeared in G++ 4.5, implements a standard
2198 mangling for vector types.
2199
2200 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2201 attribute const/volatile on function pointer types, decltype of a
2202 plain decl, and use of a function parameter in the declaration of
2203 another parameter.
2204
2205 Version 6, which first appeared in G++ 4.7, corrects the promotion
2206 behavior of C++11 scoped enums and the mangling of template argument
2207 packs, const/static_cast, prefix ++ and --, and a class scope function
2208 used as a template argument.
2209
2210 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2211 builtin type and corrects the mangling of lambdas in default argument
2212 scope.
2213
2214 Version 8, which first appeared in G++ 4.9, corrects the substitution
2215 behavior of function types with function-cv-qualifiers.
2216
2217 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2218 @code{nullptr_t}.
2219
2220 Version 10, which first appeared in G++ 6.1, adds mangling of
2221 attributes that affect type identity, such as ia32 calling convention
2222 attributes (e.g. @samp{stdcall}).
2223
2224 Version 11, which first appeared in G++ 7, corrects the mangling of
2225 sizeof... expressions. It also implies
2226 @option{-fnew-inheriting-ctors}.
2227
2228 See also @option{-Wabi}.
2229
2230 @item -fabi-compat-version=@var{n}
2231 @opindex fabi-compat-version
2232 On targets that support strong aliases, G++
2233 works around mangling changes by creating an alias with the correct
2234 mangled name when defining a symbol with an incorrect mangled name.
2235 This switch specifies which ABI version to use for the alias.
2236
2237 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2238 compatibility). If another ABI version is explicitly selected, this
2239 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2240 use @option{-fabi-compat-version=2}.
2241
2242 If this option is not provided but @option{-Wabi=@var{n}} is, that
2243 version is used for compatibility aliases. If this option is provided
2244 along with @option{-Wabi} (without the version), the version from this
2245 option is used for the warning.
2246
2247 @item -fno-access-control
2248 @opindex fno-access-control
2249 Turn off all access checking. This switch is mainly useful for working
2250 around bugs in the access control code.
2251
2252 @item -faligned-new
2253 @opindex faligned-new
2254 Enable support for C++17 @code{new} of types that require more
2255 alignment than @code{void* ::operator new(std::size_t)} provides. A
2256 numeric argument such as @code{-faligned-new=32} can be used to
2257 specify how much alignment (in bytes) is provided by that function,
2258 but few users will need to override the default of
2259 @code{alignof(std::max_align_t)}.
2260
2261 @item -fcheck-new
2262 @opindex fcheck-new
2263 Check that the pointer returned by @code{operator new} is non-null
2264 before attempting to modify the storage allocated. This check is
2265 normally unnecessary because the C++ standard specifies that
2266 @code{operator new} only returns @code{0} if it is declared
2267 @code{throw()}, in which case the compiler always checks the
2268 return value even without this option. In all other cases, when
2269 @code{operator new} has a non-empty exception specification, memory
2270 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2271 @samp{new (nothrow)}.
2272
2273 @item -fconcepts
2274 @opindex fconcepts
2275 Enable support for the C++ Extensions for Concepts Technical
2276 Specification, ISO 19217 (2015), which allows code like
2277
2278 @smallexample
2279 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2280 template <Addable T> T add (T a, T b) @{ return a + b; @}
2281 @end smallexample
2282
2283 @item -fconstexpr-depth=@var{n}
2284 @opindex fconstexpr-depth
2285 Set the maximum nested evaluation depth for C++11 constexpr functions
2286 to @var{n}. A limit is needed to detect endless recursion during
2287 constant expression evaluation. The minimum specified by the standard
2288 is 512.
2289
2290 @item -fconstexpr-loop-limit=@var{n}
2291 @opindex fconstexpr-loop-limit
2292 Set the maximum number of iterations for a loop in C++14 constexpr functions
2293 to @var{n}. A limit is needed to detect infinite loops during
2294 constant expression evaluation. The default is 262144 (1<<18).
2295
2296 @item -fdeduce-init-list
2297 @opindex fdeduce-init-list
2298 Enable deduction of a template type parameter as
2299 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2300
2301 @smallexample
2302 template <class T> auto forward(T t) -> decltype (realfn (t))
2303 @{
2304 return realfn (t);
2305 @}
2306
2307 void f()
2308 @{
2309 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2310 @}
2311 @end smallexample
2312
2313 This deduction was implemented as a possible extension to the
2314 originally proposed semantics for the C++11 standard, but was not part
2315 of the final standard, so it is disabled by default. This option is
2316 deprecated, and may be removed in a future version of G++.
2317
2318 @item -ffriend-injection
2319 @opindex ffriend-injection
2320 Inject friend functions into the enclosing namespace, so that they are
2321 visible outside the scope of the class in which they are declared.
2322 Friend functions were documented to work this way in the old Annotated
2323 C++ Reference Manual.
2324 However, in ISO C++ a friend function that is not declared
2325 in an enclosing scope can only be found using argument dependent
2326 lookup. GCC defaults to the standard behavior.
2327
2328 This option is for compatibility, and may be removed in a future
2329 release of G++.
2330
2331 @item -fno-elide-constructors
2332 @opindex fno-elide-constructors
2333 The C++ standard allows an implementation to omit creating a temporary
2334 that is only used to initialize another object of the same type.
2335 Specifying this option disables that optimization, and forces G++ to
2336 call the copy constructor in all cases. This option also causes G++
2337 to call trivial member functions which otherwise would be expanded inline.
2338
2339 In C++17, the compiler is required to omit these temporaries, but this
2340 option still affects trivial member functions.
2341
2342 @item -fno-enforce-eh-specs
2343 @opindex fno-enforce-eh-specs
2344 Don't generate code to check for violation of exception specifications
2345 at run time. This option violates the C++ standard, but may be useful
2346 for reducing code size in production builds, much like defining
2347 @code{NDEBUG}. This does not give user code permission to throw
2348 exceptions in violation of the exception specifications; the compiler
2349 still optimizes based on the specifications, so throwing an
2350 unexpected exception results in undefined behavior at run time.
2351
2352 @item -fextern-tls-init
2353 @itemx -fno-extern-tls-init
2354 @opindex fextern-tls-init
2355 @opindex fno-extern-tls-init
2356 The C++11 and OpenMP standards allow @code{thread_local} and
2357 @code{threadprivate} variables to have dynamic (runtime)
2358 initialization. To support this, any use of such a variable goes
2359 through a wrapper function that performs any necessary initialization.
2360 When the use and definition of the variable are in the same
2361 translation unit, this overhead can be optimized away, but when the
2362 use is in a different translation unit there is significant overhead
2363 even if the variable doesn't actually need dynamic initialization. If
2364 the programmer can be sure that no use of the variable in a
2365 non-defining TU needs to trigger dynamic initialization (either
2366 because the variable is statically initialized, or a use of the
2367 variable in the defining TU will be executed before any uses in
2368 another TU), they can avoid this overhead with the
2369 @option{-fno-extern-tls-init} option.
2370
2371 On targets that support symbol aliases, the default is
2372 @option{-fextern-tls-init}. On targets that do not support symbol
2373 aliases, the default is @option{-fno-extern-tls-init}.
2374
2375 @item -ffor-scope
2376 @itemx -fno-for-scope
2377 @opindex ffor-scope
2378 @opindex fno-for-scope
2379 If @option{-ffor-scope} is specified, the scope of variables declared in
2380 a @i{for-init-statement} is limited to the @code{for} loop itself,
2381 as specified by the C++ standard.
2382 If @option{-fno-for-scope} is specified, the scope of variables declared in
2383 a @i{for-init-statement} extends to the end of the enclosing scope,
2384 as was the case in old versions of G++, and other (traditional)
2385 implementations of C++.
2386
2387 If neither flag is given, the default is to follow the standard,
2388 but to allow and give a warning for old-style code that would
2389 otherwise be invalid, or have different behavior.
2390
2391 @item -fno-gnu-keywords
2392 @opindex fno-gnu-keywords
2393 Do not recognize @code{typeof} as a keyword, so that code can use this
2394 word as an identifier. You can use the keyword @code{__typeof__} instead.
2395 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2396 @option{-std=c++98}, @option{-std=c++11}, etc.
2397
2398 @item -fno-implicit-templates
2399 @opindex fno-implicit-templates
2400 Never emit code for non-inline templates that are instantiated
2401 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2402 @xref{Template Instantiation}, for more information.
2403
2404 @item -fno-implicit-inline-templates
2405 @opindex fno-implicit-inline-templates
2406 Don't emit code for implicit instantiations of inline templates, either.
2407 The default is to handle inlines differently so that compiles with and
2408 without optimization need the same set of explicit instantiations.
2409
2410 @item -fno-implement-inlines
2411 @opindex fno-implement-inlines
2412 To save space, do not emit out-of-line copies of inline functions
2413 controlled by @code{#pragma implementation}. This causes linker
2414 errors if these functions are not inlined everywhere they are called.
2415
2416 @item -fms-extensions
2417 @opindex fms-extensions
2418 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2419 int and getting a pointer to member function via non-standard syntax.
2420
2421 @item -fnew-inheriting-ctors
2422 @opindex fnew-inheriting-ctors
2423 Enable the P0136 adjustment to the semantics of C++11 constructor
2424 inheritance. This is part of C++17 but also considered to be a Defect
2425 Report against C++11 and C++14. This flag is enabled by default
2426 unless @option{-fabi-version=10} or lower is specified.
2427
2428 @item -fno-nonansi-builtins
2429 @opindex fno-nonansi-builtins
2430 Disable built-in declarations of functions that are not mandated by
2431 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2432 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2433
2434 @item -fnothrow-opt
2435 @opindex fnothrow-opt
2436 Treat a @code{throw()} exception specification as if it were a
2437 @code{noexcept} specification to reduce or eliminate the text size
2438 overhead relative to a function with no exception specification. If
2439 the function has local variables of types with non-trivial
2440 destructors, the exception specification actually makes the
2441 function smaller because the EH cleanups for those variables can be
2442 optimized away. The semantic effect is that an exception thrown out of
2443 a function with such an exception specification results in a call
2444 to @code{terminate} rather than @code{unexpected}.
2445
2446 @item -fno-operator-names
2447 @opindex fno-operator-names
2448 Do not treat the operator name keywords @code{and}, @code{bitand},
2449 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2450 synonyms as keywords.
2451
2452 @item -fno-optional-diags
2453 @opindex fno-optional-diags
2454 Disable diagnostics that the standard says a compiler does not need to
2455 issue. Currently, the only such diagnostic issued by G++ is the one for
2456 a name having multiple meanings within a class.
2457
2458 @item -fpermissive
2459 @opindex fpermissive
2460 Downgrade some diagnostics about nonconformant code from errors to
2461 warnings. Thus, using @option{-fpermissive} allows some
2462 nonconforming code to compile.
2463
2464 @item -fno-pretty-templates
2465 @opindex fno-pretty-templates
2466 When an error message refers to a specialization of a function
2467 template, the compiler normally prints the signature of the
2468 template followed by the template arguments and any typedefs or
2469 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2470 rather than @code{void f(int)}) so that it's clear which template is
2471 involved. When an error message refers to a specialization of a class
2472 template, the compiler omits any template arguments that match
2473 the default template arguments for that template. If either of these
2474 behaviors make it harder to understand the error message rather than
2475 easier, you can use @option{-fno-pretty-templates} to disable them.
2476
2477 @item -frepo
2478 @opindex frepo
2479 Enable automatic template instantiation at link time. This option also
2480 implies @option{-fno-implicit-templates}. @xref{Template
2481 Instantiation}, for more information.
2482
2483 @item -fno-rtti
2484 @opindex fno-rtti
2485 Disable generation of information about every class with virtual
2486 functions for use by the C++ run-time type identification features
2487 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2488 of the language, you can save some space by using this flag. Note that
2489 exception handling uses the same information, but G++ generates it as
2490 needed. The @code{dynamic_cast} operator can still be used for casts that
2491 do not require run-time type information, i.e.@: casts to @code{void *} or to
2492 unambiguous base classes.
2493
2494 @item -fsized-deallocation
2495 @opindex fsized-deallocation
2496 Enable the built-in global declarations
2497 @smallexample
2498 void operator delete (void *, std::size_t) noexcept;
2499 void operator delete[] (void *, std::size_t) noexcept;
2500 @end smallexample
2501 as introduced in C++14. This is useful for user-defined replacement
2502 deallocation functions that, for example, use the size of the object
2503 to make deallocation faster. Enabled by default under
2504 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2505 warns about places that might want to add a definition.
2506
2507 @item -fstrict-enums
2508 @opindex fstrict-enums
2509 Allow the compiler to optimize using the assumption that a value of
2510 enumerated type can only be one of the values of the enumeration (as
2511 defined in the C++ standard; basically, a value that can be
2512 represented in the minimum number of bits needed to represent all the
2513 enumerators). This assumption may not be valid if the program uses a
2514 cast to convert an arbitrary integer value to the enumerated type.
2515
2516 @item -fstrong-eval-order
2517 @opindex fstrong-eval-order
2518 Evaluate member access, array subscripting, and shift expressions in
2519 left-to-right order, and evaluate assignment in right-to-left order,
2520 as adopted for C++17. Enabled by default with @option{-std=c++1z}.
2521 @option{-fstrong-eval-order=some} enables just the ordering of member
2522 access and shift expressions, and is the default without
2523 @option{-std=c++1z}.
2524
2525 @item -ftemplate-backtrace-limit=@var{n}
2526 @opindex ftemplate-backtrace-limit
2527 Set the maximum number of template instantiation notes for a single
2528 warning or error to @var{n}. The default value is 10.
2529
2530 @item -ftemplate-depth=@var{n}
2531 @opindex ftemplate-depth
2532 Set the maximum instantiation depth for template classes to @var{n}.
2533 A limit on the template instantiation depth is needed to detect
2534 endless recursions during template class instantiation. ANSI/ISO C++
2535 conforming programs must not rely on a maximum depth greater than 17
2536 (changed to 1024 in C++11). The default value is 900, as the compiler
2537 can run out of stack space before hitting 1024 in some situations.
2538
2539 @item -fno-threadsafe-statics
2540 @opindex fno-threadsafe-statics
2541 Do not emit the extra code to use the routines specified in the C++
2542 ABI for thread-safe initialization of local statics. You can use this
2543 option to reduce code size slightly in code that doesn't need to be
2544 thread-safe.
2545
2546 @item -fuse-cxa-atexit
2547 @opindex fuse-cxa-atexit
2548 Register destructors for objects with static storage duration with the
2549 @code{__cxa_atexit} function rather than the @code{atexit} function.
2550 This option is required for fully standards-compliant handling of static
2551 destructors, but only works if your C library supports
2552 @code{__cxa_atexit}.
2553
2554 @item -fno-use-cxa-get-exception-ptr
2555 @opindex fno-use-cxa-get-exception-ptr
2556 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2557 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2558 if the runtime routine is not available.
2559
2560 @item -fvisibility-inlines-hidden
2561 @opindex fvisibility-inlines-hidden
2562 This switch declares that the user does not attempt to compare
2563 pointers to inline functions or methods where the addresses of the two functions
2564 are taken in different shared objects.
2565
2566 The effect of this is that GCC may, effectively, mark inline methods with
2567 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2568 appear in the export table of a DSO and do not require a PLT indirection
2569 when used within the DSO@. Enabling this option can have a dramatic effect
2570 on load and link times of a DSO as it massively reduces the size of the
2571 dynamic export table when the library makes heavy use of templates.
2572
2573 The behavior of this switch is not quite the same as marking the
2574 methods as hidden directly, because it does not affect static variables
2575 local to the function or cause the compiler to deduce that
2576 the function is defined in only one shared object.
2577
2578 You may mark a method as having a visibility explicitly to negate the
2579 effect of the switch for that method. For example, if you do want to
2580 compare pointers to a particular inline method, you might mark it as
2581 having default visibility. Marking the enclosing class with explicit
2582 visibility has no effect.
2583
2584 Explicitly instantiated inline methods are unaffected by this option
2585 as their linkage might otherwise cross a shared library boundary.
2586 @xref{Template Instantiation}.
2587
2588 @item -fvisibility-ms-compat
2589 @opindex fvisibility-ms-compat
2590 This flag attempts to use visibility settings to make GCC's C++
2591 linkage model compatible with that of Microsoft Visual Studio.
2592
2593 The flag makes these changes to GCC's linkage model:
2594
2595 @enumerate
2596 @item
2597 It sets the default visibility to @code{hidden}, like
2598 @option{-fvisibility=hidden}.
2599
2600 @item
2601 Types, but not their members, are not hidden by default.
2602
2603 @item
2604 The One Definition Rule is relaxed for types without explicit
2605 visibility specifications that are defined in more than one
2606 shared object: those declarations are permitted if they are
2607 permitted when this option is not used.
2608 @end enumerate
2609
2610 In new code it is better to use @option{-fvisibility=hidden} and
2611 export those classes that are intended to be externally visible.
2612 Unfortunately it is possible for code to rely, perhaps accidentally,
2613 on the Visual Studio behavior.
2614
2615 Among the consequences of these changes are that static data members
2616 of the same type with the same name but defined in different shared
2617 objects are different, so changing one does not change the other;
2618 and that pointers to function members defined in different shared
2619 objects may not compare equal. When this flag is given, it is a
2620 violation of the ODR to define types with the same name differently.
2621
2622 @item -fno-weak
2623 @opindex fno-weak
2624 Do not use weak symbol support, even if it is provided by the linker.
2625 By default, G++ uses weak symbols if they are available. This
2626 option exists only for testing, and should not be used by end-users;
2627 it results in inferior code and has no benefits. This option may
2628 be removed in a future release of G++.
2629
2630 @item -nostdinc++
2631 @opindex nostdinc++
2632 Do not search for header files in the standard directories specific to
2633 C++, but do still search the other standard directories. (This option
2634 is used when building the C++ library.)
2635 @end table
2636
2637 In addition, these optimization, warning, and code generation options
2638 have meanings only for C++ programs:
2639
2640 @table @gcctabopt
2641 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2642 @opindex Wabi
2643 @opindex Wno-abi
2644 Warn when G++ it generates code that is probably not compatible with
2645 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2646 ABI with each major release, normally @option{-Wabi} will warn only if
2647 there is a check added later in a release series for an ABI issue
2648 discovered since the initial release. @option{-Wabi} will warn about
2649 more things if an older ABI version is selected (with
2650 @option{-fabi-version=@var{n}}).
2651
2652 @option{-Wabi} can also be used with an explicit version number to
2653 warn about compatibility with a particular @option{-fabi-version}
2654 level, e.g. @option{-Wabi=2} to warn about changes relative to
2655 @option{-fabi-version=2}.
2656
2657 If an explicit version number is provided and
2658 @option{-fabi-compat-version} is not specified, the version number
2659 from this option is used for compatibility aliases. If no explicit
2660 version number is provided with this option, but
2661 @option{-fabi-compat-version} is specified, that version number is
2662 used for ABI warnings.
2663
2664 Although an effort has been made to warn about
2665 all such cases, there are probably some cases that are not warned about,
2666 even though G++ is generating incompatible code. There may also be
2667 cases where warnings are emitted even though the code that is generated
2668 is compatible.
2669
2670 You should rewrite your code to avoid these warnings if you are
2671 concerned about the fact that code generated by G++ may not be binary
2672 compatible with code generated by other compilers.
2673
2674 Known incompatibilities in @option{-fabi-version=2} (which was the
2675 default from GCC 3.4 to 4.9) include:
2676
2677 @itemize @bullet
2678
2679 @item
2680 A template with a non-type template parameter of reference type was
2681 mangled incorrectly:
2682 @smallexample
2683 extern int N;
2684 template <int &> struct S @{@};
2685 void n (S<N>) @{2@}
2686 @end smallexample
2687
2688 This was fixed in @option{-fabi-version=3}.
2689
2690 @item
2691 SIMD vector types declared using @code{__attribute ((vector_size))} were
2692 mangled in a non-standard way that does not allow for overloading of
2693 functions taking vectors of different sizes.
2694
2695 The mangling was changed in @option{-fabi-version=4}.
2696
2697 @item
2698 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2699 qualifiers, and @code{decltype} of a plain declaration was folded away.
2700
2701 These mangling issues were fixed in @option{-fabi-version=5}.
2702
2703 @item
2704 Scoped enumerators passed as arguments to a variadic function are
2705 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2706 On most targets this does not actually affect the parameter passing
2707 ABI, as there is no way to pass an argument smaller than @code{int}.
2708
2709 Also, the ABI changed the mangling of template argument packs,
2710 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2711 a class scope function used as a template argument.
2712
2713 These issues were corrected in @option{-fabi-version=6}.
2714
2715 @item
2716 Lambdas in default argument scope were mangled incorrectly, and the
2717 ABI changed the mangling of @code{nullptr_t}.
2718
2719 These issues were corrected in @option{-fabi-version=7}.
2720
2721 @item
2722 When mangling a function type with function-cv-qualifiers, the
2723 un-qualified function type was incorrectly treated as a substitution
2724 candidate.
2725
2726 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2727
2728 @item
2729 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2730 unaligned accesses. Note that this did not affect the ABI of a
2731 function with a @code{nullptr_t} parameter, as parameters have a
2732 minimum alignment.
2733
2734 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2735
2736 @item
2737 Target-specific attributes that affect the identity of a type, such as
2738 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2739 did not affect the mangled name, leading to name collisions when
2740 function pointers were used as template arguments.
2741
2742 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2743
2744 @end itemize
2745
2746 It also warns about psABI-related changes. The known psABI changes at this
2747 point include:
2748
2749 @itemize @bullet
2750
2751 @item
2752 For SysV/x86-64, unions with @code{long double} members are
2753 passed in memory as specified in psABI. For example:
2754
2755 @smallexample
2756 union U @{
2757 long double ld;
2758 int i;
2759 @};
2760 @end smallexample
2761
2762 @noindent
2763 @code{union U} is always passed in memory.
2764
2765 @end itemize
2766
2767 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2768 @opindex Wabi-tag
2769 @opindex -Wabi-tag
2770 Warn when a type with an ABI tag is used in a context that does not
2771 have that ABI tag. See @ref{C++ Attributes} for more information
2772 about ABI tags.
2773
2774 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2775 @opindex Wctor-dtor-privacy
2776 @opindex Wno-ctor-dtor-privacy
2777 Warn when a class seems unusable because all the constructors or
2778 destructors in that class are private, and it has neither friends nor
2779 public static member functions. Also warn if there are no non-private
2780 methods, and there's at least one private member function that isn't
2781 a constructor or destructor.
2782
2783 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2784 @opindex Wdelete-non-virtual-dtor
2785 @opindex Wno-delete-non-virtual-dtor
2786 Warn when @code{delete} is used to destroy an instance of a class that
2787 has virtual functions and non-virtual destructor. It is unsafe to delete
2788 an instance of a derived class through a pointer to a base class if the
2789 base class does not have a virtual destructor. This warning is enabled
2790 by @option{-Wall}.
2791
2792 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2793 @opindex Wliteral-suffix
2794 @opindex Wno-literal-suffix
2795 Warn when a string or character literal is followed by a ud-suffix which does
2796 not begin with an underscore. As a conforming extension, GCC treats such
2797 suffixes as separate preprocessing tokens in order to maintain backwards
2798 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2799 For example:
2800
2801 @smallexample
2802 #define __STDC_FORMAT_MACROS
2803 #include <inttypes.h>
2804 #include <stdio.h>
2805
2806 int main() @{
2807 int64_t i64 = 123;
2808 printf("My int64: %" PRId64"\n", i64);
2809 @}
2810 @end smallexample
2811
2812 In this case, @code{PRId64} is treated as a separate preprocessing token.
2813
2814 This warning is enabled by default.
2815
2816 @item -Wlto-type-mismatch
2817 @opindex Wlto-type-mismatch
2818 @opindex Wno-lto-type-mismatch
2819
2820 During the link-time optimization warn about type mismatches in
2821 global declarations from different compilation units.
2822 Requires @option{-flto} to be enabled. Enabled by default.
2823
2824 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2825 @opindex Wnarrowing
2826 @opindex Wno-narrowing
2827 With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing
2828 conversion prohibited by C++11 occurs within
2829 @samp{@{ @}}, e.g.
2830
2831 @smallexample
2832 int i = @{ 2.2 @}; // error: narrowing from double to int
2833 @end smallexample
2834
2835 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2836
2837 When a later standard is in effect, e.g. when using @option{-std=c++11},
2838 narrowing conversions are diagnosed by default, as required by the standard.
2839 A narrowing conversion from a constant produces an error,
2840 and a narrowing conversion from a non-constant produces a warning,
2841 but @option{-Wno-narrowing} suppresses the diagnostic.
2842 Note that this does not affect the meaning of well-formed code;
2843 narrowing conversions are still considered ill-formed in SFINAE contexts.
2844
2845 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2846 @opindex Wnoexcept
2847 @opindex Wno-noexcept
2848 Warn when a noexcept-expression evaluates to false because of a call
2849 to a function that does not have a non-throwing exception
2850 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2851 the compiler to never throw an exception.
2852
2853 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2854 @opindex Wnon-virtual-dtor
2855 @opindex Wno-non-virtual-dtor
2856 Warn when a class has virtual functions and an accessible non-virtual
2857 destructor itself or in an accessible polymorphic base class, in which
2858 case it is possible but unsafe to delete an instance of a derived
2859 class through a pointer to the class itself or base class. This
2860 warning is automatically enabled if @option{-Weffc++} is specified.
2861
2862 @item -Wregister @r{(C++ and Objective-C++ only)}
2863 @opindex Wregister
2864 @opindex Wno-register
2865 Warn on uses of the @code{register} storage class specifier, except
2866 when it is part of the GNU @ref{Explicit Register Variables} extension.
2867 The use of the @code{register} keyword as storage class specifier has
2868 been deprecated in C++11 and removed in C++17.
2869 Enabled by default with @option{-std=c++1z}.
2870
2871 @item -Wreorder @r{(C++ and Objective-C++ only)}
2872 @opindex Wreorder
2873 @opindex Wno-reorder
2874 @cindex reordering, warning
2875 @cindex warning for reordering of member initializers
2876 Warn when the order of member initializers given in the code does not
2877 match the order in which they must be executed. For instance:
2878
2879 @smallexample
2880 struct A @{
2881 int i;
2882 int j;
2883 A(): j (0), i (1) @{ @}
2884 @};
2885 @end smallexample
2886
2887 @noindent
2888 The compiler rearranges the member initializers for @code{i}
2889 and @code{j} to match the declaration order of the members, emitting
2890 a warning to that effect. This warning is enabled by @option{-Wall}.
2891
2892 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2893 @opindex fext-numeric-literals
2894 @opindex fno-ext-numeric-literals
2895 Accept imaginary, fixed-point, or machine-defined
2896 literal number suffixes as GNU extensions.
2897 When this option is turned off these suffixes are treated
2898 as C++11 user-defined literal numeric suffixes.
2899 This is on by default for all pre-C++11 dialects and all GNU dialects:
2900 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2901 @option{-std=gnu++14}.
2902 This option is off by default
2903 for ISO C++11 onwards (@option{-std=c++11}, ...).
2904 @end table
2905
2906 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2907
2908 @table @gcctabopt
2909 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2910 @opindex Weffc++
2911 @opindex Wno-effc++
2912 Warn about violations of the following style guidelines from Scott Meyers'
2913 @cite{Effective C++} series of books:
2914
2915 @itemize @bullet
2916 @item
2917 Define a copy constructor and an assignment operator for classes
2918 with dynamically-allocated memory.
2919
2920 @item
2921 Prefer initialization to assignment in constructors.
2922
2923 @item
2924 Have @code{operator=} return a reference to @code{*this}.
2925
2926 @item
2927 Don't try to return a reference when you must return an object.
2928
2929 @item
2930 Distinguish between prefix and postfix forms of increment and
2931 decrement operators.
2932
2933 @item
2934 Never overload @code{&&}, @code{||}, or @code{,}.
2935
2936 @end itemize
2937
2938 This option also enables @option{-Wnon-virtual-dtor}, which is also
2939 one of the effective C++ recommendations. However, the check is
2940 extended to warn about the lack of virtual destructor in accessible
2941 non-polymorphic bases classes too.
2942
2943 When selecting this option, be aware that the standard library
2944 headers do not obey all of these guidelines; use @samp{grep -v}
2945 to filter out those warnings.
2946
2947 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2948 @opindex Wstrict-null-sentinel
2949 @opindex Wno-strict-null-sentinel
2950 Warn about the use of an uncasted @code{NULL} as sentinel. When
2951 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2952 to @code{__null}. Although it is a null pointer constant rather than a
2953 null pointer, it is guaranteed to be of the same size as a pointer.
2954 But this use is not portable across different compilers.
2955
2956 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2957 @opindex Wno-non-template-friend
2958 @opindex Wnon-template-friend
2959 Disable warnings when non-templatized friend functions are declared
2960 within a template. Since the advent of explicit template specification
2961 support in G++, if the name of the friend is an unqualified-id (i.e.,
2962 @samp{friend foo(int)}), the C++ language specification demands that the
2963 friend declare or define an ordinary, nontemplate function. (Section
2964 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2965 could be interpreted as a particular specialization of a templatized
2966 function. Because this non-conforming behavior is no longer the default
2967 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2968 check existing code for potential trouble spots and is on by default.
2969 This new compiler behavior can be turned off with
2970 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2971 but disables the helpful warning.
2972
2973 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2974 @opindex Wold-style-cast
2975 @opindex Wno-old-style-cast
2976 Warn if an old-style (C-style) cast to a non-void type is used within
2977 a C++ program. The new-style casts (@code{dynamic_cast},
2978 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
2979 less vulnerable to unintended effects and much easier to search for.
2980
2981 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2982 @opindex Woverloaded-virtual
2983 @opindex Wno-overloaded-virtual
2984 @cindex overloaded virtual function, warning
2985 @cindex warning for overloaded virtual function
2986 Warn when a function declaration hides virtual functions from a
2987 base class. For example, in:
2988
2989 @smallexample
2990 struct A @{
2991 virtual void f();
2992 @};
2993
2994 struct B: public A @{
2995 void f(int);
2996 @};
2997 @end smallexample
2998
2999 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3000 like:
3001
3002 @smallexample
3003 B* b;
3004 b->f();
3005 @end smallexample
3006
3007 @noindent
3008 fails to compile.
3009
3010 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3011 @opindex Wno-pmf-conversions
3012 @opindex Wpmf-conversions
3013 Disable the diagnostic for converting a bound pointer to member function
3014 to a plain pointer.
3015
3016 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3017 @opindex Wsign-promo
3018 @opindex Wno-sign-promo
3019 Warn when overload resolution chooses a promotion from unsigned or
3020 enumerated type to a signed type, over a conversion to an unsigned type of
3021 the same size. Previous versions of G++ tried to preserve
3022 unsignedness, but the standard mandates the current behavior.
3023
3024 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3025 @opindex Wtemplates
3026 Warn when a primary template declaration is encountered. Some coding
3027 rules disallow templates, and this may be used to enforce that rule.
3028 The warning is inactive inside a system header file, such as the STL, so
3029 one can still use the STL. One may also instantiate or specialize
3030 templates.
3031
3032 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3033 @opindex Wmultiple-inheritance
3034 Warn when a class is defined with multiple direct base classes. Some
3035 coding rules disallow multiple inheritance, and this may be used to
3036 enforce that rule. The warning is inactive inside a system header file,
3037 such as the STL, so one can still use the STL. One may also define
3038 classes that indirectly use multiple inheritance.
3039
3040 @item -Wvirtual-inheritance
3041 @opindex Wvirtual-inheritance
3042 Warn when a class is defined with a virtual direct base classe. Some
3043 coding rules disallow multiple inheritance, and this may be used to
3044 enforce that rule. The warning is inactive inside a system header file,
3045 such as the STL, so one can still use the STL. One may also define
3046 classes that indirectly use virtual inheritance.
3047
3048 @item -Wnamespaces
3049 @opindex Wnamespaces
3050 Warn when a namespace definition is opened. Some coding rules disallow
3051 namespaces, and this may be used to enforce that rule. The warning is
3052 inactive inside a system header file, such as the STL, so one can still
3053 use the STL. One may also use using directives and qualified names.
3054
3055 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3056 @opindex Wterminate
3057 @opindex Wno-terminate
3058 Disable the warning about a throw-expression that will immediately
3059 result in a call to @code{terminate}.
3060 @end table
3061
3062 @node Objective-C and Objective-C++ Dialect Options
3063 @section Options Controlling Objective-C and Objective-C++ Dialects
3064
3065 @cindex compiler options, Objective-C and Objective-C++
3066 @cindex Objective-C and Objective-C++ options, command-line
3067 @cindex options, Objective-C and Objective-C++
3068 (NOTE: This manual does not describe the Objective-C and Objective-C++
3069 languages themselves. @xref{Standards,,Language Standards
3070 Supported by GCC}, for references.)
3071
3072 This section describes the command-line options that are only meaningful
3073 for Objective-C and Objective-C++ programs. You can also use most of
3074 the language-independent GNU compiler options.
3075 For example, you might compile a file @file{some_class.m} like this:
3076
3077 @smallexample
3078 gcc -g -fgnu-runtime -O -c some_class.m
3079 @end smallexample
3080
3081 @noindent
3082 In this example, @option{-fgnu-runtime} is an option meant only for
3083 Objective-C and Objective-C++ programs; you can use the other options with
3084 any language supported by GCC@.
3085
3086 Note that since Objective-C is an extension of the C language, Objective-C
3087 compilations may also use options specific to the C front-end (e.g.,
3088 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3089 C++-specific options (e.g., @option{-Wabi}).
3090
3091 Here is a list of options that are @emph{only} for compiling Objective-C
3092 and Objective-C++ programs:
3093
3094 @table @gcctabopt
3095 @item -fconstant-string-class=@var{class-name}
3096 @opindex fconstant-string-class
3097 Use @var{class-name} as the name of the class to instantiate for each
3098 literal string specified with the syntax @code{@@"@dots{}"}. The default
3099 class name is @code{NXConstantString} if the GNU runtime is being used, and
3100 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3101 @option{-fconstant-cfstrings} option, if also present, overrides the
3102 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3103 to be laid out as constant CoreFoundation strings.
3104
3105 @item -fgnu-runtime
3106 @opindex fgnu-runtime
3107 Generate object code compatible with the standard GNU Objective-C
3108 runtime. This is the default for most types of systems.
3109
3110 @item -fnext-runtime
3111 @opindex fnext-runtime
3112 Generate output compatible with the NeXT runtime. This is the default
3113 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3114 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3115 used.
3116
3117 @item -fno-nil-receivers
3118 @opindex fno-nil-receivers
3119 Assume that all Objective-C message dispatches (@code{[receiver
3120 message:arg]}) in this translation unit ensure that the receiver is
3121 not @code{nil}. This allows for more efficient entry points in the
3122 runtime to be used. This option is only available in conjunction with
3123 the NeXT runtime and ABI version 0 or 1.
3124
3125 @item -fobjc-abi-version=@var{n}
3126 @opindex fobjc-abi-version
3127 Use version @var{n} of the Objective-C ABI for the selected runtime.
3128 This option is currently supported only for the NeXT runtime. In that
3129 case, Version 0 is the traditional (32-bit) ABI without support for
3130 properties and other Objective-C 2.0 additions. Version 1 is the
3131 traditional (32-bit) ABI with support for properties and other
3132 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3133 nothing is specified, the default is Version 0 on 32-bit target
3134 machines, and Version 2 on 64-bit target machines.
3135
3136 @item -fobjc-call-cxx-cdtors
3137 @opindex fobjc-call-cxx-cdtors
3138 For each Objective-C class, check if any of its instance variables is a
3139 C++ object with a non-trivial default constructor. If so, synthesize a
3140 special @code{- (id) .cxx_construct} instance method which runs
3141 non-trivial default constructors on any such instance variables, in order,
3142 and then return @code{self}. Similarly, check if any instance variable
3143 is a C++ object with a non-trivial destructor, and if so, synthesize a
3144 special @code{- (void) .cxx_destruct} method which runs
3145 all such default destructors, in reverse order.
3146
3147 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3148 methods thusly generated only operate on instance variables
3149 declared in the current Objective-C class, and not those inherited
3150 from superclasses. It is the responsibility of the Objective-C
3151 runtime to invoke all such methods in an object's inheritance
3152 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3153 by the runtime immediately after a new object instance is allocated;
3154 the @code{- (void) .cxx_destruct} methods are invoked immediately
3155 before the runtime deallocates an object instance.
3156
3157 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3158 support for invoking the @code{- (id) .cxx_construct} and
3159 @code{- (void) .cxx_destruct} methods.
3160
3161 @item -fobjc-direct-dispatch
3162 @opindex fobjc-direct-dispatch
3163 Allow fast jumps to the message dispatcher. On Darwin this is
3164 accomplished via the comm page.
3165
3166 @item -fobjc-exceptions
3167 @opindex fobjc-exceptions
3168 Enable syntactic support for structured exception handling in
3169 Objective-C, similar to what is offered by C++ and Java. This option
3170 is required to use the Objective-C keywords @code{@@try},
3171 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3172 @code{@@synchronized}. This option is available with both the GNU
3173 runtime and the NeXT runtime (but not available in conjunction with
3174 the NeXT runtime on Mac OS X 10.2 and earlier).
3175
3176 @item -fobjc-gc
3177 @opindex fobjc-gc
3178 Enable garbage collection (GC) in Objective-C and Objective-C++
3179 programs. This option is only available with the NeXT runtime; the
3180 GNU runtime has a different garbage collection implementation that
3181 does not require special compiler flags.
3182
3183 @item -fobjc-nilcheck
3184 @opindex fobjc-nilcheck
3185 For the NeXT runtime with version 2 of the ABI, check for a nil
3186 receiver in method invocations before doing the actual method call.
3187 This is the default and can be disabled using
3188 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3189 checked for nil in this way no matter what this flag is set to.
3190 Currently this flag does nothing when the GNU runtime, or an older
3191 version of the NeXT runtime ABI, is used.
3192
3193 @item -fobjc-std=objc1
3194 @opindex fobjc-std
3195 Conform to the language syntax of Objective-C 1.0, the language
3196 recognized by GCC 4.0. This only affects the Objective-C additions to
3197 the C/C++ language; it does not affect conformance to C/C++ standards,
3198 which is controlled by the separate C/C++ dialect option flags. When
3199 this option is used with the Objective-C or Objective-C++ compiler,
3200 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3201 This is useful if you need to make sure that your Objective-C code can
3202 be compiled with older versions of GCC@.
3203
3204 @item -freplace-objc-classes
3205 @opindex freplace-objc-classes
3206 Emit a special marker instructing @command{ld(1)} not to statically link in
3207 the resulting object file, and allow @command{dyld(1)} to load it in at
3208 run time instead. This is used in conjunction with the Fix-and-Continue
3209 debugging mode, where the object file in question may be recompiled and
3210 dynamically reloaded in the course of program execution, without the need
3211 to restart the program itself. Currently, Fix-and-Continue functionality
3212 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3213 and later.
3214
3215 @item -fzero-link
3216 @opindex fzero-link
3217 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3218 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3219 compile time) with static class references that get initialized at load time,
3220 which improves run-time performance. Specifying the @option{-fzero-link} flag
3221 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3222 to be retained. This is useful in Zero-Link debugging mode, since it allows
3223 for individual class implementations to be modified during program execution.
3224 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3225 regardless of command-line options.
3226
3227 @item -fno-local-ivars
3228 @opindex fno-local-ivars
3229 @opindex flocal-ivars
3230 By default instance variables in Objective-C can be accessed as if
3231 they were local variables from within the methods of the class they're
3232 declared in. This can lead to shadowing between instance variables
3233 and other variables declared either locally inside a class method or
3234 globally with the same name. Specifying the @option{-fno-local-ivars}
3235 flag disables this behavior thus avoiding variable shadowing issues.
3236
3237 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3238 @opindex fivar-visibility
3239 Set the default instance variable visibility to the specified option
3240 so that instance variables declared outside the scope of any access
3241 modifier directives default to the specified visibility.
3242
3243 @item -gen-decls
3244 @opindex gen-decls
3245 Dump interface declarations for all classes seen in the source file to a
3246 file named @file{@var{sourcename}.decl}.
3247
3248 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3249 @opindex Wassign-intercept
3250 @opindex Wno-assign-intercept
3251 Warn whenever an Objective-C assignment is being intercepted by the
3252 garbage collector.
3253
3254 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3255 @opindex Wno-protocol
3256 @opindex Wprotocol
3257 If a class is declared to implement a protocol, a warning is issued for
3258 every method in the protocol that is not implemented by the class. The
3259 default behavior is to issue a warning for every method not explicitly
3260 implemented in the class, even if a method implementation is inherited
3261 from the superclass. If you use the @option{-Wno-protocol} option, then
3262 methods inherited from the superclass are considered to be implemented,
3263 and no warning is issued for them.
3264
3265 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3266 @opindex Wselector
3267 @opindex Wno-selector
3268 Warn if multiple methods of different types for the same selector are
3269 found during compilation. The check is performed on the list of methods
3270 in the final stage of compilation. Additionally, a check is performed
3271 for each selector appearing in a @code{@@selector(@dots{})}
3272 expression, and a corresponding method for that selector has been found
3273 during compilation. Because these checks scan the method table only at
3274 the end of compilation, these warnings are not produced if the final
3275 stage of compilation is not reached, for example because an error is
3276 found during compilation, or because the @option{-fsyntax-only} option is
3277 being used.
3278
3279 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3280 @opindex Wstrict-selector-match
3281 @opindex Wno-strict-selector-match
3282 Warn if multiple methods with differing argument and/or return types are
3283 found for a given selector when attempting to send a message using this
3284 selector to a receiver of type @code{id} or @code{Class}. When this flag
3285 is off (which is the default behavior), the compiler omits such warnings
3286 if any differences found are confined to types that share the same size
3287 and alignment.
3288
3289 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3290 @opindex Wundeclared-selector
3291 @opindex Wno-undeclared-selector
3292 Warn if a @code{@@selector(@dots{})} expression referring to an
3293 undeclared selector is found. A selector is considered undeclared if no
3294 method with that name has been declared before the
3295 @code{@@selector(@dots{})} expression, either explicitly in an
3296 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3297 an @code{@@implementation} section. This option always performs its
3298 checks as soon as a @code{@@selector(@dots{})} expression is found,
3299 while @option{-Wselector} only performs its checks in the final stage of
3300 compilation. This also enforces the coding style convention
3301 that methods and selectors must be declared before being used.
3302
3303 @item -print-objc-runtime-info
3304 @opindex print-objc-runtime-info
3305 Generate C header describing the largest structure that is passed by
3306 value, if any.
3307
3308 @end table
3309
3310 @node Diagnostic Message Formatting Options
3311 @section Options to Control Diagnostic Messages Formatting
3312 @cindex options to control diagnostics formatting
3313 @cindex diagnostic messages
3314 @cindex message formatting
3315
3316 Traditionally, diagnostic messages have been formatted irrespective of
3317 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3318 options described below
3319 to control the formatting algorithm for diagnostic messages,
3320 e.g.@: how many characters per line, how often source location
3321 information should be reported. Note that some language front ends may not
3322 honor these options.
3323
3324 @table @gcctabopt
3325 @item -fmessage-length=@var{n}
3326 @opindex fmessage-length
3327 Try to format error messages so that they fit on lines of about
3328 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3329 done; each error message appears on a single line. This is the
3330 default for all front ends.
3331
3332 @item -fdiagnostics-show-location=once
3333 @opindex fdiagnostics-show-location
3334 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3335 reporter to emit source location information @emph{once}; that is, in
3336 case the message is too long to fit on a single physical line and has to
3337 be wrapped, the source location won't be emitted (as prefix) again,
3338 over and over, in subsequent continuation lines. This is the default
3339 behavior.
3340
3341 @item -fdiagnostics-show-location=every-line
3342 Only meaningful in line-wrapping mode. Instructs the diagnostic
3343 messages reporter to emit the same source location information (as
3344 prefix) for physical lines that result from the process of breaking
3345 a message which is too long to fit on a single line.
3346
3347 @item -fdiagnostics-color[=@var{WHEN}]
3348 @itemx -fno-diagnostics-color
3349 @opindex fdiagnostics-color
3350 @cindex highlight, color
3351 @vindex GCC_COLORS @r{environment variable}
3352 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3353 or @samp{auto}. The default depends on how the compiler has been configured,
3354 it can be any of the above @var{WHEN} options or also @samp{never}
3355 if @env{GCC_COLORS} environment variable isn't present in the environment,
3356 and @samp{auto} otherwise.
3357 @samp{auto} means to use color only when the standard error is a terminal.
3358 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3359 aliases for @option{-fdiagnostics-color=always} and
3360 @option{-fdiagnostics-color=never}, respectively.
3361
3362 The colors are defined by the environment variable @env{GCC_COLORS}.
3363 Its value is a colon-separated list of capabilities and Select Graphic
3364 Rendition (SGR) substrings. SGR commands are interpreted by the
3365 terminal or terminal emulator. (See the section in the documentation
3366 of your text terminal for permitted values and their meanings as
3367 character attributes.) These substring values are integers in decimal
3368 representation and can be concatenated with semicolons.
3369 Common values to concatenate include
3370 @samp{1} for bold,
3371 @samp{4} for underline,
3372 @samp{5} for blink,
3373 @samp{7} for inverse,
3374 @samp{39} for default foreground color,
3375 @samp{30} to @samp{37} for foreground colors,
3376 @samp{90} to @samp{97} for 16-color mode foreground colors,
3377 @samp{38;5;0} to @samp{38;5;255}
3378 for 88-color and 256-color modes foreground colors,
3379 @samp{49} for default background color,
3380 @samp{40} to @samp{47} for background colors,
3381 @samp{100} to @samp{107} for 16-color mode background colors,
3382 and @samp{48;5;0} to @samp{48;5;255}
3383 for 88-color and 256-color modes background colors.
3384
3385 The default @env{GCC_COLORS} is
3386 @smallexample
3387 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:quote=01:\
3388 fixit-insert=32:fixit-delete=31:\
3389 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32
3390 @end smallexample
3391 @noindent
3392 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3393 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3394 @samp{01} is bold, and @samp{31} is red.
3395 Setting @env{GCC_COLORS} to the empty string disables colors.
3396 Supported capabilities are as follows.
3397
3398 @table @code
3399 @item error=
3400 @vindex error GCC_COLORS @r{capability}
3401 SGR substring for error: markers.
3402
3403 @item warning=
3404 @vindex warning GCC_COLORS @r{capability}
3405 SGR substring for warning: markers.
3406
3407 @item note=
3408 @vindex note GCC_COLORS @r{capability}
3409 SGR substring for note: markers.
3410
3411 @item range1=
3412 @vindex range1 GCC_COLORS @r{capability}
3413 SGR substring for first additional range.
3414
3415 @item range2=
3416 @vindex range2 GCC_COLORS @r{capability}
3417 SGR substring for second additional range.
3418
3419 @item locus=
3420 @vindex locus GCC_COLORS @r{capability}
3421 SGR substring for location information, @samp{file:line} or
3422 @samp{file:line:column} etc.
3423
3424 @item quote=
3425 @vindex quote GCC_COLORS @r{capability}
3426 SGR substring for information printed within quotes.
3427
3428 @item fixit-insert=
3429 @vindex fixit-insert GCC_COLORS @r{capability}
3430 SGR substring for fix-it hints suggesting text to
3431 be inserted or replaced.
3432
3433 @item fixit-delete=
3434 @vindex fixit-delete GCC_COLORS @r{capability}
3435 SGR substring for fix-it hints suggesting text to
3436 be deleted.
3437
3438 @item diff-filename=
3439 @vindex diff-filename GCC_COLORS @r{capability}
3440 SGR substring for filename headers within generated patches.
3441
3442 @item diff-hunk=
3443 @vindex diff-hunk GCC_COLORS @r{capability}
3444 SGR substring for the starts of hunks within generated patches.
3445
3446 @item diff-delete=
3447 @vindex diff-delete GCC_COLORS @r{capability}
3448 SGR substring for deleted lines within generated patches.
3449
3450 @item diff-insert=
3451 @vindex diff-insert GCC_COLORS @r{capability}
3452 SGR substring for inserted lines within generated patches.
3453 @end table
3454
3455 @item -fno-diagnostics-show-option
3456 @opindex fno-diagnostics-show-option
3457 @opindex fdiagnostics-show-option
3458 By default, each diagnostic emitted includes text indicating the
3459 command-line option that directly controls the diagnostic (if such an
3460 option is known to the diagnostic machinery). Specifying the
3461 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3462
3463 @item -fno-diagnostics-show-caret
3464 @opindex fno-diagnostics-show-caret
3465 @opindex fdiagnostics-show-caret
3466 By default, each diagnostic emitted includes the original source line
3467 and a caret @samp{^} indicating the column. This option suppresses this
3468 information. The source line is truncated to @var{n} characters, if
3469 the @option{-fmessage-length=n} option is given. When the output is done
3470 to the terminal, the width is limited to the width given by the
3471 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3472
3473 @item -fdiagnostics-parseable-fixits
3474 @opindex fdiagnostics-parseable-fixits
3475 Emit fix-it hints in a machine-parseable format, suitable for consumption
3476 by IDEs. For each fix-it, a line will be printed after the relevant
3477 diagnostic, starting with the string ``fix-it:''. For example:
3478
3479 @smallexample
3480 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3481 @end smallexample
3482
3483 The location is expressed as a half-open range, expressed as a count of
3484 bytes, starting at byte 1 for the initial column. In the above example,
3485 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3486 given string:
3487
3488 @smallexample
3489 00000000011111111112222222222
3490 12345678901234567890123456789
3491 gtk_widget_showall (dlg);
3492 ^^^^^^^^^^^^^^^^^^
3493 gtk_widget_show_all
3494 @end smallexample
3495
3496 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3497 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3498 (e.g. vertical tab as ``\013'').
3499
3500 An empty replacement string indicates that the given range is to be removed.
3501 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3502 be inserted at the given position.
3503
3504 @item -fdiagnostics-generate-patch
3505 @opindex fdiagnostics-generate-patch
3506 Print fix-it hints to stderr in unified diff format, after any diagnostics
3507 are printed. For example:
3508
3509 @smallexample
3510 --- test.c
3511 +++ test.c
3512 @@ -42,5 +42,5 @@
3513
3514 void show_cb(GtkDialog *dlg)
3515 @{
3516 - gtk_widget_showall(dlg);
3517 + gtk_widget_show_all(dlg);
3518 @}
3519
3520 @end smallexample
3521
3522 The diff may or may not be colorized, following the same rules
3523 as for diagnostics (see @option{-fdiagnostics-color}).
3524
3525 @end table
3526
3527 @node Warning Options
3528 @section Options to Request or Suppress Warnings
3529 @cindex options to control warnings
3530 @cindex warning messages
3531 @cindex messages, warning
3532 @cindex suppressing warnings
3533
3534 Warnings are diagnostic messages that report constructions that
3535 are not inherently erroneous but that are risky or suggest there
3536 may have been an error.
3537
3538 The following language-independent options do not enable specific
3539 warnings but control the kinds of diagnostics produced by GCC@.
3540
3541 @table @gcctabopt
3542 @cindex syntax checking
3543 @item -fsyntax-only
3544 @opindex fsyntax-only
3545 Check the code for syntax errors, but don't do anything beyond that.
3546
3547 @item -fmax-errors=@var{n}
3548 @opindex fmax-errors
3549 Limits the maximum number of error messages to @var{n}, at which point
3550 GCC bails out rather than attempting to continue processing the source
3551 code. If @var{n} is 0 (the default), there is no limit on the number
3552 of error messages produced. If @option{-Wfatal-errors} is also
3553 specified, then @option{-Wfatal-errors} takes precedence over this
3554 option.
3555
3556 @item -w
3557 @opindex w
3558 Inhibit all warning messages.
3559
3560 @item -Werror
3561 @opindex Werror
3562 @opindex Wno-error
3563 Make all warnings into errors.
3564
3565 @item -Werror=
3566 @opindex Werror=
3567 @opindex Wno-error=
3568 Make the specified warning into an error. The specifier for a warning
3569 is appended; for example @option{-Werror=switch} turns the warnings
3570 controlled by @option{-Wswitch} into errors. This switch takes a
3571 negative form, to be used to negate @option{-Werror} for specific
3572 warnings; for example @option{-Wno-error=switch} makes
3573 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3574 is in effect.
3575
3576 The warning message for each controllable warning includes the
3577 option that controls the warning. That option can then be used with
3578 @option{-Werror=} and @option{-Wno-error=} as described above.
3579 (Printing of the option in the warning message can be disabled using the
3580 @option{-fno-diagnostics-show-option} flag.)
3581
3582 Note that specifying @option{-Werror=}@var{foo} automatically implies
3583 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3584 imply anything.
3585
3586 @item -Wfatal-errors
3587 @opindex Wfatal-errors
3588 @opindex Wno-fatal-errors
3589 This option causes the compiler to abort compilation on the first error
3590 occurred rather than trying to keep going and printing further error
3591 messages.
3592
3593 @end table
3594
3595 You can request many specific warnings with options beginning with
3596 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3597 implicit declarations. Each of these specific warning options also
3598 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3599 example, @option{-Wno-implicit}. This manual lists only one of the
3600 two forms, whichever is not the default. For further
3601 language-specific options also refer to @ref{C++ Dialect Options} and
3602 @ref{Objective-C and Objective-C++ Dialect Options}.
3603
3604 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3605 options, such as @option{-Wunused}, which may turn on further options,
3606 such as @option{-Wunused-value}. The combined effect of positive and
3607 negative forms is that more specific options have priority over less
3608 specific ones, independently of their position in the command-line. For
3609 options of the same specificity, the last one takes effect. Options
3610 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3611 as if they appeared at the end of the command-line.
3612
3613 When an unrecognized warning option is requested (e.g.,
3614 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3615 that the option is not recognized. However, if the @option{-Wno-} form
3616 is used, the behavior is slightly different: no diagnostic is
3617 produced for @option{-Wno-unknown-warning} unless other diagnostics
3618 are being produced. This allows the use of new @option{-Wno-} options
3619 with old compilers, but if something goes wrong, the compiler
3620 warns that an unrecognized option is present.
3621
3622 @table @gcctabopt
3623 @item -Wpedantic
3624 @itemx -pedantic
3625 @opindex pedantic
3626 @opindex Wpedantic
3627 Issue all the warnings demanded by strict ISO C and ISO C++;
3628 reject all programs that use forbidden extensions, and some other
3629 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3630 version of the ISO C standard specified by any @option{-std} option used.
3631
3632 Valid ISO C and ISO C++ programs should compile properly with or without
3633 this option (though a rare few require @option{-ansi} or a
3634 @option{-std} option specifying the required version of ISO C)@. However,
3635 without this option, certain GNU extensions and traditional C and C++
3636 features are supported as well. With this option, they are rejected.
3637
3638 @option{-Wpedantic} does not cause warning messages for use of the
3639 alternate keywords whose names begin and end with @samp{__}. Pedantic
3640 warnings are also disabled in the expression that follows
3641 @code{__extension__}. However, only system header files should use
3642 these escape routes; application programs should avoid them.
3643 @xref{Alternate Keywords}.
3644
3645 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3646 C conformance. They soon find that it does not do quite what they want:
3647 it finds some non-ISO practices, but not all---only those for which
3648 ISO C @emph{requires} a diagnostic, and some others for which
3649 diagnostics have been added.
3650
3651 A feature to report any failure to conform to ISO C might be useful in
3652 some instances, but would require considerable additional work and would
3653 be quite different from @option{-Wpedantic}. We don't have plans to
3654 support such a feature in the near future.
3655
3656 Where the standard specified with @option{-std} represents a GNU
3657 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3658 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3659 extended dialect is based. Warnings from @option{-Wpedantic} are given
3660 where they are required by the base standard. (It does not make sense
3661 for such warnings to be given only for features not in the specified GNU
3662 C dialect, since by definition the GNU dialects of C include all
3663 features the compiler supports with the given option, and there would be
3664 nothing to warn about.)
3665
3666 @item -pedantic-errors
3667 @opindex pedantic-errors
3668 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3669 requires a diagnostic, in some cases where there is undefined behavior
3670 at compile-time and in some other cases that do not prevent compilation
3671 of programs that are valid according to the standard. This is not
3672 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3673 by this option and not enabled by the latter and vice versa.
3674
3675 @item -Wall
3676 @opindex Wall
3677 @opindex Wno-all
3678 This enables all the warnings about constructions that some users
3679 consider questionable, and that are easy to avoid (or modify to
3680 prevent the warning), even in conjunction with macros. This also
3681 enables some language-specific warnings described in @ref{C++ Dialect
3682 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3683
3684 @option{-Wall} turns on the following warning flags:
3685
3686 @gccoptlist{-Waddress @gol
3687 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3688 -Wbool-compare @gol
3689 -Wbool-operation @gol
3690 -Wc++11-compat -Wc++14-compat@gol
3691 -Wchar-subscripts @gol
3692 -Wcomment @gol
3693 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3694 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3695 -Wformat @gol
3696 -Wint-in-bool-context @gol
3697 -Wimplicit @r{(C and Objective-C only)} @gol
3698 -Wimplicit-int @r{(C and Objective-C only)} @gol
3699 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3700 -Winit-self @r{(only for C++)} @gol
3701 -Wlogical-not-parentheses
3702 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3703 -Wmaybe-uninitialized @gol
3704 -Wmemset-elt-size @gol
3705 -Wmemset-transposed-args @gol
3706 -Wmisleading-indentation @r{(only for C/C++)} @gol
3707 -Wmissing-braces @r{(only for C/ObjC)} @gol
3708 -Wnarrowing @r{(only for C++)} @gol
3709 -Wnonnull @gol
3710 -Wnonnull-compare @gol
3711 -Wopenmp-simd @gol
3712 -Wparentheses @gol
3713 -Wpointer-sign @gol
3714 -Wreorder @gol
3715 -Wreturn-type @gol
3716 -Wsequence-point @gol
3717 -Wsign-compare @r{(only in C++)} @gol
3718 -Wsizeof-pointer-memaccess @gol
3719 -Wstrict-aliasing @gol
3720 -Wstrict-overflow=1 @gol
3721 -Wswitch @gol
3722 -Wtautological-compare @gol
3723 -Wtrigraphs @gol
3724 -Wuninitialized @gol
3725 -Wunknown-pragmas @gol
3726 -Wunused-function @gol
3727 -Wunused-label @gol
3728 -Wunused-value @gol
3729 -Wunused-variable @gol
3730 -Wvolatile-register-var @gol
3731 }
3732
3733 Note that some warning flags are not implied by @option{-Wall}. Some of
3734 them warn about constructions that users generally do not consider
3735 questionable, but which occasionally you might wish to check for;
3736 others warn about constructions that are necessary or hard to avoid in
3737 some cases, and there is no simple way to modify the code to suppress
3738 the warning. Some of them are enabled by @option{-Wextra} but many of
3739 them must be enabled individually.
3740
3741 @item -Wextra
3742 @opindex W
3743 @opindex Wextra
3744 @opindex Wno-extra
3745 This enables some extra warning flags that are not enabled by
3746 @option{-Wall}. (This option used to be called @option{-W}. The older
3747 name is still supported, but the newer name is more descriptive.)
3748
3749 @gccoptlist{-Wclobbered @gol
3750 -Wempty-body @gol
3751 -Wignored-qualifiers @gol
3752 -Wimplicit-fallthrough=3 @gol
3753 -Wmissing-field-initializers @gol
3754 -Wmissing-parameter-type @r{(C only)} @gol
3755 -Wold-style-declaration @r{(C only)} @gol
3756 -Woverride-init @gol
3757 -Wsign-compare @r{(C only)} @gol
3758 -Wtype-limits @gol
3759 -Wuninitialized @gol
3760 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3761 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3762 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3763 }
3764
3765 The option @option{-Wextra} also prints warning messages for the
3766 following cases:
3767
3768 @itemize @bullet
3769
3770 @item
3771 A pointer is compared against integer zero with @code{<}, @code{<=},
3772 @code{>}, or @code{>=}.
3773
3774 @item
3775 (C++ only) An enumerator and a non-enumerator both appear in a
3776 conditional expression.
3777
3778 @item
3779 (C++ only) Ambiguous virtual bases.
3780
3781 @item
3782 (C++ only) Subscripting an array that has been declared @code{register}.
3783
3784 @item
3785 (C++ only) Taking the address of a variable that has been declared
3786 @code{register}.
3787
3788 @item
3789 (C++ only) A base class is not initialized in the copy constructor
3790 of a derived class.
3791
3792 @end itemize
3793
3794 @item -Wchar-subscripts
3795 @opindex Wchar-subscripts
3796 @opindex Wno-char-subscripts
3797 Warn if an array subscript has type @code{char}. This is a common cause
3798 of error, as programmers often forget that this type is signed on some
3799 machines.
3800 This warning is enabled by @option{-Wall}.
3801
3802 @item -Wcomment
3803 @opindex Wcomment
3804 @opindex Wno-comment
3805 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3806 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3807 This warning is enabled by @option{-Wall}.
3808
3809 @item -Wno-coverage-mismatch
3810 @opindex Wno-coverage-mismatch
3811 Warn if feedback profiles do not match when using the
3812 @option{-fprofile-use} option.
3813 If a source file is changed between compiling with @option{-fprofile-gen} and
3814 with @option{-fprofile-use}, the files with the profile feedback can fail
3815 to match the source file and GCC cannot use the profile feedback
3816 information. By default, this warning is enabled and is treated as an
3817 error. @option{-Wno-coverage-mismatch} can be used to disable the
3818 warning or @option{-Wno-error=coverage-mismatch} can be used to
3819 disable the error. Disabling the error for this warning can result in
3820 poorly optimized code and is useful only in the
3821 case of very minor changes such as bug fixes to an existing code-base.
3822 Completely disabling the warning is not recommended.
3823
3824 @item -Wno-cpp
3825 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3826
3827 Suppress warning messages emitted by @code{#warning} directives.
3828
3829 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3830 @opindex Wdouble-promotion
3831 @opindex Wno-double-promotion
3832 Give a warning when a value of type @code{float} is implicitly
3833 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3834 floating-point unit implement @code{float} in hardware, but emulate
3835 @code{double} in software. On such a machine, doing computations
3836 using @code{double} values is much more expensive because of the
3837 overhead required for software emulation.
3838
3839 It is easy to accidentally do computations with @code{double} because
3840 floating-point literals are implicitly of type @code{double}. For
3841 example, in:
3842 @smallexample
3843 @group
3844 float area(float radius)
3845 @{
3846 return 3.14159 * radius * radius;
3847 @}
3848 @end group
3849 @end smallexample
3850 the compiler performs the entire computation with @code{double}
3851 because the floating-point literal is a @code{double}.
3852
3853 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
3854 @opindex Wduplicate-decl-specifier
3855 @opindex Wno-duplicate-decl-specifier
3856 Warn if a declaration has duplicate @code{const}, @code{volatile},
3857 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
3858 @option{-Wall}.
3859
3860 @item -Wformat
3861 @itemx -Wformat=@var{n}
3862 @opindex Wformat
3863 @opindex Wno-format
3864 @opindex ffreestanding
3865 @opindex fno-builtin
3866 @opindex Wformat=
3867 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3868 the arguments supplied have types appropriate to the format string
3869 specified, and that the conversions specified in the format string make
3870 sense. This includes standard functions, and others specified by format
3871 attributes (@pxref{Function Attributes}), in the @code{printf},
3872 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3873 not in the C standard) families (or other target-specific families).
3874 Which functions are checked without format attributes having been
3875 specified depends on the standard version selected, and such checks of
3876 functions without the attribute specified are disabled by
3877 @option{-ffreestanding} or @option{-fno-builtin}.
3878
3879 The formats are checked against the format features supported by GNU
3880 libc version 2.2. These include all ISO C90 and C99 features, as well
3881 as features from the Single Unix Specification and some BSD and GNU
3882 extensions. Other library implementations may not support all these
3883 features; GCC does not support warning about features that go beyond a
3884 particular library's limitations. However, if @option{-Wpedantic} is used
3885 with @option{-Wformat}, warnings are given about format features not
3886 in the selected standard version (but not for @code{strfmon} formats,
3887 since those are not in any version of the C standard). @xref{C Dialect
3888 Options,,Options Controlling C Dialect}.
3889
3890 @table @gcctabopt
3891 @item -Wformat=1
3892 @itemx -Wformat
3893 @opindex Wformat
3894 @opindex Wformat=1
3895 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3896 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3897 @option{-Wformat} also checks for null format arguments for several
3898 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3899 aspects of this level of format checking can be disabled by the
3900 options: @option{-Wno-format-contains-nul},
3901 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3902 @option{-Wformat} is enabled by @option{-Wall}.
3903
3904 @item -Wno-format-contains-nul
3905 @opindex Wno-format-contains-nul
3906 @opindex Wformat-contains-nul
3907 If @option{-Wformat} is specified, do not warn about format strings that
3908 contain NUL bytes.
3909
3910 @item -Wno-format-extra-args
3911 @opindex Wno-format-extra-args
3912 @opindex Wformat-extra-args
3913 If @option{-Wformat} is specified, do not warn about excess arguments to a
3914 @code{printf} or @code{scanf} format function. The C standard specifies
3915 that such arguments are ignored.
3916
3917 Where the unused arguments lie between used arguments that are
3918 specified with @samp{$} operand number specifications, normally
3919 warnings are still given, since the implementation could not know what
3920 type to pass to @code{va_arg} to skip the unused arguments. However,
3921 in the case of @code{scanf} formats, this option suppresses the
3922 warning if the unused arguments are all pointers, since the Single
3923 Unix Specification says that such unused arguments are allowed.
3924
3925 @item -Wformat-length
3926 @itemx -Wformat-length=@var{level}
3927 @opindex Wformat-length
3928 @opindex Wno-format-length
3929 Warn about calls to formatted input/output functions such as @code{sprintf}
3930 that might overflow the destination buffer, or about bounded functions such
3931 as @code{snprintf} that might result in output truncation. When the exact
3932 number of bytes written by a format directive cannot be determined at
3933 compile-time it is estimated based on heuristics that depend on the
3934 @var{level} argument and on optimization. While enabling optimization
3935 will in most cases improve the accuracy of the warning, it may also
3936 result in false positives.
3937
3938 @table @gcctabopt
3939 @item -Wformat-length
3940 @item -Wformat-length=1
3941 @opindex Wformat-length
3942 @opindex Wno-format-length
3943 Level @var{1} of @option{-Wformat-length} enabled by @option{-Wformat}
3944 employs a conservative approach that warns only about calls that most
3945 likely overflow the buffer or result in output truncation. At this
3946 level, numeric arguments to format directives with unknown values are
3947 assumed to have the value of one, and strings of unknown length to be
3948 empty. Numeric arguments that are known to be bounded to a subrange
3949 of their type, or string arguments whose output is bounded either by
3950 their directive's precision or by a finite set of string literals, are
3951 assumed to take on the value within the range that results in the most
3952 bytes on output. For example, the call to @code{sprintf} below is
3953 diagnosed because even with both @var{a} and @var{b} equal to zero,
3954 the terminating NUL character (@code{'\0'}) appended by the function
3955 to the destination buffer will be written past its end. Increasing
3956 the size of the buffer by a single byte is sufficient to avoid the
3957 warning, though it may not be sufficient to avoid the overflow.
3958
3959 @smallexample
3960 void f (int a, int b)
3961 @{
3962 char buf [12];
3963 sprintf (buf, "a = %i, b = %i\n", a, b);
3964 @}
3965 @end smallexample
3966
3967 @item -Wformat-length=2
3968 Level @var{2} warns also about calls that might overflow the destination
3969 buffer or result in truncation given an argument of sufficient length
3970 or magnitude. At level @var{2}, unknown numeric arguments are assumed
3971 to have the minimum representable value for signed types with a precision
3972 greater than 1, and the maximum representable value otherwise. Unknown
3973 string arguments whose length cannot be assumed to be bounded either by
3974 the directive's precision, or by a finite set of string literals they
3975 may evaluate to, or the character array they may point to, are assumed
3976 to be 1 character long.
3977
3978 At level @var{2}, the call in the example above is again diagnosed, but
3979 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
3980 @code{%i} directive will write some of its digits beyond the end of
3981 the destination buffer. To make the call safe regardless of the values
3982 of the two variables, the size of the destination buffer must be increased
3983 to at least 34 bytes. GCC includes the minimum size of the buffer in
3984 an informational note following the warning.
3985
3986 An alternative to increasing the size of the destination buffer is to
3987 constrain the range of formatted values. The maximum length of string
3988 arguments can be bounded by specifying the precision in the format
3989 directive. When numeric arguments of format directives can be assumed
3990 to be bounded by less than the precision of their type, choosing
3991 an appropriate length modifier to the format specifier will reduce
3992 the required buffer size. For example, if @var{a} and @var{b} in the
3993 example above can be assumed to be within the precision of
3994 the @code{short int} type then using either the @code{%hi} format
3995 directive or casting the argument to @code{short} reduces the maximum
3996 required size of the buffer to 24 bytes.
3997
3998 @smallexample
3999 void f (int a, int b)
4000 @{
4001 char buf [23];
4002 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4003 @}
4004 @end smallexample
4005 @end table
4006
4007 @item -Wno-format-zero-length
4008 @opindex Wno-format-zero-length
4009 @opindex Wformat-zero-length
4010 If @option{-Wformat} is specified, do not warn about zero-length formats.
4011 The C standard specifies that zero-length formats are allowed.
4012
4013
4014 @item -Wformat=2
4015 @opindex Wformat=2
4016 Enable @option{-Wformat} plus additional format checks. Currently
4017 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4018 -Wformat-y2k}.
4019
4020 @item -Wformat-nonliteral
4021 @opindex Wformat-nonliteral
4022 @opindex Wno-format-nonliteral
4023 If @option{-Wformat} is specified, also warn if the format string is not a
4024 string literal and so cannot be checked, unless the format function
4025 takes its format arguments as a @code{va_list}.
4026
4027 @item -Wformat-security
4028 @opindex Wformat-security
4029 @opindex Wno-format-security
4030 If @option{-Wformat} is specified, also warn about uses of format
4031 functions that represent possible security problems. At present, this
4032 warns about calls to @code{printf} and @code{scanf} functions where the
4033 format string is not a string literal and there are no format arguments,
4034 as in @code{printf (foo);}. This may be a security hole if the format
4035 string came from untrusted input and contains @samp{%n}. (This is
4036 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4037 in future warnings may be added to @option{-Wformat-security} that are not
4038 included in @option{-Wformat-nonliteral}.)
4039
4040 @item -Wformat-signedness
4041 @opindex Wformat-signedness
4042 @opindex Wno-format-signedness
4043 If @option{-Wformat} is specified, also warn if the format string
4044 requires an unsigned argument and the argument is signed and vice versa.
4045
4046 @item -Wformat-y2k
4047 @opindex Wformat-y2k
4048 @opindex Wno-format-y2k
4049 If @option{-Wformat} is specified, also warn about @code{strftime}
4050 formats that may yield only a two-digit year.
4051 @end table
4052
4053 @item -Wnonnull
4054 @opindex Wnonnull
4055 @opindex Wno-nonnull
4056 Warn about passing a null pointer for arguments marked as
4057 requiring a non-null value by the @code{nonnull} function attribute.
4058
4059 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4060 can be disabled with the @option{-Wno-nonnull} option.
4061
4062 @item -Wnonnull-compare
4063 @opindex Wnonnull-compare
4064 @opindex Wno-nonnull-compare
4065 Warn when comparing an argument marked with the @code{nonnull}
4066 function attribute against null inside the function.
4067
4068 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4069 can be disabled with the @option{-Wno-nonnull-compare} option.
4070
4071 @item -Wnull-dereference
4072 @opindex Wnull-dereference
4073 @opindex Wno-null-dereference
4074 Warn if the compiler detects paths that trigger erroneous or
4075 undefined behavior due to dereferencing a null pointer. This option
4076 is only active when @option{-fdelete-null-pointer-checks} is active,
4077 which is enabled by optimizations in most targets. The precision of
4078 the warnings depends on the optimization options used.
4079
4080 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4081 @opindex Winit-self
4082 @opindex Wno-init-self
4083 Warn about uninitialized variables that are initialized with themselves.
4084 Note this option can only be used with the @option{-Wuninitialized} option.
4085
4086 For example, GCC warns about @code{i} being uninitialized in the
4087 following snippet only when @option{-Winit-self} has been specified:
4088 @smallexample
4089 @group
4090 int f()
4091 @{
4092 int i = i;
4093 return i;
4094 @}
4095 @end group
4096 @end smallexample
4097
4098 This warning is enabled by @option{-Wall} in C++.
4099
4100 @item -Wimplicit-int @r{(C and Objective-C only)}
4101 @opindex Wimplicit-int
4102 @opindex Wno-implicit-int
4103 Warn when a declaration does not specify a type.
4104 This warning is enabled by @option{-Wall}.
4105
4106 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4107 @opindex Wimplicit-function-declaration
4108 @opindex Wno-implicit-function-declaration
4109 Give a warning whenever a function is used before being declared. In
4110 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4111 enabled by default and it is made into an error by
4112 @option{-pedantic-errors}. This warning is also enabled by
4113 @option{-Wall}.
4114
4115 @item -Wimplicit @r{(C and Objective-C only)}
4116 @opindex Wimplicit
4117 @opindex Wno-implicit
4118 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4119 This warning is enabled by @option{-Wall}.
4120
4121 @item -Wimplicit-fallthrough
4122 @opindex Wimplicit-fallthrough
4123 @opindex Wno-implicit-fallthrough
4124 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4125 and @option{-Wno-implicit-fallthrough} is the same as
4126 @option{-Wimplicit-fallthrough=0}.
4127
4128 @item -Wimplicit-fallthrough=@var{n}
4129 @opindex Wimplicit-fallthrough=
4130 Warn when a switch case falls through. For example:
4131
4132 @smallexample
4133 @group
4134 switch (cond)
4135 @{
4136 case 1:
4137 a = 1;
4138 break;
4139 case 2:
4140 a = 2;
4141 case 3:
4142 a = 3;
4143 break;
4144 @}
4145 @end group
4146 @end smallexample
4147
4148 This warning does not warn when the last statement of a case cannot
4149 fall through, e.g. when there is a return statement or a call to function
4150 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4151 also takes into account control flow statements, such as ifs, and only
4152 warns when appropriate. E.g.@:
4153
4154 @smallexample
4155 @group
4156 switch (cond)
4157 @{
4158 case 1:
4159 if (i > 3) @{
4160 bar (5);
4161 break;
4162 @} else if (i < 1) @{
4163 bar (0);
4164 @} else
4165 return;
4166 default:
4167 @dots{}
4168 @}
4169 @end group
4170 @end smallexample
4171
4172 Since there are occasions where a switch case fall through is desirable,
4173 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4174 to be used along with a null statement to suppress this warning that
4175 would normally occur:
4176
4177 @smallexample
4178 @group
4179 switch (cond)
4180 @{
4181 case 1:
4182 bar (0);
4183 __attribute__ ((fallthrough));
4184 default:
4185 @dots{}
4186 @}
4187 @end group
4188 @end smallexample
4189
4190 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4191 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4192 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4193 Instead of the these attributes, it is also possible to add a fallthrough
4194 comment to silence the warning. The whole body of the C or C++ style comment
4195 should match the given regular expressions listed below. The option argument
4196 @var{n} specifies what kind of comments are accepted:
4197
4198 @itemize @bullet
4199
4200 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4201
4202 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4203 expression, any comment is used as fallthrough comment.
4204
4205 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4206 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4207
4208 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4209 following regular expressions:
4210
4211 @itemize @bullet
4212
4213 @item @code{-fallthrough}
4214
4215 @item @code{@@fallthrough@@}
4216
4217 @item @code{lint -fallthrough[ \t]*}
4218
4219 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4220
4221 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4222
4223 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4224
4225 @end itemize
4226
4227 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4228 following regular expressions:
4229
4230 @itemize @bullet
4231
4232 @item @code{-fallthrough}
4233
4234 @item @code{@@fallthrough@@}
4235
4236 @item @code{lint -fallthrough[ \t]*}
4237
4238 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4239
4240 @end itemize
4241
4242 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4243 fallthrough comments, only attributes disable the warning.
4244
4245 @end itemize
4246
4247 The comment needs to be followed after optional whitespace and other comments
4248 by @code{case} or @code{default} keywords or by a user label that preceeds some
4249 @code{case} or @code{default} label.
4250
4251 @smallexample
4252 @group
4253 switch (cond)
4254 @{
4255 case 1:
4256 bar (0);
4257 /* FALLTHRU */
4258 default:
4259 @dots{}
4260 @}
4261 @end group
4262 @end smallexample
4263
4264 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4265
4266 @item -Wignored-qualifiers @r{(C and C++ only)}
4267 @opindex Wignored-qualifiers
4268 @opindex Wno-ignored-qualifiers
4269 Warn if the return type of a function has a type qualifier
4270 such as @code{const}. For ISO C such a type qualifier has no effect,
4271 since the value returned by a function is not an lvalue.
4272 For C++, the warning is only emitted for scalar types or @code{void}.
4273 ISO C prohibits qualified @code{void} return types on function
4274 definitions, so such return types always receive a warning
4275 even without this option.
4276
4277 This warning is also enabled by @option{-Wextra}.
4278
4279 @item -Wignored-attributes @r{(C and C++ only)}
4280 @opindex Wignored-attributes
4281 @opindex Wno-ignored-attributes
4282 Warn when an attribute is ignored. This is different from the
4283 @option{-Wattributes} option in that it warns whenever the compiler decides
4284 to drop an attribute, not that the attribute is either unknown, used in a
4285 wrong place, etc. This warning is enabled by default.
4286
4287 @item -Wmain
4288 @opindex Wmain
4289 @opindex Wno-main
4290 Warn if the type of @code{main} is suspicious. @code{main} should be
4291 a function with external linkage, returning int, taking either zero
4292 arguments, two, or three arguments of appropriate types. This warning
4293 is enabled by default in C++ and is enabled by either @option{-Wall}
4294 or @option{-Wpedantic}.
4295
4296 @item -Wmisleading-indentation @r{(C and C++ only)}
4297 @opindex Wmisleading-indentation
4298 @opindex Wno-misleading-indentation
4299 Warn when the indentation of the code does not reflect the block structure.
4300 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4301 @code{for} clauses with a guarded statement that does not use braces,
4302 followed by an unguarded statement with the same indentation.
4303
4304 In the following example, the call to ``bar'' is misleadingly indented as
4305 if it were guarded by the ``if'' conditional.
4306
4307 @smallexample
4308 if (some_condition ())
4309 foo ();
4310 bar (); /* Gotcha: this is not guarded by the "if". */
4311 @end smallexample
4312
4313 In the case of mixed tabs and spaces, the warning uses the
4314 @option{-ftabstop=} option to determine if the statements line up
4315 (defaulting to 8).
4316
4317 The warning is not issued for code involving multiline preprocessor logic
4318 such as the following example.
4319
4320 @smallexample
4321 if (flagA)
4322 foo (0);
4323 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4324 if (flagB)
4325 #endif
4326 foo (1);
4327 @end smallexample
4328
4329 The warning is not issued after a @code{#line} directive, since this
4330 typically indicates autogenerated code, and no assumptions can be made
4331 about the layout of the file that the directive references.
4332
4333 This warning is enabled by @option{-Wall} in C and C++.
4334
4335 @item -Wmissing-braces
4336 @opindex Wmissing-braces
4337 @opindex Wno-missing-braces
4338 Warn if an aggregate or union initializer is not fully bracketed. In
4339 the following example, the initializer for @code{a} is not fully
4340 bracketed, but that for @code{b} is fully bracketed. This warning is
4341 enabled by @option{-Wall} in C.
4342
4343 @smallexample
4344 int a[2][2] = @{ 0, 1, 2, 3 @};
4345 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4346 @end smallexample
4347
4348 This warning is enabled by @option{-Wall}.
4349
4350 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4351 @opindex Wmissing-include-dirs
4352 @opindex Wno-missing-include-dirs
4353 Warn if a user-supplied include directory does not exist.
4354
4355 @item -Wparentheses
4356 @opindex Wparentheses
4357 @opindex Wno-parentheses
4358 Warn if parentheses are omitted in certain contexts, such
4359 as when there is an assignment in a context where a truth value
4360 is expected, or when operators are nested whose precedence people
4361 often get confused about.
4362
4363 Also warn if a comparison like @code{x<=y<=z} appears; this is
4364 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4365 interpretation from that of ordinary mathematical notation.
4366
4367 Also warn for dangerous uses of the GNU extension to
4368 @code{?:} with omitted middle operand. When the condition
4369 in the @code{?}: operator is a boolean expression, the omitted value is
4370 always 1. Often programmers expect it to be a value computed
4371 inside the conditional expression instead.
4372
4373 This warning is enabled by @option{-Wall}.
4374
4375 @item -Wsequence-point
4376 @opindex Wsequence-point
4377 @opindex Wno-sequence-point
4378 Warn about code that may have undefined semantics because of violations
4379 of sequence point rules in the C and C++ standards.
4380
4381 The C and C++ standards define the order in which expressions in a C/C++
4382 program are evaluated in terms of @dfn{sequence points}, which represent
4383 a partial ordering between the execution of parts of the program: those
4384 executed before the sequence point, and those executed after it. These
4385 occur after the evaluation of a full expression (one which is not part
4386 of a larger expression), after the evaluation of the first operand of a
4387 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4388 function is called (but after the evaluation of its arguments and the
4389 expression denoting the called function), and in certain other places.
4390 Other than as expressed by the sequence point rules, the order of
4391 evaluation of subexpressions of an expression is not specified. All
4392 these rules describe only a partial order rather than a total order,
4393 since, for example, if two functions are called within one expression
4394 with no sequence point between them, the order in which the functions
4395 are called is not specified. However, the standards committee have
4396 ruled that function calls do not overlap.
4397
4398 It is not specified when between sequence points modifications to the
4399 values of objects take effect. Programs whose behavior depends on this
4400 have undefined behavior; the C and C++ standards specify that ``Between
4401 the previous and next sequence point an object shall have its stored
4402 value modified at most once by the evaluation of an expression.
4403 Furthermore, the prior value shall be read only to determine the value
4404 to be stored.''. If a program breaks these rules, the results on any
4405 particular implementation are entirely unpredictable.
4406
4407 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4408 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4409 diagnosed by this option, and it may give an occasional false positive
4410 result, but in general it has been found fairly effective at detecting
4411 this sort of problem in programs.
4412
4413 The C++17 standard will define the order of evaluation of operands in
4414 more cases: in particular it requires that the right-hand side of an
4415 assignment be evaluated before the left-hand side, so the above
4416 examples are no longer undefined. But this warning will still warn
4417 about them, to help people avoid writing code that is undefined in C
4418 and earlier revisions of C++.
4419
4420 The standard is worded confusingly, therefore there is some debate
4421 over the precise meaning of the sequence point rules in subtle cases.
4422 Links to discussions of the problem, including proposed formal
4423 definitions, may be found on the GCC readings page, at
4424 @uref{http://gcc.gnu.org/@/readings.html}.
4425
4426 This warning is enabled by @option{-Wall} for C and C++.
4427
4428 @item -Wno-return-local-addr
4429 @opindex Wno-return-local-addr
4430 @opindex Wreturn-local-addr
4431 Do not warn about returning a pointer (or in C++, a reference) to a
4432 variable that goes out of scope after the function returns.
4433
4434 @item -Wreturn-type
4435 @opindex Wreturn-type
4436 @opindex Wno-return-type
4437 Warn whenever a function is defined with a return type that defaults
4438 to @code{int}. Also warn about any @code{return} statement with no
4439 return value in a function whose return type is not @code{void}
4440 (falling off the end of the function body is considered returning
4441 without a value).
4442
4443 For C only, warn about a @code{return} statement with an expression in a
4444 function whose return type is @code{void}, unless the expression type is
4445 also @code{void}. As a GNU extension, the latter case is accepted
4446 without a warning unless @option{-Wpedantic} is used.
4447
4448 For C++, a function without return type always produces a diagnostic
4449 message, even when @option{-Wno-return-type} is specified. The only
4450 exceptions are @code{main} and functions defined in system headers.
4451
4452 This warning is enabled by @option{-Wall}.
4453
4454 @item -Wshift-count-negative
4455 @opindex Wshift-count-negative
4456 @opindex Wno-shift-count-negative
4457 Warn if shift count is negative. This warning is enabled by default.
4458
4459 @item -Wshift-count-overflow
4460 @opindex Wshift-count-overflow
4461 @opindex Wno-shift-count-overflow
4462 Warn if shift count >= width of type. This warning is enabled by default.
4463
4464 @item -Wshift-negative-value
4465 @opindex Wshift-negative-value
4466 @opindex Wno-shift-negative-value
4467 Warn if left shifting a negative value. This warning is enabled by
4468 @option{-Wextra} in C99 and C++11 modes (and newer).
4469
4470 @item -Wshift-overflow
4471 @itemx -Wshift-overflow=@var{n}
4472 @opindex Wshift-overflow
4473 @opindex Wno-shift-overflow
4474 Warn about left shift overflows. This warning is enabled by
4475 default in C99 and C++11 modes (and newer).
4476
4477 @table @gcctabopt
4478 @item -Wshift-overflow=1
4479 This is the warning level of @option{-Wshift-overflow} and is enabled
4480 by default in C99 and C++11 modes (and newer). This warning level does
4481 not warn about left-shifting 1 into the sign bit. (However, in C, such
4482 an overflow is still rejected in contexts where an integer constant expression
4483 is required.)
4484
4485 @item -Wshift-overflow=2
4486 This warning level also warns about left-shifting 1 into the sign bit,
4487 unless C++14 mode is active.
4488 @end table
4489
4490 @item -Wswitch
4491 @opindex Wswitch
4492 @opindex Wno-switch
4493 Warn whenever a @code{switch} statement has an index of enumerated type
4494 and lacks a @code{case} for one or more of the named codes of that
4495 enumeration. (The presence of a @code{default} label prevents this
4496 warning.) @code{case} labels outside the enumeration range also
4497 provoke warnings when this option is used (even if there is a
4498 @code{default} label).
4499 This warning is enabled by @option{-Wall}.
4500
4501 @item -Wswitch-default
4502 @opindex Wswitch-default
4503 @opindex Wno-switch-default
4504 Warn whenever a @code{switch} statement does not have a @code{default}
4505 case.
4506
4507 @item -Wswitch-enum
4508 @opindex Wswitch-enum
4509 @opindex Wno-switch-enum
4510 Warn whenever a @code{switch} statement has an index of enumerated type
4511 and lacks a @code{case} for one or more of the named codes of that
4512 enumeration. @code{case} labels outside the enumeration range also
4513 provoke warnings when this option is used. The only difference
4514 between @option{-Wswitch} and this option is that this option gives a
4515 warning about an omitted enumeration code even if there is a
4516 @code{default} label.
4517
4518 @item -Wswitch-bool
4519 @opindex Wswitch-bool
4520 @opindex Wno-switch-bool
4521 Warn whenever a @code{switch} statement has an index of boolean type
4522 and the case values are outside the range of a boolean type.
4523 It is possible to suppress this warning by casting the controlling
4524 expression to a type other than @code{bool}. For example:
4525 @smallexample
4526 @group
4527 switch ((int) (a == 4))
4528 @{
4529 @dots{}
4530 @}
4531 @end group
4532 @end smallexample
4533 This warning is enabled by default for C and C++ programs.
4534
4535 @item -Wswitch-unreachable
4536 @opindex Wswitch-unreachable
4537 @opindex Wno-switch-unreachable
4538 Warn whenever a @code{switch} statement contains statements between the
4539 controlling expression and the first case label, which will never be
4540 executed. For example:
4541 @smallexample
4542 @group
4543 switch (cond)
4544 @{
4545 i = 15;
4546 @dots{}
4547 case 5:
4548 @dots{}
4549 @}
4550 @end group
4551 @end smallexample
4552 @option{-Wswitch-unreachable} does not warn if the statement between the
4553 controlling expression and the first case label is just a declaration:
4554 @smallexample
4555 @group
4556 switch (cond)
4557 @{
4558 int i;
4559 @dots{}
4560 case 5:
4561 i = 5;
4562 @dots{}
4563 @}
4564 @end group
4565 @end smallexample
4566 This warning is enabled by default for C and C++ programs.
4567
4568 @item -Wsync-nand @r{(C and C++ only)}
4569 @opindex Wsync-nand
4570 @opindex Wno-sync-nand
4571 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4572 built-in functions are used. These functions changed semantics in GCC 4.4.
4573
4574 @item -Wtrigraphs
4575 @opindex Wtrigraphs
4576 @opindex Wno-trigraphs
4577 Warn if any trigraphs are encountered that might change the meaning of
4578 the program (trigraphs within comments are not warned about).
4579 This warning is enabled by @option{-Wall}.
4580
4581 @item -Wunused-but-set-parameter
4582 @opindex Wunused-but-set-parameter
4583 @opindex Wno-unused-but-set-parameter
4584 Warn whenever a function parameter is assigned to, but otherwise unused
4585 (aside from its declaration).
4586
4587 To suppress this warning use the @code{unused} attribute
4588 (@pxref{Variable Attributes}).
4589
4590 This warning is also enabled by @option{-Wunused} together with
4591 @option{-Wextra}.
4592
4593 @item -Wunused-but-set-variable
4594 @opindex Wunused-but-set-variable
4595 @opindex Wno-unused-but-set-variable
4596 Warn whenever a local variable is assigned to, but otherwise unused
4597 (aside from its declaration).
4598 This warning is enabled by @option{-Wall}.
4599
4600 To suppress this warning use the @code{unused} attribute
4601 (@pxref{Variable Attributes}).
4602
4603 This warning is also enabled by @option{-Wunused}, which is enabled
4604 by @option{-Wall}.
4605
4606 @item -Wunused-function
4607 @opindex Wunused-function
4608 @opindex Wno-unused-function
4609 Warn whenever a static function is declared but not defined or a
4610 non-inline static function is unused.
4611 This warning is enabled by @option{-Wall}.
4612
4613 @item -Wunused-label
4614 @opindex Wunused-label
4615 @opindex Wno-unused-label
4616 Warn whenever a label is declared but not used.
4617 This warning is enabled by @option{-Wall}.
4618
4619 To suppress this warning use the @code{unused} attribute
4620 (@pxref{Variable Attributes}).
4621
4622 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4623 @opindex Wunused-local-typedefs
4624 Warn when a typedef locally defined in a function is not used.
4625 This warning is enabled by @option{-Wall}.
4626
4627 @item -Wunused-parameter
4628 @opindex Wunused-parameter
4629 @opindex Wno-unused-parameter
4630 Warn whenever a function parameter is unused aside from its declaration.
4631
4632 To suppress this warning use the @code{unused} attribute
4633 (@pxref{Variable Attributes}).
4634
4635 @item -Wno-unused-result
4636 @opindex Wunused-result
4637 @opindex Wno-unused-result
4638 Do not warn if a caller of a function marked with attribute
4639 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4640 its return value. The default is @option{-Wunused-result}.
4641
4642 @item -Wunused-variable
4643 @opindex Wunused-variable
4644 @opindex Wno-unused-variable
4645 Warn whenever a local or static variable is unused aside from its
4646 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4647 but not for C++. This warning is enabled by @option{-Wall}.
4648
4649 To suppress this warning use the @code{unused} attribute
4650 (@pxref{Variable Attributes}).
4651
4652 @item -Wunused-const-variable
4653 @itemx -Wunused-const-variable=@var{n}
4654 @opindex Wunused-const-variable
4655 @opindex Wno-unused-const-variable
4656 Warn whenever a constant static variable is unused aside from its declaration.
4657 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4658 for C, but not for C++. In C this declares variable storage, but in C++ this
4659 is not an error since const variables take the place of @code{#define}s.
4660
4661 To suppress this warning use the @code{unused} attribute
4662 (@pxref{Variable Attributes}).
4663
4664 @table @gcctabopt
4665 @item -Wunused-const-variable=1
4666 This is the warning level that is enabled by @option{-Wunused-variable} for
4667 C. It warns only about unused static const variables defined in the main
4668 compilation unit, but not about static const variables declared in any
4669 header included.
4670
4671 @item -Wunused-const-variable=2
4672 This warning level also warns for unused constant static variables in
4673 headers (excluding system headers). This is the warning level of
4674 @option{-Wunused-const-variable} and must be explicitly requested since
4675 in C++ this isn't an error and in C it might be harder to clean up all
4676 headers included.
4677 @end table
4678
4679 @item -Wunused-value
4680 @opindex Wunused-value
4681 @opindex Wno-unused-value
4682 Warn whenever a statement computes a result that is explicitly not
4683 used. To suppress this warning cast the unused expression to
4684 @code{void}. This includes an expression-statement or the left-hand
4685 side of a comma expression that contains no side effects. For example,
4686 an expression such as @code{x[i,j]} causes a warning, while
4687 @code{x[(void)i,j]} does not.
4688
4689 This warning is enabled by @option{-Wall}.
4690
4691 @item -Wunused
4692 @opindex Wunused
4693 @opindex Wno-unused
4694 All the above @option{-Wunused} options combined.
4695
4696 In order to get a warning about an unused function parameter, you must
4697 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4698 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4699
4700 @item -Wuninitialized
4701 @opindex Wuninitialized
4702 @opindex Wno-uninitialized
4703 Warn if an automatic variable is used without first being initialized
4704 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4705 warn if a non-static reference or non-static @code{const} member
4706 appears in a class without constructors.
4707
4708 If you want to warn about code that uses the uninitialized value of the
4709 variable in its own initializer, use the @option{-Winit-self} option.
4710
4711 These warnings occur for individual uninitialized or clobbered
4712 elements of structure, union or array variables as well as for
4713 variables that are uninitialized or clobbered as a whole. They do
4714 not occur for variables or elements declared @code{volatile}. Because
4715 these warnings depend on optimization, the exact variables or elements
4716 for which there are warnings depends on the precise optimization
4717 options and version of GCC used.
4718
4719 Note that there may be no warning about a variable that is used only
4720 to compute a value that itself is never used, because such
4721 computations may be deleted by data flow analysis before the warnings
4722 are printed.
4723
4724 @item -Winvalid-memory-model
4725 @opindex Winvalid-memory-model
4726 @opindex Wno-invalid-memory-model
4727 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4728 and the C11 atomic generic functions with a memory consistency argument
4729 that is either invalid for the operation or outside the range of values
4730 of the @code{memory_order} enumeration. For example, since the
4731 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4732 defined for the relaxed, release, and sequentially consistent memory
4733 orders the following code is diagnosed:
4734
4735 @smallexample
4736 void store (int *i)
4737 @{
4738 __atomic_store_n (i, 0, memory_order_consume);
4739 @}
4740 @end smallexample
4741
4742 @option{-Winvalid-memory-model} is enabled by default.
4743
4744 @item -Wmaybe-uninitialized
4745 @opindex Wmaybe-uninitialized
4746 @opindex Wno-maybe-uninitialized
4747 For an automatic variable, if there exists a path from the function
4748 entry to a use of the variable that is initialized, but there exist
4749 some other paths for which the variable is not initialized, the compiler
4750 emits a warning if it cannot prove the uninitialized paths are not
4751 executed at run time. These warnings are made optional because GCC is
4752 not smart enough to see all the reasons why the code might be correct
4753 in spite of appearing to have an error. Here is one example of how
4754 this can happen:
4755
4756 @smallexample
4757 @group
4758 @{
4759 int x;
4760 switch (y)
4761 @{
4762 case 1: x = 1;
4763 break;
4764 case 2: x = 4;
4765 break;
4766 case 3: x = 5;
4767 @}
4768 foo (x);
4769 @}
4770 @end group
4771 @end smallexample
4772
4773 @noindent
4774 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4775 always initialized, but GCC doesn't know this. To suppress the
4776 warning, you need to provide a default case with assert(0) or
4777 similar code.
4778
4779 @cindex @code{longjmp} warnings
4780 This option also warns when a non-volatile automatic variable might be
4781 changed by a call to @code{longjmp}. These warnings as well are possible
4782 only in optimizing compilation.
4783
4784 The compiler sees only the calls to @code{setjmp}. It cannot know
4785 where @code{longjmp} will be called; in fact, a signal handler could
4786 call it at any point in the code. As a result, you may get a warning
4787 even when there is in fact no problem because @code{longjmp} cannot
4788 in fact be called at the place that would cause a problem.
4789
4790 Some spurious warnings can be avoided if you declare all the functions
4791 you use that never return as @code{noreturn}. @xref{Function
4792 Attributes}.
4793
4794 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4795
4796 @item -Wunknown-pragmas
4797 @opindex Wunknown-pragmas
4798 @opindex Wno-unknown-pragmas
4799 @cindex warning for unknown pragmas
4800 @cindex unknown pragmas, warning
4801 @cindex pragmas, warning of unknown
4802 Warn when a @code{#pragma} directive is encountered that is not understood by
4803 GCC@. If this command-line option is used, warnings are even issued
4804 for unknown pragmas in system header files. This is not the case if
4805 the warnings are only enabled by the @option{-Wall} command-line option.
4806
4807 @item -Wno-pragmas
4808 @opindex Wno-pragmas
4809 @opindex Wpragmas
4810 Do not warn about misuses of pragmas, such as incorrect parameters,
4811 invalid syntax, or conflicts between pragmas. See also
4812 @option{-Wunknown-pragmas}.
4813
4814 @item -Wstrict-aliasing
4815 @opindex Wstrict-aliasing
4816 @opindex Wno-strict-aliasing
4817 This option is only active when @option{-fstrict-aliasing} is active.
4818 It warns about code that might break the strict aliasing rules that the
4819 compiler is using for optimization. The warning does not catch all
4820 cases, but does attempt to catch the more common pitfalls. It is
4821 included in @option{-Wall}.
4822 It is equivalent to @option{-Wstrict-aliasing=3}
4823
4824 @item -Wstrict-aliasing=n
4825 @opindex Wstrict-aliasing=n
4826 This option is only active when @option{-fstrict-aliasing} is active.
4827 It warns about code that might break the strict aliasing rules that the
4828 compiler is using for optimization.
4829 Higher levels correspond to higher accuracy (fewer false positives).
4830 Higher levels also correspond to more effort, similar to the way @option{-O}
4831 works.
4832 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4833
4834 Level 1: Most aggressive, quick, least accurate.
4835 Possibly useful when higher levels
4836 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4837 false negatives. However, it has many false positives.
4838 Warns for all pointer conversions between possibly incompatible types,
4839 even if never dereferenced. Runs in the front end only.
4840
4841 Level 2: Aggressive, quick, not too precise.
4842 May still have many false positives (not as many as level 1 though),
4843 and few false negatives (but possibly more than level 1).
4844 Unlike level 1, it only warns when an address is taken. Warns about
4845 incomplete types. Runs in the front end only.
4846
4847 Level 3 (default for @option{-Wstrict-aliasing}):
4848 Should have very few false positives and few false
4849 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4850 Takes care of the common pun+dereference pattern in the front end:
4851 @code{*(int*)&some_float}.
4852 If optimization is enabled, it also runs in the back end, where it deals
4853 with multiple statement cases using flow-sensitive points-to information.
4854 Only warns when the converted pointer is dereferenced.
4855 Does not warn about incomplete types.
4856
4857 @item -Wstrict-overflow
4858 @itemx -Wstrict-overflow=@var{n}
4859 @opindex Wstrict-overflow
4860 @opindex Wno-strict-overflow
4861 This option is only active when @option{-fstrict-overflow} is active.
4862 It warns about cases where the compiler optimizes based on the
4863 assumption that signed overflow does not occur. Note that it does not
4864 warn about all cases where the code might overflow: it only warns
4865 about cases where the compiler implements some optimization. Thus
4866 this warning depends on the optimization level.
4867
4868 An optimization that assumes that signed overflow does not occur is
4869 perfectly safe if the values of the variables involved are such that
4870 overflow never does, in fact, occur. Therefore this warning can
4871 easily give a false positive: a warning about code that is not
4872 actually a problem. To help focus on important issues, several
4873 warning levels are defined. No warnings are issued for the use of
4874 undefined signed overflow when estimating how many iterations a loop
4875 requires, in particular when determining whether a loop will be
4876 executed at all.
4877
4878 @table @gcctabopt
4879 @item -Wstrict-overflow=1
4880 Warn about cases that are both questionable and easy to avoid. For
4881 example, with @option{-fstrict-overflow}, the compiler simplifies
4882 @code{x + 1 > x} to @code{1}. This level of
4883 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4884 are not, and must be explicitly requested.
4885
4886 @item -Wstrict-overflow=2
4887 Also warn about other cases where a comparison is simplified to a
4888 constant. For example: @code{abs (x) >= 0}. This can only be
4889 simplified when @option{-fstrict-overflow} is in effect, because
4890 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4891 zero. @option{-Wstrict-overflow} (with no level) is the same as
4892 @option{-Wstrict-overflow=2}.
4893
4894 @item -Wstrict-overflow=3
4895 Also warn about other cases where a comparison is simplified. For
4896 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4897
4898 @item -Wstrict-overflow=4
4899 Also warn about other simplifications not covered by the above cases.
4900 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4901
4902 @item -Wstrict-overflow=5
4903 Also warn about cases where the compiler reduces the magnitude of a
4904 constant involved in a comparison. For example: @code{x + 2 > y} is
4905 simplified to @code{x + 1 >= y}. This is reported only at the
4906 highest warning level because this simplification applies to many
4907 comparisons, so this warning level gives a very large number of
4908 false positives.
4909 @end table
4910
4911 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4912 @opindex Wsuggest-attribute=
4913 @opindex Wno-suggest-attribute=
4914 Warn for cases where adding an attribute may be beneficial. The
4915 attributes currently supported are listed below.
4916
4917 @table @gcctabopt
4918 @item -Wsuggest-attribute=pure
4919 @itemx -Wsuggest-attribute=const
4920 @itemx -Wsuggest-attribute=noreturn
4921 @opindex Wsuggest-attribute=pure
4922 @opindex Wno-suggest-attribute=pure
4923 @opindex Wsuggest-attribute=const
4924 @opindex Wno-suggest-attribute=const
4925 @opindex Wsuggest-attribute=noreturn
4926 @opindex Wno-suggest-attribute=noreturn
4927
4928 Warn about functions that might be candidates for attributes
4929 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4930 functions visible in other compilation units or (in the case of @code{pure} and
4931 @code{const}) if it cannot prove that the function returns normally. A function
4932 returns normally if it doesn't contain an infinite loop or return abnormally
4933 by throwing, calling @code{abort} or trapping. This analysis requires option
4934 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4935 higher. Higher optimization levels improve the accuracy of the analysis.
4936
4937 @item -Wsuggest-attribute=format
4938 @itemx -Wmissing-format-attribute
4939 @opindex Wsuggest-attribute=format
4940 @opindex Wmissing-format-attribute
4941 @opindex Wno-suggest-attribute=format
4942 @opindex Wno-missing-format-attribute
4943 @opindex Wformat
4944 @opindex Wno-format
4945
4946 Warn about function pointers that might be candidates for @code{format}
4947 attributes. Note these are only possible candidates, not absolute ones.
4948 GCC guesses that function pointers with @code{format} attributes that
4949 are used in assignment, initialization, parameter passing or return
4950 statements should have a corresponding @code{format} attribute in the
4951 resulting type. I.e.@: the left-hand side of the assignment or
4952 initialization, the type of the parameter variable, or the return type
4953 of the containing function respectively should also have a @code{format}
4954 attribute to avoid the warning.
4955
4956 GCC also warns about function definitions that might be
4957 candidates for @code{format} attributes. Again, these are only
4958 possible candidates. GCC guesses that @code{format} attributes
4959 might be appropriate for any function that calls a function like
4960 @code{vprintf} or @code{vscanf}, but this might not always be the
4961 case, and some functions for which @code{format} attributes are
4962 appropriate may not be detected.
4963 @end table
4964
4965 @item -Wsuggest-final-types
4966 @opindex Wno-suggest-final-types
4967 @opindex Wsuggest-final-types
4968 Warn about types with virtual methods where code quality would be improved
4969 if the type were declared with the C++11 @code{final} specifier,
4970 or, if possible,
4971 declared in an anonymous namespace. This allows GCC to more aggressively
4972 devirtualize the polymorphic calls. This warning is more effective with link
4973 time optimization, where the information about the class hierarchy graph is
4974 more complete.
4975
4976 @item -Wsuggest-final-methods
4977 @opindex Wno-suggest-final-methods
4978 @opindex Wsuggest-final-methods
4979 Warn about virtual methods where code quality would be improved if the method
4980 were declared with the C++11 @code{final} specifier,
4981 or, if possible, its type were
4982 declared in an anonymous namespace or with the @code{final} specifier.
4983 This warning is
4984 more effective with link time optimization, where the information about the
4985 class hierarchy graph is more complete. It is recommended to first consider
4986 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4987 annotations.
4988
4989 @item -Wsuggest-override
4990 Warn about overriding virtual functions that are not marked with the override
4991 keyword.
4992
4993 @item -Walloca
4994 @opindex Wno-alloca
4995 @opindex Walloca
4996 This option warns on all uses of @code{alloca} in the source.
4997
4998 @item -Walloca-larger-than=@var{n}
4999 This option warns on calls to @code{alloca} that are not bounded by a
5000 controlling predicate limiting its argument of integer type to at most
5001 @var{n} bytes, or calls to @code{alloca} where the bound is unknown.
5002 Arguments of non-integer types are considered unbounded even if they
5003 appear to be constrained to the expected range.
5004
5005 For example, a bounded case of @code{alloca} could be:
5006
5007 @smallexample
5008 void func (size_t n)
5009 @{
5010 void *p;
5011 if (n <= 1000)
5012 p = alloca (n);
5013 else
5014 p = malloc (n);
5015 f (p);
5016 @}
5017 @end smallexample
5018
5019 In the above example, passing @code{-Walloca-larger-than=1000} would not
5020 issue a warning because the call to @code{alloca} is known to be at most
5021 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5022 the compiler would emit a warning.
5023
5024 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5025 controlling predicate constraining its integer argument. For example:
5026
5027 @smallexample
5028 void func ()
5029 @{
5030 void *p = alloca (n);
5031 f (p);
5032 @}
5033 @end smallexample
5034
5035 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5036 a warning, but this time because of the lack of bounds checking.
5037
5038 Note, that even seemingly correct code involving signed integers could
5039 cause a warning:
5040
5041 @smallexample
5042 void func (signed int n)
5043 @{
5044 if (n < 500)
5045 @{
5046 p = alloca (n);
5047 f (p);
5048 @}
5049 @}
5050 @end smallexample
5051
5052 In the above example, @var{n} could be negative, causing a larger than
5053 expected argument to be implicitly cast into the @code{alloca} call.
5054
5055 This option also warns when @code{alloca} is used in a loop.
5056
5057 This warning is not enabled by @option{-Wall}, and is only active when
5058 @option{-ftree-vrp} is active (default for @option{-O2} and above).
5059
5060 See also @option{-Wvla-larger-than=@var{n}}.
5061
5062 @item -Warray-bounds
5063 @itemx -Warray-bounds=@var{n}
5064 @opindex Wno-array-bounds
5065 @opindex Warray-bounds
5066 This option is only active when @option{-ftree-vrp} is active
5067 (default for @option{-O2} and above). It warns about subscripts to arrays
5068 that are always out of bounds. This warning is enabled by @option{-Wall}.
5069
5070 @table @gcctabopt
5071 @item -Warray-bounds=1
5072 This is the warning level of @option{-Warray-bounds} and is enabled
5073 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5074
5075 @item -Warray-bounds=2
5076 This warning level also warns about out of bounds access for
5077 arrays at the end of a struct and for arrays accessed through
5078 pointers. This warning level may give a larger number of
5079 false positives and is deactivated by default.
5080 @end table
5081
5082 @item -Wbool-compare
5083 @opindex Wno-bool-compare
5084 @opindex Wbool-compare
5085 Warn about boolean expression compared with an integer value different from
5086 @code{true}/@code{false}. For instance, the following comparison is
5087 always false:
5088 @smallexample
5089 int n = 5;
5090 @dots{}
5091 if ((n > 1) == 2) @{ @dots{} @}
5092 @end smallexample
5093 This warning is enabled by @option{-Wall}.
5094
5095 @item -Wbool-operation
5096 @opindex Wno-bool-operation
5097 @opindex Wbool-operation
5098 Warn about suspicious operations on expressions of a boolean type. For
5099 instance, bitwise negation of a boolean is very likely a bug in the program.
5100 For C, this warning also warns about incrementing or decrementing a boolean,
5101 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5102 Incrementing a boolean is invalid in C++1z, and deprecated otherwise.)
5103
5104 This warning is enabled by @option{-Wall}.
5105
5106 @item -Wduplicated-cond
5107 @opindex Wno-duplicated-cond
5108 @opindex Wduplicated-cond
5109 Warn about duplicated conditions in an if-else-if chain. For instance,
5110 warn for the following code:
5111 @smallexample
5112 if (p->q != NULL) @{ @dots{} @}
5113 else if (p->q != NULL) @{ @dots{} @}
5114 @end smallexample
5115
5116 @item -Wframe-address
5117 @opindex Wno-frame-address
5118 @opindex Wframe-address
5119 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5120 is called with an argument greater than 0. Such calls may return indeterminate
5121 values or crash the program. The warning is included in @option{-Wall}.
5122
5123 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5124 @opindex Wno-discarded-qualifiers
5125 @opindex Wdiscarded-qualifiers
5126 Do not warn if type qualifiers on pointers are being discarded.
5127 Typically, the compiler warns if a @code{const char *} variable is
5128 passed to a function that takes a @code{char *} parameter. This option
5129 can be used to suppress such a warning.
5130
5131 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5132 @opindex Wno-discarded-array-qualifiers
5133 @opindex Wdiscarded-array-qualifiers
5134 Do not warn if type qualifiers on arrays which are pointer targets
5135 are being discarded. Typically, the compiler warns if a
5136 @code{const int (*)[]} variable is passed to a function that
5137 takes a @code{int (*)[]} parameter. This option can be used to
5138 suppress such a warning.
5139
5140 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5141 @opindex Wno-incompatible-pointer-types
5142 @opindex Wincompatible-pointer-types
5143 Do not warn when there is a conversion between pointers that have incompatible
5144 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5145 which warns for pointer argument passing or assignment with different
5146 signedness.
5147
5148 @item -Wno-int-conversion @r{(C and Objective-C only)}
5149 @opindex Wno-int-conversion
5150 @opindex Wint-conversion
5151 Do not warn about incompatible integer to pointer and pointer to integer
5152 conversions. This warning is about implicit conversions; for explicit
5153 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5154 @option{-Wno-pointer-to-int-cast} may be used.
5155
5156 @item -Wno-div-by-zero
5157 @opindex Wno-div-by-zero
5158 @opindex Wdiv-by-zero
5159 Do not warn about compile-time integer division by zero. Floating-point
5160 division by zero is not warned about, as it can be a legitimate way of
5161 obtaining infinities and NaNs.
5162
5163 @item -Wsystem-headers
5164 @opindex Wsystem-headers
5165 @opindex Wno-system-headers
5166 @cindex warnings from system headers
5167 @cindex system headers, warnings from
5168 Print warning messages for constructs found in system header files.
5169 Warnings from system headers are normally suppressed, on the assumption
5170 that they usually do not indicate real problems and would only make the
5171 compiler output harder to read. Using this command-line option tells
5172 GCC to emit warnings from system headers as if they occurred in user
5173 code. However, note that using @option{-Wall} in conjunction with this
5174 option does @emph{not} warn about unknown pragmas in system
5175 headers---for that, @option{-Wunknown-pragmas} must also be used.
5176
5177 @item -Wtautological-compare
5178 @opindex Wtautological-compare
5179 @opindex Wno-tautological-compare
5180 Warn if a self-comparison always evaluates to true or false. This
5181 warning detects various mistakes such as:
5182 @smallexample
5183 int i = 1;
5184 @dots{}
5185 if (i > i) @{ @dots{} @}
5186 @end smallexample
5187 This warning is enabled by @option{-Wall}.
5188
5189 @item -Wtrampolines
5190 @opindex Wtrampolines
5191 @opindex Wno-trampolines
5192 Warn about trampolines generated for pointers to nested functions.
5193 A trampoline is a small piece of data or code that is created at run
5194 time on the stack when the address of a nested function is taken, and is
5195 used to call the nested function indirectly. For some targets, it is
5196 made up of data only and thus requires no special treatment. But, for
5197 most targets, it is made up of code and thus requires the stack to be
5198 made executable in order for the program to work properly.
5199
5200 @item -Wfloat-equal
5201 @opindex Wfloat-equal
5202 @opindex Wno-float-equal
5203 Warn if floating-point values are used in equality comparisons.
5204
5205 The idea behind this is that sometimes it is convenient (for the
5206 programmer) to consider floating-point values as approximations to
5207 infinitely precise real numbers. If you are doing this, then you need
5208 to compute (by analyzing the code, or in some other way) the maximum or
5209 likely maximum error that the computation introduces, and allow for it
5210 when performing comparisons (and when producing output, but that's a
5211 different problem). In particular, instead of testing for equality, you
5212 should check to see whether the two values have ranges that overlap; and
5213 this is done with the relational operators, so equality comparisons are
5214 probably mistaken.
5215
5216 @item -Wtraditional @r{(C and Objective-C only)}
5217 @opindex Wtraditional
5218 @opindex Wno-traditional
5219 Warn about certain constructs that behave differently in traditional and
5220 ISO C@. Also warn about ISO C constructs that have no traditional C
5221 equivalent, and/or problematic constructs that should be avoided.
5222
5223 @itemize @bullet
5224 @item
5225 Macro parameters that appear within string literals in the macro body.
5226 In traditional C macro replacement takes place within string literals,
5227 but in ISO C it does not.
5228
5229 @item
5230 In traditional C, some preprocessor directives did not exist.
5231 Traditional preprocessors only considered a line to be a directive
5232 if the @samp{#} appeared in column 1 on the line. Therefore
5233 @option{-Wtraditional} warns about directives that traditional C
5234 understands but ignores because the @samp{#} does not appear as the
5235 first character on the line. It also suggests you hide directives like
5236 @code{#pragma} not understood by traditional C by indenting them. Some
5237 traditional implementations do not recognize @code{#elif}, so this option
5238 suggests avoiding it altogether.
5239
5240 @item
5241 A function-like macro that appears without arguments.
5242
5243 @item
5244 The unary plus operator.
5245
5246 @item
5247 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5248 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5249 constants.) Note, these suffixes appear in macros defined in the system
5250 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5251 Use of these macros in user code might normally lead to spurious
5252 warnings, however GCC's integrated preprocessor has enough context to
5253 avoid warning in these cases.
5254
5255 @item
5256 A function declared external in one block and then used after the end of
5257 the block.
5258
5259 @item
5260 A @code{switch} statement has an operand of type @code{long}.
5261
5262 @item
5263 A non-@code{static} function declaration follows a @code{static} one.
5264 This construct is not accepted by some traditional C compilers.
5265
5266 @item
5267 The ISO type of an integer constant has a different width or
5268 signedness from its traditional type. This warning is only issued if
5269 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5270 typically represent bit patterns, are not warned about.
5271
5272 @item
5273 Usage of ISO string concatenation is detected.
5274
5275 @item
5276 Initialization of automatic aggregates.
5277
5278 @item
5279 Identifier conflicts with labels. Traditional C lacks a separate
5280 namespace for labels.
5281
5282 @item
5283 Initialization of unions. If the initializer is zero, the warning is
5284 omitted. This is done under the assumption that the zero initializer in
5285 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
5286 initializer warnings and relies on default initialization to zero in the
5287 traditional C case.
5288
5289 @item
5290 Conversions by prototypes between fixed/floating-point values and vice
5291 versa. The absence of these prototypes when compiling with traditional
5292 C causes serious problems. This is a subset of the possible
5293 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
5294
5295 @item
5296 Use of ISO C style function definitions. This warning intentionally is
5297 @emph{not} issued for prototype declarations or variadic functions
5298 because these ISO C features appear in your code when using
5299 libiberty's traditional C compatibility macros, @code{PARAMS} and
5300 @code{VPARAMS}. This warning is also bypassed for nested functions
5301 because that feature is already a GCC extension and thus not relevant to
5302 traditional C compatibility.
5303 @end itemize
5304
5305 @item -Wtraditional-conversion @r{(C and Objective-C only)}
5306 @opindex Wtraditional-conversion
5307 @opindex Wno-traditional-conversion
5308 Warn if a prototype causes a type conversion that is different from what
5309 would happen to the same argument in the absence of a prototype. This
5310 includes conversions of fixed point to floating and vice versa, and
5311 conversions changing the width or signedness of a fixed-point argument
5312 except when the same as the default promotion.
5313
5314 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
5315 @opindex Wdeclaration-after-statement
5316 @opindex Wno-declaration-after-statement
5317 Warn when a declaration is found after a statement in a block. This
5318 construct, known from C++, was introduced with ISO C99 and is by default
5319 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
5320
5321 @item -Wundef
5322 @opindex Wundef
5323 @opindex Wno-undef
5324 Warn if an undefined identifier is evaluated in an @code{#if} directive.
5325
5326 @item -Wno-endif-labels
5327 @opindex Wno-endif-labels
5328 @opindex Wendif-labels
5329 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
5330
5331 @item -Wshadow
5332 @opindex Wshadow
5333 @opindex Wno-shadow
5334 Warn whenever a local variable or type declaration shadows another
5335 variable, parameter, type, class member (in C++), or instance variable
5336 (in Objective-C) or whenever a built-in function is shadowed. Note
5337 that in C++, the compiler warns if a local variable shadows an
5338 explicit typedef, but not if it shadows a struct/class/enum.
5339 Same as @option{-Wshadow=global}.
5340
5341 @item -Wno-shadow-ivar @r{(Objective-C only)}
5342 @opindex Wno-shadow-ivar
5343 @opindex Wshadow-ivar
5344 Do not warn whenever a local variable shadows an instance variable in an
5345 Objective-C method.
5346
5347 @item -Wshadow=global
5348 @opindex Wshadow=local
5349 The default for @option{-Wshadow}. Warns for any (global) shadowing.
5350
5351 @item -Wshadow=local
5352 @opindex Wshadow=local
5353 Warn when a local variable shadows another local variable or parameter.
5354 This warning is enabled by @option{-Wshadow=global}.
5355
5356 @item -Wshadow=compatible-local
5357 @opindex Wshadow=compatible-local
5358 Warn when a local variable shadows another local variable or parameter
5359 whose type is compatible with that of the shadowing variable. In C++,
5360 type compatibility here means the type of the shadowing variable can be
5361 converted to that of the shadowed variable. The creation of this flag
5362 (in addition to @option{-Wshadow=local}) is based on the idea that when
5363 a local variable shadows another one of incompatible type, it is most
5364 likely intentional, not a bug or typo, as shown in the following example:
5365
5366 @smallexample
5367 @group
5368 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5369 @{
5370 for (int i = 0; i < N; ++i)
5371 @{
5372 ...
5373 @}
5374 ...
5375 @}
5376 @end group
5377 @end smallexample
5378
5379 Since the two variable @code{i} in the example above have incompatible types,
5380 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
5381 Because their types are incompatible, if a programmer accidentally uses one
5382 in place of the other, type checking will catch that and emit an error or
5383 warning. So not warning (about shadowing) in this case will not lead to
5384 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
5385 possibly reduce the number of warnings triggered by intentional shadowing.
5386
5387 This warning is enabled by @option{-Wshadow=local}.
5388
5389 @item -Wlarger-than=@var{len}
5390 @opindex Wlarger-than=@var{len}
5391 @opindex Wlarger-than-@var{len}
5392 Warn whenever an object of larger than @var{len} bytes is defined.
5393
5394 @item -Wframe-larger-than=@var{len}
5395 @opindex Wframe-larger-than
5396 Warn if the size of a function frame is larger than @var{len} bytes.
5397 The computation done to determine the stack frame size is approximate
5398 and not conservative.
5399 The actual requirements may be somewhat greater than @var{len}
5400 even if you do not get a warning. In addition, any space allocated
5401 via @code{alloca}, variable-length arrays, or related constructs
5402 is not included by the compiler when determining
5403 whether or not to issue a warning.
5404
5405 @item -Wno-free-nonheap-object
5406 @opindex Wno-free-nonheap-object
5407 @opindex Wfree-nonheap-object
5408 Do not warn when attempting to free an object that was not allocated
5409 on the heap.
5410
5411 @item -Wstack-usage=@var{len}
5412 @opindex Wstack-usage
5413 Warn if the stack usage of a function might be larger than @var{len} bytes.
5414 The computation done to determine the stack usage is conservative.
5415 Any space allocated via @code{alloca}, variable-length arrays, or related
5416 constructs is included by the compiler when determining whether or not to
5417 issue a warning.
5418
5419 The message is in keeping with the output of @option{-fstack-usage}.
5420
5421 @itemize
5422 @item
5423 If the stack usage is fully static but exceeds the specified amount, it's:
5424
5425 @smallexample
5426 warning: stack usage is 1120 bytes
5427 @end smallexample
5428 @item
5429 If the stack usage is (partly) dynamic but bounded, it's:
5430
5431 @smallexample
5432 warning: stack usage might be 1648 bytes
5433 @end smallexample
5434 @item
5435 If the stack usage is (partly) dynamic and not bounded, it's:
5436
5437 @smallexample
5438 warning: stack usage might be unbounded
5439 @end smallexample
5440 @end itemize
5441
5442 @item -Wunsafe-loop-optimizations
5443 @opindex Wunsafe-loop-optimizations
5444 @opindex Wno-unsafe-loop-optimizations
5445 Warn if the loop cannot be optimized because the compiler cannot
5446 assume anything on the bounds of the loop indices. With
5447 @option{-funsafe-loop-optimizations} warn if the compiler makes
5448 such assumptions.
5449
5450 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
5451 @opindex Wno-pedantic-ms-format
5452 @opindex Wpedantic-ms-format
5453 When used in combination with @option{-Wformat}
5454 and @option{-pedantic} without GNU extensions, this option
5455 disables the warnings about non-ISO @code{printf} / @code{scanf} format
5456 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
5457 which depend on the MS runtime.
5458
5459 @item -Waligned-new
5460 @opindex Waligned-new
5461 @opindex Wno-aligned-new
5462 Warn about a new-expression of a type that requires greater alignment
5463 than the @code{alignof(std::max_align_t)} but uses an allocation
5464 function without an explicit alignment parameter. This option is
5465 enabled by @option{-Wall}.
5466
5467 Normally this only warns about global allocation functions, but
5468 @option{-Waligned-new=all} also warns about class member allocation
5469 functions.
5470
5471 @item -Wplacement-new
5472 @itemx -Wplacement-new=@var{n}
5473 @opindex Wplacement-new
5474 @opindex Wno-placement-new
5475 Warn about placement new expressions with undefined behavior, such as
5476 constructing an object in a buffer that is smaller than the type of
5477 the object. For example, the placement new expression below is diagnosed
5478 because it attempts to construct an array of 64 integers in a buffer only
5479 64 bytes large.
5480 @smallexample
5481 char buf [64];
5482 new (buf) int[64];
5483 @end smallexample
5484 This warning is enabled by default.
5485
5486 @table @gcctabopt
5487 @item -Wplacement-new=1
5488 This is the default warning level of @option{-Wplacement-new}. At this
5489 level the warning is not issued for some strictly undefined constructs that
5490 GCC allows as extensions for compatibility with legacy code. For example,
5491 the following @code{new} expression is not diagnosed at this level even
5492 though it has undefined behavior according to the C++ standard because
5493 it writes past the end of the one-element array.
5494 @smallexample
5495 struct S @{ int n, a[1]; @};
5496 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5497 new (s->a)int [32]();
5498 @end smallexample
5499
5500 @item -Wplacement-new=2
5501 At this level, in addition to diagnosing all the same constructs as at level
5502 1, a diagnostic is also issued for placement new expressions that construct
5503 an object in the last member of structure whose type is an array of a single
5504 element and whose size is less than the size of the object being constructed.
5505 While the previous example would be diagnosed, the following construct makes
5506 use of the flexible member array extension to avoid the warning at level 2.
5507 @smallexample
5508 struct S @{ int n, a[]; @};
5509 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5510 new (s->a)int [32]();
5511 @end smallexample
5512
5513 @end table
5514
5515 @item -Wpointer-arith
5516 @opindex Wpointer-arith
5517 @opindex Wno-pointer-arith
5518 Warn about anything that depends on the ``size of'' a function type or
5519 of @code{void}. GNU C assigns these types a size of 1, for
5520 convenience in calculations with @code{void *} pointers and pointers
5521 to functions. In C++, warn also when an arithmetic operation involves
5522 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
5523
5524 @item -Wtype-limits
5525 @opindex Wtype-limits
5526 @opindex Wno-type-limits
5527 Warn if a comparison is always true or always false due to the limited
5528 range of the data type, but do not warn for constant expressions. For
5529 example, warn if an unsigned variable is compared against zero with
5530 @code{<} or @code{>=}. This warning is also enabled by
5531 @option{-Wextra}.
5532
5533 @item -Wbad-function-cast @r{(C and Objective-C only)}
5534 @opindex Wbad-function-cast
5535 @opindex Wno-bad-function-cast
5536 Warn when a function call is cast to a non-matching type.
5537 For example, warn if a call to a function returning an integer type
5538 is cast to a pointer type.
5539
5540 @item -Wc90-c99-compat @r{(C and Objective-C only)}
5541 @opindex Wc90-c99-compat
5542 @opindex Wno-c90-c99-compat
5543 Warn about features not present in ISO C90, but present in ISO C99.
5544 For instance, warn about use of variable length arrays, @code{long long}
5545 type, @code{bool} type, compound literals, designated initializers, and so
5546 on. This option is independent of the standards mode. Warnings are disabled
5547 in the expression that follows @code{__extension__}.
5548
5549 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5550 @opindex Wc99-c11-compat
5551 @opindex Wno-c99-c11-compat
5552 Warn about features not present in ISO C99, but present in ISO C11.
5553 For instance, warn about use of anonymous structures and unions,
5554 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5555 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5556 and so on. This option is independent of the standards mode. Warnings are
5557 disabled in the expression that follows @code{__extension__}.
5558
5559 @item -Wc++-compat @r{(C and Objective-C only)}
5560 @opindex Wc++-compat
5561 Warn about ISO C constructs that are outside of the common subset of
5562 ISO C and ISO C++, e.g.@: request for implicit conversion from
5563 @code{void *} to a pointer to non-@code{void} type.
5564
5565 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5566 @opindex Wc++11-compat
5567 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5568 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5569 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5570 enabled by @option{-Wall}.
5571
5572 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5573 @opindex Wc++14-compat
5574 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5575 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5576
5577 @item -Wc++1z-compat @r{(C++ and Objective-C++ only)}
5578 @opindex Wc++1z-compat
5579 Warn about C++ constructs whose meaning differs between ISO C++ 2014
5580 and the forthoming ISO C++ 2017(?). This warning is enabled by @option{-Wall}.
5581
5582 @item -Wcast-qual
5583 @opindex Wcast-qual
5584 @opindex Wno-cast-qual
5585 Warn whenever a pointer is cast so as to remove a type qualifier from
5586 the target type. For example, warn if a @code{const char *} is cast
5587 to an ordinary @code{char *}.
5588
5589 Also warn when making a cast that introduces a type qualifier in an
5590 unsafe way. For example, casting @code{char **} to @code{const char **}
5591 is unsafe, as in this example:
5592
5593 @smallexample
5594 /* p is char ** value. */
5595 const char **q = (const char **) p;
5596 /* Assignment of readonly string to const char * is OK. */
5597 *q = "string";
5598 /* Now char** pointer points to read-only memory. */
5599 **p = 'b';
5600 @end smallexample
5601
5602 @item -Wcast-align
5603 @opindex Wcast-align
5604 @opindex Wno-cast-align
5605 Warn whenever a pointer is cast such that the required alignment of the
5606 target is increased. For example, warn if a @code{char *} is cast to
5607 an @code{int *} on machines where integers can only be accessed at
5608 two- or four-byte boundaries.
5609
5610 @item -Wwrite-strings
5611 @opindex Wwrite-strings
5612 @opindex Wno-write-strings
5613 When compiling C, give string constants the type @code{const
5614 char[@var{length}]} so that copying the address of one into a
5615 non-@code{const} @code{char *} pointer produces a warning. These
5616 warnings help you find at compile time code that can try to write
5617 into a string constant, but only if you have been very careful about
5618 using @code{const} in declarations and prototypes. Otherwise, it is
5619 just a nuisance. This is why we did not make @option{-Wall} request
5620 these warnings.
5621
5622 When compiling C++, warn about the deprecated conversion from string
5623 literals to @code{char *}. This warning is enabled by default for C++
5624 programs.
5625
5626 @item -Wclobbered
5627 @opindex Wclobbered
5628 @opindex Wno-clobbered
5629 Warn for variables that might be changed by @code{longjmp} or
5630 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5631
5632 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5633 @opindex Wconditionally-supported
5634 @opindex Wno-conditionally-supported
5635 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5636
5637 @item -Wconversion
5638 @opindex Wconversion
5639 @opindex Wno-conversion
5640 Warn for implicit conversions that may alter a value. This includes
5641 conversions between real and integer, like @code{abs (x)} when
5642 @code{x} is @code{double}; conversions between signed and unsigned,
5643 like @code{unsigned ui = -1}; and conversions to smaller types, like
5644 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5645 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5646 changed by the conversion like in @code{abs (2.0)}. Warnings about
5647 conversions between signed and unsigned integers can be disabled by
5648 using @option{-Wno-sign-conversion}.
5649
5650 For C++, also warn for confusing overload resolution for user-defined
5651 conversions; and conversions that never use a type conversion
5652 operator: conversions to @code{void}, the same type, a base class or a
5653 reference to them. Warnings about conversions between signed and
5654 unsigned integers are disabled by default in C++ unless
5655 @option{-Wsign-conversion} is explicitly enabled.
5656
5657 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5658 @opindex Wconversion-null
5659 @opindex Wno-conversion-null
5660 Do not warn for conversions between @code{NULL} and non-pointer
5661 types. @option{-Wconversion-null} is enabled by default.
5662
5663 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5664 @opindex Wzero-as-null-pointer-constant
5665 @opindex Wno-zero-as-null-pointer-constant
5666 Warn when a literal @samp{0} is used as null pointer constant. This can
5667 be useful to facilitate the conversion to @code{nullptr} in C++11.
5668
5669 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5670 @opindex Wsubobject-linkage
5671 @opindex Wno-subobject-linkage
5672 Warn if a class type has a base or a field whose type uses the anonymous
5673 namespace or depends on a type with no linkage. If a type A depends on
5674 a type B with no or internal linkage, defining it in multiple
5675 translation units would be an ODR violation because the meaning of B
5676 is different in each translation unit. If A only appears in a single
5677 translation unit, the best way to silence the warning is to give it
5678 internal linkage by putting it in an anonymous namespace as well. The
5679 compiler doesn't give this warning for types defined in the main .C
5680 file, as those are unlikely to have multiple definitions.
5681 @option{-Wsubobject-linkage} is enabled by default.
5682
5683 @item -Wdangling-else
5684 @opindex Wdangling-else
5685 @opindex Wno-dangling-else
5686 Warn about constructions where there may be confusion to which
5687 @code{if} statement an @code{else} branch belongs. Here is an example of
5688 such a case:
5689
5690 @smallexample
5691 @group
5692 @{
5693 if (a)
5694 if (b)
5695 foo ();
5696 else
5697 bar ();
5698 @}
5699 @end group
5700 @end smallexample
5701
5702 In C/C++, every @code{else} branch belongs to the innermost possible
5703 @code{if} statement, which in this example is @code{if (b)}. This is
5704 often not what the programmer expected, as illustrated in the above
5705 example by indentation the programmer chose. When there is the
5706 potential for this confusion, GCC issues a warning when this flag
5707 is specified. To eliminate the warning, add explicit braces around
5708 the innermost @code{if} statement so there is no way the @code{else}
5709 can belong to the enclosing @code{if}. The resulting code
5710 looks like this:
5711
5712 @smallexample
5713 @group
5714 @{
5715 if (a)
5716 @{
5717 if (b)
5718 foo ();
5719 else
5720 bar ();
5721 @}
5722 @}
5723 @end group
5724 @end smallexample
5725
5726 This warning is enabled by @option{-Wparentheses}.
5727
5728 @item -Wdate-time
5729 @opindex Wdate-time
5730 @opindex Wno-date-time
5731 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5732 are encountered as they might prevent bit-wise-identical reproducible
5733 compilations.
5734
5735 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5736 @opindex Wdelete-incomplete
5737 @opindex Wno-delete-incomplete
5738 Warn when deleting a pointer to incomplete type, which may cause
5739 undefined behavior at runtime. This warning is enabled by default.
5740
5741 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5742 @opindex Wuseless-cast
5743 @opindex Wno-useless-cast
5744 Warn when an expression is casted to its own type.
5745
5746 @item -Wempty-body
5747 @opindex Wempty-body
5748 @opindex Wno-empty-body
5749 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5750 while} statement. This warning is also enabled by @option{-Wextra}.
5751
5752 @item -Wenum-compare
5753 @opindex Wenum-compare
5754 @opindex Wno-enum-compare
5755 Warn about a comparison between values of different enumerated types.
5756 In C++ enumeral mismatches in conditional expressions are also
5757 diagnosed and the warning is enabled by default. In C this warning is
5758 enabled by @option{-Wall}.
5759
5760 @item -Wjump-misses-init @r{(C, Objective-C only)}
5761 @opindex Wjump-misses-init
5762 @opindex Wno-jump-misses-init
5763 Warn if a @code{goto} statement or a @code{switch} statement jumps
5764 forward across the initialization of a variable, or jumps backward to a
5765 label after the variable has been initialized. This only warns about
5766 variables that are initialized when they are declared. This warning is
5767 only supported for C and Objective-C; in C++ this sort of branch is an
5768 error in any case.
5769
5770 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5771 can be disabled with the @option{-Wno-jump-misses-init} option.
5772
5773 @item -Wsign-compare
5774 @opindex Wsign-compare
5775 @opindex Wno-sign-compare
5776 @cindex warning for comparison of signed and unsigned values
5777 @cindex comparison of signed and unsigned values, warning
5778 @cindex signed and unsigned values, comparison warning
5779 Warn when a comparison between signed and unsigned values could produce
5780 an incorrect result when the signed value is converted to unsigned.
5781 In C++, this warning is also enabled by @option{-Wall}. In C, it is
5782 also enabled by @option{-Wextra}.
5783
5784 @item -Wsign-conversion
5785 @opindex Wsign-conversion
5786 @opindex Wno-sign-conversion
5787 Warn for implicit conversions that may change the sign of an integer
5788 value, like assigning a signed integer expression to an unsigned
5789 integer variable. An explicit cast silences the warning. In C, this
5790 option is enabled also by @option{-Wconversion}.
5791
5792 @item -Wfloat-conversion
5793 @opindex Wfloat-conversion
5794 @opindex Wno-float-conversion
5795 Warn for implicit conversions that reduce the precision of a real value.
5796 This includes conversions from real to integer, and from higher precision
5797 real to lower precision real values. This option is also enabled by
5798 @option{-Wconversion}.
5799
5800 @item -Wno-scalar-storage-order
5801 @opindex -Wno-scalar-storage-order
5802 @opindex -Wscalar-storage-order
5803 Do not warn on suspicious constructs involving reverse scalar storage order.
5804
5805 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
5806 @opindex Wsized-deallocation
5807 @opindex Wno-sized-deallocation
5808 Warn about a definition of an unsized deallocation function
5809 @smallexample
5810 void operator delete (void *) noexcept;
5811 void operator delete[] (void *) noexcept;
5812 @end smallexample
5813 without a definition of the corresponding sized deallocation function
5814 @smallexample
5815 void operator delete (void *, std::size_t) noexcept;
5816 void operator delete[] (void *, std::size_t) noexcept;
5817 @end smallexample
5818 or vice versa. Enabled by @option{-Wextra} along with
5819 @option{-fsized-deallocation}.
5820
5821 @item -Wsizeof-pointer-memaccess
5822 @opindex Wsizeof-pointer-memaccess
5823 @opindex Wno-sizeof-pointer-memaccess
5824 Warn for suspicious length parameters to certain string and memory built-in
5825 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
5826 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
5827 but a pointer, and suggests a possible fix, or about
5828 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
5829 @option{-Wall}.
5830
5831 @item -Wsizeof-array-argument
5832 @opindex Wsizeof-array-argument
5833 @opindex Wno-sizeof-array-argument
5834 Warn when the @code{sizeof} operator is applied to a parameter that is
5835 declared as an array in a function definition. This warning is enabled by
5836 default for C and C++ programs.
5837
5838 @item -Wmemset-elt-size
5839 @opindex Wmemset-elt-size
5840 @opindex Wno-memset-elt-size
5841 Warn for suspicious calls to the @code{memset} built-in function, if the
5842 first argument references an array, and the third argument is a number
5843 equal to the number of elements, but not equal to the size of the array
5844 in memory. This indicates that the user has omitted a multiplication by
5845 the element size. This warning is enabled by @option{-Wall}.
5846
5847 @item -Wmemset-transposed-args
5848 @opindex Wmemset-transposed-args
5849 @opindex Wno-memset-transposed-args
5850 Warn for suspicious calls to the @code{memset} built-in function, if the
5851 second argument is not zero and the third argument is zero. This warns e.g.@
5852 about @code{memset (buf, sizeof buf, 0)} where most probably
5853 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
5854 is only emitted if the third argument is literal zero. If it is some
5855 expression that is folded to zero, a cast of zero to some type, etc.,
5856 it is far less likely that the user has mistakenly exchanged the arguments
5857 and no warning is emitted. This warning is enabled by @option{-Wall}.
5858
5859 @item -Waddress
5860 @opindex Waddress
5861 @opindex Wno-address
5862 Warn about suspicious uses of memory addresses. These include using
5863 the address of a function in a conditional expression, such as
5864 @code{void func(void); if (func)}, and comparisons against the memory
5865 address of a string literal, such as @code{if (x == "abc")}. Such
5866 uses typically indicate a programmer error: the address of a function
5867 always evaluates to true, so their use in a conditional usually
5868 indicate that the programmer forgot the parentheses in a function
5869 call; and comparisons against string literals result in unspecified
5870 behavior and are not portable in C, so they usually indicate that the
5871 programmer intended to use @code{strcmp}. This warning is enabled by
5872 @option{-Wall}.
5873
5874 @item -Wlogical-op
5875 @opindex Wlogical-op
5876 @opindex Wno-logical-op
5877 Warn about suspicious uses of logical operators in expressions.
5878 This includes using logical operators in contexts where a
5879 bit-wise operator is likely to be expected. Also warns when
5880 the operands of a logical operator are the same:
5881 @smallexample
5882 extern int a;
5883 if (a < 0 && a < 0) @{ @dots{} @}
5884 @end smallexample
5885
5886 @item -Wlogical-not-parentheses
5887 @opindex Wlogical-not-parentheses
5888 @opindex Wno-logical-not-parentheses
5889 Warn about logical not used on the left hand side operand of a comparison.
5890 This option does not warn if the right operand is considered to be a boolean
5891 expression. Its purpose is to detect suspicious code like the following:
5892 @smallexample
5893 int a;
5894 @dots{}
5895 if (!a > 1) @{ @dots{} @}
5896 @end smallexample
5897
5898 It is possible to suppress the warning by wrapping the LHS into
5899 parentheses:
5900 @smallexample
5901 if ((!a) > 1) @{ @dots{} @}
5902 @end smallexample
5903
5904 This warning is enabled by @option{-Wall}.
5905
5906 @item -Waggregate-return
5907 @opindex Waggregate-return
5908 @opindex Wno-aggregate-return
5909 Warn if any functions that return structures or unions are defined or
5910 called. (In languages where you can return an array, this also elicits
5911 a warning.)
5912
5913 @item -Wno-aggressive-loop-optimizations
5914 @opindex Wno-aggressive-loop-optimizations
5915 @opindex Waggressive-loop-optimizations
5916 Warn if in a loop with constant number of iterations the compiler detects
5917 undefined behavior in some statement during one or more of the iterations.
5918
5919 @item -Wno-attributes
5920 @opindex Wno-attributes
5921 @opindex Wattributes
5922 Do not warn if an unexpected @code{__attribute__} is used, such as
5923 unrecognized attributes, function attributes applied to variables,
5924 etc. This does not stop errors for incorrect use of supported
5925 attributes.
5926
5927 @item -Wno-builtin-macro-redefined
5928 @opindex Wno-builtin-macro-redefined
5929 @opindex Wbuiltin-macro-redefined
5930 Do not warn if certain built-in macros are redefined. This suppresses
5931 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
5932 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
5933
5934 @item -Wstrict-prototypes @r{(C and Objective-C only)}
5935 @opindex Wstrict-prototypes
5936 @opindex Wno-strict-prototypes
5937 Warn if a function is declared or defined without specifying the
5938 argument types. (An old-style function definition is permitted without
5939 a warning if preceded by a declaration that specifies the argument
5940 types.)
5941
5942 @item -Wold-style-declaration @r{(C and Objective-C only)}
5943 @opindex Wold-style-declaration
5944 @opindex Wno-old-style-declaration
5945 Warn for obsolescent usages, according to the C Standard, in a
5946 declaration. For example, warn if storage-class specifiers like
5947 @code{static} are not the first things in a declaration. This warning
5948 is also enabled by @option{-Wextra}.
5949
5950 @item -Wold-style-definition @r{(C and Objective-C only)}
5951 @opindex Wold-style-definition
5952 @opindex Wno-old-style-definition
5953 Warn if an old-style function definition is used. A warning is given
5954 even if there is a previous prototype.
5955
5956 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5957 @opindex Wmissing-parameter-type
5958 @opindex Wno-missing-parameter-type
5959 A function parameter is declared without a type specifier in K&R-style
5960 functions:
5961
5962 @smallexample
5963 void foo(bar) @{ @}
5964 @end smallexample
5965
5966 This warning is also enabled by @option{-Wextra}.
5967
5968 @item -Wmissing-prototypes @r{(C and Objective-C only)}
5969 @opindex Wmissing-prototypes
5970 @opindex Wno-missing-prototypes
5971 Warn if a global function is defined without a previous prototype
5972 declaration. This warning is issued even if the definition itself
5973 provides a prototype. Use this option to detect global functions
5974 that do not have a matching prototype declaration in a header file.
5975 This option is not valid for C++ because all function declarations
5976 provide prototypes and a non-matching declaration declares an
5977 overload rather than conflict with an earlier declaration.
5978 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
5979
5980 @item -Wmissing-declarations
5981 @opindex Wmissing-declarations
5982 @opindex Wno-missing-declarations
5983 Warn if a global function is defined without a previous declaration.
5984 Do so even if the definition itself provides a prototype.
5985 Use this option to detect global functions that are not declared in
5986 header files. In C, no warnings are issued for functions with previous
5987 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
5988 missing prototypes. In C++, no warnings are issued for function templates,
5989 or for inline functions, or for functions in anonymous namespaces.
5990
5991 @item -Wmissing-field-initializers
5992 @opindex Wmissing-field-initializers
5993 @opindex Wno-missing-field-initializers
5994 @opindex W
5995 @opindex Wextra
5996 @opindex Wno-extra
5997 Warn if a structure's initializer has some fields missing. For
5998 example, the following code causes such a warning, because
5999 @code{x.h} is implicitly zero:
6000
6001 @smallexample
6002 struct s @{ int f, g, h; @};
6003 struct s x = @{ 3, 4 @};
6004 @end smallexample
6005
6006 This option does not warn about designated initializers, so the following
6007 modification does not trigger a warning:
6008
6009 @smallexample
6010 struct s @{ int f, g, h; @};
6011 struct s x = @{ .f = 3, .g = 4 @};
6012 @end smallexample
6013
6014 In C++ this option does not warn either about the empty @{ @}
6015 initializer, for example:
6016
6017 @smallexample
6018 struct s @{ int f, g, h; @};
6019 s x = @{ @};
6020 @end smallexample
6021
6022 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6023 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6024
6025 @item -Wno-multichar
6026 @opindex Wno-multichar
6027 @opindex Wmultichar
6028 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6029 Usually they indicate a typo in the user's code, as they have
6030 implementation-defined values, and should not be used in portable code.
6031
6032 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
6033 @opindex Wnormalized=
6034 @opindex Wnormalized
6035 @opindex Wno-normalized
6036 @cindex NFC
6037 @cindex NFKC
6038 @cindex character set, input normalization
6039 In ISO C and ISO C++, two identifiers are different if they are
6040 different sequences of characters. However, sometimes when characters
6041 outside the basic ASCII character set are used, you can have two
6042 different character sequences that look the same. To avoid confusion,
6043 the ISO 10646 standard sets out some @dfn{normalization rules} which
6044 when applied ensure that two sequences that look the same are turned into
6045 the same sequence. GCC can warn you if you are using identifiers that
6046 have not been normalized; this option controls that warning.
6047
6048 There are four levels of warning supported by GCC@. The default is
6049 @option{-Wnormalized=nfc}, which warns about any identifier that is
6050 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6051 recommended form for most uses. It is equivalent to
6052 @option{-Wnormalized}.
6053
6054 Unfortunately, there are some characters allowed in identifiers by
6055 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6056 identifiers. That is, there's no way to use these symbols in portable
6057 ISO C or C++ and have all your identifiers in NFC@.
6058 @option{-Wnormalized=id} suppresses the warning for these characters.
6059 It is hoped that future versions of the standards involved will correct
6060 this, which is why this option is not the default.
6061
6062 You can switch the warning off for all characters by writing
6063 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6064 only do this if you are using some other normalization scheme (like
6065 ``D''), because otherwise you can easily create bugs that are
6066 literally impossible to see.
6067
6068 Some characters in ISO 10646 have distinct meanings but look identical
6069 in some fonts or display methodologies, especially once formatting has
6070 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6071 LETTER N'', displays just like a regular @code{n} that has been
6072 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6073 normalization scheme to convert all these into a standard form as
6074 well, and GCC warns if your code is not in NFKC if you use
6075 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6076 about every identifier that contains the letter O because it might be
6077 confused with the digit 0, and so is not the default, but may be
6078 useful as a local coding convention if the programming environment
6079 cannot be fixed to display these characters distinctly.
6080
6081 @item -Wno-deprecated
6082 @opindex Wno-deprecated
6083 @opindex Wdeprecated
6084 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6085
6086 @item -Wno-deprecated-declarations
6087 @opindex Wno-deprecated-declarations
6088 @opindex Wdeprecated-declarations
6089 Do not warn about uses of functions (@pxref{Function Attributes}),
6090 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6091 Attributes}) marked as deprecated by using the @code{deprecated}
6092 attribute.
6093
6094 @item -Wno-overflow
6095 @opindex Wno-overflow
6096 @opindex Woverflow
6097 Do not warn about compile-time overflow in constant expressions.
6098
6099 @item -Wno-odr
6100 @opindex Wno-odr
6101 @opindex Wodr
6102 Warn about One Definition Rule violations during link-time optimization.
6103 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6104
6105 @item -Wopenmp-simd
6106 @opindex Wopenm-simd
6107 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
6108 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6109 option can be used to relax the cost model.
6110
6111 @item -Woverride-init @r{(C and Objective-C only)}
6112 @opindex Woverride-init
6113 @opindex Wno-override-init
6114 @opindex W
6115 @opindex Wextra
6116 @opindex Wno-extra
6117 Warn if an initialized field without side effects is overridden when
6118 using designated initializers (@pxref{Designated Inits, , Designated
6119 Initializers}).
6120
6121 This warning is included in @option{-Wextra}. To get other
6122 @option{-Wextra} warnings without this one, use @option{-Wextra
6123 -Wno-override-init}.
6124
6125 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6126 @opindex Woverride-init-side-effects
6127 @opindex Wno-override-init-side-effects
6128 Warn if an initialized field with side effects is overridden when
6129 using designated initializers (@pxref{Designated Inits, , Designated
6130 Initializers}). This warning is enabled by default.
6131
6132 @item -Wpacked
6133 @opindex Wpacked
6134 @opindex Wno-packed
6135 Warn if a structure is given the packed attribute, but the packed
6136 attribute has no effect on the layout or size of the structure.
6137 Such structures may be mis-aligned for little benefit. For
6138 instance, in this code, the variable @code{f.x} in @code{struct bar}
6139 is misaligned even though @code{struct bar} does not itself
6140 have the packed attribute:
6141
6142 @smallexample
6143 @group
6144 struct foo @{
6145 int x;
6146 char a, b, c, d;
6147 @} __attribute__((packed));
6148 struct bar @{
6149 char z;
6150 struct foo f;
6151 @};
6152 @end group
6153 @end smallexample
6154
6155 @item -Wpacked-bitfield-compat
6156 @opindex Wpacked-bitfield-compat
6157 @opindex Wno-packed-bitfield-compat
6158 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
6159 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
6160 the change can lead to differences in the structure layout. GCC
6161 informs you when the offset of such a field has changed in GCC 4.4.
6162 For example there is no longer a 4-bit padding between field @code{a}
6163 and @code{b} in this structure:
6164
6165 @smallexample
6166 struct foo
6167 @{
6168 char a:4;
6169 char b:8;
6170 @} __attribute__ ((packed));
6171 @end smallexample
6172
6173 This warning is enabled by default. Use
6174 @option{-Wno-packed-bitfield-compat} to disable this warning.
6175
6176 @item -Wpadded
6177 @opindex Wpadded
6178 @opindex Wno-padded
6179 Warn if padding is included in a structure, either to align an element
6180 of the structure or to align the whole structure. Sometimes when this
6181 happens it is possible to rearrange the fields of the structure to
6182 reduce the padding and so make the structure smaller.
6183
6184 @item -Wredundant-decls
6185 @opindex Wredundant-decls
6186 @opindex Wno-redundant-decls
6187 Warn if anything is declared more than once in the same scope, even in
6188 cases where multiple declaration is valid and changes nothing.
6189
6190 @item -Wrestrict
6191 @opindex Wrestrict
6192 @opindex Wno-restrict
6193 Warn when an argument passed to a restrict-qualified parameter
6194 aliases with another argument.
6195
6196 @item -Wnested-externs @r{(C and Objective-C only)}
6197 @opindex Wnested-externs
6198 @opindex Wno-nested-externs
6199 Warn if an @code{extern} declaration is encountered within a function.
6200
6201 @item -Wno-inherited-variadic-ctor
6202 @opindex Winherited-variadic-ctor
6203 @opindex Wno-inherited-variadic-ctor
6204 Suppress warnings about use of C++11 inheriting constructors when the
6205 base class inherited from has a C variadic constructor; the warning is
6206 on by default because the ellipsis is not inherited.
6207
6208 @item -Winline
6209 @opindex Winline
6210 @opindex Wno-inline
6211 Warn if a function that is declared as inline cannot be inlined.
6212 Even with this option, the compiler does not warn about failures to
6213 inline functions declared in system headers.
6214
6215 The compiler uses a variety of heuristics to determine whether or not
6216 to inline a function. For example, the compiler takes into account
6217 the size of the function being inlined and the amount of inlining
6218 that has already been done in the current function. Therefore,
6219 seemingly insignificant changes in the source program can cause the
6220 warnings produced by @option{-Winline} to appear or disappear.
6221
6222 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6223 @opindex Wno-invalid-offsetof
6224 @opindex Winvalid-offsetof
6225 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6226 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6227 to a non-standard-layout type is undefined. In existing C++ implementations,
6228 however, @code{offsetof} typically gives meaningful results.
6229 This flag is for users who are aware that they are
6230 writing nonportable code and who have deliberately chosen to ignore the
6231 warning about it.
6232
6233 The restrictions on @code{offsetof} may be relaxed in a future version
6234 of the C++ standard.
6235
6236 @item -Wint-in-bool-context
6237 @opindex Wint-in-bool-context
6238 @opindex Wno-int-in-bool-context
6239 Warn for suspicious use of integer values where boolean values are expected,
6240 such as conditional expressions (?:) using non-boolean integer constants in
6241 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
6242 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
6243 for all kinds of multiplications regardless of the data type.
6244 This warning is enabled by @option{-Wall}.
6245
6246 @item -Wno-int-to-pointer-cast
6247 @opindex Wno-int-to-pointer-cast
6248 @opindex Wint-to-pointer-cast
6249 Suppress warnings from casts to pointer type of an integer of a
6250 different size. In C++, casting to a pointer type of smaller size is
6251 an error. @option{Wint-to-pointer-cast} is enabled by default.
6252
6253
6254 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
6255 @opindex Wno-pointer-to-int-cast
6256 @opindex Wpointer-to-int-cast
6257 Suppress warnings from casts from a pointer to an integer type of a
6258 different size.
6259
6260 @item -Winvalid-pch
6261 @opindex Winvalid-pch
6262 @opindex Wno-invalid-pch
6263 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
6264 the search path but can't be used.
6265
6266 @item -Wlong-long
6267 @opindex Wlong-long
6268 @opindex Wno-long-long
6269 Warn if @code{long long} type is used. This is enabled by either
6270 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
6271 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
6272
6273 @item -Wvariadic-macros
6274 @opindex Wvariadic-macros
6275 @opindex Wno-variadic-macros
6276 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6277 alternate syntax is used in ISO C99 mode. This is enabled by either
6278 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
6279 messages, use @option{-Wno-variadic-macros}.
6280
6281 @item -Wvarargs
6282 @opindex Wvarargs
6283 @opindex Wno-varargs
6284 Warn upon questionable usage of the macros used to handle variable
6285 arguments like @code{va_start}. This is default. To inhibit the
6286 warning messages, use @option{-Wno-varargs}.
6287
6288 @item -Wvector-operation-performance
6289 @opindex Wvector-operation-performance
6290 @opindex Wno-vector-operation-performance
6291 Warn if vector operation is not implemented via SIMD capabilities of the
6292 architecture. Mainly useful for the performance tuning.
6293 Vector operation can be implemented @code{piecewise}, which means that the
6294 scalar operation is performed on every vector element;
6295 @code{in parallel}, which means that the vector operation is implemented
6296 using scalars of wider type, which normally is more performance efficient;
6297 and @code{as a single scalar}, which means that vector fits into a
6298 scalar type.
6299
6300 @item -Wno-virtual-move-assign
6301 @opindex Wvirtual-move-assign
6302 @opindex Wno-virtual-move-assign
6303 Suppress warnings about inheriting from a virtual base with a
6304 non-trivial C++11 move assignment operator. This is dangerous because
6305 if the virtual base is reachable along more than one path, it is
6306 moved multiple times, which can mean both objects end up in the
6307 moved-from state. If the move assignment operator is written to avoid
6308 moving from a moved-from object, this warning can be disabled.
6309
6310 @item -Wvla
6311 @opindex Wvla
6312 @opindex Wno-vla
6313 Warn if a variable-length array is used in the code.
6314 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
6315 the variable-length array.
6316
6317 @item -Wvla-larger-than=@var{n}
6318 If this option is used, the compiler will warn on uses of
6319 variable-length arrays where the size is either unbounded, or bounded
6320 by an argument that can be larger than @var{n} bytes. This is similar
6321 to how @option{-Walloca-larger-than=@var{n}} works, but with
6322 variable-length arrays.
6323
6324 Note that GCC may optimize small variable-length arrays of a known
6325 value into plain arrays, so this warning may not get triggered for
6326 such arrays.
6327
6328 This warning is not enabled by @option{-Wall}, and is only active when
6329 @option{-ftree-vrp} is active (default for @option{-O2} and above).
6330
6331 See also @option{-Walloca-larger-than=@var{n}}.
6332
6333 @item -Wvolatile-register-var
6334 @opindex Wvolatile-register-var
6335 @opindex Wno-volatile-register-var
6336 Warn if a register variable is declared volatile. The volatile
6337 modifier does not inhibit all optimizations that may eliminate reads
6338 and/or writes to register variables. This warning is enabled by
6339 @option{-Wall}.
6340
6341 @item -Wdisabled-optimization
6342 @opindex Wdisabled-optimization
6343 @opindex Wno-disabled-optimization
6344 Warn if a requested optimization pass is disabled. This warning does
6345 not generally indicate that there is anything wrong with your code; it
6346 merely indicates that GCC's optimizers are unable to handle the code
6347 effectively. Often, the problem is that your code is too big or too
6348 complex; GCC refuses to optimize programs when the optimization
6349 itself is likely to take inordinate amounts of time.
6350
6351 @item -Wpointer-sign @r{(C and Objective-C only)}
6352 @opindex Wpointer-sign
6353 @opindex Wno-pointer-sign
6354 Warn for pointer argument passing or assignment with different signedness.
6355 This option is only supported for C and Objective-C@. It is implied by
6356 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
6357 @option{-Wno-pointer-sign}.
6358
6359 @item -Wstack-protector
6360 @opindex Wstack-protector
6361 @opindex Wno-stack-protector
6362 This option is only active when @option{-fstack-protector} is active. It
6363 warns about functions that are not protected against stack smashing.
6364
6365 @item -Woverlength-strings
6366 @opindex Woverlength-strings
6367 @opindex Wno-overlength-strings
6368 Warn about string constants that are longer than the ``minimum
6369 maximum'' length specified in the C standard. Modern compilers
6370 generally allow string constants that are much longer than the
6371 standard's minimum limit, but very portable programs should avoid
6372 using longer strings.
6373
6374 The limit applies @emph{after} string constant concatenation, and does
6375 not count the trailing NUL@. In C90, the limit was 509 characters; in
6376 C99, it was raised to 4095. C++98 does not specify a normative
6377 minimum maximum, so we do not diagnose overlength strings in C++@.
6378
6379 This option is implied by @option{-Wpedantic}, and can be disabled with
6380 @option{-Wno-overlength-strings}.
6381
6382 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
6383 @opindex Wunsuffixed-float-constants
6384
6385 Issue a warning for any floating constant that does not have
6386 a suffix. When used together with @option{-Wsystem-headers} it
6387 warns about such constants in system header files. This can be useful
6388 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
6389 from the decimal floating-point extension to C99.
6390
6391 @item -Wno-designated-init @r{(C and Objective-C only)}
6392 Suppress warnings when a positional initializer is used to initialize
6393 a structure that has been marked with the @code{designated_init}
6394 attribute.
6395
6396 @item -Whsa
6397 Issue a warning when HSAIL cannot be emitted for the compiled function or
6398 OpenMP construct.
6399
6400 @end table
6401
6402 @node Debugging Options
6403 @section Options for Debugging Your Program
6404 @cindex options, debugging
6405 @cindex debugging information options
6406
6407 To tell GCC to emit extra information for use by a debugger, in almost
6408 all cases you need only to add @option{-g} to your other options.
6409
6410 GCC allows you to use @option{-g} with
6411 @option{-O}. The shortcuts taken by optimized code may occasionally
6412 be surprising: some variables you declared may not exist
6413 at all; flow of control may briefly move where you did not expect it;
6414 some statements may not be executed because they compute constant
6415 results or their values are already at hand; some statements may
6416 execute in different places because they have been moved out of loops.
6417 Nevertheless it is possible to debug optimized output. This makes
6418 it reasonable to use the optimizer for programs that might have bugs.
6419
6420 If you are not using some other optimization option, consider
6421 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
6422 With no @option{-O} option at all, some compiler passes that collect
6423 information useful for debugging do not run at all, so that
6424 @option{-Og} may result in a better debugging experience.
6425
6426 @table @gcctabopt
6427 @item -g
6428 @opindex g
6429 Produce debugging information in the operating system's native format
6430 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
6431 information.
6432
6433 On most systems that use stabs format, @option{-g} enables use of extra
6434 debugging information that only GDB can use; this extra information
6435 makes debugging work better in GDB but probably makes other debuggers
6436 crash or
6437 refuse to read the program. If you want to control for certain whether
6438 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
6439 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
6440
6441 @item -ggdb
6442 @opindex ggdb
6443 Produce debugging information for use by GDB@. This means to use the
6444 most expressive format available (DWARF, stabs, or the native format
6445 if neither of those are supported), including GDB extensions if at all
6446 possible.
6447
6448 @item -gdwarf
6449 @itemx -gdwarf-@var{version}
6450 @opindex gdwarf
6451 Produce debugging information in DWARF format (if that is supported).
6452 The value of @var{version} may be either 2, 3, 4 or 5; the default version
6453 for most targets is 4. DWARF Version 5 is only experimental.
6454
6455 Note that with DWARF Version 2, some ports require and always
6456 use some non-conflicting DWARF 3 extensions in the unwind tables.
6457
6458 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
6459 for maximum benefit.
6460
6461 GCC no longer supports DWARF Version 1, which is substantially
6462 different than Version 2 and later. For historical reasons, some
6463 other DWARF-related options (including @option{-feliminate-dwarf2-dups}
6464 and @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
6465 in their names, but apply to all currently-supported versions of DWARF.
6466
6467 @item -gstabs
6468 @opindex gstabs
6469 Produce debugging information in stabs format (if that is supported),
6470 without GDB extensions. This is the format used by DBX on most BSD
6471 systems. On MIPS, Alpha and System V Release 4 systems this option
6472 produces stabs debugging output that is not understood by DBX or SDB@.
6473 On System V Release 4 systems this option requires the GNU assembler.
6474
6475 @item -gstabs+
6476 @opindex gstabs+
6477 Produce debugging information in stabs format (if that is supported),
6478 using GNU extensions understood only by the GNU debugger (GDB)@. The
6479 use of these extensions is likely to make other debuggers crash or
6480 refuse to read the program.
6481
6482 @item -gcoff
6483 @opindex gcoff
6484 Produce debugging information in COFF format (if that is supported).
6485 This is the format used by SDB on most System V systems prior to
6486 System V Release 4.
6487
6488 @item -gxcoff
6489 @opindex gxcoff
6490 Produce debugging information in XCOFF format (if that is supported).
6491 This is the format used by the DBX debugger on IBM RS/6000 systems.
6492
6493 @item -gxcoff+
6494 @opindex gxcoff+
6495 Produce debugging information in XCOFF format (if that is supported),
6496 using GNU extensions understood only by the GNU debugger (GDB)@. The
6497 use of these extensions is likely to make other debuggers crash or
6498 refuse to read the program, and may cause assemblers other than the GNU
6499 assembler (GAS) to fail with an error.
6500
6501 @item -gvms
6502 @opindex gvms
6503 Produce debugging information in Alpha/VMS debug format (if that is
6504 supported). This is the format used by DEBUG on Alpha/VMS systems.
6505
6506 @item -g@var{level}
6507 @itemx -ggdb@var{level}
6508 @itemx -gstabs@var{level}
6509 @itemx -gcoff@var{level}
6510 @itemx -gxcoff@var{level}
6511 @itemx -gvms@var{level}
6512 Request debugging information and also use @var{level} to specify how
6513 much information. The default level is 2.
6514
6515 Level 0 produces no debug information at all. Thus, @option{-g0} negates
6516 @option{-g}.
6517
6518 Level 1 produces minimal information, enough for making backtraces in
6519 parts of the program that you don't plan to debug. This includes
6520 descriptions of functions and external variables, and line number
6521 tables, but no information about local variables.
6522
6523 Level 3 includes extra information, such as all the macro definitions
6524 present in the program. Some debuggers support macro expansion when
6525 you use @option{-g3}.
6526
6527 @option{-gdwarf} does not accept a concatenated debug level, to avoid
6528 confusion with @option{-gdwarf-@var{level}}.
6529 Instead use an additional @option{-g@var{level}} option to change the
6530 debug level for DWARF.
6531
6532 @item -feliminate-unused-debug-symbols
6533 @opindex feliminate-unused-debug-symbols
6534 Produce debugging information in stabs format (if that is supported),
6535 for only symbols that are actually used.
6536
6537 @item -femit-class-debug-always
6538 @opindex femit-class-debug-always
6539 Instead of emitting debugging information for a C++ class in only one
6540 object file, emit it in all object files using the class. This option
6541 should be used only with debuggers that are unable to handle the way GCC
6542 normally emits debugging information for classes because using this
6543 option increases the size of debugging information by as much as a
6544 factor of two.
6545
6546 @item -fno-merge-debug-strings
6547 @opindex fmerge-debug-strings
6548 @opindex fno-merge-debug-strings
6549 Direct the linker to not merge together strings in the debugging
6550 information that are identical in different object files. Merging is
6551 not supported by all assemblers or linkers. Merging decreases the size
6552 of the debug information in the output file at the cost of increasing
6553 link processing time. Merging is enabled by default.
6554
6555 @item -fdebug-prefix-map=@var{old}=@var{new}
6556 @opindex fdebug-prefix-map
6557 When compiling files in directory @file{@var{old}}, record debugging
6558 information describing them as in @file{@var{new}} instead.
6559
6560 @item -fvar-tracking
6561 @opindex fvar-tracking
6562 Run variable tracking pass. It computes where variables are stored at each
6563 position in code. Better debugging information is then generated
6564 (if the debugging information format supports this information).
6565
6566 It is enabled by default when compiling with optimization (@option{-Os},
6567 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6568 the debug info format supports it.
6569
6570 @item -fvar-tracking-assignments
6571 @opindex fvar-tracking-assignments
6572 @opindex fno-var-tracking-assignments
6573 Annotate assignments to user variables early in the compilation and
6574 attempt to carry the annotations over throughout the compilation all the
6575 way to the end, in an attempt to improve debug information while
6576 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6577
6578 It can be enabled even if var-tracking is disabled, in which case
6579 annotations are created and maintained, but discarded at the end.
6580 By default, this flag is enabled together with @option{-fvar-tracking},
6581 except when selective scheduling is enabled.
6582
6583 @item -gsplit-dwarf
6584 @opindex gsplit-dwarf
6585 Separate as much DWARF debugging information as possible into a
6586 separate output file with the extension @file{.dwo}. This option allows
6587 the build system to avoid linking files with debug information. To
6588 be useful, this option requires a debugger capable of reading @file{.dwo}
6589 files.
6590
6591 @item -gpubnames
6592 @opindex gpubnames
6593 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
6594
6595 @item -ggnu-pubnames
6596 @opindex ggnu-pubnames
6597 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
6598 suitable for conversion into a GDB@ index. This option is only useful
6599 with a linker that can produce GDB@ index version 7.
6600
6601 @item -fdebug-types-section
6602 @opindex fdebug-types-section
6603 @opindex fno-debug-types-section
6604 When using DWARF Version 4 or higher, type DIEs can be put into
6605 their own @code{.debug_types} section instead of making them part of the
6606 @code{.debug_info} section. It is more efficient to put them in a separate
6607 comdat sections since the linker can then remove duplicates.
6608 But not all DWARF consumers support @code{.debug_types} sections yet
6609 and on some objects @code{.debug_types} produces larger instead of smaller
6610 debugging information.
6611
6612 @item -grecord-gcc-switches
6613 @item -gno-record-gcc-switches
6614 @opindex grecord-gcc-switches
6615 @opindex gno-record-gcc-switches
6616 This switch causes the command-line options used to invoke the
6617 compiler that may affect code generation to be appended to the
6618 DW_AT_producer attribute in DWARF debugging information. The options
6619 are concatenated with spaces separating them from each other and from
6620 the compiler version.
6621 It is enabled by default.
6622 See also @option{-frecord-gcc-switches} for another
6623 way of storing compiler options into the object file.
6624
6625 @item -gstrict-dwarf
6626 @opindex gstrict-dwarf
6627 Disallow using extensions of later DWARF standard version than selected
6628 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
6629 DWARF extensions from later standard versions is allowed.
6630
6631 @item -gno-strict-dwarf
6632 @opindex gno-strict-dwarf
6633 Allow using extensions of later DWARF standard version than selected with
6634 @option{-gdwarf-@var{version}}.
6635
6636 @item -gz@r{[}=@var{type}@r{]}
6637 @opindex gz
6638 Produce compressed debug sections in DWARF format, if that is supported.
6639 If @var{type} is not given, the default type depends on the capabilities
6640 of the assembler and linker used. @var{type} may be one of
6641 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
6642 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
6643 compression in traditional GNU format). If the linker doesn't support
6644 writing compressed debug sections, the option is rejected. Otherwise,
6645 if the assembler does not support them, @option{-gz} is silently ignored
6646 when producing object files.
6647
6648 @item -feliminate-dwarf2-dups
6649 @opindex feliminate-dwarf2-dups
6650 Compress DWARF debugging information by eliminating duplicated
6651 information about each symbol. This option only makes sense when
6652 generating DWARF debugging information.
6653
6654 @item -femit-struct-debug-baseonly
6655 @opindex femit-struct-debug-baseonly
6656 Emit debug information for struct-like types
6657 only when the base name of the compilation source file
6658 matches the base name of file in which the struct is defined.
6659
6660 This option substantially reduces the size of debugging information,
6661 but at significant potential loss in type information to the debugger.
6662 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6663 See @option{-femit-struct-debug-detailed} for more detailed control.
6664
6665 This option works only with DWARF debug output.
6666
6667 @item -femit-struct-debug-reduced
6668 @opindex femit-struct-debug-reduced
6669 Emit debug information for struct-like types
6670 only when the base name of the compilation source file
6671 matches the base name of file in which the type is defined,
6672 unless the struct is a template or defined in a system header.
6673
6674 This option significantly reduces the size of debugging information,
6675 with some potential loss in type information to the debugger.
6676 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6677 See @option{-femit-struct-debug-detailed} for more detailed control.
6678
6679 This option works only with DWARF debug output.
6680
6681 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6682 @opindex femit-struct-debug-detailed
6683 Specify the struct-like types
6684 for which the compiler generates debug information.
6685 The intent is to reduce duplicate struct debug information
6686 between different object files within the same program.
6687
6688 This option is a detailed version of
6689 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6690 which serves for most needs.
6691
6692 A specification has the syntax@*
6693 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6694
6695 The optional first word limits the specification to
6696 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6697 A struct type is used directly when it is the type of a variable, member.
6698 Indirect uses arise through pointers to structs.
6699 That is, when use of an incomplete struct is valid, the use is indirect.
6700 An example is
6701 @samp{struct one direct; struct two * indirect;}.
6702
6703 The optional second word limits the specification to
6704 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6705 Generic structs are a bit complicated to explain.
6706 For C++, these are non-explicit specializations of template classes,
6707 or non-template classes within the above.
6708 Other programming languages have generics,
6709 but @option{-femit-struct-debug-detailed} does not yet implement them.
6710
6711 The third word specifies the source files for those
6712 structs for which the compiler should emit debug information.
6713 The values @samp{none} and @samp{any} have the normal meaning.
6714 The value @samp{base} means that
6715 the base of name of the file in which the type declaration appears
6716 must match the base of the name of the main compilation file.
6717 In practice, this means that when compiling @file{foo.c}, debug information
6718 is generated for types declared in that file and @file{foo.h},
6719 but not other header files.
6720 The value @samp{sys} means those types satisfying @samp{base}
6721 or declared in system or compiler headers.
6722
6723 You may need to experiment to determine the best settings for your application.
6724
6725 The default is @option{-femit-struct-debug-detailed=all}.
6726
6727 This option works only with DWARF debug output.
6728
6729 @item -fno-dwarf2-cfi-asm
6730 @opindex fdwarf2-cfi-asm
6731 @opindex fno-dwarf2-cfi-asm
6732 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
6733 instead of using GAS @code{.cfi_*} directives.
6734
6735 @item -fno-eliminate-unused-debug-types
6736 @opindex feliminate-unused-debug-types
6737 @opindex fno-eliminate-unused-debug-types
6738 Normally, when producing DWARF output, GCC avoids producing debug symbol
6739 output for types that are nowhere used in the source file being compiled.
6740 Sometimes it is useful to have GCC emit debugging
6741 information for all types declared in a compilation
6742 unit, regardless of whether or not they are actually used
6743 in that compilation unit, for example
6744 if, in the debugger, you want to cast a value to a type that is
6745 not actually used in your program (but is declared). More often,
6746 however, this results in a significant amount of wasted space.
6747 @end table
6748
6749 @node Optimize Options
6750 @section Options That Control Optimization
6751 @cindex optimize options
6752 @cindex options, optimization
6753
6754 These options control various sorts of optimizations.
6755
6756 Without any optimization option, the compiler's goal is to reduce the
6757 cost of compilation and to make debugging produce the expected
6758 results. Statements are independent: if you stop the program with a
6759 breakpoint between statements, you can then assign a new value to any
6760 variable or change the program counter to any other statement in the
6761 function and get exactly the results you expect from the source
6762 code.
6763
6764 Turning on optimization flags makes the compiler attempt to improve
6765 the performance and/or code size at the expense of compilation time
6766 and possibly the ability to debug the program.
6767
6768 The compiler performs optimization based on the knowledge it has of the
6769 program. Compiling multiple files at once to a single output file mode allows
6770 the compiler to use information gained from all of the files when compiling
6771 each of them.
6772
6773 Not all optimizations are controlled directly by a flag. Only
6774 optimizations that have a flag are listed in this section.
6775
6776 Most optimizations are only enabled if an @option{-O} level is set on
6777 the command line. Otherwise they are disabled, even if individual
6778 optimization flags are specified.
6779
6780 Depending on the target and how GCC was configured, a slightly different
6781 set of optimizations may be enabled at each @option{-O} level than
6782 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6783 to find out the exact set of optimizations that are enabled at each level.
6784 @xref{Overall Options}, for examples.
6785
6786 @table @gcctabopt
6787 @item -O
6788 @itemx -O1
6789 @opindex O
6790 @opindex O1
6791 Optimize. Optimizing compilation takes somewhat more time, and a lot
6792 more memory for a large function.
6793
6794 With @option{-O}, the compiler tries to reduce code size and execution
6795 time, without performing any optimizations that take a great deal of
6796 compilation time.
6797
6798 @option{-O} turns on the following optimization flags:
6799 @gccoptlist{
6800 -fauto-inc-dec @gol
6801 -fbranch-count-reg @gol
6802 -fcombine-stack-adjustments @gol
6803 -fcompare-elim @gol
6804 -fcprop-registers @gol
6805 -fdce @gol
6806 -fdefer-pop @gol
6807 -fdelayed-branch @gol
6808 -fdse @gol
6809 -fforward-propagate @gol
6810 -fguess-branch-probability @gol
6811 -fif-conversion2 @gol
6812 -fif-conversion @gol
6813 -finline-functions-called-once @gol
6814 -fipa-pure-const @gol
6815 -fipa-profile @gol
6816 -fipa-reference @gol
6817 -fmerge-constants @gol
6818 -fmove-loop-invariants @gol
6819 -freorder-blocks @gol
6820 -fshrink-wrap @gol
6821 -fshrink-wrap-separate @gol
6822 -fsplit-wide-types @gol
6823 -fssa-backprop @gol
6824 -fssa-phiopt @gol
6825 -fstore-merging @gol
6826 -ftree-bit-ccp @gol
6827 -ftree-ccp @gol
6828 -ftree-ch @gol
6829 -ftree-coalesce-vars @gol
6830 -ftree-copy-prop @gol
6831 -ftree-dce @gol
6832 -ftree-dominator-opts @gol
6833 -ftree-dse @gol
6834 -ftree-forwprop @gol
6835 -ftree-fre @gol
6836 -ftree-phiprop @gol
6837 -ftree-sink @gol
6838 -ftree-slsr @gol
6839 -ftree-sra @gol
6840 -ftree-pta @gol
6841 -ftree-ter @gol
6842 -funit-at-a-time}
6843
6844 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6845 where doing so does not interfere with debugging.
6846
6847 @item -O2
6848 @opindex O2
6849 Optimize even more. GCC performs nearly all supported optimizations
6850 that do not involve a space-speed tradeoff.
6851 As compared to @option{-O}, this option increases both compilation time
6852 and the performance of the generated code.
6853
6854 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6855 also turns on the following optimization flags:
6856 @gccoptlist{-fthread-jumps @gol
6857 -falign-functions -falign-jumps @gol
6858 -falign-loops -falign-labels @gol
6859 -fcaller-saves @gol
6860 -fcrossjumping @gol
6861 -fcse-follow-jumps -fcse-skip-blocks @gol
6862 -fdelete-null-pointer-checks @gol
6863 -fdevirtualize -fdevirtualize-speculatively @gol
6864 -fexpensive-optimizations @gol
6865 -fgcse -fgcse-lm @gol
6866 -fhoist-adjacent-loads @gol
6867 -finline-small-functions @gol
6868 -findirect-inlining @gol
6869 -fipa-cp @gol
6870 -fipa-cp-alignment @gol
6871 -fipa-bit-cp @gol
6872 -fipa-sra @gol
6873 -fipa-icf @gol
6874 -fisolate-erroneous-paths-dereference @gol
6875 -flra-remat @gol
6876 -foptimize-sibling-calls @gol
6877 -foptimize-strlen @gol
6878 -fpartial-inlining @gol
6879 -fpeephole2 @gol
6880 -freorder-blocks-algorithm=stc @gol
6881 -freorder-blocks-and-partition -freorder-functions @gol
6882 -frerun-cse-after-loop @gol
6883 -fsched-interblock -fsched-spec @gol
6884 -fschedule-insns -fschedule-insns2 @gol
6885 -fstrict-aliasing -fstrict-overflow @gol
6886 -ftree-builtin-call-dce @gol
6887 -ftree-switch-conversion -ftree-tail-merge @gol
6888 -fcode-hoisting @gol
6889 -ftree-pre @gol
6890 -ftree-vrp @gol
6891 -fipa-ra}
6892
6893 Please note the warning under @option{-fgcse} about
6894 invoking @option{-O2} on programs that use computed gotos.
6895
6896 @item -O3
6897 @opindex O3
6898 Optimize yet more. @option{-O3} turns on all optimizations specified
6899 by @option{-O2} and also turns on the @option{-finline-functions},
6900 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6901 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
6902 @option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
6903 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
6904 @option{-ftree-partial-pre}, @option{-fpeel-loops}
6905 and @option{-fipa-cp-clone} options.
6906
6907 @item -O0
6908 @opindex O0
6909 Reduce compilation time and make debugging produce the expected
6910 results. This is the default.
6911
6912 @item -Os
6913 @opindex Os
6914 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6915 do not typically increase code size. It also performs further
6916 optimizations designed to reduce code size.
6917
6918 @option{-Os} disables the following optimization flags:
6919 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6920 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
6921 -freorder-blocks-and-partition -fprefetch-loop-arrays}
6922
6923 @item -Ofast
6924 @opindex Ofast
6925 Disregard strict standards compliance. @option{-Ofast} enables all
6926 @option{-O3} optimizations. It also enables optimizations that are not
6927 valid for all standard-compliant programs.
6928 It turns on @option{-ffast-math} and the Fortran-specific
6929 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6930
6931 @item -Og
6932 @opindex Og
6933 Optimize debugging experience. @option{-Og} enables optimizations
6934 that do not interfere with debugging. It should be the optimization
6935 level of choice for the standard edit-compile-debug cycle, offering
6936 a reasonable level of optimization while maintaining fast compilation
6937 and a good debugging experience.
6938 @end table
6939
6940 If you use multiple @option{-O} options, with or without level numbers,
6941 the last such option is the one that is effective.
6942
6943 Options of the form @option{-f@var{flag}} specify machine-independent
6944 flags. Most flags have both positive and negative forms; the negative
6945 form of @option{-ffoo} is @option{-fno-foo}. In the table
6946 below, only one of the forms is listed---the one you typically
6947 use. You can figure out the other form by either removing @samp{no-}
6948 or adding it.
6949
6950 The following options control specific optimizations. They are either
6951 activated by @option{-O} options or are related to ones that are. You
6952 can use the following flags in the rare cases when ``fine-tuning'' of
6953 optimizations to be performed is desired.
6954
6955 @table @gcctabopt
6956 @item -fno-defer-pop
6957 @opindex fno-defer-pop
6958 Always pop the arguments to each function call as soon as that function
6959 returns. For machines that must pop arguments after a function call,
6960 the compiler normally lets arguments accumulate on the stack for several
6961 function calls and pops them all at once.
6962
6963 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6964
6965 @item -fforward-propagate
6966 @opindex fforward-propagate
6967 Perform a forward propagation pass on RTL@. The pass tries to combine two
6968 instructions and checks if the result can be simplified. If loop unrolling
6969 is active, two passes are performed and the second is scheduled after
6970 loop unrolling.
6971
6972 This option is enabled by default at optimization levels @option{-O},
6973 @option{-O2}, @option{-O3}, @option{-Os}.
6974
6975 @item -ffp-contract=@var{style}
6976 @opindex ffp-contract
6977 @option{-ffp-contract=off} disables floating-point expression contraction.
6978 @option{-ffp-contract=fast} enables floating-point expression contraction
6979 such as forming of fused multiply-add operations if the target has
6980 native support for them.
6981 @option{-ffp-contract=on} enables floating-point expression contraction
6982 if allowed by the language standard. This is currently not implemented
6983 and treated equal to @option{-ffp-contract=off}.
6984
6985 The default is @option{-ffp-contract=fast}.
6986
6987 @item -fomit-frame-pointer
6988 @opindex fomit-frame-pointer
6989 Don't keep the frame pointer in a register for functions that
6990 don't need one. This avoids the instructions to save, set up and
6991 restore frame pointers; it also makes an extra register available
6992 in many functions. @strong{It also makes debugging impossible on
6993 some machines.}
6994
6995 On some machines, such as the VAX, this flag has no effect, because
6996 the standard calling sequence automatically handles the frame pointer
6997 and nothing is saved by pretending it doesn't exist. The
6998 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6999 whether a target machine supports this flag. @xref{Registers,,Register
7000 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
7001
7002 The default setting (when not optimizing for
7003 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
7004 @option{-fomit-frame-pointer}. You can configure GCC with the
7005 @option{--enable-frame-pointer} configure option to change the default.
7006
7007 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7008
7009 @item -foptimize-sibling-calls
7010 @opindex foptimize-sibling-calls
7011 Optimize sibling and tail recursive calls.
7012
7013 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7014
7015 @item -foptimize-strlen
7016 @opindex foptimize-strlen
7017 Optimize various standard C string functions (e.g. @code{strlen},
7018 @code{strchr} or @code{strcpy}) and
7019 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7020
7021 Enabled at levels @option{-O2}, @option{-O3}.
7022
7023 @item -fno-inline
7024 @opindex fno-inline
7025 Do not expand any functions inline apart from those marked with
7026 the @code{always_inline} attribute. This is the default when not
7027 optimizing.
7028
7029 Single functions can be exempted from inlining by marking them
7030 with the @code{noinline} attribute.
7031
7032 @item -finline-small-functions
7033 @opindex finline-small-functions
7034 Integrate functions into their callers when their body is smaller than expected
7035 function call code (so overall size of program gets smaller). The compiler
7036 heuristically decides which functions are simple enough to be worth integrating
7037 in this way. This inlining applies to all functions, even those not declared
7038 inline.
7039
7040 Enabled at level @option{-O2}.
7041
7042 @item -findirect-inlining
7043 @opindex findirect-inlining
7044 Inline also indirect calls that are discovered to be known at compile
7045 time thanks to previous inlining. This option has any effect only
7046 when inlining itself is turned on by the @option{-finline-functions}
7047 or @option{-finline-small-functions} options.
7048
7049 Enabled at level @option{-O2}.
7050
7051 @item -finline-functions
7052 @opindex finline-functions
7053 Consider all functions for inlining, even if they are not declared inline.
7054 The compiler heuristically decides which functions are worth integrating
7055 in this way.
7056
7057 If all calls to a given function are integrated, and the function is
7058 declared @code{static}, then the function is normally not output as
7059 assembler code in its own right.
7060
7061 Enabled at level @option{-O3}.
7062
7063 @item -finline-functions-called-once
7064 @opindex finline-functions-called-once
7065 Consider all @code{static} functions called once for inlining into their
7066 caller even if they are not marked @code{inline}. If a call to a given
7067 function is integrated, then the function is not output as assembler code
7068 in its own right.
7069
7070 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7071
7072 @item -fearly-inlining
7073 @opindex fearly-inlining
7074 Inline functions marked by @code{always_inline} and functions whose body seems
7075 smaller than the function call overhead early before doing
7076 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7077 makes profiling significantly cheaper and usually inlining faster on programs
7078 having large chains of nested wrapper functions.
7079
7080 Enabled by default.
7081
7082 @item -fipa-sra
7083 @opindex fipa-sra
7084 Perform interprocedural scalar replacement of aggregates, removal of
7085 unused parameters and replacement of parameters passed by reference
7086 by parameters passed by value.
7087
7088 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7089
7090 @item -finline-limit=@var{n}
7091 @opindex finline-limit
7092 By default, GCC limits the size of functions that can be inlined. This flag
7093 allows coarse control of this limit. @var{n} is the size of functions that
7094 can be inlined in number of pseudo instructions.
7095
7096 Inlining is actually controlled by a number of parameters, which may be
7097 specified individually by using @option{--param @var{name}=@var{value}}.
7098 The @option{-finline-limit=@var{n}} option sets some of these parameters
7099 as follows:
7100
7101 @table @gcctabopt
7102 @item max-inline-insns-single
7103 is set to @var{n}/2.
7104 @item max-inline-insns-auto
7105 is set to @var{n}/2.
7106 @end table
7107
7108 See below for a documentation of the individual
7109 parameters controlling inlining and for the defaults of these parameters.
7110
7111 @emph{Note:} there may be no value to @option{-finline-limit} that results
7112 in default behavior.
7113
7114 @emph{Note:} pseudo instruction represents, in this particular context, an
7115 abstract measurement of function's size. In no way does it represent a count
7116 of assembly instructions and as such its exact meaning might change from one
7117 release to an another.
7118
7119 @item -fno-keep-inline-dllexport
7120 @opindex fno-keep-inline-dllexport
7121 This is a more fine-grained version of @option{-fkeep-inline-functions},
7122 which applies only to functions that are declared using the @code{dllexport}
7123 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
7124 Functions}.)
7125
7126 @item -fkeep-inline-functions
7127 @opindex fkeep-inline-functions
7128 In C, emit @code{static} functions that are declared @code{inline}
7129 into the object file, even if the function has been inlined into all
7130 of its callers. This switch does not affect functions using the
7131 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7132 inline functions into the object file.
7133
7134 @item -fkeep-static-functions
7135 @opindex fkeep-static-functions
7136 Emit @code{static} functions into the object file, even if the function
7137 is never used.
7138
7139 @item -fkeep-static-consts
7140 @opindex fkeep-static-consts
7141 Emit variables declared @code{static const} when optimization isn't turned
7142 on, even if the variables aren't referenced.
7143
7144 GCC enables this option by default. If you want to force the compiler to
7145 check if a variable is referenced, regardless of whether or not
7146 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7147
7148 @item -fmerge-constants
7149 @opindex fmerge-constants
7150 Attempt to merge identical constants (string constants and floating-point
7151 constants) across compilation units.
7152
7153 This option is the default for optimized compilation if the assembler and
7154 linker support it. Use @option{-fno-merge-constants} to inhibit this
7155 behavior.
7156
7157 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7158
7159 @item -fmerge-all-constants
7160 @opindex fmerge-all-constants
7161 Attempt to merge identical constants and identical variables.
7162
7163 This option implies @option{-fmerge-constants}. In addition to
7164 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7165 arrays or initialized constant variables with integral or floating-point
7166 types. Languages like C or C++ require each variable, including multiple
7167 instances of the same variable in recursive calls, to have distinct locations,
7168 so using this option results in non-conforming
7169 behavior.
7170
7171 @item -fmodulo-sched
7172 @opindex fmodulo-sched
7173 Perform swing modulo scheduling immediately before the first scheduling
7174 pass. This pass looks at innermost loops and reorders their
7175 instructions by overlapping different iterations.
7176
7177 @item -fmodulo-sched-allow-regmoves
7178 @opindex fmodulo-sched-allow-regmoves
7179 Perform more aggressive SMS-based modulo scheduling with register moves
7180 allowed. By setting this flag certain anti-dependences edges are
7181 deleted, which triggers the generation of reg-moves based on the
7182 life-range analysis. This option is effective only with
7183 @option{-fmodulo-sched} enabled.
7184
7185 @item -fno-branch-count-reg
7186 @opindex fno-branch-count-reg
7187 Avoid running a pass scanning for opportunities to use ``decrement and
7188 branch'' instructions on a count register instead of generating sequences
7189 of instructions that decrement a register, compare it against zero, and
7190 then branch based upon the result. This option is only meaningful on
7191 architectures that support such instructions, which include x86, PowerPC,
7192 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
7193 doesn't remove the decrement and branch instructions from the generated
7194 instruction stream introduced by other optimization passes.
7195
7196 Enabled by default at @option{-O1} and higher.
7197
7198 The default is @option{-fbranch-count-reg}.
7199
7200 @item -fno-function-cse
7201 @opindex fno-function-cse
7202 Do not put function addresses in registers; make each instruction that
7203 calls a constant function contain the function's address explicitly.
7204
7205 This option results in less efficient code, but some strange hacks
7206 that alter the assembler output may be confused by the optimizations
7207 performed when this option is not used.
7208
7209 The default is @option{-ffunction-cse}
7210
7211 @item -fno-zero-initialized-in-bss
7212 @opindex fno-zero-initialized-in-bss
7213 If the target supports a BSS section, GCC by default puts variables that
7214 are initialized to zero into BSS@. This can save space in the resulting
7215 code.
7216
7217 This option turns off this behavior because some programs explicitly
7218 rely on variables going to the data section---e.g., so that the
7219 resulting executable can find the beginning of that section and/or make
7220 assumptions based on that.
7221
7222 The default is @option{-fzero-initialized-in-bss}.
7223
7224 @item -fthread-jumps
7225 @opindex fthread-jumps
7226 Perform optimizations that check to see if a jump branches to a
7227 location where another comparison subsumed by the first is found. If
7228 so, the first branch is redirected to either the destination of the
7229 second branch or a point immediately following it, depending on whether
7230 the condition is known to be true or false.
7231
7232 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7233
7234 @item -fsplit-wide-types
7235 @opindex fsplit-wide-types
7236 When using a type that occupies multiple registers, such as @code{long
7237 long} on a 32-bit system, split the registers apart and allocate them
7238 independently. This normally generates better code for those types,
7239 but may make debugging more difficult.
7240
7241 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7242 @option{-Os}.
7243
7244 @item -fcse-follow-jumps
7245 @opindex fcse-follow-jumps
7246 In common subexpression elimination (CSE), scan through jump instructions
7247 when the target of the jump is not reached by any other path. For
7248 example, when CSE encounters an @code{if} statement with an
7249 @code{else} clause, CSE follows the jump when the condition
7250 tested is false.
7251
7252 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7253
7254 @item -fcse-skip-blocks
7255 @opindex fcse-skip-blocks
7256 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7257 follow jumps that conditionally skip over blocks. When CSE
7258 encounters a simple @code{if} statement with no else clause,
7259 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7260 body of the @code{if}.
7261
7262 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7263
7264 @item -frerun-cse-after-loop
7265 @opindex frerun-cse-after-loop
7266 Re-run common subexpression elimination after loop optimizations are
7267 performed.
7268
7269 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7270
7271 @item -fgcse
7272 @opindex fgcse
7273 Perform a global common subexpression elimination pass.
7274 This pass also performs global constant and copy propagation.
7275
7276 @emph{Note:} When compiling a program using computed gotos, a GCC
7277 extension, you may get better run-time performance if you disable
7278 the global common subexpression elimination pass by adding
7279 @option{-fno-gcse} to the command line.
7280
7281 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7282
7283 @item -fgcse-lm
7284 @opindex fgcse-lm
7285 When @option{-fgcse-lm} is enabled, global common subexpression elimination
7286 attempts to move loads that are only killed by stores into themselves. This
7287 allows a loop containing a load/store sequence to be changed to a load outside
7288 the loop, and a copy/store within the loop.
7289
7290 Enabled by default when @option{-fgcse} is enabled.
7291
7292 @item -fgcse-sm
7293 @opindex fgcse-sm
7294 When @option{-fgcse-sm} is enabled, a store motion pass is run after
7295 global common subexpression elimination. This pass attempts to move
7296 stores out of loops. When used in conjunction with @option{-fgcse-lm},
7297 loops containing a load/store sequence can be changed to a load before
7298 the loop and a store after the loop.
7299
7300 Not enabled at any optimization level.
7301
7302 @item -fgcse-las
7303 @opindex fgcse-las
7304 When @option{-fgcse-las} is enabled, the global common subexpression
7305 elimination pass eliminates redundant loads that come after stores to the
7306 same memory location (both partial and full redundancies).
7307
7308 Not enabled at any optimization level.
7309
7310 @item -fgcse-after-reload
7311 @opindex fgcse-after-reload
7312 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7313 pass is performed after reload. The purpose of this pass is to clean up
7314 redundant spilling.
7315
7316 @item -faggressive-loop-optimizations
7317 @opindex faggressive-loop-optimizations
7318 This option tells the loop optimizer to use language constraints to
7319 derive bounds for the number of iterations of a loop. This assumes that
7320 loop code does not invoke undefined behavior by for example causing signed
7321 integer overflows or out-of-bound array accesses. The bounds for the
7322 number of iterations of a loop are used to guide loop unrolling and peeling
7323 and loop exit test optimizations.
7324 This option is enabled by default.
7325
7326 @item -funconstrained-commons
7327 @opindex funconstrained-commons
7328 This option tells the compiler that variables declared in common blocks
7329 (e.g. Fortran) may later be overridden with longer trailing arrays. This
7330 prevents certain optimizations that depend on knowing the array bounds.
7331
7332 @item -fcrossjumping
7333 @opindex fcrossjumping
7334 Perform cross-jumping transformation.
7335 This transformation unifies equivalent code and saves code size. The
7336 resulting code may or may not perform better than without cross-jumping.
7337
7338 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7339
7340 @item -fauto-inc-dec
7341 @opindex fauto-inc-dec
7342 Combine increments or decrements of addresses with memory accesses.
7343 This pass is always skipped on architectures that do not have
7344 instructions to support this. Enabled by default at @option{-O} and
7345 higher on architectures that support this.
7346
7347 @item -fdce
7348 @opindex fdce
7349 Perform dead code elimination (DCE) on RTL@.
7350 Enabled by default at @option{-O} and higher.
7351
7352 @item -fdse
7353 @opindex fdse
7354 Perform dead store elimination (DSE) on RTL@.
7355 Enabled by default at @option{-O} and higher.
7356
7357 @item -fif-conversion
7358 @opindex fif-conversion
7359 Attempt to transform conditional jumps into branch-less equivalents. This
7360 includes use of conditional moves, min, max, set flags and abs instructions, and
7361 some tricks doable by standard arithmetics. The use of conditional execution
7362 on chips where it is available is controlled by @option{-fif-conversion2}.
7363
7364 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7365
7366 @item -fif-conversion2
7367 @opindex fif-conversion2
7368 Use conditional execution (where available) to transform conditional jumps into
7369 branch-less equivalents.
7370
7371 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7372
7373 @item -fdeclone-ctor-dtor
7374 @opindex fdeclone-ctor-dtor
7375 The C++ ABI requires multiple entry points for constructors and
7376 destructors: one for a base subobject, one for a complete object, and
7377 one for a virtual destructor that calls operator delete afterwards.
7378 For a hierarchy with virtual bases, the base and complete variants are
7379 clones, which means two copies of the function. With this option, the
7380 base and complete variants are changed to be thunks that call a common
7381 implementation.
7382
7383 Enabled by @option{-Os}.
7384
7385 @item -fdelete-null-pointer-checks
7386 @opindex fdelete-null-pointer-checks
7387 Assume that programs cannot safely dereference null pointers, and that
7388 no code or data element resides at address zero.
7389 This option enables simple constant
7390 folding optimizations at all optimization levels. In addition, other
7391 optimization passes in GCC use this flag to control global dataflow
7392 analyses that eliminate useless checks for null pointers; these assume
7393 that a memory access to address zero always results in a trap, so
7394 that if a pointer is checked after it has already been dereferenced,
7395 it cannot be null.
7396
7397 Note however that in some environments this assumption is not true.
7398 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
7399 for programs that depend on that behavior.
7400
7401 This option is enabled by default on most targets. On Nios II ELF, it
7402 defaults to off. On AVR and CR16, this option is completely disabled.
7403
7404 Passes that use the dataflow information
7405 are enabled independently at different optimization levels.
7406
7407 @item -fdevirtualize
7408 @opindex fdevirtualize
7409 Attempt to convert calls to virtual functions to direct calls. This
7410 is done both within a procedure and interprocedurally as part of
7411 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
7412 propagation (@option{-fipa-cp}).
7413 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7414
7415 @item -fdevirtualize-speculatively
7416 @opindex fdevirtualize-speculatively
7417 Attempt to convert calls to virtual functions to speculative direct calls.
7418 Based on the analysis of the type inheritance graph, determine for a given call
7419 the set of likely targets. If the set is small, preferably of size 1, change
7420 the call into a conditional deciding between direct and indirect calls. The
7421 speculative calls enable more optimizations, such as inlining. When they seem
7422 useless after further optimization, they are converted back into original form.
7423
7424 @item -fdevirtualize-at-ltrans
7425 @opindex fdevirtualize-at-ltrans
7426 Stream extra information needed for aggressive devirtualization when running
7427 the link-time optimizer in local transformation mode.
7428 This option enables more devirtualization but
7429 significantly increases the size of streamed data. For this reason it is
7430 disabled by default.
7431
7432 @item -fexpensive-optimizations
7433 @opindex fexpensive-optimizations
7434 Perform a number of minor optimizations that are relatively expensive.
7435
7436 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7437
7438 @item -free
7439 @opindex free
7440 Attempt to remove redundant extension instructions. This is especially
7441 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
7442 registers after writing to their lower 32-bit half.
7443
7444 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
7445 @option{-O3}, @option{-Os}.
7446
7447 @item -fno-lifetime-dse
7448 @opindex fno-lifetime-dse
7449 In C++ the value of an object is only affected by changes within its
7450 lifetime: when the constructor begins, the object has an indeterminate
7451 value, and any changes during the lifetime of the object are dead when
7452 the object is destroyed. Normally dead store elimination will take
7453 advantage of this; if your code relies on the value of the object
7454 storage persisting beyond the lifetime of the object, you can use this
7455 flag to disable this optimization. To preserve stores before the
7456 constructor starts (e.g. because your operator new clears the object
7457 storage) but still treat the object as dead after the destructor you,
7458 can use @option{-flifetime-dse=1}. The default behavior can be
7459 explicitly selected with @option{-flifetime-dse=2}.
7460 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
7461
7462 @item -flive-range-shrinkage
7463 @opindex flive-range-shrinkage
7464 Attempt to decrease register pressure through register live range
7465 shrinkage. This is helpful for fast processors with small or moderate
7466 size register sets.
7467
7468 @item -fira-algorithm=@var{algorithm}
7469 @opindex fira-algorithm
7470 Use the specified coloring algorithm for the integrated register
7471 allocator. The @var{algorithm} argument can be @samp{priority}, which
7472 specifies Chow's priority coloring, or @samp{CB}, which specifies
7473 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
7474 for all architectures, but for those targets that do support it, it is
7475 the default because it generates better code.
7476
7477 @item -fira-region=@var{region}
7478 @opindex fira-region
7479 Use specified regions for the integrated register allocator. The
7480 @var{region} argument should be one of the following:
7481
7482 @table @samp
7483
7484 @item all
7485 Use all loops as register allocation regions.
7486 This can give the best results for machines with a small and/or
7487 irregular register set.
7488
7489 @item mixed
7490 Use all loops except for loops with small register pressure
7491 as the regions. This value usually gives
7492 the best results in most cases and for most architectures,
7493 and is enabled by default when compiling with optimization for speed
7494 (@option{-O}, @option{-O2}, @dots{}).
7495
7496 @item one
7497 Use all functions as a single region.
7498 This typically results in the smallest code size, and is enabled by default for
7499 @option{-Os} or @option{-O0}.
7500
7501 @end table
7502
7503 @item -fira-hoist-pressure
7504 @opindex fira-hoist-pressure
7505 Use IRA to evaluate register pressure in the code hoisting pass for
7506 decisions to hoist expressions. This option usually results in smaller
7507 code, but it can slow the compiler down.
7508
7509 This option is enabled at level @option{-Os} for all targets.
7510
7511 @item -fira-loop-pressure
7512 @opindex fira-loop-pressure
7513 Use IRA to evaluate register pressure in loops for decisions to move
7514 loop invariants. This option usually results in generation
7515 of faster and smaller code on machines with large register files (>= 32
7516 registers), but it can slow the compiler down.
7517
7518 This option is enabled at level @option{-O3} for some targets.
7519
7520 @item -fno-ira-share-save-slots
7521 @opindex fno-ira-share-save-slots
7522 Disable sharing of stack slots used for saving call-used hard
7523 registers living through a call. Each hard register gets a
7524 separate stack slot, and as a result function stack frames are
7525 larger.
7526
7527 @item -fno-ira-share-spill-slots
7528 @opindex fno-ira-share-spill-slots
7529 Disable sharing of stack slots allocated for pseudo-registers. Each
7530 pseudo-register that does not get a hard register gets a separate
7531 stack slot, and as a result function stack frames are larger.
7532
7533 @item -flra-remat
7534 @opindex flra-remat
7535 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7536 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7537 values if it is profitable.
7538
7539 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7540
7541 @item -fdelayed-branch
7542 @opindex fdelayed-branch
7543 If supported for the target machine, attempt to reorder instructions
7544 to exploit instruction slots available after delayed branch
7545 instructions.
7546
7547 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7548
7549 @item -fschedule-insns
7550 @opindex fschedule-insns
7551 If supported for the target machine, attempt to reorder instructions to
7552 eliminate execution stalls due to required data being unavailable. This
7553 helps machines that have slow floating point or memory load instructions
7554 by allowing other instructions to be issued until the result of the load
7555 or floating-point instruction is required.
7556
7557 Enabled at levels @option{-O2}, @option{-O3}.
7558
7559 @item -fschedule-insns2
7560 @opindex fschedule-insns2
7561 Similar to @option{-fschedule-insns}, but requests an additional pass of
7562 instruction scheduling after register allocation has been done. This is
7563 especially useful on machines with a relatively small number of
7564 registers and where memory load instructions take more than one cycle.
7565
7566 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7567
7568 @item -fno-sched-interblock
7569 @opindex fno-sched-interblock
7570 Don't schedule instructions across basic blocks. This is normally
7571 enabled by default when scheduling before register allocation, i.e.@:
7572 with @option{-fschedule-insns} or at @option{-O2} or higher.
7573
7574 @item -fno-sched-spec
7575 @opindex fno-sched-spec
7576 Don't allow speculative motion of non-load instructions. This is normally
7577 enabled by default when scheduling before register allocation, i.e.@:
7578 with @option{-fschedule-insns} or at @option{-O2} or higher.
7579
7580 @item -fsched-pressure
7581 @opindex fsched-pressure
7582 Enable register pressure sensitive insn scheduling before register
7583 allocation. This only makes sense when scheduling before register
7584 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7585 @option{-O2} or higher. Usage of this option can improve the
7586 generated code and decrease its size by preventing register pressure
7587 increase above the number of available hard registers and subsequent
7588 spills in register allocation.
7589
7590 @item -fsched-spec-load
7591 @opindex fsched-spec-load
7592 Allow speculative motion of some load instructions. This only makes
7593 sense when scheduling before register allocation, i.e.@: with
7594 @option{-fschedule-insns} or at @option{-O2} or higher.
7595
7596 @item -fsched-spec-load-dangerous
7597 @opindex fsched-spec-load-dangerous
7598 Allow speculative motion of more load instructions. This only makes
7599 sense when scheduling before register allocation, i.e.@: with
7600 @option{-fschedule-insns} or at @option{-O2} or higher.
7601
7602 @item -fsched-stalled-insns
7603 @itemx -fsched-stalled-insns=@var{n}
7604 @opindex fsched-stalled-insns
7605 Define how many insns (if any) can be moved prematurely from the queue
7606 of stalled insns into the ready list during the second scheduling pass.
7607 @option{-fno-sched-stalled-insns} means that no insns are moved
7608 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7609 on how many queued insns can be moved prematurely.
7610 @option{-fsched-stalled-insns} without a value is equivalent to
7611 @option{-fsched-stalled-insns=1}.
7612
7613 @item -fsched-stalled-insns-dep
7614 @itemx -fsched-stalled-insns-dep=@var{n}
7615 @opindex fsched-stalled-insns-dep
7616 Define how many insn groups (cycles) are examined for a dependency
7617 on a stalled insn that is a candidate for premature removal from the queue
7618 of stalled insns. This has an effect only during the second scheduling pass,
7619 and only if @option{-fsched-stalled-insns} is used.
7620 @option{-fno-sched-stalled-insns-dep} is equivalent to
7621 @option{-fsched-stalled-insns-dep=0}.
7622 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7623 @option{-fsched-stalled-insns-dep=1}.
7624
7625 @item -fsched2-use-superblocks
7626 @opindex fsched2-use-superblocks
7627 When scheduling after register allocation, use superblock scheduling.
7628 This allows motion across basic block boundaries,
7629 resulting in faster schedules. This option is experimental, as not all machine
7630 descriptions used by GCC model the CPU closely enough to avoid unreliable
7631 results from the algorithm.
7632
7633 This only makes sense when scheduling after register allocation, i.e.@: with
7634 @option{-fschedule-insns2} or at @option{-O2} or higher.
7635
7636 @item -fsched-group-heuristic
7637 @opindex fsched-group-heuristic
7638 Enable the group heuristic in the scheduler. This heuristic favors
7639 the instruction that belongs to a schedule group. This is enabled
7640 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7641 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7642
7643 @item -fsched-critical-path-heuristic
7644 @opindex fsched-critical-path-heuristic
7645 Enable the critical-path heuristic in the scheduler. This heuristic favors
7646 instructions on the critical path. This is enabled by default when
7647 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7648 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7649
7650 @item -fsched-spec-insn-heuristic
7651 @opindex fsched-spec-insn-heuristic
7652 Enable the speculative instruction heuristic in the scheduler. This
7653 heuristic favors speculative instructions with greater dependency weakness.
7654 This is enabled by default when scheduling is enabled, i.e.@:
7655 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7656 or at @option{-O2} or higher.
7657
7658 @item -fsched-rank-heuristic
7659 @opindex fsched-rank-heuristic
7660 Enable the rank heuristic in the scheduler. This heuristic favors
7661 the instruction belonging to a basic block with greater size or frequency.
7662 This is enabled by default when scheduling is enabled, i.e.@:
7663 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7664 at @option{-O2} or higher.
7665
7666 @item -fsched-last-insn-heuristic
7667 @opindex fsched-last-insn-heuristic
7668 Enable the last-instruction heuristic in the scheduler. This heuristic
7669 favors the instruction that is less dependent on the last instruction
7670 scheduled. This is enabled by default when scheduling is enabled,
7671 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7672 at @option{-O2} or higher.
7673
7674 @item -fsched-dep-count-heuristic
7675 @opindex fsched-dep-count-heuristic
7676 Enable the dependent-count heuristic in the scheduler. This heuristic
7677 favors the instruction that has more instructions depending on it.
7678 This is enabled by default when scheduling is enabled, i.e.@:
7679 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7680 at @option{-O2} or higher.
7681
7682 @item -freschedule-modulo-scheduled-loops
7683 @opindex freschedule-modulo-scheduled-loops
7684 Modulo scheduling is performed before traditional scheduling. If a loop
7685 is modulo scheduled, later scheduling passes may change its schedule.
7686 Use this option to control that behavior.
7687
7688 @item -fselective-scheduling
7689 @opindex fselective-scheduling
7690 Schedule instructions using selective scheduling algorithm. Selective
7691 scheduling runs instead of the first scheduler pass.
7692
7693 @item -fselective-scheduling2
7694 @opindex fselective-scheduling2
7695 Schedule instructions using selective scheduling algorithm. Selective
7696 scheduling runs instead of the second scheduler pass.
7697
7698 @item -fsel-sched-pipelining
7699 @opindex fsel-sched-pipelining
7700 Enable software pipelining of innermost loops during selective scheduling.
7701 This option has no effect unless one of @option{-fselective-scheduling} or
7702 @option{-fselective-scheduling2} is turned on.
7703
7704 @item -fsel-sched-pipelining-outer-loops
7705 @opindex fsel-sched-pipelining-outer-loops
7706 When pipelining loops during selective scheduling, also pipeline outer loops.
7707 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7708
7709 @item -fsemantic-interposition
7710 @opindex fsemantic-interposition
7711 Some object formats, like ELF, allow interposing of symbols by the
7712 dynamic linker.
7713 This means that for symbols exported from the DSO, the compiler cannot perform
7714 interprocedural propagation, inlining and other optimizations in anticipation
7715 that the function or variable in question may change. While this feature is
7716 useful, for example, to rewrite memory allocation functions by a debugging
7717 implementation, it is expensive in the terms of code quality.
7718 With @option{-fno-semantic-interposition} the compiler assumes that
7719 if interposition happens for functions the overwriting function will have
7720 precisely the same semantics (and side effects).
7721 Similarly if interposition happens
7722 for variables, the constructor of the variable will be the same. The flag
7723 has no effect for functions explicitly declared inline
7724 (where it is never allowed for interposition to change semantics)
7725 and for symbols explicitly declared weak.
7726
7727 @item -fshrink-wrap
7728 @opindex fshrink-wrap
7729 Emit function prologues only before parts of the function that need it,
7730 rather than at the top of the function. This flag is enabled by default at
7731 @option{-O} and higher.
7732
7733 @item -fshrink-wrap-separate
7734 @opindex fshrink-wrap-separate
7735 Shrink-wrap separate parts of the prologue and epilogue separately, so that
7736 those parts are only executed when needed.
7737 This option is on by default, but has no effect unless @option{-fshrink-wrap}
7738 is also turned on and the target supports this.
7739
7740 @item -fcaller-saves
7741 @opindex fcaller-saves
7742 Enable allocation of values to registers that are clobbered by
7743 function calls, by emitting extra instructions to save and restore the
7744 registers around such calls. Such allocation is done only when it
7745 seems to result in better code.
7746
7747 This option is always enabled by default on certain machines, usually
7748 those which have no call-preserved registers to use instead.
7749
7750 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7751
7752 @item -fcombine-stack-adjustments
7753 @opindex fcombine-stack-adjustments
7754 Tracks stack adjustments (pushes and pops) and stack memory references
7755 and then tries to find ways to combine them.
7756
7757 Enabled by default at @option{-O1} and higher.
7758
7759 @item -fipa-ra
7760 @opindex fipa-ra
7761 Use caller save registers for allocation if those registers are not used by
7762 any called function. In that case it is not necessary to save and restore
7763 them around calls. This is only possible if called functions are part of
7764 same compilation unit as current function and they are compiled before it.
7765
7766 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
7767 is disabled if generated code will be instrumented for profiling
7768 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
7769 exactly (this happens on targets that do not expose prologues
7770 and epilogues in RTL).
7771
7772 @item -fconserve-stack
7773 @opindex fconserve-stack
7774 Attempt to minimize stack usage. The compiler attempts to use less
7775 stack space, even if that makes the program slower. This option
7776 implies setting the @option{large-stack-frame} parameter to 100
7777 and the @option{large-stack-frame-growth} parameter to 400.
7778
7779 @item -ftree-reassoc
7780 @opindex ftree-reassoc
7781 Perform reassociation on trees. This flag is enabled by default
7782 at @option{-O} and higher.
7783
7784 @item -fcode-hoisting
7785 @opindex fcode-hoisting
7786 Perform code hoisting. Code hoisting tries to move the
7787 evaluation of expressions executed on all paths to the function exit
7788 as early as possible. This is especially useful as a code size
7789 optimization, but it often helps for code speed as well.
7790 This flag is enabled by default at @option{-O2} and higher.
7791
7792 @item -ftree-pre
7793 @opindex ftree-pre
7794 Perform partial redundancy elimination (PRE) on trees. This flag is
7795 enabled by default at @option{-O2} and @option{-O3}.
7796
7797 @item -ftree-partial-pre
7798 @opindex ftree-partial-pre
7799 Make partial redundancy elimination (PRE) more aggressive. This flag is
7800 enabled by default at @option{-O3}.
7801
7802 @item -ftree-forwprop
7803 @opindex ftree-forwprop
7804 Perform forward propagation on trees. This flag is enabled by default
7805 at @option{-O} and higher.
7806
7807 @item -ftree-fre
7808 @opindex ftree-fre
7809 Perform full redundancy elimination (FRE) on trees. The difference
7810 between FRE and PRE is that FRE only considers expressions
7811 that are computed on all paths leading to the redundant computation.
7812 This analysis is faster than PRE, though it exposes fewer redundancies.
7813 This flag is enabled by default at @option{-O} and higher.
7814
7815 @item -ftree-phiprop
7816 @opindex ftree-phiprop
7817 Perform hoisting of loads from conditional pointers on trees. This
7818 pass is enabled by default at @option{-O} and higher.
7819
7820 @item -fhoist-adjacent-loads
7821 @opindex fhoist-adjacent-loads
7822 Speculatively hoist loads from both branches of an if-then-else if the
7823 loads are from adjacent locations in the same structure and the target
7824 architecture has a conditional move instruction. This flag is enabled
7825 by default at @option{-O2} and higher.
7826
7827 @item -ftree-copy-prop
7828 @opindex ftree-copy-prop
7829 Perform copy propagation on trees. This pass eliminates unnecessary
7830 copy operations. This flag is enabled by default at @option{-O} and
7831 higher.
7832
7833 @item -fipa-pure-const
7834 @opindex fipa-pure-const
7835 Discover which functions are pure or constant.
7836 Enabled by default at @option{-O} and higher.
7837
7838 @item -fipa-reference
7839 @opindex fipa-reference
7840 Discover which static variables do not escape the
7841 compilation unit.
7842 Enabled by default at @option{-O} and higher.
7843
7844 @item -fipa-pta
7845 @opindex fipa-pta
7846 Perform interprocedural pointer analysis and interprocedural modification
7847 and reference analysis. This option can cause excessive memory and
7848 compile-time usage on large compilation units. It is not enabled by
7849 default at any optimization level.
7850
7851 @item -fipa-profile
7852 @opindex fipa-profile
7853 Perform interprocedural profile propagation. The functions called only from
7854 cold functions are marked as cold. Also functions executed once (such as
7855 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7856 functions and loop less parts of functions executed once are then optimized for
7857 size.
7858 Enabled by default at @option{-O} and higher.
7859
7860 @item -fipa-cp
7861 @opindex fipa-cp
7862 Perform interprocedural constant propagation.
7863 This optimization analyzes the program to determine when values passed
7864 to functions are constants and then optimizes accordingly.
7865 This optimization can substantially increase performance
7866 if the application has constants passed to functions.
7867 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7868
7869 @item -fipa-cp-clone
7870 @opindex fipa-cp-clone
7871 Perform function cloning to make interprocedural constant propagation stronger.
7872 When enabled, interprocedural constant propagation performs function cloning
7873 when externally visible function can be called with constant arguments.
7874 Because this optimization can create multiple copies of functions,
7875 it may significantly increase code size
7876 (see @option{--param ipcp-unit-growth=@var{value}}).
7877 This flag is enabled by default at @option{-O3}.
7878
7879 @item -fipa-cp-alignment
7880 @opindex -fipa-cp-alignment
7881 When enabled, this optimization propagates alignment of function
7882 parameters to support better vectorization and string operations.
7883
7884 This flag is enabled by default at @option{-O2} and @option{-Os}. It
7885 requires that @option{-fipa-cp} is enabled.
7886 @option{-fipa-cp-alignment} is obsolete, use @option{-fipa-bit-cp} instead.
7887
7888 @item -fipa-bit-cp
7889 @opindex -fipa-bit-cp
7890 When enabled, perform ipa bitwise constant propagation. This flag is
7891 enabled by default at @option{-O2}. It requires that @option{-fipa-cp}
7892 is enabled.
7893
7894 @item -fipa-icf
7895 @opindex fipa-icf
7896 Perform Identical Code Folding for functions and read-only variables.
7897 The optimization reduces code size and may disturb unwind stacks by replacing
7898 a function by equivalent one with a different name. The optimization works
7899 more effectively with link time optimization enabled.
7900
7901 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
7902 works on different levels and thus the optimizations are not same - there are
7903 equivalences that are found only by GCC and equivalences found only by Gold.
7904
7905 This flag is enabled by default at @option{-O2} and @option{-Os}.
7906
7907 @item -fisolate-erroneous-paths-dereference
7908 @opindex fisolate-erroneous-paths-dereference
7909 Detect paths that trigger erroneous or undefined behavior due to
7910 dereferencing a null pointer. Isolate those paths from the main control
7911 flow and turn the statement with erroneous or undefined behavior into a trap.
7912 This flag is enabled by default at @option{-O2} and higher and depends on
7913 @option{-fdelete-null-pointer-checks} also being enabled.
7914
7915 @item -fisolate-erroneous-paths-attribute
7916 @opindex fisolate-erroneous-paths-attribute
7917 Detect paths that trigger erroneous or undefined behavior due a null value
7918 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
7919 attribute. Isolate those paths from the main control flow and turn the
7920 statement with erroneous or undefined behavior into a trap. This is not
7921 currently enabled, but may be enabled by @option{-O2} in the future.
7922
7923 @item -ftree-sink
7924 @opindex ftree-sink
7925 Perform forward store motion on trees. This flag is
7926 enabled by default at @option{-O} and higher.
7927
7928 @item -ftree-bit-ccp
7929 @opindex ftree-bit-ccp
7930 Perform sparse conditional bit constant propagation on trees and propagate
7931 pointer alignment information.
7932 This pass only operates on local scalar variables and is enabled by default
7933 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7934
7935 @item -ftree-ccp
7936 @opindex ftree-ccp
7937 Perform sparse conditional constant propagation (CCP) on trees. This
7938 pass only operates on local scalar variables and is enabled by default
7939 at @option{-O} and higher.
7940
7941 @item -fssa-backprop
7942 @opindex fssa-backprop
7943 Propagate information about uses of a value up the definition chain
7944 in order to simplify the definitions. For example, this pass strips
7945 sign operations if the sign of a value never matters. The flag is
7946 enabled by default at @option{-O} and higher.
7947
7948 @item -fssa-phiopt
7949 @opindex fssa-phiopt
7950 Perform pattern matching on SSA PHI nodes to optimize conditional
7951 code. This pass is enabled by default at @option{-O} and higher.
7952
7953 @item -ftree-switch-conversion
7954 @opindex ftree-switch-conversion
7955 Perform conversion of simple initializations in a switch to
7956 initializations from a scalar array. This flag is enabled by default
7957 at @option{-O2} and higher.
7958
7959 @item -ftree-tail-merge
7960 @opindex ftree-tail-merge
7961 Look for identical code sequences. When found, replace one with a jump to the
7962 other. This optimization is known as tail merging or cross jumping. This flag
7963 is enabled by default at @option{-O2} and higher. The compilation time
7964 in this pass can
7965 be limited using @option{max-tail-merge-comparisons} parameter and
7966 @option{max-tail-merge-iterations} parameter.
7967
7968 @item -ftree-dce
7969 @opindex ftree-dce
7970 Perform dead code elimination (DCE) on trees. This flag is enabled by
7971 default at @option{-O} and higher.
7972
7973 @item -ftree-builtin-call-dce
7974 @opindex ftree-builtin-call-dce
7975 Perform conditional dead code elimination (DCE) for calls to built-in functions
7976 that may set @code{errno} but are otherwise side-effect free. This flag is
7977 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7978 specified.
7979
7980 @item -ftree-dominator-opts
7981 @opindex ftree-dominator-opts
7982 Perform a variety of simple scalar cleanups (constant/copy
7983 propagation, redundancy elimination, range propagation and expression
7984 simplification) based on a dominator tree traversal. This also
7985 performs jump threading (to reduce jumps to jumps). This flag is
7986 enabled by default at @option{-O} and higher.
7987
7988 @item -ftree-dse
7989 @opindex ftree-dse
7990 Perform dead store elimination (DSE) on trees. A dead store is a store into
7991 a memory location that is later overwritten by another store without
7992 any intervening loads. In this case the earlier store can be deleted. This
7993 flag is enabled by default at @option{-O} and higher.
7994
7995 @item -ftree-ch
7996 @opindex ftree-ch
7997 Perform loop header copying on trees. This is beneficial since it increases
7998 effectiveness of code motion optimizations. It also saves one jump. This flag
7999 is enabled by default at @option{-O} and higher. It is not enabled
8000 for @option{-Os}, since it usually increases code size.
8001
8002 @item -ftree-loop-optimize
8003 @opindex ftree-loop-optimize
8004 Perform loop optimizations on trees. This flag is enabled by default
8005 at @option{-O} and higher.
8006
8007 @item -ftree-loop-linear
8008 @itemx -floop-interchange
8009 @itemx -floop-strip-mine
8010 @itemx -floop-block
8011 @itemx -floop-unroll-and-jam
8012 @opindex ftree-loop-linear
8013 @opindex floop-interchange
8014 @opindex floop-strip-mine
8015 @opindex floop-block
8016 @opindex floop-unroll-and-jam
8017 Perform loop nest optimizations. Same as
8018 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8019 to be configured with @option{--with-isl} to enable the Graphite loop
8020 transformation infrastructure.
8021
8022 @item -fgraphite-identity
8023 @opindex fgraphite-identity
8024 Enable the identity transformation for graphite. For every SCoP we generate
8025 the polyhedral representation and transform it back to gimple. Using
8026 @option{-fgraphite-identity} we can check the costs or benefits of the
8027 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8028 are also performed by the code generator isl, like index splitting and
8029 dead code elimination in loops.
8030
8031 @item -floop-nest-optimize
8032 @opindex floop-nest-optimize
8033 Enable the isl based loop nest optimizer. This is a generic loop nest
8034 optimizer based on the Pluto optimization algorithms. It calculates a loop
8035 structure optimized for data-locality and parallelism. This option
8036 is experimental.
8037
8038 @item -floop-parallelize-all
8039 @opindex floop-parallelize-all
8040 Use the Graphite data dependence analysis to identify loops that can
8041 be parallelized. Parallelize all the loops that can be analyzed to
8042 not contain loop carried dependences without checking that it is
8043 profitable to parallelize the loops.
8044
8045 @item -ftree-coalesce-vars
8046 @opindex ftree-coalesce-vars
8047 While transforming the program out of the SSA representation, attempt to
8048 reduce copying by coalescing versions of different user-defined
8049 variables, instead of just compiler temporaries. This may severely
8050 limit the ability to debug an optimized program compiled with
8051 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8052 prevents SSA coalescing of user variables. This option is enabled by
8053 default if optimization is enabled, and it does very little otherwise.
8054
8055 @item -ftree-loop-if-convert
8056 @opindex ftree-loop-if-convert
8057 Attempt to transform conditional jumps in the innermost loops to
8058 branch-less equivalents. The intent is to remove control-flow from
8059 the innermost loops in order to improve the ability of the
8060 vectorization pass to handle these loops. This is enabled by default
8061 if vectorization is enabled.
8062
8063 @item -ftree-loop-if-convert-stores
8064 @opindex ftree-loop-if-convert-stores
8065 Attempt to also if-convert conditional jumps containing memory writes.
8066 This transformation can be unsafe for multi-threaded programs as it
8067 transforms conditional memory writes into unconditional memory writes.
8068 For example,
8069 @smallexample
8070 for (i = 0; i < N; i++)
8071 if (cond)
8072 A[i] = expr;
8073 @end smallexample
8074 is transformed to
8075 @smallexample
8076 for (i = 0; i < N; i++)
8077 A[i] = cond ? expr : A[i];
8078 @end smallexample
8079 potentially producing data races.
8080
8081 @item -ftree-loop-distribution
8082 @opindex ftree-loop-distribution
8083 Perform loop distribution. This flag can improve cache performance on
8084 big loop bodies and allow further loop optimizations, like
8085 parallelization or vectorization, to take place. For example, the loop
8086 @smallexample
8087 DO I = 1, N
8088 A(I) = B(I) + C
8089 D(I) = E(I) * F
8090 ENDDO
8091 @end smallexample
8092 is transformed to
8093 @smallexample
8094 DO I = 1, N
8095 A(I) = B(I) + C
8096 ENDDO
8097 DO I = 1, N
8098 D(I) = E(I) * F
8099 ENDDO
8100 @end smallexample
8101
8102 @item -ftree-loop-distribute-patterns
8103 @opindex ftree-loop-distribute-patterns
8104 Perform loop distribution of patterns that can be code generated with
8105 calls to a library. This flag is enabled by default at @option{-O3}.
8106
8107 This pass distributes the initialization loops and generates a call to
8108 memset zero. For example, the loop
8109 @smallexample
8110 DO I = 1, N
8111 A(I) = 0
8112 B(I) = A(I) + I
8113 ENDDO
8114 @end smallexample
8115 is transformed to
8116 @smallexample
8117 DO I = 1, N
8118 A(I) = 0
8119 ENDDO
8120 DO I = 1, N
8121 B(I) = A(I) + I
8122 ENDDO
8123 @end smallexample
8124 and the initialization loop is transformed into a call to memset zero.
8125
8126 @item -ftree-loop-im
8127 @opindex ftree-loop-im
8128 Perform loop invariant motion on trees. This pass moves only invariants that
8129 are hard to handle at RTL level (function calls, operations that expand to
8130 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8131 operands of conditions that are invariant out of the loop, so that we can use
8132 just trivial invariantness analysis in loop unswitching. The pass also includes
8133 store motion.
8134
8135 @item -ftree-loop-ivcanon
8136 @opindex ftree-loop-ivcanon
8137 Create a canonical counter for number of iterations in loops for which
8138 determining number of iterations requires complicated analysis. Later
8139 optimizations then may determine the number easily. Useful especially
8140 in connection with unrolling.
8141
8142 @item -fivopts
8143 @opindex fivopts
8144 Perform induction variable optimizations (strength reduction, induction
8145 variable merging and induction variable elimination) on trees.
8146
8147 @item -ftree-parallelize-loops=n
8148 @opindex ftree-parallelize-loops
8149 Parallelize loops, i.e., split their iteration space to run in n threads.
8150 This is only possible for loops whose iterations are independent
8151 and can be arbitrarily reordered. The optimization is only
8152 profitable on multiprocessor machines, for loops that are CPU-intensive,
8153 rather than constrained e.g.@: by memory bandwidth. This option
8154 implies @option{-pthread}, and thus is only supported on targets
8155 that have support for @option{-pthread}.
8156
8157 @item -ftree-pta
8158 @opindex ftree-pta
8159 Perform function-local points-to analysis on trees. This flag is
8160 enabled by default at @option{-O} and higher.
8161
8162 @item -ftree-sra
8163 @opindex ftree-sra
8164 Perform scalar replacement of aggregates. This pass replaces structure
8165 references with scalars to prevent committing structures to memory too
8166 early. This flag is enabled by default at @option{-O} and higher.
8167
8168 @item -fstore-merging
8169 @opindex fstore-merging
8170 Perform merging of narrow stores to consecutive memory addresses. This pass
8171 merges contiguous stores of immediate values narrower than a word into fewer
8172 wider stores to reduce the number of instructions. This is enabled by default
8173 at @option{-O} and higher.
8174
8175 @item -ftree-ter
8176 @opindex ftree-ter
8177 Perform temporary expression replacement during the SSA->normal phase. Single
8178 use/single def temporaries are replaced at their use location with their
8179 defining expression. This results in non-GIMPLE code, but gives the expanders
8180 much more complex trees to work on resulting in better RTL generation. This is
8181 enabled by default at @option{-O} and higher.
8182
8183 @item -ftree-slsr
8184 @opindex ftree-slsr
8185 Perform straight-line strength reduction on trees. This recognizes related
8186 expressions involving multiplications and replaces them by less expensive
8187 calculations when possible. This is enabled by default at @option{-O} and
8188 higher.
8189
8190 @item -ftree-vectorize
8191 @opindex ftree-vectorize
8192 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8193 and @option{-ftree-slp-vectorize} if not explicitly specified.
8194
8195 @item -ftree-loop-vectorize
8196 @opindex ftree-loop-vectorize
8197 Perform loop vectorization on trees. This flag is enabled by default at
8198 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8199
8200 @item -ftree-slp-vectorize
8201 @opindex ftree-slp-vectorize
8202 Perform basic block vectorization on trees. This flag is enabled by default at
8203 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8204
8205 @item -fvect-cost-model=@var{model}
8206 @opindex fvect-cost-model
8207 Alter the cost model used for vectorization. The @var{model} argument
8208 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
8209 With the @samp{unlimited} model the vectorized code-path is assumed
8210 to be profitable while with the @samp{dynamic} model a runtime check
8211 guards the vectorized code-path to enable it only for iteration
8212 counts that will likely execute faster than when executing the original
8213 scalar loop. The @samp{cheap} model disables vectorization of
8214 loops where doing so would be cost prohibitive for example due to
8215 required runtime checks for data dependence or alignment but otherwise
8216 is equal to the @samp{dynamic} model.
8217 The default cost model depends on other optimization flags and is
8218 either @samp{dynamic} or @samp{cheap}.
8219
8220 @item -fsimd-cost-model=@var{model}
8221 @opindex fsimd-cost-model
8222 Alter the cost model used for vectorization of loops marked with the OpenMP
8223 or Cilk Plus simd directive. The @var{model} argument should be one of
8224 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
8225 have the same meaning as described in @option{-fvect-cost-model} and by
8226 default a cost model defined with @option{-fvect-cost-model} is used.
8227
8228 @item -ftree-vrp
8229 @opindex ftree-vrp
8230 Perform Value Range Propagation on trees. This is similar to the
8231 constant propagation pass, but instead of values, ranges of values are
8232 propagated. This allows the optimizers to remove unnecessary range
8233 checks like array bound checks and null pointer checks. This is
8234 enabled by default at @option{-O2} and higher. Null pointer check
8235 elimination is only done if @option{-fdelete-null-pointer-checks} is
8236 enabled.
8237
8238 @item -fsplit-paths
8239 @opindex fsplit-paths
8240 Split paths leading to loop backedges. This can improve dead code
8241 elimination and common subexpression elimination. This is enabled by
8242 default at @option{-O2} and above.
8243
8244 @item -fsplit-ivs-in-unroller
8245 @opindex fsplit-ivs-in-unroller
8246 Enables expression of values of induction variables in later iterations
8247 of the unrolled loop using the value in the first iteration. This breaks
8248 long dependency chains, thus improving efficiency of the scheduling passes.
8249
8250 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8251 same effect. However, that is not reliable in cases where the loop body
8252 is more complicated than a single basic block. It also does not work at all
8253 on some architectures due to restrictions in the CSE pass.
8254
8255 This optimization is enabled by default.
8256
8257 @item -fvariable-expansion-in-unroller
8258 @opindex fvariable-expansion-in-unroller
8259 With this option, the compiler creates multiple copies of some
8260 local variables when unrolling a loop, which can result in superior code.
8261
8262 @item -fpartial-inlining
8263 @opindex fpartial-inlining
8264 Inline parts of functions. This option has any effect only
8265 when inlining itself is turned on by the @option{-finline-functions}
8266 or @option{-finline-small-functions} options.
8267
8268 Enabled at level @option{-O2}.
8269
8270 @item -fpredictive-commoning
8271 @opindex fpredictive-commoning
8272 Perform predictive commoning optimization, i.e., reusing computations
8273 (especially memory loads and stores) performed in previous
8274 iterations of loops.
8275
8276 This option is enabled at level @option{-O3}.
8277
8278 @item -fprefetch-loop-arrays
8279 @opindex fprefetch-loop-arrays
8280 If supported by the target machine, generate instructions to prefetch
8281 memory to improve the performance of loops that access large arrays.
8282
8283 This option may generate better or worse code; results are highly
8284 dependent on the structure of loops within the source code.
8285
8286 Disabled at level @option{-Os}.
8287
8288 @item -fprintf-return-value
8289 @opindex fprintf-return-value
8290 Substitute constants for known return value of formatted output functions
8291 such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and @code{vsnprintf}
8292 (but not @code{printf} of @code{fprintf}). This transformation allows GCC
8293 to optimize or even eliminate branches based on the known return value of
8294 these functions called with arguments that are either constant, or whose
8295 values are known to be in a range that makes determining the exact return
8296 value possible. For example, both the branch and the body of the @code{if}
8297 statement (but not the call to @code{snprint}) can be optimized away when
8298 @code{i} is a 32-bit or smaller integer because the return value is guaranteed
8299 to be at most 8.
8300
8301 @smallexample
8302 char buf[9];
8303 if (snprintf (buf, "%08x", i) >= sizeof buf)
8304 @dots{}
8305 @end smallexample
8306
8307 The @option{-fprintf-return-value} option relies on other optimizations
8308 and yields best results with @option{-O2}. It works in tandem with the
8309 @option{-Wformat-length} option. The @option{-fprintf-return-value}
8310 option is disabled by default.
8311
8312 @item -fno-peephole
8313 @itemx -fno-peephole2
8314 @opindex fno-peephole
8315 @opindex fno-peephole2
8316 Disable any machine-specific peephole optimizations. The difference
8317 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
8318 are implemented in the compiler; some targets use one, some use the
8319 other, a few use both.
8320
8321 @option{-fpeephole} is enabled by default.
8322 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8323
8324 @item -fno-guess-branch-probability
8325 @opindex fno-guess-branch-probability
8326 Do not guess branch probabilities using heuristics.
8327
8328 GCC uses heuristics to guess branch probabilities if they are
8329 not provided by profiling feedback (@option{-fprofile-arcs}). These
8330 heuristics are based on the control flow graph. If some branch probabilities
8331 are specified by @code{__builtin_expect}, then the heuristics are
8332 used to guess branch probabilities for the rest of the control flow graph,
8333 taking the @code{__builtin_expect} info into account. The interactions
8334 between the heuristics and @code{__builtin_expect} can be complex, and in
8335 some cases, it may be useful to disable the heuristics so that the effects
8336 of @code{__builtin_expect} are easier to understand.
8337
8338 The default is @option{-fguess-branch-probability} at levels
8339 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8340
8341 @item -freorder-blocks
8342 @opindex freorder-blocks
8343 Reorder basic blocks in the compiled function in order to reduce number of
8344 taken branches and improve code locality.
8345
8346 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8347
8348 @item -freorder-blocks-algorithm=@var{algorithm}
8349 @opindex freorder-blocks-algorithm
8350 Use the specified algorithm for basic block reordering. The
8351 @var{algorithm} argument can be @samp{simple}, which does not increase
8352 code size (except sometimes due to secondary effects like alignment),
8353 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
8354 put all often executed code together, minimizing the number of branches
8355 executed by making extra copies of code.
8356
8357 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
8358 @samp{stc} at levels @option{-O2}, @option{-O3}.
8359
8360 @item -freorder-blocks-and-partition
8361 @opindex freorder-blocks-and-partition
8362 In addition to reordering basic blocks in the compiled function, in order
8363 to reduce number of taken branches, partitions hot and cold basic blocks
8364 into separate sections of the assembly and @file{.o} files, to improve
8365 paging and cache locality performance.
8366
8367 This optimization is automatically turned off in the presence of
8368 exception handling, for linkonce sections, for functions with a user-defined
8369 section attribute and on any architecture that does not support named
8370 sections.
8371
8372 Enabled for x86 at levels @option{-O2}, @option{-O3}.
8373
8374 @item -freorder-functions
8375 @opindex freorder-functions
8376 Reorder functions in the object file in order to
8377 improve code locality. This is implemented by using special
8378 subsections @code{.text.hot} for most frequently executed functions and
8379 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
8380 the linker so object file format must support named sections and linker must
8381 place them in a reasonable way.
8382
8383 Also profile feedback must be available to make this option effective. See
8384 @option{-fprofile-arcs} for details.
8385
8386 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8387
8388 @item -fstrict-aliasing
8389 @opindex fstrict-aliasing
8390 Allow the compiler to assume the strictest aliasing rules applicable to
8391 the language being compiled. For C (and C++), this activates
8392 optimizations based on the type of expressions. In particular, an
8393 object of one type is assumed never to reside at the same address as an
8394 object of a different type, unless the types are almost the same. For
8395 example, an @code{unsigned int} can alias an @code{int}, but not a
8396 @code{void*} or a @code{double}. A character type may alias any other
8397 type.
8398
8399 @anchor{Type-punning}Pay special attention to code like this:
8400 @smallexample
8401 union a_union @{
8402 int i;
8403 double d;
8404 @};
8405
8406 int f() @{
8407 union a_union t;
8408 t.d = 3.0;
8409 return t.i;
8410 @}
8411 @end smallexample
8412 The practice of reading from a different union member than the one most
8413 recently written to (called ``type-punning'') is common. Even with
8414 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
8415 is accessed through the union type. So, the code above works as
8416 expected. @xref{Structures unions enumerations and bit-fields
8417 implementation}. However, this code might not:
8418 @smallexample
8419 int f() @{
8420 union a_union t;
8421 int* ip;
8422 t.d = 3.0;
8423 ip = &t.i;
8424 return *ip;
8425 @}
8426 @end smallexample
8427
8428 Similarly, access by taking the address, casting the resulting pointer
8429 and dereferencing the result has undefined behavior, even if the cast
8430 uses a union type, e.g.:
8431 @smallexample
8432 int f() @{
8433 double d = 3.0;
8434 return ((union a_union *) &d)->i;
8435 @}
8436 @end smallexample
8437
8438 The @option{-fstrict-aliasing} option is enabled at levels
8439 @option{-O2}, @option{-O3}, @option{-Os}.
8440
8441 @item -fstrict-overflow
8442 @opindex fstrict-overflow
8443 Allow the compiler to assume strict signed overflow rules, depending
8444 on the language being compiled. For C (and C++) this means that
8445 overflow when doing arithmetic with signed numbers is undefined, which
8446 means that the compiler may assume that it does not happen. This
8447 permits various optimizations. For example, the compiler assumes
8448 that an expression like @code{i + 10 > i} is always true for
8449 signed @code{i}. This assumption is only valid if signed overflow is
8450 undefined, as the expression is false if @code{i + 10} overflows when
8451 using twos complement arithmetic. When this option is in effect any
8452 attempt to determine whether an operation on signed numbers
8453 overflows must be written carefully to not actually involve overflow.
8454
8455 This option also allows the compiler to assume strict pointer
8456 semantics: given a pointer to an object, if adding an offset to that
8457 pointer does not produce a pointer to the same object, the addition is
8458 undefined. This permits the compiler to conclude that @code{p + u >
8459 p} is always true for a pointer @code{p} and unsigned integer
8460 @code{u}. This assumption is only valid because pointer wraparound is
8461 undefined, as the expression is false if @code{p + u} overflows using
8462 twos complement arithmetic.
8463
8464 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
8465 that integer signed overflow is fully defined: it wraps. When
8466 @option{-fwrapv} is used, there is no difference between
8467 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
8468 integers. With @option{-fwrapv} certain types of overflow are
8469 permitted. For example, if the compiler gets an overflow when doing
8470 arithmetic on constants, the overflowed value can still be used with
8471 @option{-fwrapv}, but not otherwise.
8472
8473 The @option{-fstrict-overflow} option is enabled at levels
8474 @option{-O2}, @option{-O3}, @option{-Os}.
8475
8476 @item -falign-functions
8477 @itemx -falign-functions=@var{n}
8478 @opindex falign-functions
8479 Align the start of functions to the next power-of-two greater than
8480 @var{n}, skipping up to @var{n} bytes. For instance,
8481 @option{-falign-functions=32} aligns functions to the next 32-byte
8482 boundary, but @option{-falign-functions=24} aligns to the next
8483 32-byte boundary only if this can be done by skipping 23 bytes or less.
8484
8485 @option{-fno-align-functions} and @option{-falign-functions=1} are
8486 equivalent and mean that functions are not aligned.
8487
8488 Some assemblers only support this flag when @var{n} is a power of two;
8489 in that case, it is rounded up.
8490
8491 If @var{n} is not specified or is zero, use a machine-dependent default.
8492
8493 Enabled at levels @option{-O2}, @option{-O3}.
8494
8495 @item -falign-labels
8496 @itemx -falign-labels=@var{n}
8497 @opindex falign-labels
8498 Align all branch targets to a power-of-two boundary, skipping up to
8499 @var{n} bytes like @option{-falign-functions}. This option can easily
8500 make code slower, because it must insert dummy operations for when the
8501 branch target is reached in the usual flow of the code.
8502
8503 @option{-fno-align-labels} and @option{-falign-labels=1} are
8504 equivalent and mean that labels are not aligned.
8505
8506 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8507 are greater than this value, then their values are used instead.
8508
8509 If @var{n} is not specified or is zero, use a machine-dependent default
8510 which is very likely to be @samp{1}, meaning no alignment.
8511
8512 Enabled at levels @option{-O2}, @option{-O3}.
8513
8514 @item -falign-loops
8515 @itemx -falign-loops=@var{n}
8516 @opindex falign-loops
8517 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8518 like @option{-falign-functions}. If the loops are
8519 executed many times, this makes up for any execution of the dummy
8520 operations.
8521
8522 @option{-fno-align-loops} and @option{-falign-loops=1} are
8523 equivalent and mean that loops are not aligned.
8524
8525 If @var{n} is not specified or is zero, use a machine-dependent default.
8526
8527 Enabled at levels @option{-O2}, @option{-O3}.
8528
8529 @item -falign-jumps
8530 @itemx -falign-jumps=@var{n}
8531 @opindex falign-jumps
8532 Align branch targets to a power-of-two boundary, for branch targets
8533 where the targets can only be reached by jumping, skipping up to @var{n}
8534 bytes like @option{-falign-functions}. In this case, no dummy operations
8535 need be executed.
8536
8537 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
8538 equivalent and mean that loops are not aligned.
8539
8540 If @var{n} is not specified or is zero, use a machine-dependent default.
8541
8542 Enabled at levels @option{-O2}, @option{-O3}.
8543
8544 @item -funit-at-a-time
8545 @opindex funit-at-a-time
8546 This option is left for compatibility reasons. @option{-funit-at-a-time}
8547 has no effect, while @option{-fno-unit-at-a-time} implies
8548 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8549
8550 Enabled by default.
8551
8552 @item -fno-toplevel-reorder
8553 @opindex fno-toplevel-reorder
8554 Do not reorder top-level functions, variables, and @code{asm}
8555 statements. Output them in the same order that they appear in the
8556 input file. When this option is used, unreferenced static variables
8557 are not removed. This option is intended to support existing code
8558 that relies on a particular ordering. For new code, it is better to
8559 use attributes when possible.
8560
8561 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8562 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8563 targets.
8564
8565 @item -fweb
8566 @opindex fweb
8567 Constructs webs as commonly used for register allocation purposes and assign
8568 each web individual pseudo register. This allows the register allocation pass
8569 to operate on pseudos directly, but also strengthens several other optimization
8570 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8571 however, make debugging impossible, since variables no longer stay in a
8572 ``home register''.
8573
8574 Enabled by default with @option{-funroll-loops}.
8575
8576 @item -fwhole-program
8577 @opindex fwhole-program
8578 Assume that the current compilation unit represents the whole program being
8579 compiled. All public functions and variables with the exception of @code{main}
8580 and those merged by attribute @code{externally_visible} become static functions
8581 and in effect are optimized more aggressively by interprocedural optimizers.
8582
8583 This option should not be used in combination with @option{-flto}.
8584 Instead relying on a linker plugin should provide safer and more precise
8585 information.
8586
8587 @item -flto[=@var{n}]
8588 @opindex flto
8589 This option runs the standard link-time optimizer. When invoked
8590 with source code, it generates GIMPLE (one of GCC's internal
8591 representations) and writes it to special ELF sections in the object
8592 file. When the object files are linked together, all the function
8593 bodies are read from these ELF sections and instantiated as if they
8594 had been part of the same translation unit.
8595
8596 To use the link-time optimizer, @option{-flto} and optimization
8597 options should be specified at compile time and during the final link.
8598 It is recommended that you compile all the files participating in the
8599 same link with the same options and also specify those options at
8600 link time.
8601 For example:
8602
8603 @smallexample
8604 gcc -c -O2 -flto foo.c
8605 gcc -c -O2 -flto bar.c
8606 gcc -o myprog -flto -O2 foo.o bar.o
8607 @end smallexample
8608
8609 The first two invocations to GCC save a bytecode representation
8610 of GIMPLE into special ELF sections inside @file{foo.o} and
8611 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8612 @file{foo.o} and @file{bar.o}, merges the two files into a single
8613 internal image, and compiles the result as usual. Since both
8614 @file{foo.o} and @file{bar.o} are merged into a single image, this
8615 causes all the interprocedural analyses and optimizations in GCC to
8616 work across the two files as if they were a single one. This means,
8617 for example, that the inliner is able to inline functions in
8618 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8619
8620 Another (simpler) way to enable link-time optimization is:
8621
8622 @smallexample
8623 gcc -o myprog -flto -O2 foo.c bar.c
8624 @end smallexample
8625
8626 The above generates bytecode for @file{foo.c} and @file{bar.c},
8627 merges them together into a single GIMPLE representation and optimizes
8628 them as usual to produce @file{myprog}.
8629
8630 The only important thing to keep in mind is that to enable link-time
8631 optimizations you need to use the GCC driver to perform the link step.
8632 GCC then automatically performs link-time optimization if any of the
8633 objects involved were compiled with the @option{-flto} command-line option.
8634 You generally
8635 should specify the optimization options to be used for link-time
8636 optimization though GCC tries to be clever at guessing an
8637 optimization level to use from the options used at compile time
8638 if you fail to specify one at link time. You can always override
8639 the automatic decision to do link-time optimization at link time
8640 by passing @option{-fno-lto} to the link command.
8641
8642 To make whole program optimization effective, it is necessary to make
8643 certain whole program assumptions. The compiler needs to know
8644 what functions and variables can be accessed by libraries and runtime
8645 outside of the link-time optimized unit. When supported by the linker,
8646 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8647 to the compiler about used and externally visible symbols. When
8648 the linker plugin is not available, @option{-fwhole-program} should be
8649 used to allow the compiler to make these assumptions, which leads
8650 to more aggressive optimization decisions.
8651
8652 When @option{-fuse-linker-plugin} is not enabled, when a file is
8653 compiled with @option{-flto}, the generated object file is larger than
8654 a regular object file because it contains GIMPLE bytecodes and the usual
8655 final code (see @option{-ffat-lto-objects}. This means that
8656 object files with LTO information can be linked as normal object
8657 files; if @option{-fno-lto} is passed to the linker, no
8658 interprocedural optimizations are applied. Note that when
8659 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
8660 but you cannot perform a regular, non-LTO link on them.
8661
8662 Additionally, the optimization flags used to compile individual files
8663 are not necessarily related to those used at link time. For instance,
8664
8665 @smallexample
8666 gcc -c -O0 -ffat-lto-objects -flto foo.c
8667 gcc -c -O0 -ffat-lto-objects -flto bar.c
8668 gcc -o myprog -O3 foo.o bar.o
8669 @end smallexample
8670
8671 This produces individual object files with unoptimized assembler
8672 code, but the resulting binary @file{myprog} is optimized at
8673 @option{-O3}. If, instead, the final binary is generated with
8674 @option{-fno-lto}, then @file{myprog} is not optimized.
8675
8676 When producing the final binary, GCC only
8677 applies link-time optimizations to those files that contain bytecode.
8678 Therefore, you can mix and match object files and libraries with
8679 GIMPLE bytecodes and final object code. GCC automatically selects
8680 which files to optimize in LTO mode and which files to link without
8681 further processing.
8682
8683 There are some code generation flags preserved by GCC when
8684 generating bytecodes, as they need to be used during the final link
8685 stage. Generally options specified at link time override those
8686 specified at compile time.
8687
8688 If you do not specify an optimization level option @option{-O} at
8689 link time, then GCC uses the highest optimization level
8690 used when compiling the object files.
8691
8692 Currently, the following options and their settings are taken from
8693 the first object file that explicitly specifies them:
8694 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8695 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8696 and all the @option{-m} target flags.
8697
8698 Certain ABI-changing flags are required to match in all compilation units,
8699 and trying to override this at link time with a conflicting value
8700 is ignored. This includes options such as @option{-freg-struct-return}
8701 and @option{-fpcc-struct-return}.
8702
8703 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8704 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8705 are passed through to the link stage and merged conservatively for
8706 conflicting translation units. Specifically
8707 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8708 precedence; and for example @option{-ffp-contract=off} takes precedence
8709 over @option{-ffp-contract=fast}. You can override them at link time.
8710
8711 If LTO encounters objects with C linkage declared with incompatible
8712 types in separate translation units to be linked together (undefined
8713 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8714 issued. The behavior is still undefined at run time. Similar
8715 diagnostics may be raised for other languages.
8716
8717 Another feature of LTO is that it is possible to apply interprocedural
8718 optimizations on files written in different languages:
8719
8720 @smallexample
8721 gcc -c -flto foo.c
8722 g++ -c -flto bar.cc
8723 gfortran -c -flto baz.f90
8724 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8725 @end smallexample
8726
8727 Notice that the final link is done with @command{g++} to get the C++
8728 runtime libraries and @option{-lgfortran} is added to get the Fortran
8729 runtime libraries. In general, when mixing languages in LTO mode, you
8730 should use the same link command options as when mixing languages in a
8731 regular (non-LTO) compilation.
8732
8733 If object files containing GIMPLE bytecode are stored in a library archive, say
8734 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8735 are using a linker with plugin support. To create static libraries suitable
8736 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8737 and @command{ranlib};
8738 to show the symbols of object files with GIMPLE bytecode, use
8739 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8740 and @command{nm} have been compiled with plugin support. At link time, use the the
8741 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8742 the LTO optimization process:
8743
8744 @smallexample
8745 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8746 @end smallexample
8747
8748 With the linker plugin enabled, the linker extracts the needed
8749 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8750 to make them part of the aggregated GIMPLE image to be optimized.
8751
8752 If you are not using a linker with plugin support and/or do not
8753 enable the linker plugin, then the objects inside @file{libfoo.a}
8754 are extracted and linked as usual, but they do not participate
8755 in the LTO optimization process. In order to make a static library suitable
8756 for both LTO optimization and usual linkage, compile its object files with
8757 @option{-flto} @option{-ffat-lto-objects}.
8758
8759 Link-time optimizations do not require the presence of the whole program to
8760 operate. If the program does not require any symbols to be exported, it is
8761 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8762 the interprocedural optimizers to use more aggressive assumptions which may
8763 lead to improved optimization opportunities.
8764 Use of @option{-fwhole-program} is not needed when linker plugin is
8765 active (see @option{-fuse-linker-plugin}).
8766
8767 The current implementation of LTO makes no
8768 attempt to generate bytecode that is portable between different
8769 types of hosts. The bytecode files are versioned and there is a
8770 strict version check, so bytecode files generated in one version of
8771 GCC do not work with an older or newer version of GCC.
8772
8773 Link-time optimization does not work well with generation of debugging
8774 information. Combining @option{-flto} with
8775 @option{-g} is currently experimental and expected to produce unexpected
8776 results.
8777
8778 If you specify the optional @var{n}, the optimization and code
8779 generation done at link time is executed in parallel using @var{n}
8780 parallel jobs by utilizing an installed @command{make} program. The
8781 environment variable @env{MAKE} may be used to override the program
8782 used. The default value for @var{n} is 1.
8783
8784 You can also specify @option{-flto=jobserver} to use GNU make's
8785 job server mode to determine the number of parallel jobs. This
8786 is useful when the Makefile calling GCC is already executing in parallel.
8787 You must prepend a @samp{+} to the command recipe in the parent Makefile
8788 for this to work. This option likely only works if @env{MAKE} is
8789 GNU make.
8790
8791 @item -flto-partition=@var{alg}
8792 @opindex flto-partition
8793 Specify the partitioning algorithm used by the link-time optimizer.
8794 The value is either @samp{1to1} to specify a partitioning mirroring
8795 the original source files or @samp{balanced} to specify partitioning
8796 into equally sized chunks (whenever possible) or @samp{max} to create
8797 new partition for every symbol where possible. Specifying @samp{none}
8798 as an algorithm disables partitioning and streaming completely.
8799 The default value is @samp{balanced}. While @samp{1to1} can be used
8800 as an workaround for various code ordering issues, the @samp{max}
8801 partitioning is intended for internal testing only.
8802 The value @samp{one} specifies that exactly one partition should be
8803 used while the value @samp{none} bypasses partitioning and executes
8804 the link-time optimization step directly from the WPA phase.
8805
8806 @item -flto-odr-type-merging
8807 @opindex flto-odr-type-merging
8808 Enable streaming of mangled types names of C++ types and their unification
8809 at link time. This increases size of LTO object files, but enables
8810 diagnostics about One Definition Rule violations.
8811
8812 @item -flto-compression-level=@var{n}
8813 @opindex flto-compression-level
8814 This option specifies the level of compression used for intermediate
8815 language written to LTO object files, and is only meaningful in
8816 conjunction with LTO mode (@option{-flto}). Valid
8817 values are 0 (no compression) to 9 (maximum compression). Values
8818 outside this range are clamped to either 0 or 9. If the option is not
8819 given, a default balanced compression setting is used.
8820
8821 @item -fuse-linker-plugin
8822 @opindex fuse-linker-plugin
8823 Enables the use of a linker plugin during link-time optimization. This
8824 option relies on plugin support in the linker, which is available in gold
8825 or in GNU ld 2.21 or newer.
8826
8827 This option enables the extraction of object files with GIMPLE bytecode out
8828 of library archives. This improves the quality of optimization by exposing
8829 more code to the link-time optimizer. This information specifies what
8830 symbols can be accessed externally (by non-LTO object or during dynamic
8831 linking). Resulting code quality improvements on binaries (and shared
8832 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
8833 See @option{-flto} for a description of the effect of this flag and how to
8834 use it.
8835
8836 This option is enabled by default when LTO support in GCC is enabled
8837 and GCC was configured for use with
8838 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8839
8840 @item -ffat-lto-objects
8841 @opindex ffat-lto-objects
8842 Fat LTO objects are object files that contain both the intermediate language
8843 and the object code. This makes them usable for both LTO linking and normal
8844 linking. This option is effective only when compiling with @option{-flto}
8845 and is ignored at link time.
8846
8847 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8848 requires the complete toolchain to be aware of LTO. It requires a linker with
8849 linker plugin support for basic functionality. Additionally,
8850 @command{nm}, @command{ar} and @command{ranlib}
8851 need to support linker plugins to allow a full-featured build environment
8852 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
8853 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8854 to these tools. With non fat LTO makefiles need to be modified to use them.
8855
8856 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
8857 support.
8858
8859 @item -fcompare-elim
8860 @opindex fcompare-elim
8861 After register allocation and post-register allocation instruction splitting,
8862 identify arithmetic instructions that compute processor flags similar to a
8863 comparison operation based on that arithmetic. If possible, eliminate the
8864 explicit comparison operation.
8865
8866 This pass only applies to certain targets that cannot explicitly represent
8867 the comparison operation before register allocation is complete.
8868
8869 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8870
8871 @item -fcprop-registers
8872 @opindex fcprop-registers
8873 After register allocation and post-register allocation instruction splitting,
8874 perform a copy-propagation pass to try to reduce scheduling dependencies
8875 and occasionally eliminate the copy.
8876
8877 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8878
8879 @item -fprofile-correction
8880 @opindex fprofile-correction
8881 Profiles collected using an instrumented binary for multi-threaded programs may
8882 be inconsistent due to missed counter updates. When this option is specified,
8883 GCC uses heuristics to correct or smooth out such inconsistencies. By
8884 default, GCC emits an error message when an inconsistent profile is detected.
8885
8886 @item -fprofile-use
8887 @itemx -fprofile-use=@var{path}
8888 @opindex fprofile-use
8889 Enable profile feedback-directed optimizations,
8890 and the following optimizations
8891 which are generally profitable only with profile feedback available:
8892 @option{-fbranch-probabilities}, @option{-fvpt},
8893 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8894 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
8895
8896 Before you can use this option, you must first generate profiling information.
8897 @xref{Optimize Options}, for information about the @option{-fprofile-generate}
8898 option.
8899
8900 By default, GCC emits an error message if the feedback profiles do not
8901 match the source code. This error can be turned into a warning by using
8902 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8903 code.
8904
8905 If @var{path} is specified, GCC looks at the @var{path} to find
8906 the profile feedback data files. See @option{-fprofile-dir}.
8907
8908 @item -fauto-profile
8909 @itemx -fauto-profile=@var{path}
8910 @opindex fauto-profile
8911 Enable sampling-based feedback-directed optimizations,
8912 and the following optimizations
8913 which are generally profitable only with profile feedback available:
8914 @option{-fbranch-probabilities}, @option{-fvpt},
8915 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8916 @option{-ftree-vectorize},
8917 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
8918 @option{-fpredictive-commoning}, @option{-funswitch-loops},
8919 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
8920
8921 @var{path} is the name of a file containing AutoFDO profile information.
8922 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
8923
8924 Producing an AutoFDO profile data file requires running your program
8925 with the @command{perf} utility on a supported GNU/Linux target system.
8926 For more information, see @uref{https://perf.wiki.kernel.org/}.
8927
8928 E.g.
8929 @smallexample
8930 perf record -e br_inst_retired:near_taken -b -o perf.data \
8931 -- your_program
8932 @end smallexample
8933
8934 Then use the @command{create_gcov} tool to convert the raw profile data
8935 to a format that can be used by GCC.@ You must also supply the
8936 unstripped binary for your program to this tool.
8937 See @uref{https://github.com/google/autofdo}.
8938
8939 E.g.
8940 @smallexample
8941 create_gcov --binary=your_program.unstripped --profile=perf.data \
8942 --gcov=profile.afdo
8943 @end smallexample
8944 @end table
8945
8946 The following options control compiler behavior regarding floating-point
8947 arithmetic. These options trade off between speed and
8948 correctness. All must be specifically enabled.
8949
8950 @table @gcctabopt
8951 @item -ffloat-store
8952 @opindex ffloat-store
8953 Do not store floating-point variables in registers, and inhibit other
8954 options that might change whether a floating-point value is taken from a
8955 register or memory.
8956
8957 @cindex floating-point precision
8958 This option prevents undesirable excess precision on machines such as
8959 the 68000 where the floating registers (of the 68881) keep more
8960 precision than a @code{double} is supposed to have. Similarly for the
8961 x86 architecture. For most programs, the excess precision does only
8962 good, but a few programs rely on the precise definition of IEEE floating
8963 point. Use @option{-ffloat-store} for such programs, after modifying
8964 them to store all pertinent intermediate computations into variables.
8965
8966 @item -fexcess-precision=@var{style}
8967 @opindex fexcess-precision
8968 This option allows further control over excess precision on machines
8969 where floating-point registers have more precision than the IEEE
8970 @code{float} and @code{double} types and the processor does not
8971 support operations rounding to those types. By default,
8972 @option{-fexcess-precision=fast} is in effect; this means that
8973 operations are carried out in the precision of the registers and that
8974 it is unpredictable when rounding to the types specified in the source
8975 code takes place. When compiling C, if
8976 @option{-fexcess-precision=standard} is specified then excess
8977 precision follows the rules specified in ISO C99; in particular,
8978 both casts and assignments cause values to be rounded to their
8979 semantic types (whereas @option{-ffloat-store} only affects
8980 assignments). This option is enabled by default for C if a strict
8981 conformance option such as @option{-std=c99} is used.
8982
8983 @opindex mfpmath
8984 @option{-fexcess-precision=standard} is not implemented for languages
8985 other than C, and has no effect if
8986 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8987 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8988 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8989 semantics apply without excess precision, and in the latter, rounding
8990 is unpredictable.
8991
8992 @item -ffast-math
8993 @opindex ffast-math
8994 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8995 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8996 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8997
8998 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8999
9000 This option is not turned on by any @option{-O} option besides
9001 @option{-Ofast} since it can result in incorrect output for programs
9002 that depend on an exact implementation of IEEE or ISO rules/specifications
9003 for math functions. It may, however, yield faster code for programs
9004 that do not require the guarantees of these specifications.
9005
9006 @item -fno-math-errno
9007 @opindex fno-math-errno
9008 Do not set @code{errno} after calling math functions that are executed
9009 with a single instruction, e.g., @code{sqrt}. A program that relies on
9010 IEEE exceptions for math error handling may want to use this flag
9011 for speed while maintaining IEEE arithmetic compatibility.
9012
9013 This option is not turned on by any @option{-O} option since
9014 it can result in incorrect output for programs that depend on
9015 an exact implementation of IEEE or ISO rules/specifications for
9016 math functions. It may, however, yield faster code for programs
9017 that do not require the guarantees of these specifications.
9018
9019 The default is @option{-fmath-errno}.
9020
9021 On Darwin systems, the math library never sets @code{errno}. There is
9022 therefore no reason for the compiler to consider the possibility that
9023 it might, and @option{-fno-math-errno} is the default.
9024
9025 @item -funsafe-math-optimizations
9026 @opindex funsafe-math-optimizations
9027
9028 Allow optimizations for floating-point arithmetic that (a) assume
9029 that arguments and results are valid and (b) may violate IEEE or
9030 ANSI standards. When used at link time, it may include libraries
9031 or startup files that change the default FPU control word or other
9032 similar optimizations.
9033
9034 This option is not turned on by any @option{-O} option since
9035 it can result in incorrect output for programs that depend on
9036 an exact implementation of IEEE or ISO rules/specifications for
9037 math functions. It may, however, yield faster code for programs
9038 that do not require the guarantees of these specifications.
9039 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9040 @option{-fassociative-math} and @option{-freciprocal-math}.
9041
9042 The default is @option{-fno-unsafe-math-optimizations}.
9043
9044 @item -fassociative-math
9045 @opindex fassociative-math
9046
9047 Allow re-association of operands in series of floating-point operations.
9048 This violates the ISO C and C++ language standard by possibly changing
9049 computation result. NOTE: re-ordering may change the sign of zero as
9050 well as ignore NaNs and inhibit or create underflow or overflow (and
9051 thus cannot be used on code that relies on rounding behavior like
9052 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9053 and thus may not be used when ordered comparisons are required.
9054 This option requires that both @option{-fno-signed-zeros} and
9055 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9056 much sense with @option{-frounding-math}. For Fortran the option
9057 is automatically enabled when both @option{-fno-signed-zeros} and
9058 @option{-fno-trapping-math} are in effect.
9059
9060 The default is @option{-fno-associative-math}.
9061
9062 @item -freciprocal-math
9063 @opindex freciprocal-math
9064
9065 Allow the reciprocal of a value to be used instead of dividing by
9066 the value if this enables optimizations. For example @code{x / y}
9067 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9068 is subject to common subexpression elimination. Note that this loses
9069 precision and increases the number of flops operating on the value.
9070
9071 The default is @option{-fno-reciprocal-math}.
9072
9073 @item -ffinite-math-only
9074 @opindex ffinite-math-only
9075 Allow optimizations for floating-point arithmetic that assume
9076 that arguments and results are not NaNs or +-Infs.
9077
9078 This option is not turned on by any @option{-O} option since
9079 it can result in incorrect output for programs that depend on
9080 an exact implementation of IEEE or ISO rules/specifications for
9081 math functions. It may, however, yield faster code for programs
9082 that do not require the guarantees of these specifications.
9083
9084 The default is @option{-fno-finite-math-only}.
9085
9086 @item -fno-signed-zeros
9087 @opindex fno-signed-zeros
9088 Allow optimizations for floating-point arithmetic that ignore the
9089 signedness of zero. IEEE arithmetic specifies the behavior of
9090 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9091 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9092 This option implies that the sign of a zero result isn't significant.
9093
9094 The default is @option{-fsigned-zeros}.
9095
9096 @item -fno-trapping-math
9097 @opindex fno-trapping-math
9098 Compile code assuming that floating-point operations cannot generate
9099 user-visible traps. These traps include division by zero, overflow,
9100 underflow, inexact result and invalid operation. This option requires
9101 that @option{-fno-signaling-nans} be in effect. Setting this option may
9102 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9103
9104 This option should never be turned on by any @option{-O} option since
9105 it can result in incorrect output for programs that depend on
9106 an exact implementation of IEEE or ISO rules/specifications for
9107 math functions.
9108
9109 The default is @option{-ftrapping-math}.
9110
9111 @item -frounding-math
9112 @opindex frounding-math
9113 Disable transformations and optimizations that assume default floating-point
9114 rounding behavior. This is round-to-zero for all floating point
9115 to integer conversions, and round-to-nearest for all other arithmetic
9116 truncations. This option should be specified for programs that change
9117 the FP rounding mode dynamically, or that may be executed with a
9118 non-default rounding mode. This option disables constant folding of
9119 floating-point expressions at compile time (which may be affected by
9120 rounding mode) and arithmetic transformations that are unsafe in the
9121 presence of sign-dependent rounding modes.
9122
9123 The default is @option{-fno-rounding-math}.
9124
9125 This option is experimental and does not currently guarantee to
9126 disable all GCC optimizations that are affected by rounding mode.
9127 Future versions of GCC may provide finer control of this setting
9128 using C99's @code{FENV_ACCESS} pragma. This command-line option
9129 will be used to specify the default state for @code{FENV_ACCESS}.
9130
9131 @item -fsignaling-nans
9132 @opindex fsignaling-nans
9133 Compile code assuming that IEEE signaling NaNs may generate user-visible
9134 traps during floating-point operations. Setting this option disables
9135 optimizations that may change the number of exceptions visible with
9136 signaling NaNs. This option implies @option{-ftrapping-math}.
9137
9138 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9139 be defined.
9140
9141 The default is @option{-fno-signaling-nans}.
9142
9143 This option is experimental and does not currently guarantee to
9144 disable all GCC optimizations that affect signaling NaN behavior.
9145
9146 @item -fno-fp-int-builtin-inexact
9147 @opindex fno-fp-int-builtin-inexact
9148 Do not allow the built-in functions @code{ceil}, @code{floor},
9149 @code{round} and @code{trunc}, and their @code{float} and @code{long
9150 double} variants, to generate code that raises the ``inexact''
9151 floating-point exception for noninteger arguments. ISO C99 and C11
9152 allow these functions to raise the ``inexact'' exception, but ISO/IEC
9153 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
9154 functions to do so.
9155
9156 The default is @option{-ffp-int-builtin-inexact}, allowing the
9157 exception to be raised. This option does nothing unless
9158 @option{-ftrapping-math} is in effect.
9159
9160 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
9161 generate a call to a library function then the ``inexact'' exception
9162 may be raised if the library implementation does not follow TS 18661.
9163
9164 @item -fsingle-precision-constant
9165 @opindex fsingle-precision-constant
9166 Treat floating-point constants as single precision instead of
9167 implicitly converting them to double-precision constants.
9168
9169 @item -fcx-limited-range
9170 @opindex fcx-limited-range
9171 When enabled, this option states that a range reduction step is not
9172 needed when performing complex division. Also, there is no checking
9173 whether the result of a complex multiplication or division is @code{NaN
9174 + I*NaN}, with an attempt to rescue the situation in that case. The
9175 default is @option{-fno-cx-limited-range}, but is enabled by
9176 @option{-ffast-math}.
9177
9178 This option controls the default setting of the ISO C99
9179 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9180 all languages.
9181
9182 @item -fcx-fortran-rules
9183 @opindex fcx-fortran-rules
9184 Complex multiplication and division follow Fortran rules. Range
9185 reduction is done as part of complex division, but there is no checking
9186 whether the result of a complex multiplication or division is @code{NaN
9187 + I*NaN}, with an attempt to rescue the situation in that case.
9188
9189 The default is @option{-fno-cx-fortran-rules}.
9190
9191 @end table
9192
9193 The following options control optimizations that may improve
9194 performance, but are not enabled by any @option{-O} options. This
9195 section includes experimental options that may produce broken code.
9196
9197 @table @gcctabopt
9198 @item -fbranch-probabilities
9199 @opindex fbranch-probabilities
9200 After running a program compiled with @option{-fprofile-arcs}
9201 (@pxref{Instrumentation Options}),
9202 you can compile it a second time using
9203 @option{-fbranch-probabilities}, to improve optimizations based on
9204 the number of times each branch was taken. When a program
9205 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9206 counts to a file called @file{@var{sourcename}.gcda} for each source
9207 file. The information in this data file is very dependent on the
9208 structure of the generated code, so you must use the same source code
9209 and the same optimization options for both compilations.
9210
9211 With @option{-fbranch-probabilities}, GCC puts a
9212 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9213 These can be used to improve optimization. Currently, they are only
9214 used in one place: in @file{reorg.c}, instead of guessing which path a
9215 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9216 exactly determine which path is taken more often.
9217
9218 @item -fprofile-values
9219 @opindex fprofile-values
9220 If combined with @option{-fprofile-arcs}, it adds code so that some
9221 data about values of expressions in the program is gathered.
9222
9223 With @option{-fbranch-probabilities}, it reads back the data gathered
9224 from profiling values of expressions for usage in optimizations.
9225
9226 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9227
9228 @item -fprofile-reorder-functions
9229 @opindex fprofile-reorder-functions
9230 Function reordering based on profile instrumentation collects
9231 first time of execution of a function and orders these functions
9232 in ascending order.
9233
9234 Enabled with @option{-fprofile-use}.
9235
9236 @item -fvpt
9237 @opindex fvpt
9238 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9239 to add code to gather information about values of expressions.
9240
9241 With @option{-fbranch-probabilities}, it reads back the data gathered
9242 and actually performs the optimizations based on them.
9243 Currently the optimizations include specialization of division operations
9244 using the knowledge about the value of the denominator.
9245
9246 @item -frename-registers
9247 @opindex frename-registers
9248 Attempt to avoid false dependencies in scheduled code by making use
9249 of registers left over after register allocation. This optimization
9250 most benefits processors with lots of registers. Depending on the
9251 debug information format adopted by the target, however, it can
9252 make debugging impossible, since variables no longer stay in
9253 a ``home register''.
9254
9255 Enabled by default with @option{-funroll-loops}.
9256
9257 @item -fschedule-fusion
9258 @opindex fschedule-fusion
9259 Performs a target dependent pass over the instruction stream to schedule
9260 instructions of same type together because target machine can execute them
9261 more efficiently if they are adjacent to each other in the instruction flow.
9262
9263 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9264
9265 @item -ftracer
9266 @opindex ftracer
9267 Perform tail duplication to enlarge superblock size. This transformation
9268 simplifies the control flow of the function allowing other optimizations to do
9269 a better job.
9270
9271 Enabled with @option{-fprofile-use}.
9272
9273 @item -funroll-loops
9274 @opindex funroll-loops
9275 Unroll loops whose number of iterations can be determined at compile time or
9276 upon entry to the loop. @option{-funroll-loops} implies
9277 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9278 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9279 a small constant number of iterations). This option makes code larger, and may
9280 or may not make it run faster.
9281
9282 Enabled with @option{-fprofile-use}.
9283
9284 @item -funroll-all-loops
9285 @opindex funroll-all-loops
9286 Unroll all loops, even if their number of iterations is uncertain when
9287 the loop is entered. This usually makes programs run more slowly.
9288 @option{-funroll-all-loops} implies the same options as
9289 @option{-funroll-loops}.
9290
9291 @item -fpeel-loops
9292 @opindex fpeel-loops
9293 Peels loops for which there is enough information that they do not
9294 roll much (from profile feedback or static analysis). It also turns on
9295 complete loop peeling (i.e.@: complete removal of loops with small constant
9296 number of iterations).
9297
9298 Enabled with @option{-O3} and/or @option{-fprofile-use}.
9299
9300 @item -fmove-loop-invariants
9301 @opindex fmove-loop-invariants
9302 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
9303 at level @option{-O1}
9304
9305 @item -fsplit-loops
9306 @opindex fsplit-loops
9307 Split a loop into two if it contains a condition that's always true
9308 for one side of the iteration space and false for the other.
9309
9310 @item -funswitch-loops
9311 @opindex funswitch-loops
9312 Move branches with loop invariant conditions out of the loop, with duplicates
9313 of the loop on both branches (modified according to result of the condition).
9314
9315 @item -ffunction-sections
9316 @itemx -fdata-sections
9317 @opindex ffunction-sections
9318 @opindex fdata-sections
9319 Place each function or data item into its own section in the output
9320 file if the target supports arbitrary sections. The name of the
9321 function or the name of the data item determines the section's name
9322 in the output file.
9323
9324 Use these options on systems where the linker can perform optimizations
9325 to improve locality of reference in the instruction space. Most systems
9326 using the ELF object format and SPARC processors running Solaris 2 have
9327 linkers with such optimizations. AIX may have these optimizations in
9328 the future.
9329
9330 Only use these options when there are significant benefits from doing
9331 so. When you specify these options, the assembler and linker
9332 create larger object and executable files and are also slower.
9333 You cannot use @command{gprof} on all systems if you
9334 specify this option, and you may have problems with debugging if
9335 you specify both this option and @option{-g}.
9336
9337 @item -fbranch-target-load-optimize
9338 @opindex fbranch-target-load-optimize
9339 Perform branch target register load optimization before prologue / epilogue
9340 threading.
9341 The use of target registers can typically be exposed only during reload,
9342 thus hoisting loads out of loops and doing inter-block scheduling needs
9343 a separate optimization pass.
9344
9345 @item -fbranch-target-load-optimize2
9346 @opindex fbranch-target-load-optimize2
9347 Perform branch target register load optimization after prologue / epilogue
9348 threading.
9349
9350 @item -fbtr-bb-exclusive
9351 @opindex fbtr-bb-exclusive
9352 When performing branch target register load optimization, don't reuse
9353 branch target registers within any basic block.
9354
9355 @item -fstdarg-opt
9356 @opindex fstdarg-opt
9357 Optimize the prologue of variadic argument functions with respect to usage of
9358 those arguments.
9359
9360 @item -fsection-anchors
9361 @opindex fsection-anchors
9362 Try to reduce the number of symbolic address calculations by using
9363 shared ``anchor'' symbols to address nearby objects. This transformation
9364 can help to reduce the number of GOT entries and GOT accesses on some
9365 targets.
9366
9367 For example, the implementation of the following function @code{foo}:
9368
9369 @smallexample
9370 static int a, b, c;
9371 int foo (void) @{ return a + b + c; @}
9372 @end smallexample
9373
9374 @noindent
9375 usually calculates the addresses of all three variables, but if you
9376 compile it with @option{-fsection-anchors}, it accesses the variables
9377 from a common anchor point instead. The effect is similar to the
9378 following pseudocode (which isn't valid C):
9379
9380 @smallexample
9381 int foo (void)
9382 @{
9383 register int *xr = &x;
9384 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9385 @}
9386 @end smallexample
9387
9388 Not all targets support this option.
9389
9390 @item --param @var{name}=@var{value}
9391 @opindex param
9392 In some places, GCC uses various constants to control the amount of
9393 optimization that is done. For example, GCC does not inline functions
9394 that contain more than a certain number of instructions. You can
9395 control some of these constants on the command line using the
9396 @option{--param} option.
9397
9398 The names of specific parameters, and the meaning of the values, are
9399 tied to the internals of the compiler, and are subject to change
9400 without notice in future releases.
9401
9402 In each case, the @var{value} is an integer. The allowable choices for
9403 @var{name} are:
9404
9405 @table @gcctabopt
9406 @item predictable-branch-outcome
9407 When branch is predicted to be taken with probability lower than this threshold
9408 (in percent), then it is considered well predictable. The default is 10.
9409
9410 @item max-rtl-if-conversion-insns
9411 RTL if-conversion tries to remove conditional branches around a block and
9412 replace them with conditionally executed instructions. This parameter
9413 gives the maximum number of instructions in a block which should be
9414 considered for if-conversion. The default is 10, though the compiler will
9415 also use other heuristics to decide whether if-conversion is likely to be
9416 profitable.
9417
9418 @item max-rtl-if-conversion-predictable-cost
9419 @item max-rtl-if-conversion-unpredictable-cost
9420 RTL if-conversion will try to remove conditional branches around a block
9421 and replace them with conditionally executed instructions. These parameters
9422 give the maximum permissible cost for the sequence that would be generated
9423 by if-conversion depending on whether the branch is statically determined
9424 to be predictable or not. The units for this parameter are the same as
9425 those for the GCC internal seq_cost metric. The compiler will try to
9426 provide a reasonable default for this parameter using the BRANCH_COST
9427 target macro.
9428
9429 @item max-crossjump-edges
9430 The maximum number of incoming edges to consider for cross-jumping.
9431 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
9432 the number of edges incoming to each block. Increasing values mean
9433 more aggressive optimization, making the compilation time increase with
9434 probably small improvement in executable size.
9435
9436 @item min-crossjump-insns
9437 The minimum number of instructions that must be matched at the end
9438 of two blocks before cross-jumping is performed on them. This
9439 value is ignored in the case where all instructions in the block being
9440 cross-jumped from are matched. The default value is 5.
9441
9442 @item max-grow-copy-bb-insns
9443 The maximum code size expansion factor when copying basic blocks
9444 instead of jumping. The expansion is relative to a jump instruction.
9445 The default value is 8.
9446
9447 @item max-goto-duplication-insns
9448 The maximum number of instructions to duplicate to a block that jumps
9449 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
9450 passes, GCC factors computed gotos early in the compilation process,
9451 and unfactors them as late as possible. Only computed jumps at the
9452 end of a basic blocks with no more than max-goto-duplication-insns are
9453 unfactored. The default value is 8.
9454
9455 @item max-delay-slot-insn-search
9456 The maximum number of instructions to consider when looking for an
9457 instruction to fill a delay slot. If more than this arbitrary number of
9458 instructions are searched, the time savings from filling the delay slot
9459 are minimal, so stop searching. Increasing values mean more
9460 aggressive optimization, making the compilation time increase with probably
9461 small improvement in execution time.
9462
9463 @item max-delay-slot-live-search
9464 When trying to fill delay slots, the maximum number of instructions to
9465 consider when searching for a block with valid live register
9466 information. Increasing this arbitrarily chosen value means more
9467 aggressive optimization, increasing the compilation time. This parameter
9468 should be removed when the delay slot code is rewritten to maintain the
9469 control-flow graph.
9470
9471 @item max-gcse-memory
9472 The approximate maximum amount of memory that can be allocated in
9473 order to perform the global common subexpression elimination
9474 optimization. If more memory than specified is required, the
9475 optimization is not done.
9476
9477 @item max-gcse-insertion-ratio
9478 If the ratio of expression insertions to deletions is larger than this value
9479 for any expression, then RTL PRE inserts or removes the expression and thus
9480 leaves partially redundant computations in the instruction stream. The default value is 20.
9481
9482 @item max-pending-list-length
9483 The maximum number of pending dependencies scheduling allows
9484 before flushing the current state and starting over. Large functions
9485 with few branches or calls can create excessively large lists which
9486 needlessly consume memory and resources.
9487
9488 @item max-modulo-backtrack-attempts
9489 The maximum number of backtrack attempts the scheduler should make
9490 when modulo scheduling a loop. Larger values can exponentially increase
9491 compilation time.
9492
9493 @item max-inline-insns-single
9494 Several parameters control the tree inliner used in GCC@.
9495 This number sets the maximum number of instructions (counted in GCC's
9496 internal representation) in a single function that the tree inliner
9497 considers for inlining. This only affects functions declared
9498 inline and methods implemented in a class declaration (C++).
9499 The default value is 400.
9500
9501 @item max-inline-insns-auto
9502 When you use @option{-finline-functions} (included in @option{-O3}),
9503 a lot of functions that would otherwise not be considered for inlining
9504 by the compiler are investigated. To those functions, a different
9505 (more restrictive) limit compared to functions declared inline can
9506 be applied.
9507 The default value is 40.
9508
9509 @item inline-min-speedup
9510 When estimated performance improvement of caller + callee runtime exceeds this
9511 threshold (in precent), the function can be inlined regardless the limit on
9512 @option{--param max-inline-insns-single} and @option{--param
9513 max-inline-insns-auto}.
9514
9515 @item large-function-insns
9516 The limit specifying really large functions. For functions larger than this
9517 limit after inlining, inlining is constrained by
9518 @option{--param large-function-growth}. This parameter is useful primarily
9519 to avoid extreme compilation time caused by non-linear algorithms used by the
9520 back end.
9521 The default value is 2700.
9522
9523 @item large-function-growth
9524 Specifies maximal growth of large function caused by inlining in percents.
9525 The default value is 100 which limits large function growth to 2.0 times
9526 the original size.
9527
9528 @item large-unit-insns
9529 The limit specifying large translation unit. Growth caused by inlining of
9530 units larger than this limit is limited by @option{--param inline-unit-growth}.
9531 For small units this might be too tight.
9532 For example, consider a unit consisting of function A
9533 that is inline and B that just calls A three times. If B is small relative to
9534 A, the growth of unit is 300\% and yet such inlining is very sane. For very
9535 large units consisting of small inlineable functions, however, the overall unit
9536 growth limit is needed to avoid exponential explosion of code size. Thus for
9537 smaller units, the size is increased to @option{--param large-unit-insns}
9538 before applying @option{--param inline-unit-growth}. The default is 10000.
9539
9540 @item inline-unit-growth
9541 Specifies maximal overall growth of the compilation unit caused by inlining.
9542 The default value is 20 which limits unit growth to 1.2 times the original
9543 size. Cold functions (either marked cold via an attribute or by profile
9544 feedback) are not accounted into the unit size.
9545
9546 @item ipcp-unit-growth
9547 Specifies maximal overall growth of the compilation unit caused by
9548 interprocedural constant propagation. The default value is 10 which limits
9549 unit growth to 1.1 times the original size.
9550
9551 @item large-stack-frame
9552 The limit specifying large stack frames. While inlining the algorithm is trying
9553 to not grow past this limit too much. The default value is 256 bytes.
9554
9555 @item large-stack-frame-growth
9556 Specifies maximal growth of large stack frames caused by inlining in percents.
9557 The default value is 1000 which limits large stack frame growth to 11 times
9558 the original size.
9559
9560 @item max-inline-insns-recursive
9561 @itemx max-inline-insns-recursive-auto
9562 Specifies the maximum number of instructions an out-of-line copy of a
9563 self-recursive inline
9564 function can grow into by performing recursive inlining.
9565
9566 @option{--param max-inline-insns-recursive} applies to functions
9567 declared inline.
9568 For functions not declared inline, recursive inlining
9569 happens only when @option{-finline-functions} (included in @option{-O3}) is
9570 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
9571 default value is 450.
9572
9573 @item max-inline-recursive-depth
9574 @itemx max-inline-recursive-depth-auto
9575 Specifies the maximum recursion depth used for recursive inlining.
9576
9577 @option{--param max-inline-recursive-depth} applies to functions
9578 declared inline. For functions not declared inline, recursive inlining
9579 happens only when @option{-finline-functions} (included in @option{-O3}) is
9580 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
9581 default value is 8.
9582
9583 @item min-inline-recursive-probability
9584 Recursive inlining is profitable only for function having deep recursion
9585 in average and can hurt for function having little recursion depth by
9586 increasing the prologue size or complexity of function body to other
9587 optimizers.
9588
9589 When profile feedback is available (see @option{-fprofile-generate}) the actual
9590 recursion depth can be guessed from the probability that function recurses
9591 via a given call expression. This parameter limits inlining only to call
9592 expressions whose probability exceeds the given threshold (in percents).
9593 The default value is 10.
9594
9595 @item early-inlining-insns
9596 Specify growth that the early inliner can make. In effect it increases
9597 the amount of inlining for code having a large abstraction penalty.
9598 The default value is 14.
9599
9600 @item max-early-inliner-iterations
9601 Limit of iterations of the early inliner. This basically bounds
9602 the number of nested indirect calls the early inliner can resolve.
9603 Deeper chains are still handled by late inlining.
9604
9605 @item comdat-sharing-probability
9606 Probability (in percent) that C++ inline function with comdat visibility
9607 are shared across multiple compilation units. The default value is 20.
9608
9609 @item profile-func-internal-id
9610 A parameter to control whether to use function internal id in profile
9611 database lookup. If the value is 0, the compiler uses an id that
9612 is based on function assembler name and filename, which makes old profile
9613 data more tolerant to source changes such as function reordering etc.
9614 The default value is 0.
9615
9616 @item min-vect-loop-bound
9617 The minimum number of iterations under which loops are not vectorized
9618 when @option{-ftree-vectorize} is used. The number of iterations after
9619 vectorization needs to be greater than the value specified by this option
9620 to allow vectorization. The default value is 0.
9621
9622 @item gcse-cost-distance-ratio
9623 Scaling factor in calculation of maximum distance an expression
9624 can be moved by GCSE optimizations. This is currently supported only in the
9625 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9626 is with simple expressions, i.e., the expressions that have cost
9627 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9628 hoisting of simple expressions. The default value is 10.
9629
9630 @item gcse-unrestricted-cost
9631 Cost, roughly measured as the cost of a single typical machine
9632 instruction, at which GCSE optimizations do not constrain
9633 the distance an expression can travel. This is currently
9634 supported only in the code hoisting pass. The lesser the cost,
9635 the more aggressive code hoisting is. Specifying 0
9636 allows all expressions to travel unrestricted distances.
9637 The default value is 3.
9638
9639 @item max-hoist-depth
9640 The depth of search in the dominator tree for expressions to hoist.
9641 This is used to avoid quadratic behavior in hoisting algorithm.
9642 The value of 0 does not limit on the search, but may slow down compilation
9643 of huge functions. The default value is 30.
9644
9645 @item max-tail-merge-comparisons
9646 The maximum amount of similar bbs to compare a bb with. This is used to
9647 avoid quadratic behavior in tree tail merging. The default value is 10.
9648
9649 @item max-tail-merge-iterations
9650 The maximum amount of iterations of the pass over the function. This is used to
9651 limit compilation time in tree tail merging. The default value is 2.
9652
9653 @item store-merging-allow-unaligned
9654 Allow the store merging pass to introduce unaligned stores if it is legal to
9655 do so. The default value is 1.
9656
9657 @item max-stores-to-merge
9658 The maximum number of stores to attempt to merge into wider stores in the store
9659 merging pass. The minimum value is 2 and the default is 64.
9660
9661 @item max-unrolled-insns
9662 The maximum number of instructions that a loop may have to be unrolled.
9663 If a loop is unrolled, this parameter also determines how many times
9664 the loop code is unrolled.
9665
9666 @item max-average-unrolled-insns
9667 The maximum number of instructions biased by probabilities of their execution
9668 that a loop may have to be unrolled. If a loop is unrolled,
9669 this parameter also determines how many times the loop code is unrolled.
9670
9671 @item max-unroll-times
9672 The maximum number of unrollings of a single loop.
9673
9674 @item max-peeled-insns
9675 The maximum number of instructions that a loop may have to be peeled.
9676 If a loop is peeled, this parameter also determines how many times
9677 the loop code is peeled.
9678
9679 @item max-peel-times
9680 The maximum number of peelings of a single loop.
9681
9682 @item max-peel-branches
9683 The maximum number of branches on the hot path through the peeled sequence.
9684
9685 @item max-completely-peeled-insns
9686 The maximum number of insns of a completely peeled loop.
9687
9688 @item max-completely-peel-times
9689 The maximum number of iterations of a loop to be suitable for complete peeling.
9690
9691 @item max-completely-peel-loop-nest-depth
9692 The maximum depth of a loop nest suitable for complete peeling.
9693
9694 @item max-unswitch-insns
9695 The maximum number of insns of an unswitched loop.
9696
9697 @item max-unswitch-level
9698 The maximum number of branches unswitched in a single loop.
9699
9700 @item max-loop-headers-insns
9701 The maximum number of insns in loop header duplicated by he copy loop headers
9702 pass.
9703
9704 @item lim-expensive
9705 The minimum cost of an expensive expression in the loop invariant motion.
9706
9707 @item iv-consider-all-candidates-bound
9708 Bound on number of candidates for induction variables, below which
9709 all candidates are considered for each use in induction variable
9710 optimizations. If there are more candidates than this,
9711 only the most relevant ones are considered to avoid quadratic time complexity.
9712
9713 @item iv-max-considered-uses
9714 The induction variable optimizations give up on loops that contain more
9715 induction variable uses.
9716
9717 @item iv-always-prune-cand-set-bound
9718 If the number of candidates in the set is smaller than this value,
9719 always try to remove unnecessary ivs from the set
9720 when adding a new one.
9721
9722 @item avg-loop-niter
9723 Average number of iterations of a loop.
9724
9725 @item scev-max-expr-size
9726 Bound on size of expressions used in the scalar evolutions analyzer.
9727 Large expressions slow the analyzer.
9728
9729 @item scev-max-expr-complexity
9730 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9731 Complex expressions slow the analyzer.
9732
9733 @item max-tree-if-conversion-phi-args
9734 Maximum number of arguments in a PHI supported by TREE if conversion
9735 unless the loop is marked with simd pragma.
9736
9737 @item vect-max-version-for-alignment-checks
9738 The maximum number of run-time checks that can be performed when
9739 doing loop versioning for alignment in the vectorizer.
9740
9741 @item vect-max-version-for-alias-checks
9742 The maximum number of run-time checks that can be performed when
9743 doing loop versioning for alias in the vectorizer.
9744
9745 @item vect-max-peeling-for-alignment
9746 The maximum number of loop peels to enhance access alignment
9747 for vectorizer. Value -1 means no limit.
9748
9749 @item max-iterations-to-track
9750 The maximum number of iterations of a loop the brute-force algorithm
9751 for analysis of the number of iterations of the loop tries to evaluate.
9752
9753 @item hot-bb-count-ws-permille
9754 A basic block profile count is considered hot if it contributes to
9755 the given permillage (i.e. 0...1000) of the entire profiled execution.
9756
9757 @item hot-bb-frequency-fraction
9758 Select fraction of the entry block frequency of executions of basic block in
9759 function given basic block needs to have to be considered hot.
9760
9761 @item max-predicted-iterations
9762 The maximum number of loop iterations we predict statically. This is useful
9763 in cases where a function contains a single loop with known bound and
9764 another loop with unknown bound.
9765 The known number of iterations is predicted correctly, while
9766 the unknown number of iterations average to roughly 10. This means that the
9767 loop without bounds appears artificially cold relative to the other one.
9768
9769 @item builtin-expect-probability
9770 Control the probability of the expression having the specified value. This
9771 parameter takes a percentage (i.e. 0 ... 100) as input.
9772 The default probability of 90 is obtained empirically.
9773
9774 @item align-threshold
9775
9776 Select fraction of the maximal frequency of executions of a basic block in
9777 a function to align the basic block.
9778
9779 @item align-loop-iterations
9780
9781 A loop expected to iterate at least the selected number of iterations is
9782 aligned.
9783
9784 @item tracer-dynamic-coverage
9785 @itemx tracer-dynamic-coverage-feedback
9786
9787 This value is used to limit superblock formation once the given percentage of
9788 executed instructions is covered. This limits unnecessary code size
9789 expansion.
9790
9791 The @option{tracer-dynamic-coverage-feedback} parameter
9792 is used only when profile
9793 feedback is available. The real profiles (as opposed to statically estimated
9794 ones) are much less balanced allowing the threshold to be larger value.
9795
9796 @item tracer-max-code-growth
9797 Stop tail duplication once code growth has reached given percentage. This is
9798 a rather artificial limit, as most of the duplicates are eliminated later in
9799 cross jumping, so it may be set to much higher values than is the desired code
9800 growth.
9801
9802 @item tracer-min-branch-ratio
9803
9804 Stop reverse growth when the reverse probability of best edge is less than this
9805 threshold (in percent).
9806
9807 @item tracer-min-branch-probability
9808 @itemx tracer-min-branch-probability-feedback
9809
9810 Stop forward growth if the best edge has probability lower than this
9811 threshold.
9812
9813 Similarly to @option{tracer-dynamic-coverage} two parameters are
9814 provided. @option{tracer-min-branch-probability-feedback} is used for
9815 compilation with profile feedback and @option{tracer-min-branch-probability}
9816 compilation without. The value for compilation with profile feedback
9817 needs to be more conservative (higher) in order to make tracer
9818 effective.
9819
9820 @item max-cse-path-length
9821
9822 The maximum number of basic blocks on path that CSE considers.
9823 The default is 10.
9824
9825 @item max-cse-insns
9826 The maximum number of instructions CSE processes before flushing.
9827 The default is 1000.
9828
9829 @item ggc-min-expand
9830
9831 GCC uses a garbage collector to manage its own memory allocation. This
9832 parameter specifies the minimum percentage by which the garbage
9833 collector's heap should be allowed to expand between collections.
9834 Tuning this may improve compilation speed; it has no effect on code
9835 generation.
9836
9837 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9838 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9839 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9840 GCC is not able to calculate RAM on a particular platform, the lower
9841 bound of 30% is used. Setting this parameter and
9842 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9843 every opportunity. This is extremely slow, but can be useful for
9844 debugging.
9845
9846 @item ggc-min-heapsize
9847
9848 Minimum size of the garbage collector's heap before it begins bothering
9849 to collect garbage. The first collection occurs after the heap expands
9850 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9851 tuning this may improve compilation speed, and has no effect on code
9852 generation.
9853
9854 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9855 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9856 with a lower bound of 4096 (four megabytes) and an upper bound of
9857 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9858 particular platform, the lower bound is used. Setting this parameter
9859 very large effectively disables garbage collection. Setting this
9860 parameter and @option{ggc-min-expand} to zero causes a full collection
9861 to occur at every opportunity.
9862
9863 @item max-reload-search-insns
9864 The maximum number of instruction reload should look backward for equivalent
9865 register. Increasing values mean more aggressive optimization, making the
9866 compilation time increase with probably slightly better performance.
9867 The default value is 100.
9868
9869 @item max-cselib-memory-locations
9870 The maximum number of memory locations cselib should take into account.
9871 Increasing values mean more aggressive optimization, making the compilation time
9872 increase with probably slightly better performance. The default value is 500.
9873
9874 @item max-sched-ready-insns
9875 The maximum number of instructions ready to be issued the scheduler should
9876 consider at any given time during the first scheduling pass. Increasing
9877 values mean more thorough searches, making the compilation time increase
9878 with probably little benefit. The default value is 100.
9879
9880 @item max-sched-region-blocks
9881 The maximum number of blocks in a region to be considered for
9882 interblock scheduling. The default value is 10.
9883
9884 @item max-pipeline-region-blocks
9885 The maximum number of blocks in a region to be considered for
9886 pipelining in the selective scheduler. The default value is 15.
9887
9888 @item max-sched-region-insns
9889 The maximum number of insns in a region to be considered for
9890 interblock scheduling. The default value is 100.
9891
9892 @item max-pipeline-region-insns
9893 The maximum number of insns in a region to be considered for
9894 pipelining in the selective scheduler. The default value is 200.
9895
9896 @item min-spec-prob
9897 The minimum probability (in percents) of reaching a source block
9898 for interblock speculative scheduling. The default value is 40.
9899
9900 @item max-sched-extend-regions-iters
9901 The maximum number of iterations through CFG to extend regions.
9902 A value of 0 (the default) disables region extensions.
9903
9904 @item max-sched-insn-conflict-delay
9905 The maximum conflict delay for an insn to be considered for speculative motion.
9906 The default value is 3.
9907
9908 @item sched-spec-prob-cutoff
9909 The minimal probability of speculation success (in percents), so that
9910 speculative insns are scheduled.
9911 The default value is 40.
9912
9913 @item sched-state-edge-prob-cutoff
9914 The minimum probability an edge must have for the scheduler to save its
9915 state across it.
9916 The default value is 10.
9917
9918 @item sched-mem-true-dep-cost
9919 Minimal distance (in CPU cycles) between store and load targeting same
9920 memory locations. The default value is 1.
9921
9922 @item selsched-max-lookahead
9923 The maximum size of the lookahead window of selective scheduling. It is a
9924 depth of search for available instructions.
9925 The default value is 50.
9926
9927 @item selsched-max-sched-times
9928 The maximum number of times that an instruction is scheduled during
9929 selective scheduling. This is the limit on the number of iterations
9930 through which the instruction may be pipelined. The default value is 2.
9931
9932 @item selsched-insns-to-rename
9933 The maximum number of best instructions in the ready list that are considered
9934 for renaming in the selective scheduler. The default value is 2.
9935
9936 @item sms-min-sc
9937 The minimum value of stage count that swing modulo scheduler
9938 generates. The default value is 2.
9939
9940 @item max-last-value-rtl
9941 The maximum size measured as number of RTLs that can be recorded in an expression
9942 in combiner for a pseudo register as last known value of that register. The default
9943 is 10000.
9944
9945 @item max-combine-insns
9946 The maximum number of instructions the RTL combiner tries to combine.
9947 The default value is 2 at @option{-Og} and 4 otherwise.
9948
9949 @item integer-share-limit
9950 Small integer constants can use a shared data structure, reducing the
9951 compiler's memory usage and increasing its speed. This sets the maximum
9952 value of a shared integer constant. The default value is 256.
9953
9954 @item ssp-buffer-size
9955 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9956 protection when @option{-fstack-protection} is used.
9957
9958 @item min-size-for-stack-sharing
9959 The minimum size of variables taking part in stack slot sharing when not
9960 optimizing. The default value is 32.
9961
9962 @item max-jump-thread-duplication-stmts
9963 Maximum number of statements allowed in a block that needs to be
9964 duplicated when threading jumps.
9965
9966 @item max-fields-for-field-sensitive
9967 Maximum number of fields in a structure treated in
9968 a field sensitive manner during pointer analysis. The default is zero
9969 for @option{-O0} and @option{-O1},
9970 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9971
9972 @item prefetch-latency
9973 Estimate on average number of instructions that are executed before
9974 prefetch finishes. The distance prefetched ahead is proportional
9975 to this constant. Increasing this number may also lead to less
9976 streams being prefetched (see @option{simultaneous-prefetches}).
9977
9978 @item simultaneous-prefetches
9979 Maximum number of prefetches that can run at the same time.
9980
9981 @item l1-cache-line-size
9982 The size of cache line in L1 cache, in bytes.
9983
9984 @item l1-cache-size
9985 The size of L1 cache, in kilobytes.
9986
9987 @item l2-cache-size
9988 The size of L2 cache, in kilobytes.
9989
9990 @item min-insn-to-prefetch-ratio
9991 The minimum ratio between the number of instructions and the
9992 number of prefetches to enable prefetching in a loop.
9993
9994 @item prefetch-min-insn-to-mem-ratio
9995 The minimum ratio between the number of instructions and the
9996 number of memory references to enable prefetching in a loop.
9997
9998 @item use-canonical-types
9999 Whether the compiler should use the ``canonical'' type system. By
10000 default, this should always be 1, which uses a more efficient internal
10001 mechanism for comparing types in C++ and Objective-C++. However, if
10002 bugs in the canonical type system are causing compilation failures,
10003 set this value to 0 to disable canonical types.
10004
10005 @item switch-conversion-max-branch-ratio
10006 Switch initialization conversion refuses to create arrays that are
10007 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10008 branches in the switch.
10009
10010 @item max-partial-antic-length
10011 Maximum length of the partial antic set computed during the tree
10012 partial redundancy elimination optimization (@option{-ftree-pre}) when
10013 optimizing at @option{-O3} and above. For some sorts of source code
10014 the enhanced partial redundancy elimination optimization can run away,
10015 consuming all of the memory available on the host machine. This
10016 parameter sets a limit on the length of the sets that are computed,
10017 which prevents the runaway behavior. Setting a value of 0 for
10018 this parameter allows an unlimited set length.
10019
10020 @item sccvn-max-scc-size
10021 Maximum size of a strongly connected component (SCC) during SCCVN
10022 processing. If this limit is hit, SCCVN processing for the whole
10023 function is not done and optimizations depending on it are
10024 disabled. The default maximum SCC size is 10000.
10025
10026 @item sccvn-max-alias-queries-per-access
10027 Maximum number of alias-oracle queries we perform when looking for
10028 redundancies for loads and stores. If this limit is hit the search
10029 is aborted and the load or store is not considered redundant. The
10030 number of queries is algorithmically limited to the number of
10031 stores on all paths from the load to the function entry.
10032 The default maximum number of queries is 1000.
10033
10034 @item ira-max-loops-num
10035 IRA uses regional register allocation by default. If a function
10036 contains more loops than the number given by this parameter, only at most
10037 the given number of the most frequently-executed loops form regions
10038 for regional register allocation. The default value of the
10039 parameter is 100.
10040
10041 @item ira-max-conflict-table-size
10042 Although IRA uses a sophisticated algorithm to compress the conflict
10043 table, the table can still require excessive amounts of memory for
10044 huge functions. If the conflict table for a function could be more
10045 than the size in MB given by this parameter, the register allocator
10046 instead uses a faster, simpler, and lower-quality
10047 algorithm that does not require building a pseudo-register conflict table.
10048 The default value of the parameter is 2000.
10049
10050 @item ira-loop-reserved-regs
10051 IRA can be used to evaluate more accurate register pressure in loops
10052 for decisions to move loop invariants (see @option{-O3}). The number
10053 of available registers reserved for some other purposes is given
10054 by this parameter. The default value of the parameter is 2, which is
10055 the minimal number of registers needed by typical instructions.
10056 This value is the best found from numerous experiments.
10057
10058 @item lra-inheritance-ebb-probability-cutoff
10059 LRA tries to reuse values reloaded in registers in subsequent insns.
10060 This optimization is called inheritance. EBB is used as a region to
10061 do this optimization. The parameter defines a minimal fall-through
10062 edge probability in percentage used to add BB to inheritance EBB in
10063 LRA. The default value of the parameter is 40. The value was chosen
10064 from numerous runs of SPEC2000 on x86-64.
10065
10066 @item loop-invariant-max-bbs-in-loop
10067 Loop invariant motion can be very expensive, both in compilation time and
10068 in amount of needed compile-time memory, with very large loops. Loops
10069 with more basic blocks than this parameter won't have loop invariant
10070 motion optimization performed on them. The default value of the
10071 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10072
10073 @item loop-max-datarefs-for-datadeps
10074 Building data dependencies is expensive for very large loops. This
10075 parameter limits the number of data references in loops that are
10076 considered for data dependence analysis. These large loops are no
10077 handled by the optimizations using loop data dependencies.
10078 The default value is 1000.
10079
10080 @item max-vartrack-size
10081 Sets a maximum number of hash table slots to use during variable
10082 tracking dataflow analysis of any function. If this limit is exceeded
10083 with variable tracking at assignments enabled, analysis for that
10084 function is retried without it, after removing all debug insns from
10085 the function. If the limit is exceeded even without debug insns, var
10086 tracking analysis is completely disabled for the function. Setting
10087 the parameter to zero makes it unlimited.
10088
10089 @item max-vartrack-expr-depth
10090 Sets a maximum number of recursion levels when attempting to map
10091 variable names or debug temporaries to value expressions. This trades
10092 compilation time for more complete debug information. If this is set too
10093 low, value expressions that are available and could be represented in
10094 debug information may end up not being used; setting this higher may
10095 enable the compiler to find more complex debug expressions, but compile
10096 time and memory use may grow. The default is 12.
10097
10098 @item min-nondebug-insn-uid
10099 Use uids starting at this parameter for nondebug insns. The range below
10100 the parameter is reserved exclusively for debug insns created by
10101 @option{-fvar-tracking-assignments}, but debug insns may get
10102 (non-overlapping) uids above it if the reserved range is exhausted.
10103
10104 @item ipa-sra-ptr-growth-factor
10105 IPA-SRA replaces a pointer to an aggregate with one or more new
10106 parameters only when their cumulative size is less or equal to
10107 @option{ipa-sra-ptr-growth-factor} times the size of the original
10108 pointer parameter.
10109
10110 @item sra-max-scalarization-size-Ospeed
10111 @item sra-max-scalarization-size-Osize
10112 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10113 replace scalar parts of aggregates with uses of independent scalar
10114 variables. These parameters control the maximum size, in storage units,
10115 of aggregate which is considered for replacement when compiling for
10116 speed
10117 (@option{sra-max-scalarization-size-Ospeed}) or size
10118 (@option{sra-max-scalarization-size-Osize}) respectively.
10119
10120 @item tm-max-aggregate-size
10121 When making copies of thread-local variables in a transaction, this
10122 parameter specifies the size in bytes after which variables are
10123 saved with the logging functions as opposed to save/restore code
10124 sequence pairs. This option only applies when using
10125 @option{-fgnu-tm}.
10126
10127 @item graphite-max-nb-scop-params
10128 To avoid exponential effects in the Graphite loop transforms, the
10129 number of parameters in a Static Control Part (SCoP) is bounded. The
10130 default value is 10 parameters. A variable whose value is unknown at
10131 compilation time and defined outside a SCoP is a parameter of the SCoP.
10132
10133 @item graphite-max-bbs-per-function
10134 To avoid exponential effects in the detection of SCoPs, the size of
10135 the functions analyzed by Graphite is bounded. The default value is
10136 100 basic blocks.
10137
10138 @item loop-block-tile-size
10139 Loop blocking or strip mining transforms, enabled with
10140 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10141 loop in the loop nest by a given number of iterations. The strip
10142 length can be changed using the @option{loop-block-tile-size}
10143 parameter. The default value is 51 iterations.
10144
10145 @item loop-unroll-jam-size
10146 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
10147 default value is 4.
10148
10149 @item loop-unroll-jam-depth
10150 Specify the dimension to be unrolled (counting from the most inner loop)
10151 for the @option{-floop-unroll-and-jam}. The default value is 2.
10152
10153 @item ipa-cp-value-list-size
10154 IPA-CP attempts to track all possible values and types passed to a function's
10155 parameter in order to propagate them and perform devirtualization.
10156 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10157 stores per one formal parameter of a function.
10158
10159 @item ipa-cp-eval-threshold
10160 IPA-CP calculates its own score of cloning profitability heuristics
10161 and performs those cloning opportunities with scores that exceed
10162 @option{ipa-cp-eval-threshold}.
10163
10164 @item ipa-cp-recursion-penalty
10165 Percentage penalty the recursive functions will receive when they
10166 are evaluated for cloning.
10167
10168 @item ipa-cp-single-call-penalty
10169 Percentage penalty functions containg a single call to another
10170 function will receive when they are evaluated for cloning.
10171
10172
10173 @item ipa-max-agg-items
10174 IPA-CP is also capable to propagate a number of scalar values passed
10175 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10176 number of such values per one parameter.
10177
10178 @item ipa-cp-loop-hint-bonus
10179 When IPA-CP determines that a cloning candidate would make the number
10180 of iterations of a loop known, it adds a bonus of
10181 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10182 the candidate.
10183
10184 @item ipa-cp-array-index-hint-bonus
10185 When IPA-CP determines that a cloning candidate would make the index of
10186 an array access known, it adds a bonus of
10187 @option{ipa-cp-array-index-hint-bonus} to the profitability
10188 score of the candidate.
10189
10190 @item ipa-max-aa-steps
10191 During its analysis of function bodies, IPA-CP employs alias analysis
10192 in order to track values pointed to by function parameters. In order
10193 not spend too much time analyzing huge functions, it gives up and
10194 consider all memory clobbered after examining
10195 @option{ipa-max-aa-steps} statements modifying memory.
10196
10197 @item lto-partitions
10198 Specify desired number of partitions produced during WHOPR compilation.
10199 The number of partitions should exceed the number of CPUs used for compilation.
10200 The default value is 32.
10201
10202 @item lto-min-partition
10203 Size of minimal partition for WHOPR (in estimated instructions).
10204 This prevents expenses of splitting very small programs into too many
10205 partitions.
10206
10207 @item lto-max-partition
10208 Size of max partition for WHOPR (in estimated instructions).
10209 to provide an upper bound for individual size of partition.
10210 Meant to be used only with balanced partitioning.
10211
10212 @item cxx-max-namespaces-for-diagnostic-help
10213 The maximum number of namespaces to consult for suggestions when C++
10214 name lookup fails for an identifier. The default is 1000.
10215
10216 @item sink-frequency-threshold
10217 The maximum relative execution frequency (in percents) of the target block
10218 relative to a statement's original block to allow statement sinking of a
10219 statement. Larger numbers result in more aggressive statement sinking.
10220 The default value is 75. A small positive adjustment is applied for
10221 statements with memory operands as those are even more profitable so sink.
10222
10223 @item max-stores-to-sink
10224 The maximum number of conditional store pairs that can be sunk. Set to 0
10225 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10226 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10227
10228 @item allow-store-data-races
10229 Allow optimizers to introduce new data races on stores.
10230 Set to 1 to allow, otherwise to 0. This option is enabled by default
10231 at optimization level @option{-Ofast}.
10232
10233 @item case-values-threshold
10234 The smallest number of different values for which it is best to use a
10235 jump-table instead of a tree of conditional branches. If the value is
10236 0, use the default for the machine. The default is 0.
10237
10238 @item tree-reassoc-width
10239 Set the maximum number of instructions executed in parallel in
10240 reassociated tree. This parameter overrides target dependent
10241 heuristics used by default if has non zero value.
10242
10243 @item sched-pressure-algorithm
10244 Choose between the two available implementations of
10245 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10246 and is the more likely to prevent instructions from being reordered.
10247 Algorithm 2 was designed to be a compromise between the relatively
10248 conservative approach taken by algorithm 1 and the rather aggressive
10249 approach taken by the default scheduler. It relies more heavily on
10250 having a regular register file and accurate register pressure classes.
10251 See @file{haifa-sched.c} in the GCC sources for more details.
10252
10253 The default choice depends on the target.
10254
10255 @item max-slsr-cand-scan
10256 Set the maximum number of existing candidates that are considered when
10257 seeking a basis for a new straight-line strength reduction candidate.
10258
10259 @item asan-globals
10260 Enable buffer overflow detection for global objects. This kind
10261 of protection is enabled by default if you are using
10262 @option{-fsanitize=address} option.
10263 To disable global objects protection use @option{--param asan-globals=0}.
10264
10265 @item asan-stack
10266 Enable buffer overflow detection for stack objects. This kind of
10267 protection is enabled by default when using @option{-fsanitize=address}.
10268 To disable stack protection use @option{--param asan-stack=0} option.
10269
10270 @item asan-instrument-reads
10271 Enable buffer overflow detection for memory reads. This kind of
10272 protection is enabled by default when using @option{-fsanitize=address}.
10273 To disable memory reads protection use
10274 @option{--param asan-instrument-reads=0}.
10275
10276 @item asan-instrument-writes
10277 Enable buffer overflow detection for memory writes. This kind of
10278 protection is enabled by default when using @option{-fsanitize=address}.
10279 To disable memory writes protection use
10280 @option{--param asan-instrument-writes=0} option.
10281
10282 @item asan-memintrin
10283 Enable detection for built-in functions. This kind of protection
10284 is enabled by default when using @option{-fsanitize=address}.
10285 To disable built-in functions protection use
10286 @option{--param asan-memintrin=0}.
10287
10288 @item asan-use-after-return
10289 Enable detection of use-after-return. This kind of protection
10290 is enabled by default when using @option{-fsanitize=address} option.
10291 To disable use-after-return detection use
10292 @option{--param asan-use-after-return=0}.
10293
10294 Note: The check is disabled by default at runtime. To enable the check,
10295 you should set environment variable @env{ASAN_OPTIONS} to
10296 @code{detect_stack_use_after_return=1}.
10297
10298 @item asan-instrumentation-with-call-threshold
10299 If number of memory accesses in function being instrumented
10300 is greater or equal to this number, use callbacks instead of inline checks.
10301 E.g. to disable inline code use
10302 @option{--param asan-instrumentation-with-call-threshold=0}.
10303
10304 @item use-after-scope-direct-emission-threshold
10305 If size of a local variables in bytes is smaller of equal to this number,
10306 direct instruction emission is utilized to poison and unpoison local variables.
10307
10308 @item chkp-max-ctor-size
10309 Static constructors generated by Pointer Bounds Checker may become very
10310 large and significantly increase compile time at optimization level
10311 @option{-O1} and higher. This parameter is a maximum nubmer of statements
10312 in a single generated constructor. Default value is 5000.
10313
10314 @item max-fsm-thread-path-insns
10315 Maximum number of instructions to copy when duplicating blocks on a
10316 finite state automaton jump thread path. The default is 100.
10317
10318 @item max-fsm-thread-length
10319 Maximum number of basic blocks on a finite state automaton jump thread
10320 path. The default is 10.
10321
10322 @item max-fsm-thread-paths
10323 Maximum number of new jump thread paths to create for a finite state
10324 automaton. The default is 50.
10325
10326 @item parloops-chunk-size
10327 Chunk size of omp schedule for loops parallelized by parloops. The default
10328 is 0.
10329
10330 @item parloops-schedule
10331 Schedule type of omp schedule for loops parallelized by parloops (static,
10332 dynamic, guided, auto, runtime). The default is static.
10333
10334 @item max-ssa-name-query-depth
10335 Maximum depth of recursion when querying properties of SSA names in things
10336 like fold routines. One level of recursion corresponds to following a
10337 use-def chain.
10338
10339 @item hsa-gen-debug-stores
10340 Enable emission of special debug stores within HSA kernels which are
10341 then read and reported by libgomp plugin. Generation of these stores
10342 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
10343 enable it.
10344
10345 @item max-speculative-devirt-maydefs
10346 The maximum number of may-defs we analyze when looking for a must-def
10347 specifying the dynamic type of an object that invokes a virtual call
10348 we may be able to devirtualize speculatively.
10349
10350 @item max-vrp-switch-assertions
10351 The maximum number of assertions to add along the default edge of a switch
10352 statement during VRP. The default is 10.
10353 @end table
10354 @end table
10355
10356 @node Instrumentation Options
10357 @section Program Instrumentation Options
10358 @cindex instrumentation options
10359 @cindex program instrumentation options
10360 @cindex run-time error checking options
10361 @cindex profiling options
10362 @cindex options, program instrumentation
10363 @cindex options, run-time error checking
10364 @cindex options, profiling
10365
10366 GCC supports a number of command-line options that control adding
10367 run-time instrumentation to the code it normally generates.
10368 For example, one purpose of instrumentation is collect profiling
10369 statistics for use in finding program hot spots, code coverage
10370 analysis, or profile-guided optimizations.
10371 Another class of program instrumentation is adding run-time checking
10372 to detect programming errors like invalid pointer
10373 dereferences or out-of-bounds array accesses, as well as deliberately
10374 hostile attacks such as stack smashing or C++ vtable hijacking.
10375 There is also a general hook which can be used to implement other
10376 forms of tracing or function-level instrumentation for debug or
10377 program analysis purposes.
10378
10379 @table @gcctabopt
10380 @cindex @command{prof}
10381 @item -p
10382 @opindex p
10383 Generate extra code to write profile information suitable for the
10384 analysis program @command{prof}. You must use this option when compiling
10385 the source files you want data about, and you must also use it when
10386 linking.
10387
10388 @cindex @command{gprof}
10389 @item -pg
10390 @opindex pg
10391 Generate extra code to write profile information suitable for the
10392 analysis program @command{gprof}. You must use this option when compiling
10393 the source files you want data about, and you must also use it when
10394 linking.
10395
10396 @item -fprofile-arcs
10397 @opindex fprofile-arcs
10398 Add code so that program flow @dfn{arcs} are instrumented. During
10399 execution the program records how many times each branch and call is
10400 executed and how many times it is taken or returns. When the compiled
10401 program exits it saves this data to a file called
10402 @file{@var{auxname}.gcda} for each source file. The data may be used for
10403 profile-directed optimizations (@option{-fbranch-probabilities}), or for
10404 test coverage analysis (@option{-ftest-coverage}). Each object file's
10405 @var{auxname} is generated from the name of the output file, if
10406 explicitly specified and it is not the final executable, otherwise it is
10407 the basename of the source file. In both cases any suffix is removed
10408 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
10409 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
10410 @xref{Cross-profiling}.
10411
10412 @cindex @command{gcov}
10413 @item --coverage
10414 @opindex coverage
10415
10416 This option is used to compile and link code instrumented for coverage
10417 analysis. The option is a synonym for @option{-fprofile-arcs}
10418 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
10419 linking). See the documentation for those options for more details.
10420
10421 @itemize
10422
10423 @item
10424 Compile the source files with @option{-fprofile-arcs} plus optimization
10425 and code generation options. For test coverage analysis, use the
10426 additional @option{-ftest-coverage} option. You do not need to profile
10427 every source file in a program.
10428
10429 @item
10430 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
10431 (the latter implies the former).
10432
10433 @item
10434 Run the program on a representative workload to generate the arc profile
10435 information. This may be repeated any number of times. You can run
10436 concurrent instances of your program, and provided that the file system
10437 supports locking, the data files will be correctly updated. Also
10438 @code{fork} calls are detected and correctly handled (double counting
10439 will not happen).
10440
10441 @item
10442 For profile-directed optimizations, compile the source files again with
10443 the same optimization and code generation options plus
10444 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
10445 Control Optimization}).
10446
10447 @item
10448 For test coverage analysis, use @command{gcov} to produce human readable
10449 information from the @file{.gcno} and @file{.gcda} files. Refer to the
10450 @command{gcov} documentation for further information.
10451
10452 @end itemize
10453
10454 With @option{-fprofile-arcs}, for each function of your program GCC
10455 creates a program flow graph, then finds a spanning tree for the graph.
10456 Only arcs that are not on the spanning tree have to be instrumented: the
10457 compiler adds code to count the number of times that these arcs are
10458 executed. When an arc is the only exit or only entrance to a block, the
10459 instrumentation code can be added to the block; otherwise, a new basic
10460 block must be created to hold the instrumentation code.
10461
10462 @need 2000
10463 @item -ftest-coverage
10464 @opindex ftest-coverage
10465 Produce a notes file that the @command{gcov} code-coverage utility
10466 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
10467 show program coverage. Each source file's note file is called
10468 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
10469 above for a description of @var{auxname} and instructions on how to
10470 generate test coverage data. Coverage data matches the source files
10471 more closely if you do not optimize.
10472
10473 @item -fprofile-dir=@var{path}
10474 @opindex fprofile-dir
10475
10476 Set the directory to search for the profile data files in to @var{path}.
10477 This option affects only the profile data generated by
10478 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
10479 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
10480 and its related options. Both absolute and relative paths can be used.
10481 By default, GCC uses the current directory as @var{path}, thus the
10482 profile data file appears in the same directory as the object file.
10483
10484 @item -fprofile-generate
10485 @itemx -fprofile-generate=@var{path}
10486 @opindex fprofile-generate
10487
10488 Enable options usually used for instrumenting application to produce
10489 profile useful for later recompilation with profile feedback based
10490 optimization. You must use @option{-fprofile-generate} both when
10491 compiling and when linking your program.
10492
10493 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
10494
10495 If @var{path} is specified, GCC looks at the @var{path} to find
10496 the profile feedback data files. See @option{-fprofile-dir}.
10497
10498 To optimize the program based on the collected profile information, use
10499 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
10500
10501 @item -fprofile-update=@var{method}
10502 @opindex fprofile-update
10503
10504 Alter the update method for an application instrumented for profile
10505 feedback based optimization. The @var{method} argument should be one of
10506 @samp{single} or @samp{atomic}. The first one is useful for single-threaded
10507 applications, while the second one prevents profile corruption by emitting
10508 thread-safe code.
10509
10510 @strong{Warning:} When an application does not properly join all threads
10511 (or creates an detached thread), a profile file can be still corrupted.
10512
10513 @item -fsanitize=address
10514 @opindex fsanitize=address
10515 Enable AddressSanitizer, a fast memory error detector.
10516 Memory access instructions are instrumented to detect
10517 out-of-bounds and use-after-free bugs.
10518 The option enables @option{-fsanitize-address-use-after-scope}.
10519 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
10520 more details. The run-time behavior can be influenced using the
10521 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
10522 the available options are shown at startup of the instrumented program. See
10523 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
10524 for a list of supported options.
10525 The option can't be combined with @option{-fsanitize=thread}.
10526
10527 @item -fsanitize=kernel-address
10528 @opindex fsanitize=kernel-address
10529 Enable AddressSanitizer for Linux kernel.
10530 The option enables @option{-fsanitize-address-use-after-scope}.
10531 See @uref{https://github.com/google/kasan/wiki} for more details.
10532
10533 @item -fsanitize=thread
10534 @opindex fsanitize=thread
10535 Enable ThreadSanitizer, a fast data race detector.
10536 Memory access instructions are instrumented to detect
10537 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
10538 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
10539 environment variable; see
10540 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
10541 supported options.
10542 The option can't be combined with @option{-fsanitize=address}
10543 and/or @option{-fsanitize=leak}.
10544
10545 @item -fsanitize=leak
10546 @opindex fsanitize=leak
10547 Enable LeakSanitizer, a memory leak detector.
10548 This option only matters for linking of executables and
10549 the executable is linked against a library that overrides @code{malloc}
10550 and other allocator functions. See
10551 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
10552 details. The run-time behavior can be influenced using the
10553 @env{LSAN_OPTIONS} environment variable.
10554 The option can't be combined with @option{-fsanitize=thread}.
10555
10556 @item -fsanitize=undefined
10557 @opindex fsanitize=undefined
10558 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
10559 Various computations are instrumented to detect undefined behavior
10560 at runtime. Current suboptions are:
10561
10562 @table @gcctabopt
10563
10564 @item -fsanitize=shift
10565 @opindex fsanitize=shift
10566 This option enables checking that the result of a shift operation is
10567 not undefined. Note that what exactly is considered undefined differs
10568 slightly between C and C++, as well as between ISO C90 and C99, etc.
10569 This option has two suboptions, @option{-fsanitize=shift-base} and
10570 @option{-fsanitize=shift-exponent}.
10571
10572 @item -fsanitize=shift-exponent
10573 @opindex fsanitize=shift-exponent
10574 This option enables checking that the second argument of a shift operation
10575 is not negative and is smaller than the precision of the promoted first
10576 argument.
10577
10578 @item -fsanitize=shift-base
10579 @opindex fsanitize=shift-base
10580 If the second argument of a shift operation is within range, check that the
10581 result of a shift operation is not undefined. Note that what exactly is
10582 considered undefined differs slightly between C and C++, as well as between
10583 ISO C90 and C99, etc.
10584
10585 @item -fsanitize=integer-divide-by-zero
10586 @opindex fsanitize=integer-divide-by-zero
10587 Detect integer division by zero as well as @code{INT_MIN / -1} division.
10588
10589 @item -fsanitize=unreachable
10590 @opindex fsanitize=unreachable
10591 With this option, the compiler turns the @code{__builtin_unreachable}
10592 call into a diagnostics message call instead. When reaching the
10593 @code{__builtin_unreachable} call, the behavior is undefined.
10594
10595 @item -fsanitize=vla-bound
10596 @opindex fsanitize=vla-bound
10597 This option instructs the compiler to check that the size of a variable
10598 length array is positive.
10599
10600 @item -fsanitize=null
10601 @opindex fsanitize=null
10602 This option enables pointer checking. Particularly, the application
10603 built with this option turned on will issue an error message when it
10604 tries to dereference a NULL pointer, or if a reference (possibly an
10605 rvalue reference) is bound to a NULL pointer, or if a method is invoked
10606 on an object pointed by a NULL pointer.
10607
10608 @item -fsanitize=return
10609 @opindex fsanitize=return
10610 This option enables return statement checking. Programs
10611 built with this option turned on will issue an error message
10612 when the end of a non-void function is reached without actually
10613 returning a value. This option works in C++ only.
10614
10615 @item -fsanitize=signed-integer-overflow
10616 @opindex fsanitize=signed-integer-overflow
10617 This option enables signed integer overflow checking. We check that
10618 the result of @code{+}, @code{*}, and both unary and binary @code{-}
10619 does not overflow in the signed arithmetics. Note, integer promotion
10620 rules must be taken into account. That is, the following is not an
10621 overflow:
10622 @smallexample
10623 signed char a = SCHAR_MAX;
10624 a++;
10625 @end smallexample
10626
10627 @item -fsanitize=bounds
10628 @opindex fsanitize=bounds
10629 This option enables instrumentation of array bounds. Various out of bounds
10630 accesses are detected. Flexible array members, flexible array member-like
10631 arrays, and initializers of variables with static storage are not instrumented.
10632
10633 @item -fsanitize=bounds-strict
10634 @opindex fsanitize=bounds-strict
10635 This option enables strict instrumentation of array bounds. Most out of bounds
10636 accesses are detected, including flexible array members and flexible array
10637 member-like arrays. Initializers of variables with static storage are not
10638 instrumented.
10639
10640 @item -fsanitize=alignment
10641 @opindex fsanitize=alignment
10642
10643 This option enables checking of alignment of pointers when they are
10644 dereferenced, or when a reference is bound to insufficiently aligned target,
10645 or when a method or constructor is invoked on insufficiently aligned object.
10646
10647 @item -fsanitize=object-size
10648 @opindex fsanitize=object-size
10649 This option enables instrumentation of memory references using the
10650 @code{__builtin_object_size} function. Various out of bounds pointer
10651 accesses are detected.
10652
10653 @item -fsanitize=float-divide-by-zero
10654 @opindex fsanitize=float-divide-by-zero
10655 Detect floating-point division by zero. Unlike other similar options,
10656 @option{-fsanitize=float-divide-by-zero} is not enabled by
10657 @option{-fsanitize=undefined}, since floating-point division by zero can
10658 be a legitimate way of obtaining infinities and NaNs.
10659
10660 @item -fsanitize=float-cast-overflow
10661 @opindex fsanitize=float-cast-overflow
10662 This option enables floating-point type to integer conversion checking.
10663 We check that the result of the conversion does not overflow.
10664 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
10665 not enabled by @option{-fsanitize=undefined}.
10666 This option does not work well with @code{FE_INVALID} exceptions enabled.
10667
10668 @item -fsanitize=nonnull-attribute
10669 @opindex fsanitize=nonnull-attribute
10670
10671 This option enables instrumentation of calls, checking whether null values
10672 are not passed to arguments marked as requiring a non-null value by the
10673 @code{nonnull} function attribute.
10674
10675 @item -fsanitize=returns-nonnull-attribute
10676 @opindex fsanitize=returns-nonnull-attribute
10677
10678 This option enables instrumentation of return statements in functions
10679 marked with @code{returns_nonnull} function attribute, to detect returning
10680 of null values from such functions.
10681
10682 @item -fsanitize=bool
10683 @opindex fsanitize=bool
10684
10685 This option enables instrumentation of loads from bool. If a value other
10686 than 0/1 is loaded, a run-time error is issued.
10687
10688 @item -fsanitize=enum
10689 @opindex fsanitize=enum
10690
10691 This option enables instrumentation of loads from an enum type. If
10692 a value outside the range of values for the enum type is loaded,
10693 a run-time error is issued.
10694
10695 @item -fsanitize=vptr
10696 @opindex fsanitize=vptr
10697
10698 This option enables instrumentation of C++ member function calls, member
10699 accesses and some conversions between pointers to base and derived classes,
10700 to verify the referenced object has the correct dynamic type.
10701
10702 @end table
10703
10704 While @option{-ftrapv} causes traps for signed overflows to be emitted,
10705 @option{-fsanitize=undefined} gives a diagnostic message.
10706 This currently works only for the C family of languages.
10707
10708 @item -fno-sanitize=all
10709 @opindex fno-sanitize=all
10710
10711 This option disables all previously enabled sanitizers.
10712 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
10713 together.
10714
10715 @item -fasan-shadow-offset=@var{number}
10716 @opindex fasan-shadow-offset
10717 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
10718 It is useful for experimenting with different shadow memory layouts in
10719 Kernel AddressSanitizer.
10720
10721 @item -fsanitize-sections=@var{s1},@var{s2},...
10722 @opindex fsanitize-sections
10723 Sanitize global variables in selected user-defined sections. @var{si} may
10724 contain wildcards.
10725
10726 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
10727 @opindex fsanitize-recover
10728 @opindex fno-sanitize-recover
10729 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
10730 mentioned in comma-separated list of @var{opts}. Enabling this option
10731 for a sanitizer component causes it to attempt to continue
10732 running the program as if no error happened. This means multiple
10733 runtime errors can be reported in a single program run, and the exit
10734 code of the program may indicate success even when errors
10735 have been reported. The @option{-fno-sanitize-recover=} option
10736 can be used to alter
10737 this behavior: only the first detected error is reported
10738 and program then exits with a non-zero exit code.
10739
10740 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
10741 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
10742 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
10743 @option{-fsanitize=bounds-strict},
10744 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
10745 For these sanitizers error recovery is turned on by default,
10746 except @option{-fsanitize=address}, for which this feature is experimental.
10747 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
10748 accepted, the former enables recovery for all sanitizers that support it,
10749 the latter disables recovery for all sanitizers that support it.
10750
10751 Even if a recovery mode is turned on the compiler side, it needs to be also
10752 enabled on the runtime library side, otherwise the failures are still fatal.
10753 The runtime library defaults to @code{halt_on_error=0} for
10754 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
10755 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
10756 setting the @code{halt_on_error} flag in the corresponding environment variable.
10757
10758 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
10759 @smallexample
10760 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
10761 @end smallexample
10762 @noindent
10763 Similarly @option{-fno-sanitize-recover} is equivalent to
10764 @smallexample
10765 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
10766 @end smallexample
10767
10768 @item -fsanitize-address-use-after-scope
10769 @opindex fsanitize-address-use-after-scope
10770 Enable sanitization of local variables to detect use-after-scope bugs.
10771 The option sets @option{-fstack-reuse} to @samp{none}.
10772
10773 @item -fsanitize-undefined-trap-on-error
10774 @opindex fsanitize-undefined-trap-on-error
10775 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
10776 report undefined behavior using @code{__builtin_trap} rather than
10777 a @code{libubsan} library routine. The advantage of this is that the
10778 @code{libubsan} library is not needed and is not linked in, so this
10779 is usable even in freestanding environments.
10780
10781 @item -fsanitize-coverage=trace-pc
10782 @opindex fsanitize-coverage=trace-pc
10783 Enable coverage-guided fuzzing code instrumentation.
10784 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
10785
10786 @item -fbounds-check
10787 @opindex fbounds-check
10788 For front ends that support it, generate additional code to check that
10789 indices used to access arrays are within the declared range. This is
10790 currently only supported by the Java and Fortran front ends, where
10791 this option defaults to true and false respectively.
10792
10793 @item -fcheck-pointer-bounds
10794 @opindex fcheck-pointer-bounds
10795 @opindex fno-check-pointer-bounds
10796 @cindex Pointer Bounds Checker options
10797 Enable Pointer Bounds Checker instrumentation. Each memory reference
10798 is instrumented with checks of the pointer used for memory access against
10799 bounds associated with that pointer.
10800
10801 Currently there
10802 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
10803 and @option{-mmpx} are required to enable this feature.
10804 MPX-based instrumentation requires
10805 a runtime library to enable MPX in hardware and handle bounds
10806 violation signals. By default when @option{-fcheck-pointer-bounds}
10807 and @option{-mmpx} options are used to link a program, the GCC driver
10808 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
10809 Bounds checking on calls to dynamic libraries requires a linker
10810 with @option{-z bndplt} support; if GCC was configured with a linker
10811 without support for this option (including the Gold linker and older
10812 versions of ld), a warning is given if you link with @option{-mmpx}
10813 without also specifying @option{-static}, since the overall effectiveness
10814 of the bounds checking protection is reduced.
10815 See also @option{-static-libmpxwrappers}.
10816
10817 MPX-based instrumentation
10818 may be used for debugging and also may be included in production code
10819 to increase program security. Depending on usage, you may
10820 have different requirements for the runtime library. The current version
10821 of the MPX runtime library is more oriented for use as a debugging
10822 tool. MPX runtime library usage implies @option{-lpthread}. See
10823 also @option{-static-libmpx}. The runtime library behavior can be
10824 influenced using various @env{CHKP_RT_*} environment variables. See
10825 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
10826 for more details.
10827
10828 Generated instrumentation may be controlled by various
10829 @option{-fchkp-*} options and by the @code{bnd_variable_size}
10830 structure field attribute (@pxref{Type Attributes}) and
10831 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
10832 (@pxref{Function Attributes}). GCC also provides a number of built-in
10833 functions for controlling the Pointer Bounds Checker. @xref{Pointer
10834 Bounds Checker builtins}, for more information.
10835
10836 @item -fchkp-check-incomplete-type
10837 @opindex fchkp-check-incomplete-type
10838 @opindex fno-chkp-check-incomplete-type
10839 Generate pointer bounds checks for variables with incomplete type.
10840 Enabled by default.
10841
10842 @item -fchkp-narrow-bounds
10843 @opindex fchkp-narrow-bounds
10844 @opindex fno-chkp-narrow-bounds
10845 Controls bounds used by Pointer Bounds Checker for pointers to object
10846 fields. If narrowing is enabled then field bounds are used. Otherwise
10847 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
10848 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
10849
10850 @item -fchkp-first-field-has-own-bounds
10851 @opindex fchkp-first-field-has-own-bounds
10852 @opindex fno-chkp-first-field-has-own-bounds
10853 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
10854 first field in the structure. By default a pointer to the first field has
10855 the same bounds as a pointer to the whole structure.
10856
10857 @item -fchkp-narrow-to-innermost-array
10858 @opindex fchkp-narrow-to-innermost-array
10859 @opindex fno-chkp-narrow-to-innermost-array
10860 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
10861 case of nested static array access. By default this option is disabled and
10862 bounds of the outermost array are used.
10863
10864 @item -fchkp-optimize
10865 @opindex fchkp-optimize
10866 @opindex fno-chkp-optimize
10867 Enables Pointer Bounds Checker optimizations. Enabled by default at
10868 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
10869
10870 @item -fchkp-use-fast-string-functions
10871 @opindex fchkp-use-fast-string-functions
10872 @opindex fno-chkp-use-fast-string-functions
10873 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
10874 by Pointer Bounds Checker. Disabled by default.
10875
10876 @item -fchkp-use-nochk-string-functions
10877 @opindex fchkp-use-nochk-string-functions
10878 @opindex fno-chkp-use-nochk-string-functions
10879 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
10880 by Pointer Bounds Checker. Disabled by default.
10881
10882 @item -fchkp-use-static-bounds
10883 @opindex fchkp-use-static-bounds
10884 @opindex fno-chkp-use-static-bounds
10885 Allow Pointer Bounds Checker to generate static bounds holding
10886 bounds of static variables. Enabled by default.
10887
10888 @item -fchkp-use-static-const-bounds
10889 @opindex fchkp-use-static-const-bounds
10890 @opindex fno-chkp-use-static-const-bounds
10891 Use statically-initialized bounds for constant bounds instead of
10892 generating them each time they are required. By default enabled when
10893 @option{-fchkp-use-static-bounds} is enabled.
10894
10895 @item -fchkp-treat-zero-dynamic-size-as-infinite
10896 @opindex fchkp-treat-zero-dynamic-size-as-infinite
10897 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
10898 With this option, objects with incomplete type whose
10899 dynamically-obtained size is zero are treated as having infinite size
10900 instead by Pointer Bounds
10901 Checker. This option may be helpful if a program is linked with a library
10902 missing size information for some symbols. Disabled by default.
10903
10904 @item -fchkp-check-read
10905 @opindex fchkp-check-read
10906 @opindex fno-chkp-check-read
10907 Instructs Pointer Bounds Checker to generate checks for all read
10908 accesses to memory. Enabled by default.
10909
10910 @item -fchkp-check-write
10911 @opindex fchkp-check-write
10912 @opindex fno-chkp-check-write
10913 Instructs Pointer Bounds Checker to generate checks for all write
10914 accesses to memory. Enabled by default.
10915
10916 @item -fchkp-store-bounds
10917 @opindex fchkp-store-bounds
10918 @opindex fno-chkp-store-bounds
10919 Instructs Pointer Bounds Checker to generate bounds stores for
10920 pointer writes. Enabled by default.
10921
10922 @item -fchkp-instrument-calls
10923 @opindex fchkp-instrument-calls
10924 @opindex fno-chkp-instrument-calls
10925 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
10926 Enabled by default.
10927
10928 @item -fchkp-instrument-marked-only
10929 @opindex fchkp-instrument-marked-only
10930 @opindex fno-chkp-instrument-marked-only
10931 Instructs Pointer Bounds Checker to instrument only functions
10932 marked with the @code{bnd_instrument} attribute
10933 (@pxref{Function Attributes}). Disabled by default.
10934
10935 @item -fchkp-use-wrappers
10936 @opindex fchkp-use-wrappers
10937 @opindex fno-chkp-use-wrappers
10938 Allows Pointer Bounds Checker to replace calls to built-in functions
10939 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
10940 is used to link a program, the GCC driver automatically links
10941 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
10942 Enabled by default.
10943
10944 @item -fstack-protector
10945 @opindex fstack-protector
10946 Emit extra code to check for buffer overflows, such as stack smashing
10947 attacks. This is done by adding a guard variable to functions with
10948 vulnerable objects. This includes functions that call @code{alloca}, and
10949 functions with buffers larger than 8 bytes. The guards are initialized
10950 when a function is entered and then checked when the function exits.
10951 If a guard check fails, an error message is printed and the program exits.
10952
10953 @item -fstack-protector-all
10954 @opindex fstack-protector-all
10955 Like @option{-fstack-protector} except that all functions are protected.
10956
10957 @item -fstack-protector-strong
10958 @opindex fstack-protector-strong
10959 Like @option{-fstack-protector} but includes additional functions to
10960 be protected --- those that have local array definitions, or have
10961 references to local frame addresses.
10962
10963 @item -fstack-protector-explicit
10964 @opindex fstack-protector-explicit
10965 Like @option{-fstack-protector} but only protects those functions which
10966 have the @code{stack_protect} attribute.
10967
10968 @item -fstack-check
10969 @opindex fstack-check
10970 Generate code to verify that you do not go beyond the boundary of the
10971 stack. You should specify this flag if you are running in an
10972 environment with multiple threads, but you only rarely need to specify it in
10973 a single-threaded environment since stack overflow is automatically
10974 detected on nearly all systems if there is only one stack.
10975
10976 Note that this switch does not actually cause checking to be done; the
10977 operating system or the language runtime must do that. The switch causes
10978 generation of code to ensure that they see the stack being extended.
10979
10980 You can additionally specify a string parameter: @samp{no} means no
10981 checking, @samp{generic} means force the use of old-style checking,
10982 @samp{specific} means use the best checking method and is equivalent
10983 to bare @option{-fstack-check}.
10984
10985 Old-style checking is a generic mechanism that requires no specific
10986 target support in the compiler but comes with the following drawbacks:
10987
10988 @enumerate
10989 @item
10990 Modified allocation strategy for large objects: they are always
10991 allocated dynamically if their size exceeds a fixed threshold.
10992
10993 @item
10994 Fixed limit on the size of the static frame of functions: when it is
10995 topped by a particular function, stack checking is not reliable and
10996 a warning is issued by the compiler.
10997
10998 @item
10999 Inefficiency: because of both the modified allocation strategy and the
11000 generic implementation, code performance is hampered.
11001 @end enumerate
11002
11003 Note that old-style stack checking is also the fallback method for
11004 @samp{specific} if no target support has been added in the compiler.
11005
11006 @item -fstack-limit-register=@var{reg}
11007 @itemx -fstack-limit-symbol=@var{sym}
11008 @itemx -fno-stack-limit
11009 @opindex fstack-limit-register
11010 @opindex fstack-limit-symbol
11011 @opindex fno-stack-limit
11012 Generate code to ensure that the stack does not grow beyond a certain value,
11013 either the value of a register or the address of a symbol. If a larger
11014 stack is required, a signal is raised at run time. For most targets,
11015 the signal is raised before the stack overruns the boundary, so
11016 it is possible to catch the signal without taking special precautions.
11017
11018 For instance, if the stack starts at absolute address @samp{0x80000000}
11019 and grows downwards, you can use the flags
11020 @option{-fstack-limit-symbol=__stack_limit} and
11021 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11022 of 128KB@. Note that this may only work with the GNU linker.
11023
11024 You can locally override stack limit checking by using the
11025 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11026
11027 @item -fsplit-stack
11028 @opindex fsplit-stack
11029 Generate code to automatically split the stack before it overflows.
11030 The resulting program has a discontiguous stack which can only
11031 overflow if the program is unable to allocate any more memory. This
11032 is most useful when running threaded programs, as it is no longer
11033 necessary to calculate a good stack size to use for each thread. This
11034 is currently only implemented for the x86 targets running
11035 GNU/Linux.
11036
11037 When code compiled with @option{-fsplit-stack} calls code compiled
11038 without @option{-fsplit-stack}, there may not be much stack space
11039 available for the latter code to run. If compiling all code,
11040 including library code, with @option{-fsplit-stack} is not an option,
11041 then the linker can fix up these calls so that the code compiled
11042 without @option{-fsplit-stack} always has a large stack. Support for
11043 this is implemented in the gold linker in GNU binutils release 2.21
11044 and later.
11045
11046 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
11047 @opindex fvtable-verify
11048 This option is only available when compiling C++ code.
11049 It turns on (or off, if using @option{-fvtable-verify=none}) the security
11050 feature that verifies at run time, for every virtual call, that
11051 the vtable pointer through which the call is made is valid for the type of
11052 the object, and has not been corrupted or overwritten. If an invalid vtable
11053 pointer is detected at run time, an error is reported and execution of the
11054 program is immediately halted.
11055
11056 This option causes run-time data structures to be built at program startup,
11057 which are used for verifying the vtable pointers.
11058 The options @samp{std} and @samp{preinit}
11059 control the timing of when these data structures are built. In both cases the
11060 data structures are built before execution reaches @code{main}. Using
11061 @option{-fvtable-verify=std} causes the data structures to be built after
11062 shared libraries have been loaded and initialized.
11063 @option{-fvtable-verify=preinit} causes them to be built before shared
11064 libraries have been loaded and initialized.
11065
11066 If this option appears multiple times in the command line with different
11067 values specified, @samp{none} takes highest priority over both @samp{std} and
11068 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
11069
11070 @item -fvtv-debug
11071 @opindex fvtv-debug
11072 When used in conjunction with @option{-fvtable-verify=std} or
11073 @option{-fvtable-verify=preinit}, causes debug versions of the
11074 runtime functions for the vtable verification feature to be called.
11075 This flag also causes the compiler to log information about which
11076 vtable pointers it finds for each class.
11077 This information is written to a file named @file{vtv_set_ptr_data.log}
11078 in the directory named by the environment variable @env{VTV_LOGS_DIR}
11079 if that is defined or the current working directory otherwise.
11080
11081 Note: This feature @emph{appends} data to the log file. If you want a fresh log
11082 file, be sure to delete any existing one.
11083
11084 @item -fvtv-counts
11085 @opindex fvtv-counts
11086 This is a debugging flag. When used in conjunction with
11087 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
11088 causes the compiler to keep track of the total number of virtual calls
11089 it encounters and the number of verifications it inserts. It also
11090 counts the number of calls to certain run-time library functions
11091 that it inserts and logs this information for each compilation unit.
11092 The compiler writes this information to a file named
11093 @file{vtv_count_data.log} in the directory named by the environment
11094 variable @env{VTV_LOGS_DIR} if that is defined or the current working
11095 directory otherwise. It also counts the size of the vtable pointer sets
11096 for each class, and writes this information to @file{vtv_class_set_sizes.log}
11097 in the same directory.
11098
11099 Note: This feature @emph{appends} data to the log files. To get fresh log
11100 files, be sure to delete any existing ones.
11101
11102 @item -finstrument-functions
11103 @opindex finstrument-functions
11104 Generate instrumentation calls for entry and exit to functions. Just
11105 after function entry and just before function exit, the following
11106 profiling functions are called with the address of the current
11107 function and its call site. (On some platforms,
11108 @code{__builtin_return_address} does not work beyond the current
11109 function, so the call site information may not be available to the
11110 profiling functions otherwise.)
11111
11112 @smallexample
11113 void __cyg_profile_func_enter (void *this_fn,
11114 void *call_site);
11115 void __cyg_profile_func_exit (void *this_fn,
11116 void *call_site);
11117 @end smallexample
11118
11119 The first argument is the address of the start of the current function,
11120 which may be looked up exactly in the symbol table.
11121
11122 This instrumentation is also done for functions expanded inline in other
11123 functions. The profiling calls indicate where, conceptually, the
11124 inline function is entered and exited. This means that addressable
11125 versions of such functions must be available. If all your uses of a
11126 function are expanded inline, this may mean an additional expansion of
11127 code size. If you use @code{extern inline} in your C code, an
11128 addressable version of such functions must be provided. (This is
11129 normally the case anyway, but if you get lucky and the optimizer always
11130 expands the functions inline, you might have gotten away without
11131 providing static copies.)
11132
11133 A function may be given the attribute @code{no_instrument_function}, in
11134 which case this instrumentation is not done. This can be used, for
11135 example, for the profiling functions listed above, high-priority
11136 interrupt routines, and any functions from which the profiling functions
11137 cannot safely be called (perhaps signal handlers, if the profiling
11138 routines generate output or allocate memory).
11139
11140 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
11141 @opindex finstrument-functions-exclude-file-list
11142
11143 Set the list of functions that are excluded from instrumentation (see
11144 the description of @option{-finstrument-functions}). If the file that
11145 contains a function definition matches with one of @var{file}, then
11146 that function is not instrumented. The match is done on substrings:
11147 if the @var{file} parameter is a substring of the file name, it is
11148 considered to be a match.
11149
11150 For example:
11151
11152 @smallexample
11153 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
11154 @end smallexample
11155
11156 @noindent
11157 excludes any inline function defined in files whose pathnames
11158 contain @file{/bits/stl} or @file{include/sys}.
11159
11160 If, for some reason, you want to include letter @samp{,} in one of
11161 @var{sym}, write @samp{\,}. For example,
11162 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
11163 (note the single quote surrounding the option).
11164
11165 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
11166 @opindex finstrument-functions-exclude-function-list
11167
11168 This is similar to @option{-finstrument-functions-exclude-file-list},
11169 but this option sets the list of function names to be excluded from
11170 instrumentation. The function name to be matched is its user-visible
11171 name, such as @code{vector<int> blah(const vector<int> &)}, not the
11172 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
11173 match is done on substrings: if the @var{sym} parameter is a substring
11174 of the function name, it is considered to be a match. For C99 and C++
11175 extended identifiers, the function name must be given in UTF-8, not
11176 using universal character names.
11177
11178 @end table
11179
11180
11181 @node Preprocessor Options
11182 @section Options Controlling the Preprocessor
11183 @cindex preprocessor options
11184 @cindex options, preprocessor
11185
11186 These options control the C preprocessor, which is run on each C source
11187 file before actual compilation.
11188
11189 If you use the @option{-E} option, nothing is done except preprocessing.
11190 Some of these options make sense only together with @option{-E} because
11191 they cause the preprocessor output to be unsuitable for actual
11192 compilation.
11193
11194 @table @gcctabopt
11195 @item -Wp,@var{option}
11196 @opindex Wp
11197 You can use @option{-Wp,@var{option}} to bypass the compiler driver
11198 and pass @var{option} directly through to the preprocessor. If
11199 @var{option} contains commas, it is split into multiple options at the
11200 commas. However, many options are modified, translated or interpreted
11201 by the compiler driver before being passed to the preprocessor, and
11202 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
11203 interface is undocumented and subject to change, so whenever possible
11204 you should avoid using @option{-Wp} and let the driver handle the
11205 options instead.
11206
11207 @item -Xpreprocessor @var{option}
11208 @opindex Xpreprocessor
11209 Pass @var{option} as an option to the preprocessor. You can use this to
11210 supply system-specific preprocessor options that GCC does not
11211 recognize.
11212
11213 If you want to pass an option that takes an argument, you must use
11214 @option{-Xpreprocessor} twice, once for the option and once for the argument.
11215
11216 @item -no-integrated-cpp
11217 @opindex no-integrated-cpp
11218 Perform preprocessing as a separate pass before compilation.
11219 By default, GCC performs preprocessing as an integrated part of
11220 input tokenization and parsing.
11221 If this option is provided, the appropriate language front end
11222 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
11223 and Objective-C, respectively) is instead invoked twice,
11224 once for preprocessing only and once for actual compilation
11225 of the preprocessed input.
11226 This option may be useful in conjunction with the @option{-B} or
11227 @option{-wrapper} options to specify an alternate preprocessor or
11228 perform additional processing of the program source between
11229 normal preprocessing and compilation.
11230 @end table
11231
11232 @include cppopts.texi
11233
11234 @node Assembler Options
11235 @section Passing Options to the Assembler
11236
11237 @c prevent bad page break with this line
11238 You can pass options to the assembler.
11239
11240 @table @gcctabopt
11241 @item -Wa,@var{option}
11242 @opindex Wa
11243 Pass @var{option} as an option to the assembler. If @var{option}
11244 contains commas, it is split into multiple options at the commas.
11245
11246 @item -Xassembler @var{option}
11247 @opindex Xassembler
11248 Pass @var{option} as an option to the assembler. You can use this to
11249 supply system-specific assembler options that GCC does not
11250 recognize.
11251
11252 If you want to pass an option that takes an argument, you must use
11253 @option{-Xassembler} twice, once for the option and once for the argument.
11254
11255 @end table
11256
11257 @node Link Options
11258 @section Options for Linking
11259 @cindex link options
11260 @cindex options, linking
11261
11262 These options come into play when the compiler links object files into
11263 an executable output file. They are meaningless if the compiler is
11264 not doing a link step.
11265
11266 @table @gcctabopt
11267 @cindex file names
11268 @item @var{object-file-name}
11269 A file name that does not end in a special recognized suffix is
11270 considered to name an object file or library. (Object files are
11271 distinguished from libraries by the linker according to the file
11272 contents.) If linking is done, these object files are used as input
11273 to the linker.
11274
11275 @item -c
11276 @itemx -S
11277 @itemx -E
11278 @opindex c
11279 @opindex S
11280 @opindex E
11281 If any of these options is used, then the linker is not run, and
11282 object file names should not be used as arguments. @xref{Overall
11283 Options}.
11284
11285 @item -fuse-ld=bfd
11286 @opindex fuse-ld=bfd
11287 Use the @command{bfd} linker instead of the default linker.
11288
11289 @item -fuse-ld=gold
11290 @opindex fuse-ld=gold
11291 Use the @command{gold} linker instead of the default linker.
11292
11293 @cindex Libraries
11294 @item -l@var{library}
11295 @itemx -l @var{library}
11296 @opindex l
11297 Search the library named @var{library} when linking. (The second
11298 alternative with the library as a separate argument is only for
11299 POSIX compliance and is not recommended.)
11300
11301 It makes a difference where in the command you write this option; the
11302 linker searches and processes libraries and object files in the order they
11303 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
11304 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
11305 to functions in @samp{z}, those functions may not be loaded.
11306
11307 The linker searches a standard list of directories for the library,
11308 which is actually a file named @file{lib@var{library}.a}. The linker
11309 then uses this file as if it had been specified precisely by name.
11310
11311 The directories searched include several standard system directories
11312 plus any that you specify with @option{-L}.
11313
11314 Normally the files found this way are library files---archive files
11315 whose members are object files. The linker handles an archive file by
11316 scanning through it for members which define symbols that have so far
11317 been referenced but not defined. But if the file that is found is an
11318 ordinary object file, it is linked in the usual fashion. The only
11319 difference between using an @option{-l} option and specifying a file name
11320 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
11321 and searches several directories.
11322
11323 @item -lobjc
11324 @opindex lobjc
11325 You need this special case of the @option{-l} option in order to
11326 link an Objective-C or Objective-C++ program.
11327
11328 @item -nostartfiles
11329 @opindex nostartfiles
11330 Do not use the standard system startup files when linking.
11331 The standard system libraries are used normally, unless @option{-nostdlib}
11332 or @option{-nodefaultlibs} is used.
11333
11334 @item -nodefaultlibs
11335 @opindex nodefaultlibs
11336 Do not use the standard system libraries when linking.
11337 Only the libraries you specify are passed to the linker, and options
11338 specifying linkage of the system libraries, such as @option{-static-libgcc}
11339 or @option{-shared-libgcc}, are ignored.
11340 The standard startup files are used normally, unless @option{-nostartfiles}
11341 is used.
11342
11343 The compiler may generate calls to @code{memcmp},
11344 @code{memset}, @code{memcpy} and @code{memmove}.
11345 These entries are usually resolved by entries in
11346 libc. These entry points should be supplied through some other
11347 mechanism when this option is specified.
11348
11349 @item -nostdlib
11350 @opindex nostdlib
11351 Do not use the standard system startup files or libraries when linking.
11352 No startup files and only the libraries you specify are passed to
11353 the linker, and options specifying linkage of the system libraries, such as
11354 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
11355
11356 The compiler may generate calls to @code{memcmp}, @code{memset},
11357 @code{memcpy} and @code{memmove}.
11358 These entries are usually resolved by entries in
11359 libc. These entry points should be supplied through some other
11360 mechanism when this option is specified.
11361
11362 @cindex @option{-lgcc}, use with @option{-nostdlib}
11363 @cindex @option{-nostdlib} and unresolved references
11364 @cindex unresolved references and @option{-nostdlib}
11365 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
11366 @cindex @option{-nodefaultlibs} and unresolved references
11367 @cindex unresolved references and @option{-nodefaultlibs}
11368 One of the standard libraries bypassed by @option{-nostdlib} and
11369 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
11370 which GCC uses to overcome shortcomings of particular machines, or special
11371 needs for some languages.
11372 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
11373 Collection (GCC) Internals},
11374 for more discussion of @file{libgcc.a}.)
11375 In most cases, you need @file{libgcc.a} even when you want to avoid
11376 other standard libraries. In other words, when you specify @option{-nostdlib}
11377 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
11378 This ensures that you have no unresolved references to internal GCC
11379 library subroutines.
11380 (An example of such an internal subroutine is @code{__main}, used to ensure C++
11381 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
11382 GNU Compiler Collection (GCC) Internals}.)
11383
11384 @item -pie
11385 @opindex pie
11386 Produce a position independent executable on targets that support it.
11387 For predictable results, you must also specify the same set of options
11388 used for compilation (@option{-fpie}, @option{-fPIE},
11389 or model suboptions) when you specify this linker option.
11390
11391 @item -no-pie
11392 @opindex no-pie
11393 Don't produce a position independent executable.
11394
11395 @item -rdynamic
11396 @opindex rdynamic
11397 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
11398 that support it. This instructs the linker to add all symbols, not
11399 only used ones, to the dynamic symbol table. This option is needed
11400 for some uses of @code{dlopen} or to allow obtaining backtraces
11401 from within a program.
11402
11403 @item -s
11404 @opindex s
11405 Remove all symbol table and relocation information from the executable.
11406
11407 @item -static
11408 @opindex static
11409 On systems that support dynamic linking, this prevents linking with the shared
11410 libraries. On other systems, this option has no effect.
11411
11412 @item -shared
11413 @opindex shared
11414 Produce a shared object which can then be linked with other objects to
11415 form an executable. Not all systems support this option. For predictable
11416 results, you must also specify the same set of options used for compilation
11417 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
11418 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
11419 needs to build supplementary stub code for constructors to work. On
11420 multi-libbed systems, @samp{gcc -shared} must select the correct support
11421 libraries to link against. Failing to supply the correct flags may lead
11422 to subtle defects. Supplying them in cases where they are not necessary
11423 is innocuous.}
11424
11425 @item -shared-libgcc
11426 @itemx -static-libgcc
11427 @opindex shared-libgcc
11428 @opindex static-libgcc
11429 On systems that provide @file{libgcc} as a shared library, these options
11430 force the use of either the shared or static version, respectively.
11431 If no shared version of @file{libgcc} was built when the compiler was
11432 configured, these options have no effect.
11433
11434 There are several situations in which an application should use the
11435 shared @file{libgcc} instead of the static version. The most common
11436 of these is when the application wishes to throw and catch exceptions
11437 across different shared libraries. In that case, each of the libraries
11438 as well as the application itself should use the shared @file{libgcc}.
11439
11440 Therefore, the G++ and GCJ drivers automatically add
11441 @option{-shared-libgcc} whenever you build a shared library or a main
11442 executable, because C++ and Java programs typically use exceptions, so
11443 this is the right thing to do.
11444
11445 If, instead, you use the GCC driver to create shared libraries, you may
11446 find that they are not always linked with the shared @file{libgcc}.
11447 If GCC finds, at its configuration time, that you have a non-GNU linker
11448 or a GNU linker that does not support option @option{--eh-frame-hdr},
11449 it links the shared version of @file{libgcc} into shared libraries
11450 by default. Otherwise, it takes advantage of the linker and optimizes
11451 away the linking with the shared version of @file{libgcc}, linking with
11452 the static version of libgcc by default. This allows exceptions to
11453 propagate through such shared libraries, without incurring relocation
11454 costs at library load time.
11455
11456 However, if a library or main executable is supposed to throw or catch
11457 exceptions, you must link it using the G++ or GCJ driver, as appropriate
11458 for the languages used in the program, or using the option
11459 @option{-shared-libgcc}, such that it is linked with the shared
11460 @file{libgcc}.
11461
11462 @item -static-libasan
11463 @opindex static-libasan
11464 When the @option{-fsanitize=address} option is used to link a program,
11465 the GCC driver automatically links against @option{libasan}. If
11466 @file{libasan} is available as a shared library, and the @option{-static}
11467 option is not used, then this links against the shared version of
11468 @file{libasan}. The @option{-static-libasan} option directs the GCC
11469 driver to link @file{libasan} statically, without necessarily linking
11470 other libraries statically.
11471
11472 @item -static-libtsan
11473 @opindex static-libtsan
11474 When the @option{-fsanitize=thread} option is used to link a program,
11475 the GCC driver automatically links against @option{libtsan}. If
11476 @file{libtsan} is available as a shared library, and the @option{-static}
11477 option is not used, then this links against the shared version of
11478 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
11479 driver to link @file{libtsan} statically, without necessarily linking
11480 other libraries statically.
11481
11482 @item -static-liblsan
11483 @opindex static-liblsan
11484 When the @option{-fsanitize=leak} option is used to link a program,
11485 the GCC driver automatically links against @option{liblsan}. If
11486 @file{liblsan} is available as a shared library, and the @option{-static}
11487 option is not used, then this links against the shared version of
11488 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
11489 driver to link @file{liblsan} statically, without necessarily linking
11490 other libraries statically.
11491
11492 @item -static-libubsan
11493 @opindex static-libubsan
11494 When the @option{-fsanitize=undefined} option is used to link a program,
11495 the GCC driver automatically links against @option{libubsan}. If
11496 @file{libubsan} is available as a shared library, and the @option{-static}
11497 option is not used, then this links against the shared version of
11498 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
11499 driver to link @file{libubsan} statically, without necessarily linking
11500 other libraries statically.
11501
11502 @item -static-libmpx
11503 @opindex static-libmpx
11504 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
11505 used to link a program, the GCC driver automatically links against
11506 @file{libmpx}. If @file{libmpx} is available as a shared library,
11507 and the @option{-static} option is not used, then this links against
11508 the shared version of @file{libmpx}. The @option{-static-libmpx}
11509 option directs the GCC driver to link @file{libmpx} statically,
11510 without necessarily linking other libraries statically.
11511
11512 @item -static-libmpxwrappers
11513 @opindex static-libmpxwrappers
11514 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
11515 to link a program without also using @option{-fno-chkp-use-wrappers}, the
11516 GCC driver automatically links against @file{libmpxwrappers}. If
11517 @file{libmpxwrappers} is available as a shared library, and the
11518 @option{-static} option is not used, then this links against the shared
11519 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
11520 option directs the GCC driver to link @file{libmpxwrappers} statically,
11521 without necessarily linking other libraries statically.
11522
11523 @item -static-libstdc++
11524 @opindex static-libstdc++
11525 When the @command{g++} program is used to link a C++ program, it
11526 normally automatically links against @option{libstdc++}. If
11527 @file{libstdc++} is available as a shared library, and the
11528 @option{-static} option is not used, then this links against the
11529 shared version of @file{libstdc++}. That is normally fine. However, it
11530 is sometimes useful to freeze the version of @file{libstdc++} used by
11531 the program without going all the way to a fully static link. The
11532 @option{-static-libstdc++} option directs the @command{g++} driver to
11533 link @file{libstdc++} statically, without necessarily linking other
11534 libraries statically.
11535
11536 @item -symbolic
11537 @opindex symbolic
11538 Bind references to global symbols when building a shared object. Warn
11539 about any unresolved references (unless overridden by the link editor
11540 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
11541 this option.
11542
11543 @item -T @var{script}
11544 @opindex T
11545 @cindex linker script
11546 Use @var{script} as the linker script. This option is supported by most
11547 systems using the GNU linker. On some targets, such as bare-board
11548 targets without an operating system, the @option{-T} option may be required
11549 when linking to avoid references to undefined symbols.
11550
11551 @item -Xlinker @var{option}
11552 @opindex Xlinker
11553 Pass @var{option} as an option to the linker. You can use this to
11554 supply system-specific linker options that GCC does not recognize.
11555
11556 If you want to pass an option that takes a separate argument, you must use
11557 @option{-Xlinker} twice, once for the option and once for the argument.
11558 For example, to pass @option{-assert definitions}, you must write
11559 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
11560 @option{-Xlinker "-assert definitions"}, because this passes the entire
11561 string as a single argument, which is not what the linker expects.
11562
11563 When using the GNU linker, it is usually more convenient to pass
11564 arguments to linker options using the @option{@var{option}=@var{value}}
11565 syntax than as separate arguments. For example, you can specify
11566 @option{-Xlinker -Map=output.map} rather than
11567 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
11568 this syntax for command-line options.
11569
11570 @item -Wl,@var{option}
11571 @opindex Wl
11572 Pass @var{option} as an option to the linker. If @var{option} contains
11573 commas, it is split into multiple options at the commas. You can use this
11574 syntax to pass an argument to the option.
11575 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
11576 linker. When using the GNU linker, you can also get the same effect with
11577 @option{-Wl,-Map=output.map}.
11578
11579 @item -u @var{symbol}
11580 @opindex u
11581 Pretend the symbol @var{symbol} is undefined, to force linking of
11582 library modules to define it. You can use @option{-u} multiple times with
11583 different symbols to force loading of additional library modules.
11584
11585 @item -z @var{keyword}
11586 @opindex z
11587 @option{-z} is passed directly on to the linker along with the keyword
11588 @var{keyword}. See the section in the documentation of your linker for
11589 permitted values and their meanings.
11590 @end table
11591
11592 @node Directory Options
11593 @section Options for Directory Search
11594 @cindex directory options
11595 @cindex options, directory search
11596 @cindex search path
11597
11598 These options specify directories to search for header files, for
11599 libraries and for parts of the compiler:
11600
11601 @table @gcctabopt
11602 @item -I@var{dir}
11603 @opindex I
11604 Add the directory @var{dir} to the head of the list of directories to be
11605 searched for header files. This can be used to override a system header
11606 file, substituting your own version, since these directories are
11607 searched before the system header file directories. However, you should
11608 not use this option to add directories that contain vendor-supplied
11609 system header files (use @option{-isystem} for that). If you use more than
11610 one @option{-I} option, the directories are scanned in left-to-right
11611 order; the standard system directories come after.
11612
11613 If a standard system include directory, or a directory specified with
11614 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
11615 option is ignored. The directory is still searched but as a
11616 system directory at its normal position in the system include chain.
11617 This is to ensure that GCC's procedure to fix buggy system headers and
11618 the ordering for the @code{include_next} directive are not inadvertently changed.
11619 If you really need to change the search order for system directories,
11620 use the @option{-nostdinc} and/or @option{-isystem} options.
11621
11622 @item -iplugindir=@var{dir}
11623 @opindex iplugindir=
11624 Set the directory to search for plugins that are passed
11625 by @option{-fplugin=@var{name}} instead of
11626 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
11627 to be used by the user, but only passed by the driver.
11628
11629 @item -iquote@var{dir}
11630 @opindex iquote
11631 Add the directory @var{dir} to the head of the list of directories to
11632 be searched for header files only for the case of @code{#include
11633 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
11634 otherwise just like @option{-I}.
11635
11636 @item -L@var{dir}
11637 @opindex L
11638 Add directory @var{dir} to the list of directories to be searched
11639 for @option{-l}.
11640
11641 @item -B@var{prefix}
11642 @opindex B
11643 This option specifies where to find the executables, libraries,
11644 include files, and data files of the compiler itself.
11645
11646 The compiler driver program runs one or more of the subprograms
11647 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
11648 @var{prefix} as a prefix for each program it tries to run, both with and
11649 without @samp{@var{machine}/@var{version}/} for the corresponding target
11650 machine and compiler version.
11651
11652 For each subprogram to be run, the compiler driver first tries the
11653 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
11654 is not specified, the driver tries two standard prefixes,
11655 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
11656 those results in a file name that is found, the unmodified program
11657 name is searched for using the directories specified in your
11658 @env{PATH} environment variable.
11659
11660 The compiler checks to see if the path provided by @option{-B}
11661 refers to a directory, and if necessary it adds a directory
11662 separator character at the end of the path.
11663
11664 @option{-B} prefixes that effectively specify directory names also apply
11665 to libraries in the linker, because the compiler translates these
11666 options into @option{-L} options for the linker. They also apply to
11667 include files in the preprocessor, because the compiler translates these
11668 options into @option{-isystem} options for the preprocessor. In this case,
11669 the compiler appends @samp{include} to the prefix.
11670
11671 The runtime support file @file{libgcc.a} can also be searched for using
11672 the @option{-B} prefix, if needed. If it is not found there, the two
11673 standard prefixes above are tried, and that is all. The file is left
11674 out of the link if it is not found by those means.
11675
11676 Another way to specify a prefix much like the @option{-B} prefix is to use
11677 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
11678 Variables}.
11679
11680 As a special kludge, if the path provided by @option{-B} is
11681 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
11682 9, then it is replaced by @file{[dir/]include}. This is to help
11683 with boot-strapping the compiler.
11684
11685 @item -no-canonical-prefixes
11686 @opindex no-canonical-prefixes
11687 Do not expand any symbolic links, resolve references to @samp{/../}
11688 or @samp{/./}, or make the path absolute when generating a relative
11689 prefix.
11690
11691 @item --sysroot=@var{dir}
11692 @opindex sysroot
11693 Use @var{dir} as the logical root directory for headers and libraries.
11694 For example, if the compiler normally searches for headers in
11695 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
11696 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
11697
11698 If you use both this option and the @option{-isysroot} option, then
11699 the @option{--sysroot} option applies to libraries, but the
11700 @option{-isysroot} option applies to header files.
11701
11702 The GNU linker (beginning with version 2.16) has the necessary support
11703 for this option. If your linker does not support this option, the
11704 header file aspect of @option{--sysroot} still works, but the
11705 library aspect does not.
11706
11707 @item --no-sysroot-suffix
11708 @opindex no-sysroot-suffix
11709 For some targets, a suffix is added to the root directory specified
11710 with @option{--sysroot}, depending on the other options used, so that
11711 headers may for example be found in
11712 @file{@var{dir}/@var{suffix}/usr/include} instead of
11713 @file{@var{dir}/usr/include}. This option disables the addition of
11714 such a suffix.
11715
11716 @item -I-
11717 @opindex I-
11718 This option has been deprecated. Please use @option{-iquote} instead for
11719 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
11720 option.
11721 Any directories you specify with @option{-I} options before the @option{-I-}
11722 option are searched only for the case of @code{#include "@var{file}"};
11723 they are not searched for @code{#include <@var{file}>}.
11724
11725 If additional directories are specified with @option{-I} options after
11726 the @option{-I-} option, these directories are searched for all @code{#include}
11727 directives. (Ordinarily @emph{all} @option{-I} directories are used
11728 this way.)
11729
11730 In addition, the @option{-I-} option inhibits the use of the current
11731 directory (where the current input file came from) as the first search
11732 directory for @code{#include "@var{file}"}. There is no way to
11733 override this effect of @option{-I-}. With @option{-I.} you can specify
11734 searching the directory that is current when the compiler is
11735 invoked. That is not exactly the same as what the preprocessor does
11736 by default, but it is often satisfactory.
11737
11738 @option{-I-} does not inhibit the use of the standard system directories
11739 for header files. Thus, @option{-I-} and @option{-nostdinc} are
11740 independent.
11741 @end table
11742
11743 @node Code Gen Options
11744 @section Options for Code Generation Conventions
11745 @cindex code generation conventions
11746 @cindex options, code generation
11747 @cindex run-time options
11748
11749 These machine-independent options control the interface conventions
11750 used in code generation.
11751
11752 Most of them have both positive and negative forms; the negative form
11753 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
11754 one of the forms is listed---the one that is not the default. You
11755 can figure out the other form by either removing @samp{no-} or adding
11756 it.
11757
11758 @table @gcctabopt
11759 @item -fstack-reuse=@var{reuse-level}
11760 @opindex fstack_reuse
11761 This option controls stack space reuse for user declared local/auto variables
11762 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
11763 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
11764 local variables and temporaries, @samp{named_vars} enables the reuse only for
11765 user defined local variables with names, and @samp{none} disables stack reuse
11766 completely. The default value is @samp{all}. The option is needed when the
11767 program extends the lifetime of a scoped local variable or a compiler generated
11768 temporary beyond the end point defined by the language. When a lifetime of
11769 a variable ends, and if the variable lives in memory, the optimizing compiler
11770 has the freedom to reuse its stack space with other temporaries or scoped
11771 local variables whose live range does not overlap with it. Legacy code extending
11772 local lifetime is likely to break with the stack reuse optimization.
11773
11774 For example,
11775
11776 @smallexample
11777 int *p;
11778 @{
11779 int local1;
11780
11781 p = &local1;
11782 local1 = 10;
11783 ....
11784 @}
11785 @{
11786 int local2;
11787 local2 = 20;
11788 ...
11789 @}
11790
11791 if (*p == 10) // out of scope use of local1
11792 @{
11793
11794 @}
11795 @end smallexample
11796
11797 Another example:
11798 @smallexample
11799
11800 struct A
11801 @{
11802 A(int k) : i(k), j(k) @{ @}
11803 int i;
11804 int j;
11805 @};
11806
11807 A *ap;
11808
11809 void foo(const A& ar)
11810 @{
11811 ap = &ar;
11812 @}
11813
11814 void bar()
11815 @{
11816 foo(A(10)); // temp object's lifetime ends when foo returns
11817
11818 @{
11819 A a(20);
11820 ....
11821 @}
11822 ap->i+= 10; // ap references out of scope temp whose space
11823 // is reused with a. What is the value of ap->i?
11824 @}
11825
11826 @end smallexample
11827
11828 The lifetime of a compiler generated temporary is well defined by the C++
11829 standard. When a lifetime of a temporary ends, and if the temporary lives
11830 in memory, the optimizing compiler has the freedom to reuse its stack
11831 space with other temporaries or scoped local variables whose live range
11832 does not overlap with it. However some of the legacy code relies on
11833 the behavior of older compilers in which temporaries' stack space is
11834 not reused, the aggressive stack reuse can lead to runtime errors. This
11835 option is used to control the temporary stack reuse optimization.
11836
11837 @item -ftrapv
11838 @opindex ftrapv
11839 This option generates traps for signed overflow on addition, subtraction,
11840 multiplication operations.
11841 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11842 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11843 @option{-fwrapv} being effective. Note that only active options override, so
11844 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11845 results in @option{-ftrapv} being effective.
11846
11847 @item -fwrapv
11848 @opindex fwrapv
11849 This option instructs the compiler to assume that signed arithmetic
11850 overflow of addition, subtraction and multiplication wraps around
11851 using twos-complement representation. This flag enables some optimizations
11852 and disables others. This option is enabled by default for the Java
11853 front end, as required by the Java language specification.
11854 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11855 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11856 @option{-fwrapv} being effective. Note that only active options override, so
11857 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11858 results in @option{-ftrapv} being effective.
11859
11860 @item -fexceptions
11861 @opindex fexceptions
11862 Enable exception handling. Generates extra code needed to propagate
11863 exceptions. For some targets, this implies GCC generates frame
11864 unwind information for all functions, which can produce significant data
11865 size overhead, although it does not affect execution. If you do not
11866 specify this option, GCC enables it by default for languages like
11867 C++ that normally require exception handling, and disables it for
11868 languages like C that do not normally require it. However, you may need
11869 to enable this option when compiling C code that needs to interoperate
11870 properly with exception handlers written in C++. You may also wish to
11871 disable this option if you are compiling older C++ programs that don't
11872 use exception handling.
11873
11874 @item -fnon-call-exceptions
11875 @opindex fnon-call-exceptions
11876 Generate code that allows trapping instructions to throw exceptions.
11877 Note that this requires platform-specific runtime support that does
11878 not exist everywhere. Moreover, it only allows @emph{trapping}
11879 instructions to throw exceptions, i.e.@: memory references or floating-point
11880 instructions. It does not allow exceptions to be thrown from
11881 arbitrary signal handlers such as @code{SIGALRM}.
11882
11883 @item -fdelete-dead-exceptions
11884 @opindex fdelete-dead-exceptions
11885 Consider that instructions that may throw exceptions but don't otherwise
11886 contribute to the execution of the program can be optimized away.
11887 This option is enabled by default for the Ada front end, as permitted by
11888 the Ada language specification.
11889 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
11890
11891 @item -funwind-tables
11892 @opindex funwind-tables
11893 Similar to @option{-fexceptions}, except that it just generates any needed
11894 static data, but does not affect the generated code in any other way.
11895 You normally do not need to enable this option; instead, a language processor
11896 that needs this handling enables it on your behalf.
11897
11898 @item -fasynchronous-unwind-tables
11899 @opindex fasynchronous-unwind-tables
11900 Generate unwind table in DWARF format, if supported by target machine. The
11901 table is exact at each instruction boundary, so it can be used for stack
11902 unwinding from asynchronous events (such as debugger or garbage collector).
11903
11904 @item -fno-gnu-unique
11905 @opindex fno-gnu-unique
11906 On systems with recent GNU assembler and C library, the C++ compiler
11907 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
11908 of template static data members and static local variables in inline
11909 functions are unique even in the presence of @code{RTLD_LOCAL}; this
11910 is necessary to avoid problems with a library used by two different
11911 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
11912 therefore disagreeing with the other one about the binding of the
11913 symbol. But this causes @code{dlclose} to be ignored for affected
11914 DSOs; if your program relies on reinitialization of a DSO via
11915 @code{dlclose} and @code{dlopen}, you can use
11916 @option{-fno-gnu-unique}.
11917
11918 @item -fpcc-struct-return
11919 @opindex fpcc-struct-return
11920 Return ``short'' @code{struct} and @code{union} values in memory like
11921 longer ones, rather than in registers. This convention is less
11922 efficient, but it has the advantage of allowing intercallability between
11923 GCC-compiled files and files compiled with other compilers, particularly
11924 the Portable C Compiler (pcc).
11925
11926 The precise convention for returning structures in memory depends
11927 on the target configuration macros.
11928
11929 Short structures and unions are those whose size and alignment match
11930 that of some integer type.
11931
11932 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11933 switch is not binary compatible with code compiled with the
11934 @option{-freg-struct-return} switch.
11935 Use it to conform to a non-default application binary interface.
11936
11937 @item -freg-struct-return
11938 @opindex freg-struct-return
11939 Return @code{struct} and @code{union} values in registers when possible.
11940 This is more efficient for small structures than
11941 @option{-fpcc-struct-return}.
11942
11943 If you specify neither @option{-fpcc-struct-return} nor
11944 @option{-freg-struct-return}, GCC defaults to whichever convention is
11945 standard for the target. If there is no standard convention, GCC
11946 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11947 the principal compiler. In those cases, we can choose the standard, and
11948 we chose the more efficient register return alternative.
11949
11950 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11951 switch is not binary compatible with code compiled with the
11952 @option{-fpcc-struct-return} switch.
11953 Use it to conform to a non-default application binary interface.
11954
11955 @item -fshort-enums
11956 @opindex fshort-enums
11957 Allocate to an @code{enum} type only as many bytes as it needs for the
11958 declared range of possible values. Specifically, the @code{enum} type
11959 is equivalent to the smallest integer type that has enough room.
11960
11961 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11962 code that is not binary compatible with code generated without that switch.
11963 Use it to conform to a non-default application binary interface.
11964
11965 @item -fshort-wchar
11966 @opindex fshort-wchar
11967 Override the underlying type for @code{wchar_t} to be @code{short
11968 unsigned int} instead of the default for the target. This option is
11969 useful for building programs to run under WINE@.
11970
11971 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11972 code that is not binary compatible with code generated without that switch.
11973 Use it to conform to a non-default application binary interface.
11974
11975 @item -fno-common
11976 @opindex fno-common
11977 @cindex tentative definitions
11978 In C code, this option controls the placement of global variables
11979 defined without an initializer, known as @dfn{tentative definitions}
11980 in the C standard. Tentative definitions are distinct from declarations
11981 of a variable with the @code{extern} keyword, which do not allocate storage.
11982
11983 Unix C compilers have traditionally allocated storage for
11984 uninitialized global variables in a common block. This allows the
11985 linker to resolve all tentative definitions of the same variable
11986 in different compilation units to the same object, or to a non-tentative
11987 definition.
11988 This is the behavior specified by @option{-fcommon}, and is the default for
11989 GCC on most targets.
11990 On the other hand, this behavior is not required by ISO
11991 C, and on some targets may carry a speed or code size penalty on
11992 variable references.
11993
11994 The @option{-fno-common} option specifies that the compiler should instead
11995 place uninitialized global variables in the data section of the object file.
11996 This inhibits the merging of tentative definitions by the linker so
11997 you get a multiple-definition error if the same
11998 variable is defined in more than one compilation unit.
11999 Compiling with @option{-fno-common} is useful on targets for which
12000 it provides better performance, or if you wish to verify that the
12001 program will work on other systems that always treat uninitialized
12002 variable definitions this way.
12003
12004 @item -fno-ident
12005 @opindex fno-ident
12006 Ignore the @code{#ident} directive.
12007
12008 @item -finhibit-size-directive
12009 @opindex finhibit-size-directive
12010 Don't output a @code{.size} assembler directive, or anything else that
12011 would cause trouble if the function is split in the middle, and the
12012 two halves are placed at locations far apart in memory. This option is
12013 used when compiling @file{crtstuff.c}; you should not need to use it
12014 for anything else.
12015
12016 @item -fverbose-asm
12017 @opindex fverbose-asm
12018 Put extra commentary information in the generated assembly code to
12019 make it more readable. This option is generally only of use to those
12020 who actually need to read the generated assembly code (perhaps while
12021 debugging the compiler itself).
12022
12023 @option{-fno-verbose-asm}, the default, causes the
12024 extra information to be omitted and is useful when comparing two assembler
12025 files.
12026
12027 The added comments include:
12028
12029 @itemize @bullet
12030
12031 @item
12032 information on the compiler version and command-line options,
12033
12034 @item
12035 the source code lines associated with the assembly instructions,
12036 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12037
12038 @item
12039 hints on which high-level expressions correspond to
12040 the various assembly instruction operands.
12041
12042 @end itemize
12043
12044 For example, given this C source file:
12045
12046 @smallexample
12047 int test (int n)
12048 @{
12049 int i;
12050 int total = 0;
12051
12052 for (i = 0; i < n; i++)
12053 total += i * i;
12054
12055 return total;
12056 @}
12057 @end smallexample
12058
12059 compiling to (x86_64) assembly via @option{-S} and emitting the result
12060 direct to stdout via @option{-o} @option{-}
12061
12062 @smallexample
12063 gcc -S test.c -fverbose-asm -Os -o -
12064 @end smallexample
12065
12066 gives output similar to this:
12067
12068 @smallexample
12069 .file "test.c"
12070 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12071 [...snip...]
12072 # options passed:
12073 [...snip...]
12074
12075 .text
12076 .globl test
12077 .type test, @@function
12078 test:
12079 .LFB0:
12080 .cfi_startproc
12081 # test.c:4: int total = 0;
12082 xorl %eax, %eax # <retval>
12083 # test.c:6: for (i = 0; i < n; i++)
12084 xorl %edx, %edx # i
12085 .L2:
12086 # test.c:6: for (i = 0; i < n; i++)
12087 cmpl %edi, %edx # n, i
12088 jge .L5 #,
12089 # test.c:7: total += i * i;
12090 movl %edx, %ecx # i, tmp92
12091 imull %edx, %ecx # i, tmp92
12092 # test.c:6: for (i = 0; i < n; i++)
12093 incl %edx # i
12094 # test.c:7: total += i * i;
12095 addl %ecx, %eax # tmp92, <retval>
12096 jmp .L2 #
12097 .L5:
12098 # test.c:10: @}
12099 ret
12100 .cfi_endproc
12101 .LFE0:
12102 .size test, .-test
12103 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
12104 .section .note.GNU-stack,"",@@progbits
12105 @end smallexample
12106
12107 The comments are intended for humans rather than machines and hence the
12108 precise format of the comments is subject to change.
12109
12110 @item -frecord-gcc-switches
12111 @opindex frecord-gcc-switches
12112 This switch causes the command line used to invoke the
12113 compiler to be recorded into the object file that is being created.
12114 This switch is only implemented on some targets and the exact format
12115 of the recording is target and binary file format dependent, but it
12116 usually takes the form of a section containing ASCII text. This
12117 switch is related to the @option{-fverbose-asm} switch, but that
12118 switch only records information in the assembler output file as
12119 comments, so it never reaches the object file.
12120 See also @option{-grecord-gcc-switches} for another
12121 way of storing compiler options into the object file.
12122
12123 @item -fpic
12124 @opindex fpic
12125 @cindex global offset table
12126 @cindex PIC
12127 Generate position-independent code (PIC) suitable for use in a shared
12128 library, if supported for the target machine. Such code accesses all
12129 constant addresses through a global offset table (GOT)@. The dynamic
12130 loader resolves the GOT entries when the program starts (the dynamic
12131 loader is not part of GCC; it is part of the operating system). If
12132 the GOT size for the linked executable exceeds a machine-specific
12133 maximum size, you get an error message from the linker indicating that
12134 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
12135 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
12136 on the m68k and RS/6000. The x86 has no such limit.)
12137
12138 Position-independent code requires special support, and therefore works
12139 only on certain machines. For the x86, GCC supports PIC for System V
12140 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
12141 position-independent.
12142
12143 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12144 are defined to 1.
12145
12146 @item -fPIC
12147 @opindex fPIC
12148 If supported for the target machine, emit position-independent code,
12149 suitable for dynamic linking and avoiding any limit on the size of the
12150 global offset table. This option makes a difference on AArch64, m68k,
12151 PowerPC and SPARC@.
12152
12153 Position-independent code requires special support, and therefore works
12154 only on certain machines.
12155
12156 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12157 are defined to 2.
12158
12159 @item -fpie
12160 @itemx -fPIE
12161 @opindex fpie
12162 @opindex fPIE
12163 These options are similar to @option{-fpic} and @option{-fPIC}, but
12164 generated position independent code can be only linked into executables.
12165 Usually these options are used when @option{-pie} GCC option is
12166 used during linking.
12167
12168 @option{-fpie} and @option{-fPIE} both define the macros
12169 @code{__pie__} and @code{__PIE__}. The macros have the value 1
12170 for @option{-fpie} and 2 for @option{-fPIE}.
12171
12172 @item -fno-plt
12173 @opindex fno-plt
12174 Do not use the PLT for external function calls in position-independent code.
12175 Instead, load the callee address at call sites from the GOT and branch to it.
12176 This leads to more efficient code by eliminating PLT stubs and exposing
12177 GOT loads to optimizations. On architectures such as 32-bit x86 where
12178 PLT stubs expect the GOT pointer in a specific register, this gives more
12179 register allocation freedom to the compiler.
12180 Lazy binding requires use of the PLT;
12181 with @option{-fno-plt} all external symbols are resolved at load time.
12182
12183 Alternatively, the function attribute @code{noplt} can be used to avoid calls
12184 through the PLT for specific external functions.
12185
12186 In position-dependent code, a few targets also convert calls to
12187 functions that are marked to not use the PLT to use the GOT instead.
12188
12189 @item -fno-jump-tables
12190 @opindex fno-jump-tables
12191 Do not use jump tables for switch statements even where it would be
12192 more efficient than other code generation strategies. This option is
12193 of use in conjunction with @option{-fpic} or @option{-fPIC} for
12194 building code that forms part of a dynamic linker and cannot
12195 reference the address of a jump table. On some targets, jump tables
12196 do not require a GOT and this option is not needed.
12197
12198 @item -ffixed-@var{reg}
12199 @opindex ffixed
12200 Treat the register named @var{reg} as a fixed register; generated code
12201 should never refer to it (except perhaps as a stack pointer, frame
12202 pointer or in some other fixed role).
12203
12204 @var{reg} must be the name of a register. The register names accepted
12205 are machine-specific and are defined in the @code{REGISTER_NAMES}
12206 macro in the machine description macro file.
12207
12208 This flag does not have a negative form, because it specifies a
12209 three-way choice.
12210
12211 @item -fcall-used-@var{reg}
12212 @opindex fcall-used
12213 Treat the register named @var{reg} as an allocable register that is
12214 clobbered by function calls. It may be allocated for temporaries or
12215 variables that do not live across a call. Functions compiled this way
12216 do not save and restore the register @var{reg}.
12217
12218 It is an error to use this flag with the frame pointer or stack pointer.
12219 Use of this flag for other registers that have fixed pervasive roles in
12220 the machine's execution model produces disastrous results.
12221
12222 This flag does not have a negative form, because it specifies a
12223 three-way choice.
12224
12225 @item -fcall-saved-@var{reg}
12226 @opindex fcall-saved
12227 Treat the register named @var{reg} as an allocable register saved by
12228 functions. It may be allocated even for temporaries or variables that
12229 live across a call. Functions compiled this way save and restore
12230 the register @var{reg} if they use it.
12231
12232 It is an error to use this flag with the frame pointer or stack pointer.
12233 Use of this flag for other registers that have fixed pervasive roles in
12234 the machine's execution model produces disastrous results.
12235
12236 A different sort of disaster results from the use of this flag for
12237 a register in which function values may be returned.
12238
12239 This flag does not have a negative form, because it specifies a
12240 three-way choice.
12241
12242 @item -fpack-struct[=@var{n}]
12243 @opindex fpack-struct
12244 Without a value specified, pack all structure members together without
12245 holes. When a value is specified (which must be a small power of two), pack
12246 structure members according to this value, representing the maximum
12247 alignment (that is, objects with default alignment requirements larger than
12248 this are output potentially unaligned at the next fitting location.
12249
12250 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
12251 code that is not binary compatible with code generated without that switch.
12252 Additionally, it makes the code suboptimal.
12253 Use it to conform to a non-default application binary interface.
12254
12255 @item -fleading-underscore
12256 @opindex fleading-underscore
12257 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
12258 change the way C symbols are represented in the object file. One use
12259 is to help link with legacy assembly code.
12260
12261 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
12262 generate code that is not binary compatible with code generated without that
12263 switch. Use it to conform to a non-default application binary interface.
12264 Not all targets provide complete support for this switch.
12265
12266 @item -ftls-model=@var{model}
12267 @opindex ftls-model
12268 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
12269 The @var{model} argument should be one of @samp{global-dynamic},
12270 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
12271 Note that the choice is subject to optimization: the compiler may use
12272 a more efficient model for symbols not visible outside of the translation
12273 unit, or if @option{-fpic} is not given on the command line.
12274
12275 The default without @option{-fpic} is @samp{initial-exec}; with
12276 @option{-fpic} the default is @samp{global-dynamic}.
12277
12278 @item -ftrampolines
12279 @opindex ftrampolines
12280 For targets that normally need trampolines for nested functions, always
12281 generate them instead of using descriptors. Otherwise, for targets that
12282 do not need them, like for example HP-PA or IA-64, do nothing.
12283
12284 A trampoline is a small piece of code that is created at run time on the
12285 stack when the address of a nested function is taken, and is used to call
12286 the nested function indirectly. Therefore, it requires the stack to be
12287 made executable in order for the program to work properly.
12288
12289 @option{-fno-trampolines} is enabled by default on a language by language
12290 basis to let the compiler avoid generating them, if it computes that this
12291 is safe, and replace them with descriptors. Descriptors are made up of data
12292 only, but the generated code must be prepared to deal with them. As of this
12293 writing, @option{-fno-trampolines} is enabled by default only for Ada.
12294
12295 Moreover, code compiled with @option{-ftrampolines} and code compiled with
12296 @option{-fno-trampolines} are not binary compatible if nested functions are
12297 present. This option must therefore be used on a program-wide basis and be
12298 manipulated with extreme care.
12299
12300 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
12301 @opindex fvisibility
12302 Set the default ELF image symbol visibility to the specified option---all
12303 symbols are marked with this unless overridden within the code.
12304 Using this feature can very substantially improve linking and
12305 load times of shared object libraries, produce more optimized
12306 code, provide near-perfect API export and prevent symbol clashes.
12307 It is @strong{strongly} recommended that you use this in any shared objects
12308 you distribute.
12309
12310 Despite the nomenclature, @samp{default} always means public; i.e.,
12311 available to be linked against from outside the shared object.
12312 @samp{protected} and @samp{internal} are pretty useless in real-world
12313 usage so the only other commonly used option is @samp{hidden}.
12314 The default if @option{-fvisibility} isn't specified is
12315 @samp{default}, i.e., make every symbol public.
12316
12317 A good explanation of the benefits offered by ensuring ELF
12318 symbols have the correct visibility is given by ``How To Write
12319 Shared Libraries'' by Ulrich Drepper (which can be found at
12320 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
12321 solution made possible by this option to marking things hidden when
12322 the default is public is to make the default hidden and mark things
12323 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
12324 and @code{__attribute__ ((visibility("default")))} instead of
12325 @code{__declspec(dllexport)} you get almost identical semantics with
12326 identical syntax. This is a great boon to those working with
12327 cross-platform projects.
12328
12329 For those adding visibility support to existing code, you may find
12330 @code{#pragma GCC visibility} of use. This works by you enclosing
12331 the declarations you wish to set visibility for with (for example)
12332 @code{#pragma GCC visibility push(hidden)} and
12333 @code{#pragma GCC visibility pop}.
12334 Bear in mind that symbol visibility should be viewed @strong{as
12335 part of the API interface contract} and thus all new code should
12336 always specify visibility when it is not the default; i.e., declarations
12337 only for use within the local DSO should @strong{always} be marked explicitly
12338 as hidden as so to avoid PLT indirection overheads---making this
12339 abundantly clear also aids readability and self-documentation of the code.
12340 Note that due to ISO C++ specification requirements, @code{operator new} and
12341 @code{operator delete} must always be of default visibility.
12342
12343 Be aware that headers from outside your project, in particular system
12344 headers and headers from any other library you use, may not be
12345 expecting to be compiled with visibility other than the default. You
12346 may need to explicitly say @code{#pragma GCC visibility push(default)}
12347 before including any such headers.
12348
12349 @code{extern} declarations are not affected by @option{-fvisibility}, so
12350 a lot of code can be recompiled with @option{-fvisibility=hidden} with
12351 no modifications. However, this means that calls to @code{extern}
12352 functions with no explicit visibility use the PLT, so it is more
12353 effective to use @code{__attribute ((visibility))} and/or
12354 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
12355 declarations should be treated as hidden.
12356
12357 Note that @option{-fvisibility} does affect C++ vague linkage
12358 entities. This means that, for instance, an exception class that is
12359 be thrown between DSOs must be explicitly marked with default
12360 visibility so that the @samp{type_info} nodes are unified between
12361 the DSOs.
12362
12363 An overview of these techniques, their benefits and how to use them
12364 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
12365
12366 @item -fstrict-volatile-bitfields
12367 @opindex fstrict-volatile-bitfields
12368 This option should be used if accesses to volatile bit-fields (or other
12369 structure fields, although the compiler usually honors those types
12370 anyway) should use a single access of the width of the
12371 field's type, aligned to a natural alignment if possible. For
12372 example, targets with memory-mapped peripheral registers might require
12373 all such accesses to be 16 bits wide; with this flag you can
12374 declare all peripheral bit-fields as @code{unsigned short} (assuming short
12375 is 16 bits on these targets) to force GCC to use 16-bit accesses
12376 instead of, perhaps, a more efficient 32-bit access.
12377
12378 If this option is disabled, the compiler uses the most efficient
12379 instruction. In the previous example, that might be a 32-bit load
12380 instruction, even though that accesses bytes that do not contain
12381 any portion of the bit-field, or memory-mapped registers unrelated to
12382 the one being updated.
12383
12384 In some cases, such as when the @code{packed} attribute is applied to a
12385 structure field, it may not be possible to access the field with a single
12386 read or write that is correctly aligned for the target machine. In this
12387 case GCC falls back to generating multiple accesses rather than code that
12388 will fault or truncate the result at run time.
12389
12390 Note: Due to restrictions of the C/C++11 memory model, write accesses are
12391 not allowed to touch non bit-field members. It is therefore recommended
12392 to define all bits of the field's type as bit-field members.
12393
12394 The default value of this option is determined by the application binary
12395 interface for the target processor.
12396
12397 @item -fsync-libcalls
12398 @opindex fsync-libcalls
12399 This option controls whether any out-of-line instance of the @code{__sync}
12400 family of functions may be used to implement the C++11 @code{__atomic}
12401 family of functions.
12402
12403 The default value of this option is enabled, thus the only useful form
12404 of the option is @option{-fno-sync-libcalls}. This option is used in
12405 the implementation of the @file{libatomic} runtime library.
12406
12407 @end table
12408
12409 @node Developer Options
12410 @section GCC Developer Options
12411 @cindex developer options
12412 @cindex debugging GCC
12413 @cindex debug dump options
12414 @cindex dump options
12415 @cindex compilation statistics
12416
12417 This section describes command-line options that are primarily of
12418 interest to GCC developers, including options to support compiler
12419 testing and investigation of compiler bugs and compile-time
12420 performance problems. This includes options that produce debug dumps
12421 at various points in the compilation; that print statistics such as
12422 memory use and execution time; and that print information about GCC's
12423 configuration, such as where it searches for libraries. You should
12424 rarely need to use any of these options for ordinary compilation and
12425 linking tasks.
12426
12427 @table @gcctabopt
12428
12429 @item -d@var{letters}
12430 @itemx -fdump-rtl-@var{pass}
12431 @itemx -fdump-rtl-@var{pass}=@var{filename}
12432 @opindex d
12433 @opindex fdump-rtl-@var{pass}
12434 Says to make debugging dumps during compilation at times specified by
12435 @var{letters}. This is used for debugging the RTL-based passes of the
12436 compiler. The file names for most of the dumps are made by appending
12437 a pass number and a word to the @var{dumpname}, and the files are
12438 created in the directory of the output file. In case of
12439 @option{=@var{filename}} option, the dump is output on the given file
12440 instead of the pass numbered dump files. Note that the pass number is
12441 assigned as passes are registered into the pass manager. Most passes
12442 are registered in the order that they will execute and for these passes
12443 the number corresponds to the pass execution order. However, passes
12444 registered by plugins, passes specific to compilation targets, or
12445 passes that are otherwise registered after all the other passes are
12446 numbered higher than a pass named "final", even if they are executed
12447 earlier. @var{dumpname} is generated from the name of the output
12448 file if explicitly specified and not an executable, otherwise it is
12449 the basename of the source file. These switches may have different
12450 effects when @option{-E} is used for preprocessing.
12451
12452 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
12453 @option{-d} option @var{letters}. Here are the possible
12454 letters for use in @var{pass} and @var{letters}, and their meanings:
12455
12456 @table @gcctabopt
12457
12458 @item -fdump-rtl-alignments
12459 @opindex fdump-rtl-alignments
12460 Dump after branch alignments have been computed.
12461
12462 @item -fdump-rtl-asmcons
12463 @opindex fdump-rtl-asmcons
12464 Dump after fixing rtl statements that have unsatisfied in/out constraints.
12465
12466 @item -fdump-rtl-auto_inc_dec
12467 @opindex fdump-rtl-auto_inc_dec
12468 Dump after auto-inc-dec discovery. This pass is only run on
12469 architectures that have auto inc or auto dec instructions.
12470
12471 @item -fdump-rtl-barriers
12472 @opindex fdump-rtl-barriers
12473 Dump after cleaning up the barrier instructions.
12474
12475 @item -fdump-rtl-bbpart
12476 @opindex fdump-rtl-bbpart
12477 Dump after partitioning hot and cold basic blocks.
12478
12479 @item -fdump-rtl-bbro
12480 @opindex fdump-rtl-bbro
12481 Dump after block reordering.
12482
12483 @item -fdump-rtl-btl1
12484 @itemx -fdump-rtl-btl2
12485 @opindex fdump-rtl-btl2
12486 @opindex fdump-rtl-btl2
12487 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
12488 after the two branch
12489 target load optimization passes.
12490
12491 @item -fdump-rtl-bypass
12492 @opindex fdump-rtl-bypass
12493 Dump after jump bypassing and control flow optimizations.
12494
12495 @item -fdump-rtl-combine
12496 @opindex fdump-rtl-combine
12497 Dump after the RTL instruction combination pass.
12498
12499 @item -fdump-rtl-compgotos
12500 @opindex fdump-rtl-compgotos
12501 Dump after duplicating the computed gotos.
12502
12503 @item -fdump-rtl-ce1
12504 @itemx -fdump-rtl-ce2
12505 @itemx -fdump-rtl-ce3
12506 @opindex fdump-rtl-ce1
12507 @opindex fdump-rtl-ce2
12508 @opindex fdump-rtl-ce3
12509 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
12510 @option{-fdump-rtl-ce3} enable dumping after the three
12511 if conversion passes.
12512
12513 @item -fdump-rtl-cprop_hardreg
12514 @opindex fdump-rtl-cprop_hardreg
12515 Dump after hard register copy propagation.
12516
12517 @item -fdump-rtl-csa
12518 @opindex fdump-rtl-csa
12519 Dump after combining stack adjustments.
12520
12521 @item -fdump-rtl-cse1
12522 @itemx -fdump-rtl-cse2
12523 @opindex fdump-rtl-cse1
12524 @opindex fdump-rtl-cse2
12525 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
12526 the two common subexpression elimination passes.
12527
12528 @item -fdump-rtl-dce
12529 @opindex fdump-rtl-dce
12530 Dump after the standalone dead code elimination passes.
12531
12532 @item -fdump-rtl-dbr
12533 @opindex fdump-rtl-dbr
12534 Dump after delayed branch scheduling.
12535
12536 @item -fdump-rtl-dce1
12537 @itemx -fdump-rtl-dce2
12538 @opindex fdump-rtl-dce1
12539 @opindex fdump-rtl-dce2
12540 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
12541 the two dead store elimination passes.
12542
12543 @item -fdump-rtl-eh
12544 @opindex fdump-rtl-eh
12545 Dump after finalization of EH handling code.
12546
12547 @item -fdump-rtl-eh_ranges
12548 @opindex fdump-rtl-eh_ranges
12549 Dump after conversion of EH handling range regions.
12550
12551 @item -fdump-rtl-expand
12552 @opindex fdump-rtl-expand
12553 Dump after RTL generation.
12554
12555 @item -fdump-rtl-fwprop1
12556 @itemx -fdump-rtl-fwprop2
12557 @opindex fdump-rtl-fwprop1
12558 @opindex fdump-rtl-fwprop2
12559 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
12560 dumping after the two forward propagation passes.
12561
12562 @item -fdump-rtl-gcse1
12563 @itemx -fdump-rtl-gcse2
12564 @opindex fdump-rtl-gcse1
12565 @opindex fdump-rtl-gcse2
12566 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
12567 after global common subexpression elimination.
12568
12569 @item -fdump-rtl-init-regs
12570 @opindex fdump-rtl-init-regs
12571 Dump after the initialization of the registers.
12572
12573 @item -fdump-rtl-initvals
12574 @opindex fdump-rtl-initvals
12575 Dump after the computation of the initial value sets.
12576
12577 @item -fdump-rtl-into_cfglayout
12578 @opindex fdump-rtl-into_cfglayout
12579 Dump after converting to cfglayout mode.
12580
12581 @item -fdump-rtl-ira
12582 @opindex fdump-rtl-ira
12583 Dump after iterated register allocation.
12584
12585 @item -fdump-rtl-jump
12586 @opindex fdump-rtl-jump
12587 Dump after the second jump optimization.
12588
12589 @item -fdump-rtl-loop2
12590 @opindex fdump-rtl-loop2
12591 @option{-fdump-rtl-loop2} enables dumping after the rtl
12592 loop optimization passes.
12593
12594 @item -fdump-rtl-mach
12595 @opindex fdump-rtl-mach
12596 Dump after performing the machine dependent reorganization pass, if that
12597 pass exists.
12598
12599 @item -fdump-rtl-mode_sw
12600 @opindex fdump-rtl-mode_sw
12601 Dump after removing redundant mode switches.
12602
12603 @item -fdump-rtl-rnreg
12604 @opindex fdump-rtl-rnreg
12605 Dump after register renumbering.
12606
12607 @item -fdump-rtl-outof_cfglayout
12608 @opindex fdump-rtl-outof_cfglayout
12609 Dump after converting from cfglayout mode.
12610
12611 @item -fdump-rtl-peephole2
12612 @opindex fdump-rtl-peephole2
12613 Dump after the peephole pass.
12614
12615 @item -fdump-rtl-postreload
12616 @opindex fdump-rtl-postreload
12617 Dump after post-reload optimizations.
12618
12619 @item -fdump-rtl-pro_and_epilogue
12620 @opindex fdump-rtl-pro_and_epilogue
12621 Dump after generating the function prologues and epilogues.
12622
12623 @item -fdump-rtl-sched1
12624 @itemx -fdump-rtl-sched2
12625 @opindex fdump-rtl-sched1
12626 @opindex fdump-rtl-sched2
12627 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
12628 after the basic block scheduling passes.
12629
12630 @item -fdump-rtl-ree
12631 @opindex fdump-rtl-ree
12632 Dump after sign/zero extension elimination.
12633
12634 @item -fdump-rtl-seqabstr
12635 @opindex fdump-rtl-seqabstr
12636 Dump after common sequence discovery.
12637
12638 @item -fdump-rtl-shorten
12639 @opindex fdump-rtl-shorten
12640 Dump after shortening branches.
12641
12642 @item -fdump-rtl-sibling
12643 @opindex fdump-rtl-sibling
12644 Dump after sibling call optimizations.
12645
12646 @item -fdump-rtl-split1
12647 @itemx -fdump-rtl-split2
12648 @itemx -fdump-rtl-split3
12649 @itemx -fdump-rtl-split4
12650 @itemx -fdump-rtl-split5
12651 @opindex fdump-rtl-split1
12652 @opindex fdump-rtl-split2
12653 @opindex fdump-rtl-split3
12654 @opindex fdump-rtl-split4
12655 @opindex fdump-rtl-split5
12656 These options enable dumping after five rounds of
12657 instruction splitting.
12658
12659 @item -fdump-rtl-sms
12660 @opindex fdump-rtl-sms
12661 Dump after modulo scheduling. This pass is only run on some
12662 architectures.
12663
12664 @item -fdump-rtl-stack
12665 @opindex fdump-rtl-stack
12666 Dump after conversion from GCC's ``flat register file'' registers to the
12667 x87's stack-like registers. This pass is only run on x86 variants.
12668
12669 @item -fdump-rtl-subreg1
12670 @itemx -fdump-rtl-subreg2
12671 @opindex fdump-rtl-subreg1
12672 @opindex fdump-rtl-subreg2
12673 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
12674 the two subreg expansion passes.
12675
12676 @item -fdump-rtl-unshare
12677 @opindex fdump-rtl-unshare
12678 Dump after all rtl has been unshared.
12679
12680 @item -fdump-rtl-vartrack
12681 @opindex fdump-rtl-vartrack
12682 Dump after variable tracking.
12683
12684 @item -fdump-rtl-vregs
12685 @opindex fdump-rtl-vregs
12686 Dump after converting virtual registers to hard registers.
12687
12688 @item -fdump-rtl-web
12689 @opindex fdump-rtl-web
12690 Dump after live range splitting.
12691
12692 @item -fdump-rtl-regclass
12693 @itemx -fdump-rtl-subregs_of_mode_init
12694 @itemx -fdump-rtl-subregs_of_mode_finish
12695 @itemx -fdump-rtl-dfinit
12696 @itemx -fdump-rtl-dfinish
12697 @opindex fdump-rtl-regclass
12698 @opindex fdump-rtl-subregs_of_mode_init
12699 @opindex fdump-rtl-subregs_of_mode_finish
12700 @opindex fdump-rtl-dfinit
12701 @opindex fdump-rtl-dfinish
12702 These dumps are defined but always produce empty files.
12703
12704 @item -da
12705 @itemx -fdump-rtl-all
12706 @opindex da
12707 @opindex fdump-rtl-all
12708 Produce all the dumps listed above.
12709
12710 @item -dA
12711 @opindex dA
12712 Annotate the assembler output with miscellaneous debugging information.
12713
12714 @item -dD
12715 @opindex dD
12716 Dump all macro definitions, at the end of preprocessing, in addition to
12717 normal output.
12718
12719 @item -dH
12720 @opindex dH
12721 Produce a core dump whenever an error occurs.
12722
12723 @item -dp
12724 @opindex dp
12725 Annotate the assembler output with a comment indicating which
12726 pattern and alternative is used. The length of each instruction is
12727 also printed.
12728
12729 @item -dP
12730 @opindex dP
12731 Dump the RTL in the assembler output as a comment before each instruction.
12732 Also turns on @option{-dp} annotation.
12733
12734 @item -dx
12735 @opindex dx
12736 Just generate RTL for a function instead of compiling it. Usually used
12737 with @option{-fdump-rtl-expand}.
12738 @end table
12739
12740 @item -fdump-noaddr
12741 @opindex fdump-noaddr
12742 When doing debugging dumps, suppress address output. This makes it more
12743 feasible to use diff on debugging dumps for compiler invocations with
12744 different compiler binaries and/or different
12745 text / bss / data / heap / stack / dso start locations.
12746
12747 @item -freport-bug
12748 @opindex freport-bug
12749 Collect and dump debug information into a temporary file if an
12750 internal compiler error (ICE) occurs.
12751
12752 @item -fdump-unnumbered
12753 @opindex fdump-unnumbered
12754 When doing debugging dumps, suppress instruction numbers and address output.
12755 This makes it more feasible to use diff on debugging dumps for compiler
12756 invocations with different options, in particular with and without
12757 @option{-g}.
12758
12759 @item -fdump-unnumbered-links
12760 @opindex fdump-unnumbered-links
12761 When doing debugging dumps (see @option{-d} option above), suppress
12762 instruction numbers for the links to the previous and next instructions
12763 in a sequence.
12764
12765 @item -fdump-translation-unit @r{(C++ only)}
12766 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
12767 @opindex fdump-translation-unit
12768 Dump a representation of the tree structure for the entire translation
12769 unit to a file. The file name is made by appending @file{.tu} to the
12770 source file name, and the file is created in the same directory as the
12771 output file. If the @samp{-@var{options}} form is used, @var{options}
12772 controls the details of the dump as described for the
12773 @option{-fdump-tree} options.
12774
12775 @item -fdump-class-hierarchy @r{(C++ only)}
12776 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
12777 @opindex fdump-class-hierarchy
12778 Dump a representation of each class's hierarchy and virtual function
12779 table layout to a file. The file name is made by appending
12780 @file{.class} to the source file name, and the file is created in the
12781 same directory as the output file. If the @samp{-@var{options}} form
12782 is used, @var{options} controls the details of the dump as described
12783 for the @option{-fdump-tree} options.
12784
12785 @item -fdump-ipa-@var{switch}
12786 @opindex fdump-ipa
12787 Control the dumping at various stages of inter-procedural analysis
12788 language tree to a file. The file name is generated by appending a
12789 switch specific suffix to the source file name, and the file is created
12790 in the same directory as the output file. The following dumps are
12791 possible:
12792
12793 @table @samp
12794 @item all
12795 Enables all inter-procedural analysis dumps.
12796
12797 @item cgraph
12798 Dumps information about call-graph optimization, unused function removal,
12799 and inlining decisions.
12800
12801 @item inline
12802 Dump after function inlining.
12803
12804 @end table
12805
12806 @item -fdump-passes
12807 @opindex fdump-passes
12808 Dump the list of optimization passes that are turned on and off by
12809 the current command-line options.
12810
12811 @item -fdump-statistics-@var{option}
12812 @opindex fdump-statistics
12813 Enable and control dumping of pass statistics in a separate file. The
12814 file name is generated by appending a suffix ending in
12815 @samp{.statistics} to the source file name, and the file is created in
12816 the same directory as the output file. If the @samp{-@var{option}}
12817 form is used, @samp{-stats} causes counters to be summed over the
12818 whole compilation unit while @samp{-details} dumps every event as
12819 the passes generate them. The default with no option is to sum
12820 counters for each function compiled.
12821
12822 @item -fdump-tree-@var{switch}
12823 @itemx -fdump-tree-@var{switch}-@var{options}
12824 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
12825 @opindex fdump-tree
12826 Control the dumping at various stages of processing the intermediate
12827 language tree to a file. The file name is generated by appending a
12828 switch-specific suffix to the source file name, and the file is
12829 created in the same directory as the output file. In case of
12830 @option{=@var{filename}} option, the dump is output on the given file
12831 instead of the auto named dump files. If the @samp{-@var{options}}
12832 form is used, @var{options} is a list of @samp{-} separated options
12833 which control the details of the dump. Not all options are applicable
12834 to all dumps; those that are not meaningful are ignored. The
12835 following options are available
12836
12837 @table @samp
12838 @item address
12839 Print the address of each node. Usually this is not meaningful as it
12840 changes according to the environment and source file. Its primary use
12841 is for tying up a dump file with a debug environment.
12842 @item asmname
12843 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
12844 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
12845 use working backward from mangled names in the assembly file.
12846 @item slim
12847 When dumping front-end intermediate representations, inhibit dumping
12848 of members of a scope or body of a function merely because that scope
12849 has been reached. Only dump such items when they are directly reachable
12850 by some other path.
12851
12852 When dumping pretty-printed trees, this option inhibits dumping the
12853 bodies of control structures.
12854
12855 When dumping RTL, print the RTL in slim (condensed) form instead of
12856 the default LISP-like representation.
12857 @item raw
12858 Print a raw representation of the tree. By default, trees are
12859 pretty-printed into a C-like representation.
12860 @item details
12861 Enable more detailed dumps (not honored by every dump option). Also
12862 include information from the optimization passes.
12863 @item stats
12864 Enable dumping various statistics about the pass (not honored by every dump
12865 option).
12866 @item blocks
12867 Enable showing basic block boundaries (disabled in raw dumps).
12868 @item graph
12869 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
12870 dump a representation of the control flow graph suitable for viewing with
12871 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
12872 the file is pretty-printed as a subgraph, so that GraphViz can render them
12873 all in a single plot.
12874
12875 This option currently only works for RTL dumps, and the RTL is always
12876 dumped in slim form.
12877 @item vops
12878 Enable showing virtual operands for every statement.
12879 @item lineno
12880 Enable showing line numbers for statements.
12881 @item uid
12882 Enable showing the unique ID (@code{DECL_UID}) for each variable.
12883 @item verbose
12884 Enable showing the tree dump for each statement.
12885 @item eh
12886 Enable showing the EH region number holding each statement.
12887 @item scev
12888 Enable showing scalar evolution analysis details.
12889 @item optimized
12890 Enable showing optimization information (only available in certain
12891 passes).
12892 @item missed
12893 Enable showing missed optimization information (only available in certain
12894 passes).
12895 @item note
12896 Enable other detailed optimization information (only available in
12897 certain passes).
12898 @item =@var{filename}
12899 Instead of an auto named dump file, output into the given file
12900 name. The file names @file{stdout} and @file{stderr} are treated
12901 specially and are considered already open standard streams. For
12902 example,
12903
12904 @smallexample
12905 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
12906 -fdump-tree-pre=stderr file.c
12907 @end smallexample
12908
12909 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
12910 output on to @file{stderr}. If two conflicting dump filenames are
12911 given for the same pass, then the latter option overrides the earlier
12912 one.
12913
12914 @item split-paths
12915 @opindex fdump-tree-split-paths
12916 Dump each function after splitting paths to loop backedges. The file
12917 name is made by appending @file{.split-paths} to the source file name.
12918
12919 @item all
12920 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
12921 and @option{lineno}.
12922
12923 @item optall
12924 Turn on all optimization options, i.e., @option{optimized},
12925 @option{missed}, and @option{note}.
12926 @end table
12927
12928 The following tree dumps are possible:
12929 @table @samp
12930
12931 @item original
12932 @opindex fdump-tree-original
12933 Dump before any tree based optimization, to @file{@var{file}.original}.
12934
12935 @item optimized
12936 @opindex fdump-tree-optimized
12937 Dump after all tree based optimization, to @file{@var{file}.optimized}.
12938
12939 @item gimple
12940 @opindex fdump-tree-gimple
12941 Dump each function before and after the gimplification pass to a file. The
12942 file name is made by appending @file{.gimple} to the source file name.
12943
12944 @item cfg
12945 @opindex fdump-tree-cfg
12946 Dump the control flow graph of each function to a file. The file name is
12947 made by appending @file{.cfg} to the source file name.
12948
12949 @item ch
12950 @opindex fdump-tree-ch
12951 Dump each function after copying loop headers. The file name is made by
12952 appending @file{.ch} to the source file name.
12953
12954 @item ssa
12955 @opindex fdump-tree-ssa
12956 Dump SSA related information to a file. The file name is made by appending
12957 @file{.ssa} to the source file name.
12958
12959 @item alias
12960 @opindex fdump-tree-alias
12961 Dump aliasing information for each function. The file name is made by
12962 appending @file{.alias} to the source file name.
12963
12964 @item ccp
12965 @opindex fdump-tree-ccp
12966 Dump each function after CCP@. The file name is made by appending
12967 @file{.ccp} to the source file name.
12968
12969 @item storeccp
12970 @opindex fdump-tree-storeccp
12971 Dump each function after STORE-CCP@. The file name is made by appending
12972 @file{.storeccp} to the source file name.
12973
12974 @item pre
12975 @opindex fdump-tree-pre
12976 Dump trees after partial redundancy elimination and/or code hoisting.
12977 The file name is made by appending @file{.pre} to the source file name.
12978
12979 @item fre
12980 @opindex fdump-tree-fre
12981 Dump trees after full redundancy elimination. The file name is made
12982 by appending @file{.fre} to the source file name.
12983
12984 @item copyprop
12985 @opindex fdump-tree-copyprop
12986 Dump trees after copy propagation. The file name is made
12987 by appending @file{.copyprop} to the source file name.
12988
12989 @item store_copyprop
12990 @opindex fdump-tree-store_copyprop
12991 Dump trees after store copy-propagation. The file name is made
12992 by appending @file{.store_copyprop} to the source file name.
12993
12994 @item dce
12995 @opindex fdump-tree-dce
12996 Dump each function after dead code elimination. The file name is made by
12997 appending @file{.dce} to the source file name.
12998
12999 @item sra
13000 @opindex fdump-tree-sra
13001 Dump each function after performing scalar replacement of aggregates. The
13002 file name is made by appending @file{.sra} to the source file name.
13003
13004 @item sink
13005 @opindex fdump-tree-sink
13006 Dump each function after performing code sinking. The file name is made
13007 by appending @file{.sink} to the source file name.
13008
13009 @item dom
13010 @opindex fdump-tree-dom
13011 Dump each function after applying dominator tree optimizations. The file
13012 name is made by appending @file{.dom} to the source file name.
13013
13014 @item dse
13015 @opindex fdump-tree-dse
13016 Dump each function after applying dead store elimination. The file
13017 name is made by appending @file{.dse} to the source file name.
13018
13019 @item phiopt
13020 @opindex fdump-tree-phiopt
13021 Dump each function after optimizing PHI nodes into straightline code. The file
13022 name is made by appending @file{.phiopt} to the source file name.
13023
13024 @item backprop
13025 @opindex fdump-tree-backprop
13026 Dump each function after back-propagating use information up the definition
13027 chain. The file name is made by appending @file{.backprop} to the
13028 source file name.
13029
13030 @item forwprop
13031 @opindex fdump-tree-forwprop
13032 Dump each function after forward propagating single use variables. The file
13033 name is made by appending @file{.forwprop} to the source file name.
13034
13035 @item nrv
13036 @opindex fdump-tree-nrv
13037 Dump each function after applying the named return value optimization on
13038 generic trees. The file name is made by appending @file{.nrv} to the source
13039 file name.
13040
13041 @item vect
13042 @opindex fdump-tree-vect
13043 Dump each function after applying vectorization of loops. The file name is
13044 made by appending @file{.vect} to the source file name.
13045
13046 @item slp
13047 @opindex fdump-tree-slp
13048 Dump each function after applying vectorization of basic blocks. The file name
13049 is made by appending @file{.slp} to the source file name.
13050
13051 @item vrp
13052 @opindex fdump-tree-vrp
13053 Dump each function after Value Range Propagation (VRP). The file name
13054 is made by appending @file{.vrp} to the source file name.
13055
13056 @item early vrp
13057 @opindex fdump-tree-evrp
13058 Dump each function after Early Value Range Propagation (EVRP). The file name
13059 is made by appending @file{.evrp} to the source file name.
13060
13061 @item oaccdevlow
13062 @opindex fdump-tree-oaccdevlow
13063 Dump each function after applying device-specific OpenACC transformations.
13064 The file name is made by appending @file{.oaccdevlow} to the source file name.
13065
13066 @item all
13067 @opindex fdump-tree-all
13068 Enable all the available tree dumps with the flags provided in this option.
13069 @end table
13070
13071 @item -fopt-info
13072 @itemx -fopt-info-@var{options}
13073 @itemx -fopt-info-@var{options}=@var{filename}
13074 @opindex fopt-info
13075 Controls optimization dumps from various optimization passes. If the
13076 @samp{-@var{options}} form is used, @var{options} is a list of
13077 @samp{-} separated option keywords to select the dump details and
13078 optimizations.
13079
13080 The @var{options} can be divided into two groups: options describing the
13081 verbosity of the dump, and options describing which optimizations
13082 should be included. The options from both the groups can be freely
13083 mixed as they are non-overlapping. However, in case of any conflicts,
13084 the later options override the earlier options on the command
13085 line.
13086
13087 The following options control the dump verbosity:
13088
13089 @table @samp
13090 @item optimized
13091 Print information when an optimization is successfully applied. It is
13092 up to a pass to decide which information is relevant. For example, the
13093 vectorizer passes print the source location of loops which are
13094 successfully vectorized.
13095 @item missed
13096 Print information about missed optimizations. Individual passes
13097 control which information to include in the output.
13098 @item note
13099 Print verbose information about optimizations, such as certain
13100 transformations, more detailed messages about decisions etc.
13101 @item all
13102 Print detailed optimization information. This includes
13103 @samp{optimized}, @samp{missed}, and @samp{note}.
13104 @end table
13105
13106 One or more of the following option keywords can be used to describe a
13107 group of optimizations:
13108
13109 @table @samp
13110 @item ipa
13111 Enable dumps from all interprocedural optimizations.
13112 @item loop
13113 Enable dumps from all loop optimizations.
13114 @item inline
13115 Enable dumps from all inlining optimizations.
13116 @item vec
13117 Enable dumps from all vectorization optimizations.
13118 @item optall
13119 Enable dumps from all optimizations. This is a superset of
13120 the optimization groups listed above.
13121 @end table
13122
13123 If @var{options} is
13124 omitted, it defaults to @samp{optimized-optall}, which means to dump all
13125 info about successful optimizations from all the passes.
13126
13127 If the @var{filename} is provided, then the dumps from all the
13128 applicable optimizations are concatenated into the @var{filename}.
13129 Otherwise the dump is output onto @file{stderr}. Though multiple
13130 @option{-fopt-info} options are accepted, only one of them can include
13131 a @var{filename}. If other filenames are provided then all but the
13132 first such option are ignored.
13133
13134 Note that the output @var{filename} is overwritten
13135 in case of multiple translation units. If a combined output from
13136 multiple translation units is desired, @file{stderr} should be used
13137 instead.
13138
13139 In the following example, the optimization info is output to
13140 @file{stderr}:
13141
13142 @smallexample
13143 gcc -O3 -fopt-info
13144 @end smallexample
13145
13146 This example:
13147 @smallexample
13148 gcc -O3 -fopt-info-missed=missed.all
13149 @end smallexample
13150
13151 @noindent
13152 outputs missed optimization report from all the passes into
13153 @file{missed.all}, and this one:
13154
13155 @smallexample
13156 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13157 @end smallexample
13158
13159 @noindent
13160 prints information about missed optimization opportunities from
13161 vectorization passes on @file{stderr}.
13162 Note that @option{-fopt-info-vec-missed} is equivalent to
13163 @option{-fopt-info-missed-vec}.
13164
13165 As another example,
13166 @smallexample
13167 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13168 @end smallexample
13169
13170 @noindent
13171 outputs information about missed optimizations as well as
13172 optimized locations from all the inlining passes into
13173 @file{inline.txt}.
13174
13175 Finally, consider:
13176
13177 @smallexample
13178 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13179 @end smallexample
13180
13181 @noindent
13182 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
13183 in conflict since only one output file is allowed. In this case, only
13184 the first option takes effect and the subsequent options are
13185 ignored. Thus only @file{vec.miss} is produced which contains
13186 dumps from the vectorizer about missed opportunities.
13187
13188 @item -fsched-verbose=@var{n}
13189 @opindex fsched-verbose
13190 On targets that use instruction scheduling, this option controls the
13191 amount of debugging output the scheduler prints to the dump files.
13192
13193 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
13194 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
13195 For @var{n} greater than one, it also output basic block probabilities,
13196 detailed ready list information and unit/insn info. For @var{n} greater
13197 than two, it includes RTL at abort point, control-flow and regions info.
13198 And for @var{n} over four, @option{-fsched-verbose} also includes
13199 dependence info.
13200
13201
13202
13203 @item -fenable-@var{kind}-@var{pass}
13204 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
13205 @opindex fdisable-
13206 @opindex fenable-
13207
13208 This is a set of options that are used to explicitly disable/enable
13209 optimization passes. These options are intended for use for debugging GCC.
13210 Compiler users should use regular options for enabling/disabling
13211 passes instead.
13212
13213 @table @gcctabopt
13214
13215 @item -fdisable-ipa-@var{pass}
13216 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13217 statically invoked in the compiler multiple times, the pass name should be
13218 appended with a sequential number starting from 1.
13219
13220 @item -fdisable-rtl-@var{pass}
13221 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
13222 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
13223 statically invoked in the compiler multiple times, the pass name should be
13224 appended with a sequential number starting from 1. @var{range-list} is a
13225 comma-separated list of function ranges or assembler names. Each range is a number
13226 pair separated by a colon. The range is inclusive in both ends. If the range
13227 is trivial, the number pair can be simplified as a single number. If the
13228 function's call graph node's @var{uid} falls within one of the specified ranges,
13229 the @var{pass} is disabled for that function. The @var{uid} is shown in the
13230 function header of a dump file, and the pass names can be dumped by using
13231 option @option{-fdump-passes}.
13232
13233 @item -fdisable-tree-@var{pass}
13234 @itemx -fdisable-tree-@var{pass}=@var{range-list}
13235 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
13236 option arguments.
13237
13238 @item -fenable-ipa-@var{pass}
13239 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13240 statically invoked in the compiler multiple times, the pass name should be
13241 appended with a sequential number starting from 1.
13242
13243 @item -fenable-rtl-@var{pass}
13244 @itemx -fenable-rtl-@var{pass}=@var{range-list}
13245 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
13246 description and examples.
13247
13248 @item -fenable-tree-@var{pass}
13249 @itemx -fenable-tree-@var{pass}=@var{range-list}
13250 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
13251 of option arguments.
13252
13253 @end table
13254
13255 Here are some examples showing uses of these options.
13256
13257 @smallexample
13258
13259 # disable ccp1 for all functions
13260 -fdisable-tree-ccp1
13261 # disable complete unroll for function whose cgraph node uid is 1
13262 -fenable-tree-cunroll=1
13263 # disable gcse2 for functions at the following ranges [1,1],
13264 # [300,400], and [400,1000]
13265 # disable gcse2 for functions foo and foo2
13266 -fdisable-rtl-gcse2=foo,foo2
13267 # disable early inlining
13268 -fdisable-tree-einline
13269 # disable ipa inlining
13270 -fdisable-ipa-inline
13271 # enable tree full unroll
13272 -fenable-tree-unroll
13273
13274 @end smallexample
13275
13276 @item -fchecking
13277 @itemx -fchecking=@var{n}
13278 @opindex fchecking
13279 @opindex fno-checking
13280 Enable internal consistency checking. The default depends on
13281 the compiler configuration. @option{-fchecking=2} enables further
13282 internal consistency checking that might affect code generation.
13283
13284 @item -frandom-seed=@var{string}
13285 @opindex frandom-seed
13286 This option provides a seed that GCC uses in place of
13287 random numbers in generating certain symbol names
13288 that have to be different in every compiled file. It is also used to
13289 place unique stamps in coverage data files and the object files that
13290 produce them. You can use the @option{-frandom-seed} option to produce
13291 reproducibly identical object files.
13292
13293 The @var{string} can either be a number (decimal, octal or hex) or an
13294 arbitrary string (in which case it's converted to a number by
13295 computing CRC32).
13296
13297 The @var{string} should be different for every file you compile.
13298
13299 @item -save-temps
13300 @itemx -save-temps=cwd
13301 @opindex save-temps
13302 Store the usual ``temporary'' intermediate files permanently; place them
13303 in the current directory and name them based on the source file. Thus,
13304 compiling @file{foo.c} with @option{-c -save-temps} produces files
13305 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
13306 preprocessed @file{foo.i} output file even though the compiler now
13307 normally uses an integrated preprocessor.
13308
13309 When used in combination with the @option{-x} command-line option,
13310 @option{-save-temps} is sensible enough to avoid over writing an
13311 input source file with the same extension as an intermediate file.
13312 The corresponding intermediate file may be obtained by renaming the
13313 source file before using @option{-save-temps}.
13314
13315 If you invoke GCC in parallel, compiling several different source
13316 files that share a common base name in different subdirectories or the
13317 same source file compiled for multiple output destinations, it is
13318 likely that the different parallel compilers will interfere with each
13319 other, and overwrite the temporary files. For instance:
13320
13321 @smallexample
13322 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
13323 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
13324 @end smallexample
13325
13326 may result in @file{foo.i} and @file{foo.o} being written to
13327 simultaneously by both compilers.
13328
13329 @item -save-temps=obj
13330 @opindex save-temps=obj
13331 Store the usual ``temporary'' intermediate files permanently. If the
13332 @option{-o} option is used, the temporary files are based on the
13333 object file. If the @option{-o} option is not used, the
13334 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
13335
13336 For example:
13337
13338 @smallexample
13339 gcc -save-temps=obj -c foo.c
13340 gcc -save-temps=obj -c bar.c -o dir/xbar.o
13341 gcc -save-temps=obj foobar.c -o dir2/yfoobar
13342 @end smallexample
13343
13344 @noindent
13345 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
13346 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
13347 @file{dir2/yfoobar.o}.
13348
13349 @item -time@r{[}=@var{file}@r{]}
13350 @opindex time
13351 Report the CPU time taken by each subprocess in the compilation
13352 sequence. For C source files, this is the compiler proper and assembler
13353 (plus the linker if linking is done).
13354
13355 Without the specification of an output file, the output looks like this:
13356
13357 @smallexample
13358 # cc1 0.12 0.01
13359 # as 0.00 0.01
13360 @end smallexample
13361
13362 The first number on each line is the ``user time'', that is time spent
13363 executing the program itself. The second number is ``system time'',
13364 time spent executing operating system routines on behalf of the program.
13365 Both numbers are in seconds.
13366
13367 With the specification of an output file, the output is appended to the
13368 named file, and it looks like this:
13369
13370 @smallexample
13371 0.12 0.01 cc1 @var{options}
13372 0.00 0.01 as @var{options}
13373 @end smallexample
13374
13375 The ``user time'' and the ``system time'' are moved before the program
13376 name, and the options passed to the program are displayed, so that one
13377 can later tell what file was being compiled, and with which options.
13378
13379 @item -fdump-final-insns@r{[}=@var{file}@r{]}
13380 @opindex fdump-final-insns
13381 Dump the final internal representation (RTL) to @var{file}. If the
13382 optional argument is omitted (or if @var{file} is @code{.}), the name
13383 of the dump file is determined by appending @code{.gkd} to the
13384 compilation output file name.
13385
13386 @item -fcompare-debug@r{[}=@var{opts}@r{]}
13387 @opindex fcompare-debug
13388 @opindex fno-compare-debug
13389 If no error occurs during compilation, run the compiler a second time,
13390 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
13391 passed to the second compilation. Dump the final internal
13392 representation in both compilations, and print an error if they differ.
13393
13394 If the equal sign is omitted, the default @option{-gtoggle} is used.
13395
13396 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
13397 and nonzero, implicitly enables @option{-fcompare-debug}. If
13398 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
13399 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
13400 is used.
13401
13402 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
13403 is equivalent to @option{-fno-compare-debug}, which disables the dumping
13404 of the final representation and the second compilation, preventing even
13405 @env{GCC_COMPARE_DEBUG} from taking effect.
13406
13407 To verify full coverage during @option{-fcompare-debug} testing, set
13408 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
13409 which GCC rejects as an invalid option in any actual compilation
13410 (rather than preprocessing, assembly or linking). To get just a
13411 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
13412 not overridden} will do.
13413
13414 @item -fcompare-debug-second
13415 @opindex fcompare-debug-second
13416 This option is implicitly passed to the compiler for the second
13417 compilation requested by @option{-fcompare-debug}, along with options to
13418 silence warnings, and omitting other options that would cause
13419 side-effect compiler outputs to files or to the standard output. Dump
13420 files and preserved temporary files are renamed so as to contain the
13421 @code{.gk} additional extension during the second compilation, to avoid
13422 overwriting those generated by the first.
13423
13424 When this option is passed to the compiler driver, it causes the
13425 @emph{first} compilation to be skipped, which makes it useful for little
13426 other than debugging the compiler proper.
13427
13428 @item -gtoggle
13429 @opindex gtoggle
13430 Turn off generation of debug info, if leaving out this option
13431 generates it, or turn it on at level 2 otherwise. The position of this
13432 argument in the command line does not matter; it takes effect after all
13433 other options are processed, and it does so only once, no matter how
13434 many times it is given. This is mainly intended to be used with
13435 @option{-fcompare-debug}.
13436
13437 @item -fvar-tracking-assignments-toggle
13438 @opindex fvar-tracking-assignments-toggle
13439 @opindex fno-var-tracking-assignments-toggle
13440 Toggle @option{-fvar-tracking-assignments}, in the same way that
13441 @option{-gtoggle} toggles @option{-g}.
13442
13443 @item -Q
13444 @opindex Q
13445 Makes the compiler print out each function name as it is compiled, and
13446 print some statistics about each pass when it finishes.
13447
13448 @item -ftime-report
13449 @opindex ftime-report
13450 Makes the compiler print some statistics about the time consumed by each
13451 pass when it finishes.
13452
13453 @item -ftime-report-details
13454 @opindex ftime-report-details
13455 Record the time consumed by infrastructure parts separately for each pass.
13456
13457 @item -fira-verbose=@var{n}
13458 @opindex fira-verbose
13459 Control the verbosity of the dump file for the integrated register allocator.
13460 The default value is 5. If the value @var{n} is greater or equal to 10,
13461 the dump output is sent to stderr using the same format as @var{n} minus 10.
13462
13463 @item -flto-report
13464 @opindex flto-report
13465 Prints a report with internal details on the workings of the link-time
13466 optimizer. The contents of this report vary from version to version.
13467 It is meant to be useful to GCC developers when processing object
13468 files in LTO mode (via @option{-flto}).
13469
13470 Disabled by default.
13471
13472 @item -flto-report-wpa
13473 @opindex flto-report-wpa
13474 Like @option{-flto-report}, but only print for the WPA phase of Link
13475 Time Optimization.
13476
13477 @item -fmem-report
13478 @opindex fmem-report
13479 Makes the compiler print some statistics about permanent memory
13480 allocation when it finishes.
13481
13482 @item -fmem-report-wpa
13483 @opindex fmem-report-wpa
13484 Makes the compiler print some statistics about permanent memory
13485 allocation for the WPA phase only.
13486
13487 @item -fpre-ipa-mem-report
13488 @opindex fpre-ipa-mem-report
13489 @item -fpost-ipa-mem-report
13490 @opindex fpost-ipa-mem-report
13491 Makes the compiler print some statistics about permanent memory
13492 allocation before or after interprocedural optimization.
13493
13494 @item -fprofile-report
13495 @opindex fprofile-report
13496 Makes the compiler print some statistics about consistency of the
13497 (estimated) profile and effect of individual passes.
13498
13499 @item -fstack-usage
13500 @opindex fstack-usage
13501 Makes the compiler output stack usage information for the program, on a
13502 per-function basis. The filename for the dump is made by appending
13503 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
13504 the output file, if explicitly specified and it is not an executable,
13505 otherwise it is the basename of the source file. An entry is made up
13506 of three fields:
13507
13508 @itemize
13509 @item
13510 The name of the function.
13511 @item
13512 A number of bytes.
13513 @item
13514 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
13515 @end itemize
13516
13517 The qualifier @code{static} means that the function manipulates the stack
13518 statically: a fixed number of bytes are allocated for the frame on function
13519 entry and released on function exit; no stack adjustments are otherwise made
13520 in the function. The second field is this fixed number of bytes.
13521
13522 The qualifier @code{dynamic} means that the function manipulates the stack
13523 dynamically: in addition to the static allocation described above, stack
13524 adjustments are made in the body of the function, for example to push/pop
13525 arguments around function calls. If the qualifier @code{bounded} is also
13526 present, the amount of these adjustments is bounded at compile time and
13527 the second field is an upper bound of the total amount of stack used by
13528 the function. If it is not present, the amount of these adjustments is
13529 not bounded at compile time and the second field only represents the
13530 bounded part.
13531
13532 @item -fstats
13533 @opindex fstats
13534 Emit statistics about front-end processing at the end of the compilation.
13535 This option is supported only by the C++ front end, and
13536 the information is generally only useful to the G++ development team.
13537
13538 @item -fdbg-cnt-list
13539 @opindex fdbg-cnt-list
13540 Print the name and the counter upper bound for all debug counters.
13541
13542
13543 @item -fdbg-cnt=@var{counter-value-list}
13544 @opindex fdbg-cnt
13545 Set the internal debug counter upper bound. @var{counter-value-list}
13546 is a comma-separated list of @var{name}:@var{value} pairs
13547 which sets the upper bound of each debug counter @var{name} to @var{value}.
13548 All debug counters have the initial upper bound of @code{UINT_MAX};
13549 thus @code{dbg_cnt} returns true always unless the upper bound
13550 is set by this option.
13551 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
13552 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
13553
13554 @item -print-file-name=@var{library}
13555 @opindex print-file-name
13556 Print the full absolute name of the library file @var{library} that
13557 would be used when linking---and don't do anything else. With this
13558 option, GCC does not compile or link anything; it just prints the
13559 file name.
13560
13561 @item -print-multi-directory
13562 @opindex print-multi-directory
13563 Print the directory name corresponding to the multilib selected by any
13564 other switches present in the command line. This directory is supposed
13565 to exist in @env{GCC_EXEC_PREFIX}.
13566
13567 @item -print-multi-lib
13568 @opindex print-multi-lib
13569 Print the mapping from multilib directory names to compiler switches
13570 that enable them. The directory name is separated from the switches by
13571 @samp{;}, and each switch starts with an @samp{@@} instead of the
13572 @samp{-}, without spaces between multiple switches. This is supposed to
13573 ease shell processing.
13574
13575 @item -print-multi-os-directory
13576 @opindex print-multi-os-directory
13577 Print the path to OS libraries for the selected
13578 multilib, relative to some @file{lib} subdirectory. If OS libraries are
13579 present in the @file{lib} subdirectory and no multilibs are used, this is
13580 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
13581 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
13582 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
13583 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
13584
13585 @item -print-multiarch
13586 @opindex print-multiarch
13587 Print the path to OS libraries for the selected multiarch,
13588 relative to some @file{lib} subdirectory.
13589
13590 @item -print-prog-name=@var{program}
13591 @opindex print-prog-name
13592 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
13593
13594 @item -print-libgcc-file-name
13595 @opindex print-libgcc-file-name
13596 Same as @option{-print-file-name=libgcc.a}.
13597
13598 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
13599 but you do want to link with @file{libgcc.a}. You can do:
13600
13601 @smallexample
13602 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
13603 @end smallexample
13604
13605 @item -print-search-dirs
13606 @opindex print-search-dirs
13607 Print the name of the configured installation directory and a list of
13608 program and library directories @command{gcc} searches---and don't do anything else.
13609
13610 This is useful when @command{gcc} prints the error message
13611 @samp{installation problem, cannot exec cpp0: No such file or directory}.
13612 To resolve this you either need to put @file{cpp0} and the other compiler
13613 components where @command{gcc} expects to find them, or you can set the environment
13614 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
13615 Don't forget the trailing @samp{/}.
13616 @xref{Environment Variables}.
13617
13618 @item -print-sysroot
13619 @opindex print-sysroot
13620 Print the target sysroot directory that is used during
13621 compilation. This is the target sysroot specified either at configure
13622 time or using the @option{--sysroot} option, possibly with an extra
13623 suffix that depends on compilation options. If no target sysroot is
13624 specified, the option prints nothing.
13625
13626 @item -print-sysroot-headers-suffix
13627 @opindex print-sysroot-headers-suffix
13628 Print the suffix added to the target sysroot when searching for
13629 headers, or give an error if the compiler is not configured with such
13630 a suffix---and don't do anything else.
13631
13632 @item -dumpmachine
13633 @opindex dumpmachine
13634 Print the compiler's target machine (for example,
13635 @samp{i686-pc-linux-gnu})---and don't do anything else.
13636
13637 @item -dumpversion
13638 @opindex dumpversion
13639 Print the compiler version (for example, @code{3.0})---and don't do
13640 anything else.
13641
13642 @item -dumpspecs
13643 @opindex dumpspecs
13644 Print the compiler's built-in specs---and don't do anything else. (This
13645 is used when GCC itself is being built.) @xref{Spec Files}.
13646 @end table
13647
13648 @node Submodel Options
13649 @section Machine-Dependent Options
13650 @cindex submodel options
13651 @cindex specifying hardware config
13652 @cindex hardware models and configurations, specifying
13653 @cindex target-dependent options
13654 @cindex machine-dependent options
13655
13656 Each target machine supported by GCC can have its own options---for
13657 example, to allow you to compile for a particular processor variant or
13658 ABI, or to control optimizations specific to that machine. By
13659 convention, the names of machine-specific options start with
13660 @samp{-m}.
13661
13662 Some configurations of the compiler also support additional target-specific
13663 options, usually for compatibility with other compilers on the same
13664 platform.
13665
13666 @c This list is ordered alphanumerically by subsection name.
13667 @c It should be the same order and spelling as these options are listed
13668 @c in Machine Dependent Options
13669
13670 @menu
13671 * AArch64 Options::
13672 * Adapteva Epiphany Options::
13673 * ARC Options::
13674 * ARM Options::
13675 * AVR Options::
13676 * Blackfin Options::
13677 * C6X Options::
13678 * CRIS Options::
13679 * CR16 Options::
13680 * Darwin Options::
13681 * DEC Alpha Options::
13682 * FR30 Options::
13683 * FT32 Options::
13684 * FRV Options::
13685 * GNU/Linux Options::
13686 * H8/300 Options::
13687 * HPPA Options::
13688 * IA-64 Options::
13689 * LM32 Options::
13690 * M32C Options::
13691 * M32R/D Options::
13692 * M680x0 Options::
13693 * MCore Options::
13694 * MeP Options::
13695 * MicroBlaze Options::
13696 * MIPS Options::
13697 * MMIX Options::
13698 * MN10300 Options::
13699 * Moxie Options::
13700 * MSP430 Options::
13701 * NDS32 Options::
13702 * Nios II Options::
13703 * Nvidia PTX Options::
13704 * PDP-11 Options::
13705 * picoChip Options::
13706 * PowerPC Options::
13707 * RL78 Options::
13708 * RS/6000 and PowerPC Options::
13709 * RX Options::
13710 * S/390 and zSeries Options::
13711 * Score Options::
13712 * SH Options::
13713 * Solaris 2 Options::
13714 * SPARC Options::
13715 * SPU Options::
13716 * System V Options::
13717 * TILE-Gx Options::
13718 * TILEPro Options::
13719 * V850 Options::
13720 * VAX Options::
13721 * Visium Options::
13722 * VMS Options::
13723 * VxWorks Options::
13724 * x86 Options::
13725 * x86 Windows Options::
13726 * Xstormy16 Options::
13727 * Xtensa Options::
13728 * zSeries Options::
13729 @end menu
13730
13731 @node AArch64 Options
13732 @subsection AArch64 Options
13733 @cindex AArch64 Options
13734
13735 These options are defined for AArch64 implementations:
13736
13737 @table @gcctabopt
13738
13739 @item -mabi=@var{name}
13740 @opindex mabi
13741 Generate code for the specified data model. Permissible values
13742 are @samp{ilp32} for SysV-like data model where int, long int and pointers
13743 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
13744 but long int and pointers are 64 bits.
13745
13746 The default depends on the specific target configuration. Note that
13747 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
13748 entire program with the same ABI, and link with a compatible set of libraries.
13749
13750 @item -mbig-endian
13751 @opindex mbig-endian
13752 Generate big-endian code. This is the default when GCC is configured for an
13753 @samp{aarch64_be-*-*} target.
13754
13755 @item -mgeneral-regs-only
13756 @opindex mgeneral-regs-only
13757 Generate code which uses only the general-purpose registers. This will prevent
13758 the compiler from using floating-point and Advanced SIMD registers but will not
13759 impose any restrictions on the assembler.
13760
13761 @item -mlittle-endian
13762 @opindex mlittle-endian
13763 Generate little-endian code. This is the default when GCC is configured for an
13764 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
13765
13766 @item -mcmodel=tiny
13767 @opindex mcmodel=tiny
13768 Generate code for the tiny code model. The program and its statically defined
13769 symbols must be within 1MB of each other. Programs can be statically or
13770 dynamically linked.
13771
13772 @item -mcmodel=small
13773 @opindex mcmodel=small
13774 Generate code for the small code model. The program and its statically defined
13775 symbols must be within 4GB of each other. Programs can be statically or
13776 dynamically linked. This is the default code model.
13777
13778 @item -mcmodel=large
13779 @opindex mcmodel=large
13780 Generate code for the large code model. This makes no assumptions about
13781 addresses and sizes of sections. Programs can be statically linked only.
13782
13783 @item -mstrict-align
13784 @opindex mstrict-align
13785 Avoid generating memory accesses that may not be aligned on a natural object
13786 boundary as described in the architecture specification.
13787
13788 @item -momit-leaf-frame-pointer
13789 @itemx -mno-omit-leaf-frame-pointer
13790 @opindex momit-leaf-frame-pointer
13791 @opindex mno-omit-leaf-frame-pointer
13792 Omit or keep the frame pointer in leaf functions. The former behavior is the
13793 default.
13794
13795 @item -mtls-dialect=desc
13796 @opindex mtls-dialect=desc
13797 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
13798 of TLS variables. This is the default.
13799
13800 @item -mtls-dialect=traditional
13801 @opindex mtls-dialect=traditional
13802 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
13803 of TLS variables.
13804
13805 @item -mtls-size=@var{size}
13806 @opindex mtls-size
13807 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
13808 This option requires binutils 2.26 or newer.
13809
13810 @item -mfix-cortex-a53-835769
13811 @itemx -mno-fix-cortex-a53-835769
13812 @opindex mfix-cortex-a53-835769
13813 @opindex mno-fix-cortex-a53-835769
13814 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
13815 This involves inserting a NOP instruction between memory instructions and
13816 64-bit integer multiply-accumulate instructions.
13817
13818 @item -mfix-cortex-a53-843419
13819 @itemx -mno-fix-cortex-a53-843419
13820 @opindex mfix-cortex-a53-843419
13821 @opindex mno-fix-cortex-a53-843419
13822 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
13823 This erratum workaround is made at link time and this will only pass the
13824 corresponding flag to the linker.
13825
13826 @item -mlow-precision-recip-sqrt
13827 @item -mno-low-precision-recip-sqrt
13828 @opindex mlow-precision-recip-sqrt
13829 @opindex mno-low-precision-recip-sqrt
13830 Enable or disable the reciprocal square root approximation.
13831 This option only has an effect if @option{-ffast-math} or
13832 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13833 precision of reciprocal square root results to about 16 bits for
13834 single precision and to 32 bits for double precision.
13835
13836 @item -mlow-precision-sqrt
13837 @item -mno-low-precision-sqrt
13838 @opindex -mlow-precision-sqrt
13839 @opindex -mno-low-precision-sqrt
13840 Enable or disable the square root approximation.
13841 This option only has an effect if @option{-ffast-math} or
13842 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13843 precision of square root results to about 16 bits for
13844 single precision and to 32 bits for double precision.
13845 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
13846
13847 @item -mlow-precision-div
13848 @item -mno-low-precision-div
13849 @opindex -mlow-precision-div
13850 @opindex -mno-low-precision-div
13851 Enable or disable the division approximation.
13852 This option only has an effect if @option{-ffast-math} or
13853 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13854 precision of division results to about 16 bits for
13855 single precision and to 32 bits for double precision.
13856
13857 @item -march=@var{name}
13858 @opindex march
13859 Specify the name of the target architecture and, optionally, one or
13860 more feature modifiers. This option has the form
13861 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
13862
13863 The permissible values for @var{arch} are @samp{armv8-a},
13864 @samp{armv8.1-a}, @samp{armv8.2-a} or @var{native}.
13865
13866 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
13867 support for the ARMv8.2-A architecture extensions.
13868
13869 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
13870 support for the ARMv8.1-A architecture extension. In particular, it
13871 enables the @samp{+crc} and @samp{+lse} features.
13872
13873 The value @samp{native} is available on native AArch64 GNU/Linux and
13874 causes the compiler to pick the architecture of the host system. This
13875 option has no effect if the compiler is unable to recognize the
13876 architecture of the host system,
13877
13878 The permissible values for @var{feature} are listed in the sub-section
13879 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13880 Feature Modifiers}. Where conflicting feature modifiers are
13881 specified, the right-most feature is used.
13882
13883 GCC uses @var{name} to determine what kind of instructions it can emit
13884 when generating assembly code. If @option{-march} is specified
13885 without either of @option{-mtune} or @option{-mcpu} also being
13886 specified, the code is tuned to perform well across a range of target
13887 processors implementing the target architecture.
13888
13889 @item -mtune=@var{name}
13890 @opindex mtune
13891 Specify the name of the target processor for which GCC should tune the
13892 performance of the code. Permissible values for this option are:
13893 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
13894 @samp{cortex-a72}, @samp{cortex-a73}, @samp{exynos-m1}, @samp{falkor},
13895 @samp{qdf24xx}, @samp{thunderx}, @samp{xgene1}, @samp{vulcan},
13896 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
13897 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}, @samp{native}.
13898
13899 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
13900 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}
13901 specify that GCC should tune for a big.LITTLE system.
13902
13903 Additionally on native AArch64 GNU/Linux systems the value
13904 @samp{native} tunes performance to the host system. This option has no effect
13905 if the compiler is unable to recognize the processor of the host system.
13906
13907 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
13908 are specified, the code is tuned to perform well across a range
13909 of target processors.
13910
13911 This option cannot be suffixed by feature modifiers.
13912
13913 @item -mcpu=@var{name}
13914 @opindex mcpu
13915 Specify the name of the target processor, optionally suffixed by one
13916 or more feature modifiers. This option has the form
13917 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
13918 the permissible values for @var{cpu} are the same as those available
13919 for @option{-mtune}. The permissible values for @var{feature} are
13920 documented in the sub-section on
13921 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13922 Feature Modifiers}. Where conflicting feature modifiers are
13923 specified, the right-most feature is used.
13924
13925 GCC uses @var{name} to determine what kind of instructions it can emit when
13926 generating assembly code (as if by @option{-march}) and to determine
13927 the target processor for which to tune for performance (as if
13928 by @option{-mtune}). Where this option is used in conjunction
13929 with @option{-march} or @option{-mtune}, those options take precedence
13930 over the appropriate part of this option.
13931
13932 @item -moverride=@var{string}
13933 @opindex moverride
13934 Override tuning decisions made by the back-end in response to a
13935 @option{-mtune=} switch. The syntax, semantics, and accepted values
13936 for @var{string} in this option are not guaranteed to be consistent
13937 across releases.
13938
13939 This option is only intended to be useful when developing GCC.
13940
13941 @item -mpc-relative-literal-loads
13942 @opindex mpc-relative-literal-loads
13943 Enable PC-relative literal loads. With this option literal pools are
13944 accessed using a single instruction and emitted after each function. This
13945 limits the maximum size of functions to 1MB. This is enabled by default for
13946 @option{-mcmodel=tiny}.
13947
13948 @end table
13949
13950 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
13951 @anchor{aarch64-feature-modifiers}
13952 @cindex @option{-march} feature modifiers
13953 @cindex @option{-mcpu} feature modifiers
13954 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
13955 the following and their inverses @option{no@var{feature}}:
13956
13957 @table @samp
13958 @item crc
13959 Enable CRC extension. This is on by default for
13960 @option{-march=armv8.1-a}.
13961 @item crypto
13962 Enable Crypto extension. This also enables Advanced SIMD and floating-point
13963 instructions.
13964 @item fp
13965 Enable floating-point instructions. This is on by default for all possible
13966 values for options @option{-march} and @option{-mcpu}.
13967 @item simd
13968 Enable Advanced SIMD instructions. This also enables floating-point
13969 instructions. This is on by default for all possible values for options
13970 @option{-march} and @option{-mcpu}.
13971 @item lse
13972 Enable Large System Extension instructions. This is on by default for
13973 @option{-march=armv8.1-a}.
13974 @item fp16
13975 Enable FP16 extension. This also enables floating-point instructions.
13976
13977 @end table
13978
13979 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
13980 Conversely, @option{nofp} implies @option{nosimd}, which implies
13981 @option{nocrypto}.
13982
13983 @node Adapteva Epiphany Options
13984 @subsection Adapteva Epiphany Options
13985
13986 These @samp{-m} options are defined for Adapteva Epiphany:
13987
13988 @table @gcctabopt
13989 @item -mhalf-reg-file
13990 @opindex mhalf-reg-file
13991 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
13992 That allows code to run on hardware variants that lack these registers.
13993
13994 @item -mprefer-short-insn-regs
13995 @opindex mprefer-short-insn-regs
13996 Preferentially allocate registers that allow short instruction generation.
13997 This can result in increased instruction count, so this may either reduce or
13998 increase overall code size.
13999
14000 @item -mbranch-cost=@var{num}
14001 @opindex mbranch-cost
14002 Set the cost of branches to roughly @var{num} ``simple'' instructions.
14003 This cost is only a heuristic and is not guaranteed to produce
14004 consistent results across releases.
14005
14006 @item -mcmove
14007 @opindex mcmove
14008 Enable the generation of conditional moves.
14009
14010 @item -mnops=@var{num}
14011 @opindex mnops
14012 Emit @var{num} NOPs before every other generated instruction.
14013
14014 @item -mno-soft-cmpsf
14015 @opindex mno-soft-cmpsf
14016 For single-precision floating-point comparisons, emit an @code{fsub} instruction
14017 and test the flags. This is faster than a software comparison, but can
14018 get incorrect results in the presence of NaNs, or when two different small
14019 numbers are compared such that their difference is calculated as zero.
14020 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
14021 software comparisons.
14022
14023 @item -mstack-offset=@var{num}
14024 @opindex mstack-offset
14025 Set the offset between the top of the stack and the stack pointer.
14026 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
14027 can be used by leaf functions without stack allocation.
14028 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
14029 Note also that this option changes the ABI; compiling a program with a
14030 different stack offset than the libraries have been compiled with
14031 generally does not work.
14032 This option can be useful if you want to evaluate if a different stack
14033 offset would give you better code, but to actually use a different stack
14034 offset to build working programs, it is recommended to configure the
14035 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
14036
14037 @item -mno-round-nearest
14038 @opindex mno-round-nearest
14039 Make the scheduler assume that the rounding mode has been set to
14040 truncating. The default is @option{-mround-nearest}.
14041
14042 @item -mlong-calls
14043 @opindex mlong-calls
14044 If not otherwise specified by an attribute, assume all calls might be beyond
14045 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
14046 function address into a register before performing a (otherwise direct) call.
14047 This is the default.
14048
14049 @item -mshort-calls
14050 @opindex short-calls
14051 If not otherwise specified by an attribute, assume all direct calls are
14052 in the range of the @code{b} / @code{bl} instructions, so use these instructions
14053 for direct calls. The default is @option{-mlong-calls}.
14054
14055 @item -msmall16
14056 @opindex msmall16
14057 Assume addresses can be loaded as 16-bit unsigned values. This does not
14058 apply to function addresses for which @option{-mlong-calls} semantics
14059 are in effect.
14060
14061 @item -mfp-mode=@var{mode}
14062 @opindex mfp-mode
14063 Set the prevailing mode of the floating-point unit.
14064 This determines the floating-point mode that is provided and expected
14065 at function call and return time. Making this mode match the mode you
14066 predominantly need at function start can make your programs smaller and
14067 faster by avoiding unnecessary mode switches.
14068
14069 @var{mode} can be set to one the following values:
14070
14071 @table @samp
14072 @item caller
14073 Any mode at function entry is valid, and retained or restored when
14074 the function returns, and when it calls other functions.
14075 This mode is useful for compiling libraries or other compilation units
14076 you might want to incorporate into different programs with different
14077 prevailing FPU modes, and the convenience of being able to use a single
14078 object file outweighs the size and speed overhead for any extra
14079 mode switching that might be needed, compared with what would be needed
14080 with a more specific choice of prevailing FPU mode.
14081
14082 @item truncate
14083 This is the mode used for floating-point calculations with
14084 truncating (i.e.@: round towards zero) rounding mode. That includes
14085 conversion from floating point to integer.
14086
14087 @item round-nearest
14088 This is the mode used for floating-point calculations with
14089 round-to-nearest-or-even rounding mode.
14090
14091 @item int
14092 This is the mode used to perform integer calculations in the FPU, e.g.@:
14093 integer multiply, or integer multiply-and-accumulate.
14094 @end table
14095
14096 The default is @option{-mfp-mode=caller}
14097
14098 @item -mnosplit-lohi
14099 @itemx -mno-postinc
14100 @itemx -mno-postmodify
14101 @opindex mnosplit-lohi
14102 @opindex mno-postinc
14103 @opindex mno-postmodify
14104 Code generation tweaks that disable, respectively, splitting of 32-bit
14105 loads, generation of post-increment addresses, and generation of
14106 post-modify addresses. The defaults are @option{msplit-lohi},
14107 @option{-mpost-inc}, and @option{-mpost-modify}.
14108
14109 @item -mnovect-double
14110 @opindex mno-vect-double
14111 Change the preferred SIMD mode to SImode. The default is
14112 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
14113
14114 @item -max-vect-align=@var{num}
14115 @opindex max-vect-align
14116 The maximum alignment for SIMD vector mode types.
14117 @var{num} may be 4 or 8. The default is 8.
14118 Note that this is an ABI change, even though many library function
14119 interfaces are unaffected if they don't use SIMD vector modes
14120 in places that affect size and/or alignment of relevant types.
14121
14122 @item -msplit-vecmove-early
14123 @opindex msplit-vecmove-early
14124 Split vector moves into single word moves before reload. In theory this
14125 can give better register allocation, but so far the reverse seems to be
14126 generally the case.
14127
14128 @item -m1reg-@var{reg}
14129 @opindex m1reg-
14130 Specify a register to hold the constant @minus{}1, which makes loading small negative
14131 constants and certain bitmasks faster.
14132 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
14133 which specify use of that register as a fixed register,
14134 and @samp{none}, which means that no register is used for this
14135 purpose. The default is @option{-m1reg-none}.
14136
14137 @end table
14138
14139 @node ARC Options
14140 @subsection ARC Options
14141 @cindex ARC options
14142
14143 The following options control the architecture variant for which code
14144 is being compiled:
14145
14146 @c architecture variants
14147 @table @gcctabopt
14148
14149 @item -mbarrel-shifter
14150 @opindex mbarrel-shifter
14151 Generate instructions supported by barrel shifter. This is the default
14152 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
14153
14154 @item -mcpu=@var{cpu}
14155 @opindex mcpu
14156 Set architecture type, register usage, and instruction scheduling
14157 parameters for @var{cpu}. There are also shortcut alias options
14158 available for backward compatibility and convenience. Supported
14159 values for @var{cpu} are
14160
14161 @table @samp
14162 @opindex mA6
14163 @opindex mARC600
14164 @item ARC600
14165 @item arc600
14166 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
14167
14168 @item ARC601
14169 @item arc601
14170 @opindex mARC601
14171 Compile for ARC601. Alias: @option{-mARC601}.
14172
14173 @item ARC700
14174 @item arc700
14175 @opindex mA7
14176 @opindex mARC700
14177 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
14178 This is the default when configured with @option{--with-cpu=arc700}@.
14179
14180 @item ARCEM
14181 @item arcem
14182 Compile for ARC EM.
14183
14184 @item ARCHS
14185 @item archs
14186 Compile for ARC HS.
14187 @end table
14188
14189 @item -mdpfp
14190 @opindex mdpfp
14191 @itemx -mdpfp-compact
14192 @opindex mdpfp-compact
14193 FPX: Generate Double Precision FPX instructions, tuned for the compact
14194 implementation.
14195
14196 @item -mdpfp-fast
14197 @opindex mdpfp-fast
14198 FPX: Generate Double Precision FPX instructions, tuned for the fast
14199 implementation.
14200
14201 @item -mno-dpfp-lrsr
14202 @opindex mno-dpfp-lrsr
14203 Disable LR and SR instructions from using FPX extension aux registers.
14204
14205 @item -mea
14206 @opindex mea
14207 Generate Extended arithmetic instructions. Currently only
14208 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
14209 supported. This is always enabled for @option{-mcpu=ARC700}.
14210
14211 @item -mno-mpy
14212 @opindex mno-mpy
14213 Do not generate mpy instructions for ARC700.
14214
14215 @item -mmul32x16
14216 @opindex mmul32x16
14217 Generate 32x16 bit multiply and mac instructions.
14218
14219 @item -mmul64
14220 @opindex mmul64
14221 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
14222
14223 @item -mnorm
14224 @opindex mnorm
14225 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
14226 is in effect.
14227
14228 @item -mspfp
14229 @opindex mspfp
14230 @itemx -mspfp-compact
14231 @opindex mspfp-compact
14232 FPX: Generate Single Precision FPX instructions, tuned for the compact
14233 implementation.
14234
14235 @item -mspfp-fast
14236 @opindex mspfp-fast
14237 FPX: Generate Single Precision FPX instructions, tuned for the fast
14238 implementation.
14239
14240 @item -msimd
14241 @opindex msimd
14242 Enable generation of ARC SIMD instructions via target-specific
14243 builtins. Only valid for @option{-mcpu=ARC700}.
14244
14245 @item -msoft-float
14246 @opindex msoft-float
14247 This option ignored; it is provided for compatibility purposes only.
14248 Software floating point code is emitted by default, and this default
14249 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
14250 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
14251 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
14252
14253 @item -mswap
14254 @opindex mswap
14255 Generate swap instructions.
14256
14257 @item -matomic
14258 @opindex matomic
14259 This enables Locked Load/Store Conditional extension to implement
14260 atomic memopry built-in functions. Not available for ARC 6xx or ARC
14261 EM cores.
14262
14263 @item -mdiv-rem
14264 @opindex mdiv-rem
14265 Enable DIV/REM instructions for ARCv2 cores.
14266
14267 @item -mcode-density
14268 @opindex mcode-density
14269 Enable code density instructions for ARC EM, default on for ARC HS.
14270
14271 @item -mll64
14272 @opindex mll64
14273 Enable double load/store operations for ARC HS cores.
14274
14275 @item -mtp-regno=@var{regno}
14276 @opindex mtp-regno
14277 Specify thread pointer register number.
14278
14279 @item -mmpy-option=@var{multo}
14280 @opindex mmpy-option
14281 Compile ARCv2 code with a multiplier design option. @samp{wlh1} is
14282 the default value. The recognized values for @var{multo} are:
14283
14284 @table @samp
14285 @item 0
14286 No multiplier available.
14287
14288 @item 1
14289 @opindex w
14290 The multiply option is set to w: 16x16 multiplier, fully pipelined.
14291 The following instructions are enabled: MPYW, and MPYUW.
14292
14293 @item 2
14294 @opindex wlh1
14295 The multiply option is set to wlh1: 32x32 multiplier, fully
14296 pipelined (1 stage). The following instructions are additionally
14297 enabled: MPY, MPYU, MPYM, MPYMU, and MPY_S.
14298
14299 @item 3
14300 @opindex wlh2
14301 The multiply option is set to wlh2: 32x32 multiplier, fully pipelined
14302 (2 stages). The following instructions are additionally enabled: MPY,
14303 MPYU, MPYM, MPYMU, and MPY_S.
14304
14305 @item 4
14306 @opindex wlh3
14307 The multiply option is set to wlh3: Two 16x16 multiplier, blocking,
14308 sequential. The following instructions are additionally enabled: MPY,
14309 MPYU, MPYM, MPYMU, and MPY_S.
14310
14311 @item 5
14312 @opindex wlh4
14313 The multiply option is set to wlh4: One 16x16 multiplier, blocking,
14314 sequential. The following instructions are additionally enabled: MPY,
14315 MPYU, MPYM, MPYMU, and MPY_S.
14316
14317 @item 6
14318 @opindex wlh5
14319 The multiply option is set to wlh5: One 32x4 multiplier, blocking,
14320 sequential. The following instructions are additionally enabled: MPY,
14321 MPYU, MPYM, MPYMU, and MPY_S.
14322
14323 @end table
14324
14325 This option is only available for ARCv2 cores@.
14326
14327 @item -mfpu=@var{fpu}
14328 @opindex mfpu
14329 Enables specific floating-point hardware extension for ARCv2
14330 core. Supported values for @var{fpu} are:
14331
14332 @table @samp
14333
14334 @item fpus
14335 @opindex fpus
14336 Enables support for single precision floating point hardware
14337 extensions@.
14338
14339 @item fpud
14340 @opindex fpud
14341 Enables support for double precision floating point hardware
14342 extensions. The single precision floating point extension is also
14343 enabled. Not available for ARC EM@.
14344
14345 @item fpuda
14346 @opindex fpuda
14347 Enables support for double precision floating point hardware
14348 extensions using double precision assist instructions. The single
14349 precision floating point extension is also enabled. This option is
14350 only available for ARC EM@.
14351
14352 @item fpuda_div
14353 @opindex fpuda_div
14354 Enables support for double precision floating point hardware
14355 extensions using double precision assist instructions, and simple
14356 precision square-root and divide hardware extensions. The single
14357 precision floating point extension is also enabled. This option is
14358 only available for ARC EM@.
14359
14360 @item fpuda_fma
14361 @opindex fpuda_fma
14362 Enables support for double precision floating point hardware
14363 extensions using double precision assist instructions, and simple
14364 precision fused multiple and add hardware extension. The single
14365 precision floating point extension is also enabled. This option is
14366 only available for ARC EM@.
14367
14368 @item fpuda_all
14369 @opindex fpuda_all
14370 Enables support for double precision floating point hardware
14371 extensions using double precision assist instructions, and all simple
14372 precision hardware extensions. The single precision floating point
14373 extension is also enabled. This option is only available for ARC EM@.
14374
14375 @item fpus_div
14376 @opindex fpus_div
14377 Enables support for single precision floating point, and single
14378 precision square-root and divide hardware extensions@.
14379
14380 @item fpud_div
14381 @opindex fpud_div
14382 Enables support for double precision floating point, and double
14383 precision square-root and divide hardware extensions. This option
14384 includes option @samp{fpus_div}. Not available for ARC EM@.
14385
14386 @item fpus_fma
14387 @opindex fpus_fma
14388 Enables support for single precision floating point, and single
14389 precision fused multiple and add hardware extensions@.
14390
14391 @item fpud_fma
14392 @opindex fpud_fma
14393 Enables support for double precision floating point, and double
14394 precision fused multiple and add hardware extensions. This option
14395 includes option @samp{fpus_fma}. Not available for ARC EM@.
14396
14397 @item fpus_all
14398 @opindex fpus_all
14399 Enables support for all single precision floating point hardware
14400 extensions@.
14401
14402 @item fpud_all
14403 @opindex fpud_all
14404 Enables support for all single and double precision floating point
14405 hardware extensions. Not available for ARC EM@.
14406
14407 @end table
14408
14409 @end table
14410
14411 The following options are passed through to the assembler, and also
14412 define preprocessor macro symbols.
14413
14414 @c Flags used by the assembler, but for which we define preprocessor
14415 @c macro symbols as well.
14416 @table @gcctabopt
14417 @item -mdsp-packa
14418 @opindex mdsp-packa
14419 Passed down to the assembler to enable the DSP Pack A extensions.
14420 Also sets the preprocessor symbol @code{__Xdsp_packa}.
14421
14422 @item -mdvbf
14423 @opindex mdvbf
14424 Passed down to the assembler to enable the dual viterbi butterfly
14425 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
14426
14427 @c ARC700 4.10 extension instruction
14428 @item -mlock
14429 @opindex mlock
14430 Passed down to the assembler to enable the Locked Load/Store
14431 Conditional extension. Also sets the preprocessor symbol
14432 @code{__Xlock}.
14433
14434 @item -mmac-d16
14435 @opindex mmac-d16
14436 Passed down to the assembler. Also sets the preprocessor symbol
14437 @code{__Xxmac_d16}.
14438
14439 @item -mmac-24
14440 @opindex mmac-24
14441 Passed down to the assembler. Also sets the preprocessor symbol
14442 @code{__Xxmac_24}.
14443
14444 @c ARC700 4.10 extension instruction
14445 @item -mrtsc
14446 @opindex mrtsc
14447 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
14448 extension instruction. Also sets the preprocessor symbol
14449 @code{__Xrtsc}.
14450
14451 @c ARC700 4.10 extension instruction
14452 @item -mswape
14453 @opindex mswape
14454 Passed down to the assembler to enable the swap byte ordering
14455 extension instruction. Also sets the preprocessor symbol
14456 @code{__Xswape}.
14457
14458 @item -mtelephony
14459 @opindex mtelephony
14460 Passed down to the assembler to enable dual and single operand
14461 instructions for telephony. Also sets the preprocessor symbol
14462 @code{__Xtelephony}.
14463
14464 @item -mxy
14465 @opindex mxy
14466 Passed down to the assembler to enable the XY Memory extension. Also
14467 sets the preprocessor symbol @code{__Xxy}.
14468
14469 @end table
14470
14471 The following options control how the assembly code is annotated:
14472
14473 @c Assembly annotation options
14474 @table @gcctabopt
14475 @item -misize
14476 @opindex misize
14477 Annotate assembler instructions with estimated addresses.
14478
14479 @item -mannotate-align
14480 @opindex mannotate-align
14481 Explain what alignment considerations lead to the decision to make an
14482 instruction short or long.
14483
14484 @end table
14485
14486 The following options are passed through to the linker:
14487
14488 @c options passed through to the linker
14489 @table @gcctabopt
14490 @item -marclinux
14491 @opindex marclinux
14492 Passed through to the linker, to specify use of the @code{arclinux} emulation.
14493 This option is enabled by default in tool chains built for
14494 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
14495 when profiling is not requested.
14496
14497 @item -marclinux_prof
14498 @opindex marclinux_prof
14499 Passed through to the linker, to specify use of the
14500 @code{arclinux_prof} emulation. This option is enabled by default in
14501 tool chains built for @w{@code{arc-linux-uclibc}} and
14502 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
14503
14504 @end table
14505
14506 The following options control the semantics of generated code:
14507
14508 @c semantically relevant code generation options
14509 @table @gcctabopt
14510 @item -mlong-calls
14511 @opindex mlong-calls
14512 Generate call insns as register indirect calls, thus providing access
14513 to the full 32-bit address range.
14514
14515 @item -mmedium-calls
14516 @opindex mmedium-calls
14517 Don't use less than 25 bit addressing range for calls, which is the
14518 offset available for an unconditional branch-and-link
14519 instruction. Conditional execution of function calls is suppressed, to
14520 allow use of the 25-bit range, rather than the 21-bit range with
14521 conditional branch-and-link. This is the default for tool chains built
14522 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
14523
14524 @item -mno-sdata
14525 @opindex mno-sdata
14526 Do not generate sdata references. This is the default for tool chains
14527 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
14528 targets.
14529
14530 @item -mucb-mcount
14531 @opindex mucb-mcount
14532 Instrument with mcount calls as used in UCB code. I.e. do the
14533 counting in the callee, not the caller. By default ARC instrumentation
14534 counts in the caller.
14535
14536 @item -mvolatile-cache
14537 @opindex mvolatile-cache
14538 Use ordinarily cached memory accesses for volatile references. This is the
14539 default.
14540
14541 @item -mno-volatile-cache
14542 @opindex mno-volatile-cache
14543 Enable cache bypass for volatile references.
14544
14545 @end table
14546
14547 The following options fine tune code generation:
14548 @c code generation tuning options
14549 @table @gcctabopt
14550 @item -malign-call
14551 @opindex malign-call
14552 Do alignment optimizations for call instructions.
14553
14554 @item -mauto-modify-reg
14555 @opindex mauto-modify-reg
14556 Enable the use of pre/post modify with register displacement.
14557
14558 @item -mbbit-peephole
14559 @opindex mbbit-peephole
14560 Enable bbit peephole2.
14561
14562 @item -mno-brcc
14563 @opindex mno-brcc
14564 This option disables a target-specific pass in @file{arc_reorg} to
14565 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
14566 generation driven by the combiner pass.
14567
14568 @item -mcase-vector-pcrel
14569 @opindex mcase-vector-pcrel
14570 Use pc-relative switch case tables - this enables case table shortening.
14571 This is the default for @option{-Os}.
14572
14573 @item -mcompact-casesi
14574 @opindex mcompact-casesi
14575 Enable compact casesi pattern. This is the default for @option{-Os},
14576 and only available for ARCv1 cores.
14577
14578 @item -mno-cond-exec
14579 @opindex mno-cond-exec
14580 Disable ARCompact specific pass to generate conditional execution instructions.
14581 Due to delay slot scheduling and interactions between operand numbers,
14582 literal sizes, instruction lengths, and the support for conditional execution,
14583 the target-independent pass to generate conditional execution is often lacking,
14584 so the ARC port has kept a special pass around that tries to find more
14585 conditional execution generating opportunities after register allocation,
14586 branch shortening, and delay slot scheduling have been done. This pass
14587 generally, but not always, improves performance and code size, at the cost of
14588 extra compilation time, which is why there is an option to switch it off.
14589 If you have a problem with call instructions exceeding their allowable
14590 offset range because they are conditionalized, you should consider using
14591 @option{-mmedium-calls} instead.
14592
14593 @item -mearly-cbranchsi
14594 @opindex mearly-cbranchsi
14595 Enable pre-reload use of the cbranchsi pattern.
14596
14597 @item -mexpand-adddi
14598 @opindex mexpand-adddi
14599 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
14600 @code{add.f}, @code{adc} etc.
14601
14602 @item -mindexed-loads
14603 @opindex mindexed-loads
14604 Enable the use of indexed loads. This can be problematic because some
14605 optimizers then assume that indexed stores exist, which is not
14606 the case.
14607
14608 @opindex mlra
14609 Enable Local Register Allocation. This is still experimental for ARC,
14610 so by default the compiler uses standard reload
14611 (i.e. @option{-mno-lra}).
14612
14613 @item -mlra-priority-none
14614 @opindex mlra-priority-none
14615 Don't indicate any priority for target registers.
14616
14617 @item -mlra-priority-compact
14618 @opindex mlra-priority-compact
14619 Indicate target register priority for r0..r3 / r12..r15.
14620
14621 @item -mlra-priority-noncompact
14622 @opindex mlra-priority-noncompact
14623 Reduce target register priority for r0..r3 / r12..r15.
14624
14625 @item -mno-millicode
14626 @opindex mno-millicode
14627 When optimizing for size (using @option{-Os}), prologues and epilogues
14628 that have to save or restore a large number of registers are often
14629 shortened by using call to a special function in libgcc; this is
14630 referred to as a @emph{millicode} call. As these calls can pose
14631 performance issues, and/or cause linking issues when linking in a
14632 nonstandard way, this option is provided to turn off millicode call
14633 generation.
14634
14635 @item -mmixed-code
14636 @opindex mmixed-code
14637 Tweak register allocation to help 16-bit instruction generation.
14638 This generally has the effect of decreasing the average instruction size
14639 while increasing the instruction count.
14640
14641 @item -mq-class
14642 @opindex mq-class
14643 Enable 'q' instruction alternatives.
14644 This is the default for @option{-Os}.
14645
14646 @item -mRcq
14647 @opindex mRcq
14648 Enable Rcq constraint handling - most short code generation depends on this.
14649 This is the default.
14650
14651 @item -mRcw
14652 @opindex mRcw
14653 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
14654 This is the default.
14655
14656 @item -msize-level=@var{level}
14657 @opindex msize-level
14658 Fine-tune size optimization with regards to instruction lengths and alignment.
14659 The recognized values for @var{level} are:
14660 @table @samp
14661 @item 0
14662 No size optimization. This level is deprecated and treated like @samp{1}.
14663
14664 @item 1
14665 Short instructions are used opportunistically.
14666
14667 @item 2
14668 In addition, alignment of loops and of code after barriers are dropped.
14669
14670 @item 3
14671 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
14672
14673 @end table
14674
14675 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
14676 the behavior when this is not set is equivalent to level @samp{1}.
14677
14678 @item -mtune=@var{cpu}
14679 @opindex mtune
14680 Set instruction scheduling parameters for @var{cpu}, overriding any implied
14681 by @option{-mcpu=}.
14682
14683 Supported values for @var{cpu} are
14684
14685 @table @samp
14686 @item ARC600
14687 Tune for ARC600 cpu.
14688
14689 @item ARC601
14690 Tune for ARC601 cpu.
14691
14692 @item ARC700
14693 Tune for ARC700 cpu with standard multiplier block.
14694
14695 @item ARC700-xmac
14696 Tune for ARC700 cpu with XMAC block.
14697
14698 @item ARC725D
14699 Tune for ARC725D cpu.
14700
14701 @item ARC750D
14702 Tune for ARC750D cpu.
14703
14704 @end table
14705
14706 @item -mmultcost=@var{num}
14707 @opindex mmultcost
14708 Cost to assume for a multiply instruction, with @samp{4} being equal to a
14709 normal instruction.
14710
14711 @item -munalign-prob-threshold=@var{probability}
14712 @opindex munalign-prob-threshold
14713 Set probability threshold for unaligning branches.
14714 When tuning for @samp{ARC700} and optimizing for speed, branches without
14715 filled delay slot are preferably emitted unaligned and long, unless
14716 profiling indicates that the probability for the branch to be taken
14717 is below @var{probability}. @xref{Cross-profiling}.
14718 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
14719
14720 @end table
14721
14722 The following options are maintained for backward compatibility, but
14723 are now deprecated and will be removed in a future release:
14724
14725 @c Deprecated options
14726 @table @gcctabopt
14727
14728 @item -margonaut
14729 @opindex margonaut
14730 Obsolete FPX.
14731
14732 @item -mbig-endian
14733 @opindex mbig-endian
14734 @itemx -EB
14735 @opindex EB
14736 Compile code for big endian targets. Use of these options is now
14737 deprecated. Users wanting big-endian code, should use the
14738 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
14739 building the tool chain, for which big-endian is the default.
14740
14741 @item -mlittle-endian
14742 @opindex mlittle-endian
14743 @itemx -EL
14744 @opindex EL
14745 Compile code for little endian targets. Use of these options is now
14746 deprecated. Users wanting little-endian code should use the
14747 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
14748 building the tool chain, for which little-endian is the default.
14749
14750 @item -mbarrel_shifter
14751 @opindex mbarrel_shifter
14752 Replaced by @option{-mbarrel-shifter}.
14753
14754 @item -mdpfp_compact
14755 @opindex mdpfp_compact
14756 Replaced by @option{-mdpfp-compact}.
14757
14758 @item -mdpfp_fast
14759 @opindex mdpfp_fast
14760 Replaced by @option{-mdpfp-fast}.
14761
14762 @item -mdsp_packa
14763 @opindex mdsp_packa
14764 Replaced by @option{-mdsp-packa}.
14765
14766 @item -mEA
14767 @opindex mEA
14768 Replaced by @option{-mea}.
14769
14770 @item -mmac_24
14771 @opindex mmac_24
14772 Replaced by @option{-mmac-24}.
14773
14774 @item -mmac_d16
14775 @opindex mmac_d16
14776 Replaced by @option{-mmac-d16}.
14777
14778 @item -mspfp_compact
14779 @opindex mspfp_compact
14780 Replaced by @option{-mspfp-compact}.
14781
14782 @item -mspfp_fast
14783 @opindex mspfp_fast
14784 Replaced by @option{-mspfp-fast}.
14785
14786 @item -mtune=@var{cpu}
14787 @opindex mtune
14788 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
14789 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
14790 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
14791
14792 @item -multcost=@var{num}
14793 @opindex multcost
14794 Replaced by @option{-mmultcost}.
14795
14796 @end table
14797
14798 @node ARM Options
14799 @subsection ARM Options
14800 @cindex ARM options
14801
14802 These @samp{-m} options are defined for the ARM port:
14803
14804 @table @gcctabopt
14805 @item -mabi=@var{name}
14806 @opindex mabi
14807 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
14808 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
14809
14810 @item -mapcs-frame
14811 @opindex mapcs-frame
14812 Generate a stack frame that is compliant with the ARM Procedure Call
14813 Standard for all functions, even if this is not strictly necessary for
14814 correct execution of the code. Specifying @option{-fomit-frame-pointer}
14815 with this option causes the stack frames not to be generated for
14816 leaf functions. The default is @option{-mno-apcs-frame}.
14817 This option is deprecated.
14818
14819 @item -mapcs
14820 @opindex mapcs
14821 This is a synonym for @option{-mapcs-frame} and is deprecated.
14822
14823 @ignore
14824 @c not currently implemented
14825 @item -mapcs-stack-check
14826 @opindex mapcs-stack-check
14827 Generate code to check the amount of stack space available upon entry to
14828 every function (that actually uses some stack space). If there is
14829 insufficient space available then either the function
14830 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
14831 called, depending upon the amount of stack space required. The runtime
14832 system is required to provide these functions. The default is
14833 @option{-mno-apcs-stack-check}, since this produces smaller code.
14834
14835 @c not currently implemented
14836 @item -mapcs-float
14837 @opindex mapcs-float
14838 Pass floating-point arguments using the floating-point registers. This is
14839 one of the variants of the APCS@. This option is recommended if the
14840 target hardware has a floating-point unit or if a lot of floating-point
14841 arithmetic is going to be performed by the code. The default is
14842 @option{-mno-apcs-float}, since the size of integer-only code is
14843 slightly increased if @option{-mapcs-float} is used.
14844
14845 @c not currently implemented
14846 @item -mapcs-reentrant
14847 @opindex mapcs-reentrant
14848 Generate reentrant, position-independent code. The default is
14849 @option{-mno-apcs-reentrant}.
14850 @end ignore
14851
14852 @item -mthumb-interwork
14853 @opindex mthumb-interwork
14854 Generate code that supports calling between the ARM and Thumb
14855 instruction sets. Without this option, on pre-v5 architectures, the
14856 two instruction sets cannot be reliably used inside one program. The
14857 default is @option{-mno-thumb-interwork}, since slightly larger code
14858 is generated when @option{-mthumb-interwork} is specified. In AAPCS
14859 configurations this option is meaningless.
14860
14861 @item -mno-sched-prolog
14862 @opindex mno-sched-prolog
14863 Prevent the reordering of instructions in the function prologue, or the
14864 merging of those instruction with the instructions in the function's
14865 body. This means that all functions start with a recognizable set
14866 of instructions (or in fact one of a choice from a small set of
14867 different function prologues), and this information can be used to
14868 locate the start of functions inside an executable piece of code. The
14869 default is @option{-msched-prolog}.
14870
14871 @item -mfloat-abi=@var{name}
14872 @opindex mfloat-abi
14873 Specifies which floating-point ABI to use. Permissible values
14874 are: @samp{soft}, @samp{softfp} and @samp{hard}.
14875
14876 Specifying @samp{soft} causes GCC to generate output containing
14877 library calls for floating-point operations.
14878 @samp{softfp} allows the generation of code using hardware floating-point
14879 instructions, but still uses the soft-float calling conventions.
14880 @samp{hard} allows generation of floating-point instructions
14881 and uses FPU-specific calling conventions.
14882
14883 The default depends on the specific target configuration. Note that
14884 the hard-float and soft-float ABIs are not link-compatible; you must
14885 compile your entire program with the same ABI, and link with a
14886 compatible set of libraries.
14887
14888 @item -mlittle-endian
14889 @opindex mlittle-endian
14890 Generate code for a processor running in little-endian mode. This is
14891 the default for all standard configurations.
14892
14893 @item -mbig-endian
14894 @opindex mbig-endian
14895 Generate code for a processor running in big-endian mode; the default is
14896 to compile code for a little-endian processor.
14897
14898 @item -march=@var{name}
14899 @opindex march
14900 This specifies the name of the target ARM architecture. GCC uses this
14901 name to determine what kind of instructions it can emit when generating
14902 assembly code. This option can be used in conjunction with or instead
14903 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
14904 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
14905 @samp{armv5}, @samp{armv5e}, @samp{armv5t}, @samp{armv5te},
14906 @samp{armv6}, @samp{armv6-m}, @samp{armv6j}, @samp{armv6k},
14907 @samp{armv6kz}, @samp{armv6s-m},
14908 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk},
14909 @samp{armv7}, @samp{armv7-a}, @samp{armv7-m}, @samp{armv7-r}, @samp{armv7e-m},
14910 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
14911 @samp{armv8.1-a+crc}, @samp{armv8-m.base}, @samp{armv8-m.main},
14912 @samp{armv8-m.main+dsp}, @samp{iwmmxt}, @samp{iwmmxt2}.
14913
14914 Architecture revisions older than @samp{armv4t} are deprecated.
14915
14916 @option{-march=armv6s-m} is the @samp{armv6-m} architecture with support for
14917 the (now mandatory) SVC instruction.
14918
14919 @option{-march=armv6zk} is an alias for @samp{armv6kz}, existing for backwards
14920 compatibility.
14921
14922 @option{-march=armv7ve} is the @samp{armv7-a} architecture with virtualization
14923 extensions.
14924
14925 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
14926 architecture together with the optional CRC32 extensions.
14927
14928 @option{-march=armv8.1-a} enables compiler support for the ARMv8.1-A
14929 architecture. This also enables the features provided by
14930 @option{-march=armv8-a+crc}.
14931
14932 @option{-march=armv8.2-a} enables compiler support for the ARMv8.2-A
14933 architecture. This also enables the features provided by
14934 @option{-march=armv8.1-a}.
14935
14936 @option{-march=armv8.2-a+fp16} enables compiler support for the
14937 ARMv8.2-A architecture with the optional FP16 instructions extension.
14938 This also enables the features provided by @option{-march=armv8.1-a}
14939 and implies @option{-mfp16-format=ieee}.
14940
14941 @option{-march=native} causes the compiler to auto-detect the architecture
14942 of the build computer. At present, this feature is only supported on
14943 GNU/Linux, and not all architectures are recognized. If the auto-detect
14944 is unsuccessful the option has no effect.
14945
14946 @item -mtune=@var{name}
14947 @opindex mtune
14948 This option specifies the name of the target ARM processor for
14949 which GCC should tune the performance of the code.
14950 For some ARM implementations better performance can be obtained by using
14951 this option.
14952 Permissible names are: @samp{arm2}, @samp{arm250},
14953 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
14954 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
14955 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
14956 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
14957 @samp{arm720},
14958 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
14959 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
14960 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
14961 @samp{strongarm1110},
14962 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
14963 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
14964 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
14965 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
14966 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
14967 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
14968 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
14969 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
14970 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
14971 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
14972 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-r4},
14973 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
14974 @samp{cortex-m33},
14975 @samp{cortex-m23},
14976 @samp{cortex-m7},
14977 @samp{cortex-m4},
14978 @samp{cortex-m3},
14979 @samp{cortex-m1},
14980 @samp{cortex-m0},
14981 @samp{cortex-m0plus},
14982 @samp{cortex-m1.small-multiply},
14983 @samp{cortex-m0.small-multiply},
14984 @samp{cortex-m0plus.small-multiply},
14985 @samp{exynos-m1},
14986 @samp{falkor},
14987 @samp{qdf24xx},
14988 @samp{marvell-pj4},
14989 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
14990 @samp{fa526}, @samp{fa626},
14991 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
14992 @samp{xgene1}.
14993
14994 Additionally, this option can specify that GCC should tune the performance
14995 of the code for a big.LITTLE system. Permissible names are:
14996 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
14997 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14998 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}.
14999
15000 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
15001 performance for a blend of processors within architecture @var{arch}.
15002 The aim is to generate code that run well on the current most popular
15003 processors, balancing between optimizations that benefit some CPUs in the
15004 range, and avoiding performance pitfalls of other CPUs. The effects of
15005 this option may change in future GCC versions as CPU models come and go.
15006
15007 @option{-mtune=native} causes the compiler to auto-detect the CPU
15008 of the build computer. At present, this feature is only supported on
15009 GNU/Linux, and not all architectures are recognized. If the auto-detect is
15010 unsuccessful the option has no effect.
15011
15012 @item -mcpu=@var{name}
15013 @opindex mcpu
15014 This specifies the name of the target ARM processor. GCC uses this name
15015 to derive the name of the target ARM architecture (as if specified
15016 by @option{-march}) and the ARM processor type for which to tune for
15017 performance (as if specified by @option{-mtune}). Where this option
15018 is used in conjunction with @option{-march} or @option{-mtune},
15019 those options take precedence over the appropriate part of this option.
15020
15021 Permissible names for this option are the same as those for
15022 @option{-mtune}.
15023
15024 @option{-mcpu=generic-@var{arch}} is also permissible, and is
15025 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
15026 See @option{-mtune} for more information.
15027
15028 @option{-mcpu=native} causes the compiler to auto-detect the CPU
15029 of the build computer. At present, this feature is only supported on
15030 GNU/Linux, and not all architectures are recognized. If the auto-detect
15031 is unsuccessful the option has no effect.
15032
15033 @item -mfpu=@var{name}
15034 @opindex mfpu
15035 This specifies what floating-point hardware (or hardware emulation) is
15036 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
15037 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
15038 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
15039 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
15040 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
15041 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
15042
15043 If @option{-msoft-float} is specified this specifies the format of
15044 floating-point values.
15045
15046 If the selected floating-point hardware includes the NEON extension
15047 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
15048 operations are not generated by GCC's auto-vectorization pass unless
15049 @option{-funsafe-math-optimizations} is also specified. This is
15050 because NEON hardware does not fully implement the IEEE 754 standard for
15051 floating-point arithmetic (in particular denormal values are treated as
15052 zero), so the use of NEON instructions may lead to a loss of precision.
15053
15054 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}).
15055
15056 @item -mfp16-format=@var{name}
15057 @opindex mfp16-format
15058 Specify the format of the @code{__fp16} half-precision floating-point type.
15059 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
15060 the default is @samp{none}, in which case the @code{__fp16} type is not
15061 defined. @xref{Half-Precision}, for more information.
15062
15063 @item -mstructure-size-boundary=@var{n}
15064 @opindex mstructure-size-boundary
15065 The sizes of all structures and unions are rounded up to a multiple
15066 of the number of bits set by this option. Permissible values are 8, 32
15067 and 64. The default value varies for different toolchains. For the COFF
15068 targeted toolchain the default value is 8. A value of 64 is only allowed
15069 if the underlying ABI supports it.
15070
15071 Specifying a larger number can produce faster, more efficient code, but
15072 can also increase the size of the program. Different values are potentially
15073 incompatible. Code compiled with one value cannot necessarily expect to
15074 work with code or libraries compiled with another value, if they exchange
15075 information using structures or unions.
15076
15077 @item -mabort-on-noreturn
15078 @opindex mabort-on-noreturn
15079 Generate a call to the function @code{abort} at the end of a
15080 @code{noreturn} function. It is executed if the function tries to
15081 return.
15082
15083 @item -mlong-calls
15084 @itemx -mno-long-calls
15085 @opindex mlong-calls
15086 @opindex mno-long-calls
15087 Tells the compiler to perform function calls by first loading the
15088 address of the function into a register and then performing a subroutine
15089 call on this register. This switch is needed if the target function
15090 lies outside of the 64-megabyte addressing range of the offset-based
15091 version of subroutine call instruction.
15092
15093 Even if this switch is enabled, not all function calls are turned
15094 into long calls. The heuristic is that static functions, functions
15095 that have the @code{short_call} attribute, functions that are inside
15096 the scope of a @code{#pragma no_long_calls} directive, and functions whose
15097 definitions have already been compiled within the current compilation
15098 unit are not turned into long calls. The exceptions to this rule are
15099 that weak function definitions, functions with the @code{long_call}
15100 attribute or the @code{section} attribute, and functions that are within
15101 the scope of a @code{#pragma long_calls} directive are always
15102 turned into long calls.
15103
15104 This feature is not enabled by default. Specifying
15105 @option{-mno-long-calls} restores the default behavior, as does
15106 placing the function calls within the scope of a @code{#pragma
15107 long_calls_off} directive. Note these switches have no effect on how
15108 the compiler generates code to handle function calls via function
15109 pointers.
15110
15111 @item -msingle-pic-base
15112 @opindex msingle-pic-base
15113 Treat the register used for PIC addressing as read-only, rather than
15114 loading it in the prologue for each function. The runtime system is
15115 responsible for initializing this register with an appropriate value
15116 before execution begins.
15117
15118 @item -mpic-register=@var{reg}
15119 @opindex mpic-register
15120 Specify the register to be used for PIC addressing.
15121 For standard PIC base case, the default is any suitable register
15122 determined by compiler. For single PIC base case, the default is
15123 @samp{R9} if target is EABI based or stack-checking is enabled,
15124 otherwise the default is @samp{R10}.
15125
15126 @item -mpic-data-is-text-relative
15127 @opindex mpic-data-is-text-relative
15128 Assume that the displacement between the text and data segments is fixed
15129 at static link time. This permits using PC-relative addressing
15130 operations to access data known to be in the data segment. For
15131 non-VxWorks RTP targets, this option is enabled by default. When
15132 disabled on such targets, it will enable @option{-msingle-pic-base} by
15133 default.
15134
15135 @item -mpoke-function-name
15136 @opindex mpoke-function-name
15137 Write the name of each function into the text section, directly
15138 preceding the function prologue. The generated code is similar to this:
15139
15140 @smallexample
15141 t0
15142 .ascii "arm_poke_function_name", 0
15143 .align
15144 t1
15145 .word 0xff000000 + (t1 - t0)
15146 arm_poke_function_name
15147 mov ip, sp
15148 stmfd sp!, @{fp, ip, lr, pc@}
15149 sub fp, ip, #4
15150 @end smallexample
15151
15152 When performing a stack backtrace, code can inspect the value of
15153 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
15154 location @code{pc - 12} and the top 8 bits are set, then we know that
15155 there is a function name embedded immediately preceding this location
15156 and has length @code{((pc[-3]) & 0xff000000)}.
15157
15158 @item -mthumb
15159 @itemx -marm
15160 @opindex marm
15161 @opindex mthumb
15162
15163 Select between generating code that executes in ARM and Thumb
15164 states. The default for most configurations is to generate code
15165 that executes in ARM state, but the default can be changed by
15166 configuring GCC with the @option{--with-mode=}@var{state}
15167 configure option.
15168
15169 You can also override the ARM and Thumb mode for each function
15170 by using the @code{target("thumb")} and @code{target("arm")} function attributes
15171 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
15172
15173 @item -mtpcs-frame
15174 @opindex mtpcs-frame
15175 Generate a stack frame that is compliant with the Thumb Procedure Call
15176 Standard for all non-leaf functions. (A leaf function is one that does
15177 not call any other functions.) The default is @option{-mno-tpcs-frame}.
15178
15179 @item -mtpcs-leaf-frame
15180 @opindex mtpcs-leaf-frame
15181 Generate a stack frame that is compliant with the Thumb Procedure Call
15182 Standard for all leaf functions. (A leaf function is one that does
15183 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
15184
15185 @item -mcallee-super-interworking
15186 @opindex mcallee-super-interworking
15187 Gives all externally visible functions in the file being compiled an ARM
15188 instruction set header which switches to Thumb mode before executing the
15189 rest of the function. This allows these functions to be called from
15190 non-interworking code. This option is not valid in AAPCS configurations
15191 because interworking is enabled by default.
15192
15193 @item -mcaller-super-interworking
15194 @opindex mcaller-super-interworking
15195 Allows calls via function pointers (including virtual functions) to
15196 execute correctly regardless of whether the target code has been
15197 compiled for interworking or not. There is a small overhead in the cost
15198 of executing a function pointer if this option is enabled. This option
15199 is not valid in AAPCS configurations because interworking is enabled
15200 by default.
15201
15202 @item -mtp=@var{name}
15203 @opindex mtp
15204 Specify the access model for the thread local storage pointer. The valid
15205 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
15206 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
15207 (supported in the arm6k architecture), and @samp{auto}, which uses the
15208 best available method for the selected processor. The default setting is
15209 @samp{auto}.
15210
15211 @item -mtls-dialect=@var{dialect}
15212 @opindex mtls-dialect
15213 Specify the dialect to use for accessing thread local storage. Two
15214 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
15215 @samp{gnu} dialect selects the original GNU scheme for supporting
15216 local and global dynamic TLS models. The @samp{gnu2} dialect
15217 selects the GNU descriptor scheme, which provides better performance
15218 for shared libraries. The GNU descriptor scheme is compatible with
15219 the original scheme, but does require new assembler, linker and
15220 library support. Initial and local exec TLS models are unaffected by
15221 this option and always use the original scheme.
15222
15223 @item -mword-relocations
15224 @opindex mword-relocations
15225 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
15226 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
15227 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
15228 is specified.
15229
15230 @item -mfix-cortex-m3-ldrd
15231 @opindex mfix-cortex-m3-ldrd
15232 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
15233 with overlapping destination and base registers are used. This option avoids
15234 generating these instructions. This option is enabled by default when
15235 @option{-mcpu=cortex-m3} is specified.
15236
15237 @item -munaligned-access
15238 @itemx -mno-unaligned-access
15239 @opindex munaligned-access
15240 @opindex mno-unaligned-access
15241 Enables (or disables) reading and writing of 16- and 32- bit values
15242 from addresses that are not 16- or 32- bit aligned. By default
15243 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
15244 ARMv8-M Baseline architectures, and enabled for all other
15245 architectures. If unaligned access is not enabled then words in packed
15246 data structures are accessed a byte at a time.
15247
15248 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
15249 generated object file to either true or false, depending upon the
15250 setting of this option. If unaligned access is enabled then the
15251 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
15252 defined.
15253
15254 @item -mneon-for-64bits
15255 @opindex mneon-for-64bits
15256 Enables using Neon to handle scalar 64-bits operations. This is
15257 disabled by default since the cost of moving data from core registers
15258 to Neon is high.
15259
15260 @item -mslow-flash-data
15261 @opindex mslow-flash-data
15262 Assume loading data from flash is slower than fetching instruction.
15263 Therefore literal load is minimized for better performance.
15264 This option is only supported when compiling for ARMv7 M-profile and
15265 off by default.
15266
15267 @item -masm-syntax-unified
15268 @opindex masm-syntax-unified
15269 Assume inline assembler is using unified asm syntax. The default is
15270 currently off which implies divided syntax. This option has no impact
15271 on Thumb2. However, this may change in future releases of GCC.
15272 Divided syntax should be considered deprecated.
15273
15274 @item -mrestrict-it
15275 @opindex mrestrict-it
15276 Restricts generation of IT blocks to conform to the rules of ARMv8.
15277 IT blocks can only contain a single 16-bit instruction from a select
15278 set of instructions. This option is on by default for ARMv8 Thumb mode.
15279
15280 @item -mprint-tune-info
15281 @opindex mprint-tune-info
15282 Print CPU tuning information as comment in assembler file. This is
15283 an option used only for regression testing of the compiler and not
15284 intended for ordinary use in compiling code. This option is disabled
15285 by default.
15286
15287 @item -mpure-code
15288 @opindex mpure-code
15289 Do not allow constant data to be placed in code sections.
15290 Additionally, when compiling for ELF object format give all text sections the
15291 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
15292 is only available when generating non-pic code for ARMv7-M targets.
15293
15294 @end table
15295
15296 @node AVR Options
15297 @subsection AVR Options
15298 @cindex AVR Options
15299
15300 These options are defined for AVR implementations:
15301
15302 @table @gcctabopt
15303 @item -mmcu=@var{mcu}
15304 @opindex mmcu
15305 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
15306
15307 The default for this option is@tie{}@samp{avr2}.
15308
15309 GCC supports the following AVR devices and ISAs:
15310
15311 @include avr-mmcu.texi
15312
15313 @item -maccumulate-args
15314 @opindex maccumulate-args
15315 Accumulate outgoing function arguments and acquire/release the needed
15316 stack space for outgoing function arguments once in function
15317 prologue/epilogue. Without this option, outgoing arguments are pushed
15318 before calling a function and popped afterwards.
15319
15320 Popping the arguments after the function call can be expensive on
15321 AVR so that accumulating the stack space might lead to smaller
15322 executables because arguments need not to be removed from the
15323 stack after such a function call.
15324
15325 This option can lead to reduced code size for functions that perform
15326 several calls to functions that get their arguments on the stack like
15327 calls to printf-like functions.
15328
15329 @item -mbranch-cost=@var{cost}
15330 @opindex mbranch-cost
15331 Set the branch costs for conditional branch instructions to
15332 @var{cost}. Reasonable values for @var{cost} are small, non-negative
15333 integers. The default branch cost is 0.
15334
15335 @item -mcall-prologues
15336 @opindex mcall-prologues
15337 Functions prologues/epilogues are expanded as calls to appropriate
15338 subroutines. Code size is smaller.
15339
15340 @item -mint8
15341 @opindex mint8
15342 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
15343 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
15344 and @code{long long} is 4 bytes. Please note that this option does not
15345 conform to the C standards, but it results in smaller code
15346 size.
15347
15348 @item -mn-flash=@var{num}
15349 @opindex mn-flash
15350 Assume that the flash memory has a size of
15351 @var{num} times 64@tie{}KiB.
15352
15353 @item -mno-interrupts
15354 @opindex mno-interrupts
15355 Generated code is not compatible with hardware interrupts.
15356 Code size is smaller.
15357
15358 @item -mrelax
15359 @opindex mrelax
15360 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
15361 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
15362 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
15363 the assembler's command line and the @option{--relax} option to the
15364 linker's command line.
15365
15366 Jump relaxing is performed by the linker because jump offsets are not
15367 known before code is located. Therefore, the assembler code generated by the
15368 compiler is the same, but the instructions in the executable may
15369 differ from instructions in the assembler code.
15370
15371 Relaxing must be turned on if linker stubs are needed, see the
15372 section on @code{EIND} and linker stubs below.
15373
15374 @item -mrmw
15375 @opindex mrmw
15376 Assume that the device supports the Read-Modify-Write
15377 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
15378
15379 @item -msp8
15380 @opindex msp8
15381 Treat the stack pointer register as an 8-bit register,
15382 i.e.@: assume the high byte of the stack pointer is zero.
15383 In general, you don't need to set this option by hand.
15384
15385 This option is used internally by the compiler to select and
15386 build multilibs for architectures @code{avr2} and @code{avr25}.
15387 These architectures mix devices with and without @code{SPH}.
15388 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
15389 the compiler driver adds or removes this option from the compiler
15390 proper's command line, because the compiler then knows if the device
15391 or architecture has an 8-bit stack pointer and thus no @code{SPH}
15392 register or not.
15393
15394 @item -mstrict-X
15395 @opindex mstrict-X
15396 Use address register @code{X} in a way proposed by the hardware. This means
15397 that @code{X} is only used in indirect, post-increment or
15398 pre-decrement addressing.
15399
15400 Without this option, the @code{X} register may be used in the same way
15401 as @code{Y} or @code{Z} which then is emulated by additional
15402 instructions.
15403 For example, loading a value with @code{X+const} addressing with a
15404 small non-negative @code{const < 64} to a register @var{Rn} is
15405 performed as
15406
15407 @example
15408 adiw r26, const ; X += const
15409 ld @var{Rn}, X ; @var{Rn} = *X
15410 sbiw r26, const ; X -= const
15411 @end example
15412
15413 @item -mtiny-stack
15414 @opindex mtiny-stack
15415 Only change the lower 8@tie{}bits of the stack pointer.
15416
15417 @item -mfract-convert-truncate
15418 @opindex mfract-convert-truncate
15419 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
15420
15421 @item -nodevicelib
15422 @opindex nodevicelib
15423 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
15424
15425 @item -Waddr-space-convert
15426 @opindex Waddr-space-convert
15427 Warn about conversions between address spaces in the case where the
15428 resulting address space is not contained in the incoming address space.
15429
15430 @item -Wmisspelled-isr
15431 @opindex Wmisspelled-isr
15432 Warn if the ISR is misspelled, i.e. without __vector prefix.
15433 Enabled by default.
15434 @end table
15435
15436 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
15437 @cindex @code{EIND}
15438 Pointers in the implementation are 16@tie{}bits wide.
15439 The address of a function or label is represented as word address so
15440 that indirect jumps and calls can target any code address in the
15441 range of 64@tie{}Ki words.
15442
15443 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
15444 bytes of program memory space, there is a special function register called
15445 @code{EIND} that serves as most significant part of the target address
15446 when @code{EICALL} or @code{EIJMP} instructions are used.
15447
15448 Indirect jumps and calls on these devices are handled as follows by
15449 the compiler and are subject to some limitations:
15450
15451 @itemize @bullet
15452
15453 @item
15454 The compiler never sets @code{EIND}.
15455
15456 @item
15457 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
15458 instructions or might read @code{EIND} directly in order to emulate an
15459 indirect call/jump by means of a @code{RET} instruction.
15460
15461 @item
15462 The compiler assumes that @code{EIND} never changes during the startup
15463 code or during the application. In particular, @code{EIND} is not
15464 saved/restored in function or interrupt service routine
15465 prologue/epilogue.
15466
15467 @item
15468 For indirect calls to functions and computed goto, the linker
15469 generates @emph{stubs}. Stubs are jump pads sometimes also called
15470 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
15471 The stub contains a direct jump to the desired address.
15472
15473 @item
15474 Linker relaxation must be turned on so that the linker generates
15475 the stubs correctly in all situations. See the compiler option
15476 @option{-mrelax} and the linker option @option{--relax}.
15477 There are corner cases where the linker is supposed to generate stubs
15478 but aborts without relaxation and without a helpful error message.
15479
15480 @item
15481 The default linker script is arranged for code with @code{EIND = 0}.
15482 If code is supposed to work for a setup with @code{EIND != 0}, a custom
15483 linker script has to be used in order to place the sections whose
15484 name start with @code{.trampolines} into the segment where @code{EIND}
15485 points to.
15486
15487 @item
15488 The startup code from libgcc never sets @code{EIND}.
15489 Notice that startup code is a blend of code from libgcc and AVR-LibC.
15490 For the impact of AVR-LibC on @code{EIND}, see the
15491 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
15492
15493 @item
15494 It is legitimate for user-specific startup code to set up @code{EIND}
15495 early, for example by means of initialization code located in
15496 section @code{.init3}. Such code runs prior to general startup code
15497 that initializes RAM and calls constructors, but after the bit
15498 of startup code from AVR-LibC that sets @code{EIND} to the segment
15499 where the vector table is located.
15500 @example
15501 #include <avr/io.h>
15502
15503 static void
15504 __attribute__((section(".init3"),naked,used,no_instrument_function))
15505 init3_set_eind (void)
15506 @{
15507 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
15508 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
15509 @}
15510 @end example
15511
15512 @noindent
15513 The @code{__trampolines_start} symbol is defined in the linker script.
15514
15515 @item
15516 Stubs are generated automatically by the linker if
15517 the following two conditions are met:
15518 @itemize @minus
15519
15520 @item The address of a label is taken by means of the @code{gs} modifier
15521 (short for @emph{generate stubs}) like so:
15522 @example
15523 LDI r24, lo8(gs(@var{func}))
15524 LDI r25, hi8(gs(@var{func}))
15525 @end example
15526 @item The final location of that label is in a code segment
15527 @emph{outside} the segment where the stubs are located.
15528 @end itemize
15529
15530 @item
15531 The compiler emits such @code{gs} modifiers for code labels in the
15532 following situations:
15533 @itemize @minus
15534 @item Taking address of a function or code label.
15535 @item Computed goto.
15536 @item If prologue-save function is used, see @option{-mcall-prologues}
15537 command-line option.
15538 @item Switch/case dispatch tables. If you do not want such dispatch
15539 tables you can specify the @option{-fno-jump-tables} command-line option.
15540 @item C and C++ constructors/destructors called during startup/shutdown.
15541 @item If the tools hit a @code{gs()} modifier explained above.
15542 @end itemize
15543
15544 @item
15545 Jumping to non-symbolic addresses like so is @emph{not} supported:
15546
15547 @example
15548 int main (void)
15549 @{
15550 /* Call function at word address 0x2 */
15551 return ((int(*)(void)) 0x2)();
15552 @}
15553 @end example
15554
15555 Instead, a stub has to be set up, i.e.@: the function has to be called
15556 through a symbol (@code{func_4} in the example):
15557
15558 @example
15559 int main (void)
15560 @{
15561 extern int func_4 (void);
15562
15563 /* Call function at byte address 0x4 */
15564 return func_4();
15565 @}
15566 @end example
15567
15568 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
15569 Alternatively, @code{func_4} can be defined in the linker script.
15570 @end itemize
15571
15572 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
15573 @cindex @code{RAMPD}
15574 @cindex @code{RAMPX}
15575 @cindex @code{RAMPY}
15576 @cindex @code{RAMPZ}
15577 Some AVR devices support memories larger than the 64@tie{}KiB range
15578 that can be accessed with 16-bit pointers. To access memory locations
15579 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
15580 register is used as high part of the address:
15581 The @code{X}, @code{Y}, @code{Z} address register is concatenated
15582 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
15583 register, respectively, to get a wide address. Similarly,
15584 @code{RAMPD} is used together with direct addressing.
15585
15586 @itemize
15587 @item
15588 The startup code initializes the @code{RAMP} special function
15589 registers with zero.
15590
15591 @item
15592 If a @ref{AVR Named Address Spaces,named address space} other than
15593 generic or @code{__flash} is used, then @code{RAMPZ} is set
15594 as needed before the operation.
15595
15596 @item
15597 If the device supports RAM larger than 64@tie{}KiB and the compiler
15598 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
15599 is reset to zero after the operation.
15600
15601 @item
15602 If the device comes with a specific @code{RAMP} register, the ISR
15603 prologue/epilogue saves/restores that SFR and initializes it with
15604 zero in case the ISR code might (implicitly) use it.
15605
15606 @item
15607 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
15608 If you use inline assembler to read from locations outside the
15609 16-bit address range and change one of the @code{RAMP} registers,
15610 you must reset it to zero after the access.
15611
15612 @end itemize
15613
15614 @subsubsection AVR Built-in Macros
15615
15616 GCC defines several built-in macros so that the user code can test
15617 for the presence or absence of features. Almost any of the following
15618 built-in macros are deduced from device capabilities and thus
15619 triggered by the @option{-mmcu=} command-line option.
15620
15621 For even more AVR-specific built-in macros see
15622 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
15623
15624 @table @code
15625
15626 @item __AVR_ARCH__
15627 Build-in macro that resolves to a decimal number that identifies the
15628 architecture and depends on the @option{-mmcu=@var{mcu}} option.
15629 Possible values are:
15630
15631 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
15632 @code{4}, @code{5}, @code{51}, @code{6}
15633
15634 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
15635 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
15636
15637 respectively and
15638
15639 @code{100}, @code{102}, @code{104},
15640 @code{105}, @code{106}, @code{107}
15641
15642 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
15643 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
15644 If @var{mcu} specifies a device, this built-in macro is set
15645 accordingly. For example, with @option{-mmcu=atmega8} the macro is
15646 defined to @code{4}.
15647
15648 @item __AVR_@var{Device}__
15649 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
15650 the device's name. For example, @option{-mmcu=atmega8} defines the
15651 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
15652 @code{__AVR_ATtiny261A__}, etc.
15653
15654 The built-in macros' names follow
15655 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
15656 the device name as from the AVR user manual. The difference between
15657 @var{Device} in the built-in macro and @var{device} in
15658 @option{-mmcu=@var{device}} is that the latter is always lowercase.
15659
15660 If @var{device} is not a device but only a core architecture like
15661 @samp{avr51}, this macro is not defined.
15662
15663 @item __AVR_DEVICE_NAME__
15664 Setting @option{-mmcu=@var{device}} defines this built-in macro to
15665 the device's name. For example, with @option{-mmcu=atmega8} the macro
15666 is defined to @code{atmega8}.
15667
15668 If @var{device} is not a device but only a core architecture like
15669 @samp{avr51}, this macro is not defined.
15670
15671 @item __AVR_XMEGA__
15672 The device / architecture belongs to the XMEGA family of devices.
15673
15674 @item __AVR_HAVE_ELPM__
15675 The device has the @code{ELPM} instruction.
15676
15677 @item __AVR_HAVE_ELPMX__
15678 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
15679 R@var{n},Z+} instructions.
15680
15681 @item __AVR_HAVE_MOVW__
15682 The device has the @code{MOVW} instruction to perform 16-bit
15683 register-register moves.
15684
15685 @item __AVR_HAVE_LPMX__
15686 The device has the @code{LPM R@var{n},Z} and
15687 @code{LPM R@var{n},Z+} instructions.
15688
15689 @item __AVR_HAVE_MUL__
15690 The device has a hardware multiplier.
15691
15692 @item __AVR_HAVE_JMP_CALL__
15693 The device has the @code{JMP} and @code{CALL} instructions.
15694 This is the case for devices with at least 16@tie{}KiB of program
15695 memory.
15696
15697 @item __AVR_HAVE_EIJMP_EICALL__
15698 @itemx __AVR_3_BYTE_PC__
15699 The device has the @code{EIJMP} and @code{EICALL} instructions.
15700 This is the case for devices with more than 128@tie{}KiB of program memory.
15701 This also means that the program counter
15702 (PC) is 3@tie{}bytes wide.
15703
15704 @item __AVR_2_BYTE_PC__
15705 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
15706 with up to 128@tie{}KiB of program memory.
15707
15708 @item __AVR_HAVE_8BIT_SP__
15709 @itemx __AVR_HAVE_16BIT_SP__
15710 The stack pointer (SP) register is treated as 8-bit respectively
15711 16-bit register by the compiler.
15712 The definition of these macros is affected by @option{-mtiny-stack}.
15713
15714 @item __AVR_HAVE_SPH__
15715 @itemx __AVR_SP8__
15716 The device has the SPH (high part of stack pointer) special function
15717 register or has an 8-bit stack pointer, respectively.
15718 The definition of these macros is affected by @option{-mmcu=} and
15719 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
15720 by @option{-msp8}.
15721
15722 @item __AVR_HAVE_RAMPD__
15723 @itemx __AVR_HAVE_RAMPX__
15724 @itemx __AVR_HAVE_RAMPY__
15725 @itemx __AVR_HAVE_RAMPZ__
15726 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
15727 @code{RAMPZ} special function register, respectively.
15728
15729 @item __NO_INTERRUPTS__
15730 This macro reflects the @option{-mno-interrupts} command-line option.
15731
15732 @item __AVR_ERRATA_SKIP__
15733 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
15734 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
15735 instructions because of a hardware erratum. Skip instructions are
15736 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
15737 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
15738 set.
15739
15740 @item __AVR_ISA_RMW__
15741 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
15742
15743 @item __AVR_SFR_OFFSET__=@var{offset}
15744 Instructions that can address I/O special function registers directly
15745 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
15746 address as if addressed by an instruction to access RAM like @code{LD}
15747 or @code{STS}. This offset depends on the device architecture and has
15748 to be subtracted from the RAM address in order to get the
15749 respective I/O@tie{}address.
15750
15751 @item __WITH_AVRLIBC__
15752 The compiler is configured to be used together with AVR-Libc.
15753 See the @option{--with-avrlibc} configure option.
15754
15755 @end table
15756
15757 @node Blackfin Options
15758 @subsection Blackfin Options
15759 @cindex Blackfin Options
15760
15761 @table @gcctabopt
15762 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
15763 @opindex mcpu=
15764 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
15765 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
15766 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
15767 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
15768 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
15769 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
15770 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
15771 @samp{bf561}, @samp{bf592}.
15772
15773 The optional @var{sirevision} specifies the silicon revision of the target
15774 Blackfin processor. Any workarounds available for the targeted silicon revision
15775 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
15776 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
15777 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
15778 hexadecimal digits representing the major and minor numbers in the silicon
15779 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
15780 is not defined. If @var{sirevision} is @samp{any}, the
15781 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
15782 If this optional @var{sirevision} is not used, GCC assumes the latest known
15783 silicon revision of the targeted Blackfin processor.
15784
15785 GCC defines a preprocessor macro for the specified @var{cpu}.
15786 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
15787 provided by libgloss to be linked in if @option{-msim} is not given.
15788
15789 Without this option, @samp{bf532} is used as the processor by default.
15790
15791 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
15792 only the preprocessor macro is defined.
15793
15794 @item -msim
15795 @opindex msim
15796 Specifies that the program will be run on the simulator. This causes
15797 the simulator BSP provided by libgloss to be linked in. This option
15798 has effect only for @samp{bfin-elf} toolchain.
15799 Certain other options, such as @option{-mid-shared-library} and
15800 @option{-mfdpic}, imply @option{-msim}.
15801
15802 @item -momit-leaf-frame-pointer
15803 @opindex momit-leaf-frame-pointer
15804 Don't keep the frame pointer in a register for leaf functions. This
15805 avoids the instructions to save, set up and restore frame pointers and
15806 makes an extra register available in leaf functions. The option
15807 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
15808 which might make debugging harder.
15809
15810 @item -mspecld-anomaly
15811 @opindex mspecld-anomaly
15812 When enabled, the compiler ensures that the generated code does not
15813 contain speculative loads after jump instructions. If this option is used,
15814 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
15815
15816 @item -mno-specld-anomaly
15817 @opindex mno-specld-anomaly
15818 Don't generate extra code to prevent speculative loads from occurring.
15819
15820 @item -mcsync-anomaly
15821 @opindex mcsync-anomaly
15822 When enabled, the compiler ensures that the generated code does not
15823 contain CSYNC or SSYNC instructions too soon after conditional branches.
15824 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
15825
15826 @item -mno-csync-anomaly
15827 @opindex mno-csync-anomaly
15828 Don't generate extra code to prevent CSYNC or SSYNC instructions from
15829 occurring too soon after a conditional branch.
15830
15831 @item -mlow-64k
15832 @opindex mlow-64k
15833 When enabled, the compiler is free to take advantage of the knowledge that
15834 the entire program fits into the low 64k of memory.
15835
15836 @item -mno-low-64k
15837 @opindex mno-low-64k
15838 Assume that the program is arbitrarily large. This is the default.
15839
15840 @item -mstack-check-l1
15841 @opindex mstack-check-l1
15842 Do stack checking using information placed into L1 scratchpad memory by the
15843 uClinux kernel.
15844
15845 @item -mid-shared-library
15846 @opindex mid-shared-library
15847 Generate code that supports shared libraries via the library ID method.
15848 This allows for execute in place and shared libraries in an environment
15849 without virtual memory management. This option implies @option{-fPIC}.
15850 With a @samp{bfin-elf} target, this option implies @option{-msim}.
15851
15852 @item -mno-id-shared-library
15853 @opindex mno-id-shared-library
15854 Generate code that doesn't assume ID-based shared libraries are being used.
15855 This is the default.
15856
15857 @item -mleaf-id-shared-library
15858 @opindex mleaf-id-shared-library
15859 Generate code that supports shared libraries via the library ID method,
15860 but assumes that this library or executable won't link against any other
15861 ID shared libraries. That allows the compiler to use faster code for jumps
15862 and calls.
15863
15864 @item -mno-leaf-id-shared-library
15865 @opindex mno-leaf-id-shared-library
15866 Do not assume that the code being compiled won't link against any ID shared
15867 libraries. Slower code is generated for jump and call insns.
15868
15869 @item -mshared-library-id=n
15870 @opindex mshared-library-id
15871 Specifies the identification number of the ID-based shared library being
15872 compiled. Specifying a value of 0 generates more compact code; specifying
15873 other values forces the allocation of that number to the current
15874 library but is no more space- or time-efficient than omitting this option.
15875
15876 @item -msep-data
15877 @opindex msep-data
15878 Generate code that allows the data segment to be located in a different
15879 area of memory from the text segment. This allows for execute in place in
15880 an environment without virtual memory management by eliminating relocations
15881 against the text section.
15882
15883 @item -mno-sep-data
15884 @opindex mno-sep-data
15885 Generate code that assumes that the data segment follows the text segment.
15886 This is the default.
15887
15888 @item -mlong-calls
15889 @itemx -mno-long-calls
15890 @opindex mlong-calls
15891 @opindex mno-long-calls
15892 Tells the compiler to perform function calls by first loading the
15893 address of the function into a register and then performing a subroutine
15894 call on this register. This switch is needed if the target function
15895 lies outside of the 24-bit addressing range of the offset-based
15896 version of subroutine call instruction.
15897
15898 This feature is not enabled by default. Specifying
15899 @option{-mno-long-calls} restores the default behavior. Note these
15900 switches have no effect on how the compiler generates code to handle
15901 function calls via function pointers.
15902
15903 @item -mfast-fp
15904 @opindex mfast-fp
15905 Link with the fast floating-point library. This library relaxes some of
15906 the IEEE floating-point standard's rules for checking inputs against
15907 Not-a-Number (NAN), in the interest of performance.
15908
15909 @item -minline-plt
15910 @opindex minline-plt
15911 Enable inlining of PLT entries in function calls to functions that are
15912 not known to bind locally. It has no effect without @option{-mfdpic}.
15913
15914 @item -mmulticore
15915 @opindex mmulticore
15916 Build a standalone application for multicore Blackfin processors.
15917 This option causes proper start files and link scripts supporting
15918 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
15919 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
15920
15921 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
15922 selects the one-application-per-core programming model. Without
15923 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
15924 programming model is used. In this model, the main function of Core B
15925 should be named as @code{coreb_main}.
15926
15927 If this option is not used, the single-core application programming
15928 model is used.
15929
15930 @item -mcorea
15931 @opindex mcorea
15932 Build a standalone application for Core A of BF561 when using
15933 the one-application-per-core programming model. Proper start files
15934 and link scripts are used to support Core A, and the macro
15935 @code{__BFIN_COREA} is defined.
15936 This option can only be used in conjunction with @option{-mmulticore}.
15937
15938 @item -mcoreb
15939 @opindex mcoreb
15940 Build a standalone application for Core B of BF561 when using
15941 the one-application-per-core programming model. Proper start files
15942 and link scripts are used to support Core B, and the macro
15943 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
15944 should be used instead of @code{main}.
15945 This option can only be used in conjunction with @option{-mmulticore}.
15946
15947 @item -msdram
15948 @opindex msdram
15949 Build a standalone application for SDRAM. Proper start files and
15950 link scripts are used to put the application into SDRAM, and the macro
15951 @code{__BFIN_SDRAM} is defined.
15952 The loader should initialize SDRAM before loading the application.
15953
15954 @item -micplb
15955 @opindex micplb
15956 Assume that ICPLBs are enabled at run time. This has an effect on certain
15957 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
15958 are enabled; for standalone applications the default is off.
15959 @end table
15960
15961 @node C6X Options
15962 @subsection C6X Options
15963 @cindex C6X Options
15964
15965 @table @gcctabopt
15966 @item -march=@var{name}
15967 @opindex march
15968 This specifies the name of the target architecture. GCC uses this
15969 name to determine what kind of instructions it can emit when generating
15970 assembly code. Permissible names are: @samp{c62x},
15971 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
15972
15973 @item -mbig-endian
15974 @opindex mbig-endian
15975 Generate code for a big-endian target.
15976
15977 @item -mlittle-endian
15978 @opindex mlittle-endian
15979 Generate code for a little-endian target. This is the default.
15980
15981 @item -msim
15982 @opindex msim
15983 Choose startup files and linker script suitable for the simulator.
15984
15985 @item -msdata=default
15986 @opindex msdata=default
15987 Put small global and static data in the @code{.neardata} section,
15988 which is pointed to by register @code{B14}. Put small uninitialized
15989 global and static data in the @code{.bss} section, which is adjacent
15990 to the @code{.neardata} section. Put small read-only data into the
15991 @code{.rodata} section. The corresponding sections used for large
15992 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
15993
15994 @item -msdata=all
15995 @opindex msdata=all
15996 Put all data, not just small objects, into the sections reserved for
15997 small data, and use addressing relative to the @code{B14} register to
15998 access them.
15999
16000 @item -msdata=none
16001 @opindex msdata=none
16002 Make no use of the sections reserved for small data, and use absolute
16003 addresses to access all data. Put all initialized global and static
16004 data in the @code{.fardata} section, and all uninitialized data in the
16005 @code{.far} section. Put all constant data into the @code{.const}
16006 section.
16007 @end table
16008
16009 @node CRIS Options
16010 @subsection CRIS Options
16011 @cindex CRIS Options
16012
16013 These options are defined specifically for the CRIS ports.
16014
16015 @table @gcctabopt
16016 @item -march=@var{architecture-type}
16017 @itemx -mcpu=@var{architecture-type}
16018 @opindex march
16019 @opindex mcpu
16020 Generate code for the specified architecture. The choices for
16021 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
16022 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
16023 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
16024 @samp{v10}.
16025
16026 @item -mtune=@var{architecture-type}
16027 @opindex mtune
16028 Tune to @var{architecture-type} everything applicable about the generated
16029 code, except for the ABI and the set of available instructions. The
16030 choices for @var{architecture-type} are the same as for
16031 @option{-march=@var{architecture-type}}.
16032
16033 @item -mmax-stack-frame=@var{n}
16034 @opindex mmax-stack-frame
16035 Warn when the stack frame of a function exceeds @var{n} bytes.
16036
16037 @item -metrax4
16038 @itemx -metrax100
16039 @opindex metrax4
16040 @opindex metrax100
16041 The options @option{-metrax4} and @option{-metrax100} are synonyms for
16042 @option{-march=v3} and @option{-march=v8} respectively.
16043
16044 @item -mmul-bug-workaround
16045 @itemx -mno-mul-bug-workaround
16046 @opindex mmul-bug-workaround
16047 @opindex mno-mul-bug-workaround
16048 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
16049 models where it applies. This option is active by default.
16050
16051 @item -mpdebug
16052 @opindex mpdebug
16053 Enable CRIS-specific verbose debug-related information in the assembly
16054 code. This option also has the effect of turning off the @samp{#NO_APP}
16055 formatted-code indicator to the assembler at the beginning of the
16056 assembly file.
16057
16058 @item -mcc-init
16059 @opindex mcc-init
16060 Do not use condition-code results from previous instruction; always emit
16061 compare and test instructions before use of condition codes.
16062
16063 @item -mno-side-effects
16064 @opindex mno-side-effects
16065 Do not emit instructions with side effects in addressing modes other than
16066 post-increment.
16067
16068 @item -mstack-align
16069 @itemx -mno-stack-align
16070 @itemx -mdata-align
16071 @itemx -mno-data-align
16072 @itemx -mconst-align
16073 @itemx -mno-const-align
16074 @opindex mstack-align
16075 @opindex mno-stack-align
16076 @opindex mdata-align
16077 @opindex mno-data-align
16078 @opindex mconst-align
16079 @opindex mno-const-align
16080 These options (@samp{no-} options) arrange (eliminate arrangements) for the
16081 stack frame, individual data and constants to be aligned for the maximum
16082 single data access size for the chosen CPU model. The default is to
16083 arrange for 32-bit alignment. ABI details such as structure layout are
16084 not affected by these options.
16085
16086 @item -m32-bit
16087 @itemx -m16-bit
16088 @itemx -m8-bit
16089 @opindex m32-bit
16090 @opindex m16-bit
16091 @opindex m8-bit
16092 Similar to the stack- data- and const-align options above, these options
16093 arrange for stack frame, writable data and constants to all be 32-bit,
16094 16-bit or 8-bit aligned. The default is 32-bit alignment.
16095
16096 @item -mno-prologue-epilogue
16097 @itemx -mprologue-epilogue
16098 @opindex mno-prologue-epilogue
16099 @opindex mprologue-epilogue
16100 With @option{-mno-prologue-epilogue}, the normal function prologue and
16101 epilogue which set up the stack frame are omitted and no return
16102 instructions or return sequences are generated in the code. Use this
16103 option only together with visual inspection of the compiled code: no
16104 warnings or errors are generated when call-saved registers must be saved,
16105 or storage for local variables needs to be allocated.
16106
16107 @item -mno-gotplt
16108 @itemx -mgotplt
16109 @opindex mno-gotplt
16110 @opindex mgotplt
16111 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
16112 instruction sequences that load addresses for functions from the PLT part
16113 of the GOT rather than (traditional on other architectures) calls to the
16114 PLT@. The default is @option{-mgotplt}.
16115
16116 @item -melf
16117 @opindex melf
16118 Legacy no-op option only recognized with the cris-axis-elf and
16119 cris-axis-linux-gnu targets.
16120
16121 @item -mlinux
16122 @opindex mlinux
16123 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
16124
16125 @item -sim
16126 @opindex sim
16127 This option, recognized for the cris-axis-elf, arranges
16128 to link with input-output functions from a simulator library. Code,
16129 initialized data and zero-initialized data are allocated consecutively.
16130
16131 @item -sim2
16132 @opindex sim2
16133 Like @option{-sim}, but pass linker options to locate initialized data at
16134 0x40000000 and zero-initialized data at 0x80000000.
16135 @end table
16136
16137 @node CR16 Options
16138 @subsection CR16 Options
16139 @cindex CR16 Options
16140
16141 These options are defined specifically for the CR16 ports.
16142
16143 @table @gcctabopt
16144
16145 @item -mmac
16146 @opindex mmac
16147 Enable the use of multiply-accumulate instructions. Disabled by default.
16148
16149 @item -mcr16cplus
16150 @itemx -mcr16c
16151 @opindex mcr16cplus
16152 @opindex mcr16c
16153 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
16154 is default.
16155
16156 @item -msim
16157 @opindex msim
16158 Links the library libsim.a which is in compatible with simulator. Applicable
16159 to ELF compiler only.
16160
16161 @item -mint32
16162 @opindex mint32
16163 Choose integer type as 32-bit wide.
16164
16165 @item -mbit-ops
16166 @opindex mbit-ops
16167 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
16168
16169 @item -mdata-model=@var{model}
16170 @opindex mdata-model
16171 Choose a data model. The choices for @var{model} are @samp{near},
16172 @samp{far} or @samp{medium}. @samp{medium} is default.
16173 However, @samp{far} is not valid with @option{-mcr16c}, as the
16174 CR16C architecture does not support the far data model.
16175 @end table
16176
16177 @node Darwin Options
16178 @subsection Darwin Options
16179 @cindex Darwin options
16180
16181 These options are defined for all architectures running the Darwin operating
16182 system.
16183
16184 FSF GCC on Darwin does not create ``fat'' object files; it creates
16185 an object file for the single architecture that GCC was built to
16186 target. Apple's GCC on Darwin does create ``fat'' files if multiple
16187 @option{-arch} options are used; it does so by running the compiler or
16188 linker multiple times and joining the results together with
16189 @file{lipo}.
16190
16191 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
16192 @samp{i686}) is determined by the flags that specify the ISA
16193 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
16194 @option{-force_cpusubtype_ALL} option can be used to override this.
16195
16196 The Darwin tools vary in their behavior when presented with an ISA
16197 mismatch. The assembler, @file{as}, only permits instructions to
16198 be used that are valid for the subtype of the file it is generating,
16199 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
16200 The linker for shared libraries, @file{/usr/bin/libtool}, fails
16201 and prints an error if asked to create a shared library with a less
16202 restrictive subtype than its input files (for instance, trying to put
16203 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
16204 for executables, @command{ld}, quietly gives the executable the most
16205 restrictive subtype of any of its input files.
16206
16207 @table @gcctabopt
16208 @item -F@var{dir}
16209 @opindex F
16210 Add the framework directory @var{dir} to the head of the list of
16211 directories to be searched for header files. These directories are
16212 interleaved with those specified by @option{-I} options and are
16213 scanned in a left-to-right order.
16214
16215 A framework directory is a directory with frameworks in it. A
16216 framework is a directory with a @file{Headers} and/or
16217 @file{PrivateHeaders} directory contained directly in it that ends
16218 in @file{.framework}. The name of a framework is the name of this
16219 directory excluding the @file{.framework}. Headers associated with
16220 the framework are found in one of those two directories, with
16221 @file{Headers} being searched first. A subframework is a framework
16222 directory that is in a framework's @file{Frameworks} directory.
16223 Includes of subframework headers can only appear in a header of a
16224 framework that contains the subframework, or in a sibling subframework
16225 header. Two subframeworks are siblings if they occur in the same
16226 framework. A subframework should not have the same name as a
16227 framework; a warning is issued if this is violated. Currently a
16228 subframework cannot have subframeworks; in the future, the mechanism
16229 may be extended to support this. The standard frameworks can be found
16230 in @file{/System/Library/Frameworks} and
16231 @file{/Library/Frameworks}. An example include looks like
16232 @code{#include <Framework/header.h>}, where @file{Framework} denotes
16233 the name of the framework and @file{header.h} is found in the
16234 @file{PrivateHeaders} or @file{Headers} directory.
16235
16236 @item -iframework@var{dir}
16237 @opindex iframework
16238 Like @option{-F} except the directory is a treated as a system
16239 directory. The main difference between this @option{-iframework} and
16240 @option{-F} is that with @option{-iframework} the compiler does not
16241 warn about constructs contained within header files found via
16242 @var{dir}. This option is valid only for the C family of languages.
16243
16244 @item -gused
16245 @opindex gused
16246 Emit debugging information for symbols that are used. For stabs
16247 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
16248 This is by default ON@.
16249
16250 @item -gfull
16251 @opindex gfull
16252 Emit debugging information for all symbols and types.
16253
16254 @item -mmacosx-version-min=@var{version}
16255 The earliest version of MacOS X that this executable will run on
16256 is @var{version}. Typical values of @var{version} include @code{10.1},
16257 @code{10.2}, and @code{10.3.9}.
16258
16259 If the compiler was built to use the system's headers by default,
16260 then the default for this option is the system version on which the
16261 compiler is running, otherwise the default is to make choices that
16262 are compatible with as many systems and code bases as possible.
16263
16264 @item -mkernel
16265 @opindex mkernel
16266 Enable kernel development mode. The @option{-mkernel} option sets
16267 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
16268 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
16269 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
16270 applicable. This mode also sets @option{-mno-altivec},
16271 @option{-msoft-float}, @option{-fno-builtin} and
16272 @option{-mlong-branch} for PowerPC targets.
16273
16274 @item -mone-byte-bool
16275 @opindex mone-byte-bool
16276 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
16277 By default @code{sizeof(bool)} is @code{4} when compiling for
16278 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
16279 option has no effect on x86.
16280
16281 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
16282 to generate code that is not binary compatible with code generated
16283 without that switch. Using this switch may require recompiling all
16284 other modules in a program, including system libraries. Use this
16285 switch to conform to a non-default data model.
16286
16287 @item -mfix-and-continue
16288 @itemx -ffix-and-continue
16289 @itemx -findirect-data
16290 @opindex mfix-and-continue
16291 @opindex ffix-and-continue
16292 @opindex findirect-data
16293 Generate code suitable for fast turnaround development, such as to
16294 allow GDB to dynamically load @file{.o} files into already-running
16295 programs. @option{-findirect-data} and @option{-ffix-and-continue}
16296 are provided for backwards compatibility.
16297
16298 @item -all_load
16299 @opindex all_load
16300 Loads all members of static archive libraries.
16301 See man ld(1) for more information.
16302
16303 @item -arch_errors_fatal
16304 @opindex arch_errors_fatal
16305 Cause the errors having to do with files that have the wrong architecture
16306 to be fatal.
16307
16308 @item -bind_at_load
16309 @opindex bind_at_load
16310 Causes the output file to be marked such that the dynamic linker will
16311 bind all undefined references when the file is loaded or launched.
16312
16313 @item -bundle
16314 @opindex bundle
16315 Produce a Mach-o bundle format file.
16316 See man ld(1) for more information.
16317
16318 @item -bundle_loader @var{executable}
16319 @opindex bundle_loader
16320 This option specifies the @var{executable} that will load the build
16321 output file being linked. See man ld(1) for more information.
16322
16323 @item -dynamiclib
16324 @opindex dynamiclib
16325 When passed this option, GCC produces a dynamic library instead of
16326 an executable when linking, using the Darwin @file{libtool} command.
16327
16328 @item -force_cpusubtype_ALL
16329 @opindex force_cpusubtype_ALL
16330 This causes GCC's output file to have the @samp{ALL} subtype, instead of
16331 one controlled by the @option{-mcpu} or @option{-march} option.
16332
16333 @item -allowable_client @var{client_name}
16334 @itemx -client_name
16335 @itemx -compatibility_version
16336 @itemx -current_version
16337 @itemx -dead_strip
16338 @itemx -dependency-file
16339 @itemx -dylib_file
16340 @itemx -dylinker_install_name
16341 @itemx -dynamic
16342 @itemx -exported_symbols_list
16343 @itemx -filelist
16344 @need 800
16345 @itemx -flat_namespace
16346 @itemx -force_flat_namespace
16347 @itemx -headerpad_max_install_names
16348 @itemx -image_base
16349 @itemx -init
16350 @itemx -install_name
16351 @itemx -keep_private_externs
16352 @itemx -multi_module
16353 @itemx -multiply_defined
16354 @itemx -multiply_defined_unused
16355 @need 800
16356 @itemx -noall_load
16357 @itemx -no_dead_strip_inits_and_terms
16358 @itemx -nofixprebinding
16359 @itemx -nomultidefs
16360 @itemx -noprebind
16361 @itemx -noseglinkedit
16362 @itemx -pagezero_size
16363 @itemx -prebind
16364 @itemx -prebind_all_twolevel_modules
16365 @itemx -private_bundle
16366 @need 800
16367 @itemx -read_only_relocs
16368 @itemx -sectalign
16369 @itemx -sectobjectsymbols
16370 @itemx -whyload
16371 @itemx -seg1addr
16372 @itemx -sectcreate
16373 @itemx -sectobjectsymbols
16374 @itemx -sectorder
16375 @itemx -segaddr
16376 @itemx -segs_read_only_addr
16377 @need 800
16378 @itemx -segs_read_write_addr
16379 @itemx -seg_addr_table
16380 @itemx -seg_addr_table_filename
16381 @itemx -seglinkedit
16382 @itemx -segprot
16383 @itemx -segs_read_only_addr
16384 @itemx -segs_read_write_addr
16385 @itemx -single_module
16386 @itemx -static
16387 @itemx -sub_library
16388 @need 800
16389 @itemx -sub_umbrella
16390 @itemx -twolevel_namespace
16391 @itemx -umbrella
16392 @itemx -undefined
16393 @itemx -unexported_symbols_list
16394 @itemx -weak_reference_mismatches
16395 @itemx -whatsloaded
16396 @opindex allowable_client
16397 @opindex client_name
16398 @opindex compatibility_version
16399 @opindex current_version
16400 @opindex dead_strip
16401 @opindex dependency-file
16402 @opindex dylib_file
16403 @opindex dylinker_install_name
16404 @opindex dynamic
16405 @opindex exported_symbols_list
16406 @opindex filelist
16407 @opindex flat_namespace
16408 @opindex force_flat_namespace
16409 @opindex headerpad_max_install_names
16410 @opindex image_base
16411 @opindex init
16412 @opindex install_name
16413 @opindex keep_private_externs
16414 @opindex multi_module
16415 @opindex multiply_defined
16416 @opindex multiply_defined_unused
16417 @opindex noall_load
16418 @opindex no_dead_strip_inits_and_terms
16419 @opindex nofixprebinding
16420 @opindex nomultidefs
16421 @opindex noprebind
16422 @opindex noseglinkedit
16423 @opindex pagezero_size
16424 @opindex prebind
16425 @opindex prebind_all_twolevel_modules
16426 @opindex private_bundle
16427 @opindex read_only_relocs
16428 @opindex sectalign
16429 @opindex sectobjectsymbols
16430 @opindex whyload
16431 @opindex seg1addr
16432 @opindex sectcreate
16433 @opindex sectobjectsymbols
16434 @opindex sectorder
16435 @opindex segaddr
16436 @opindex segs_read_only_addr
16437 @opindex segs_read_write_addr
16438 @opindex seg_addr_table
16439 @opindex seg_addr_table_filename
16440 @opindex seglinkedit
16441 @opindex segprot
16442 @opindex segs_read_only_addr
16443 @opindex segs_read_write_addr
16444 @opindex single_module
16445 @opindex static
16446 @opindex sub_library
16447 @opindex sub_umbrella
16448 @opindex twolevel_namespace
16449 @opindex umbrella
16450 @opindex undefined
16451 @opindex unexported_symbols_list
16452 @opindex weak_reference_mismatches
16453 @opindex whatsloaded
16454 These options are passed to the Darwin linker. The Darwin linker man page
16455 describes them in detail.
16456 @end table
16457
16458 @node DEC Alpha Options
16459 @subsection DEC Alpha Options
16460
16461 These @samp{-m} options are defined for the DEC Alpha implementations:
16462
16463 @table @gcctabopt
16464 @item -mno-soft-float
16465 @itemx -msoft-float
16466 @opindex mno-soft-float
16467 @opindex msoft-float
16468 Use (do not use) the hardware floating-point instructions for
16469 floating-point operations. When @option{-msoft-float} is specified,
16470 functions in @file{libgcc.a} are used to perform floating-point
16471 operations. Unless they are replaced by routines that emulate the
16472 floating-point operations, or compiled in such a way as to call such
16473 emulations routines, these routines issue floating-point
16474 operations. If you are compiling for an Alpha without floating-point
16475 operations, you must ensure that the library is built so as not to call
16476 them.
16477
16478 Note that Alpha implementations without floating-point operations are
16479 required to have floating-point registers.
16480
16481 @item -mfp-reg
16482 @itemx -mno-fp-regs
16483 @opindex mfp-reg
16484 @opindex mno-fp-regs
16485 Generate code that uses (does not use) the floating-point register set.
16486 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
16487 register set is not used, floating-point operands are passed in integer
16488 registers as if they were integers and floating-point results are passed
16489 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
16490 so any function with a floating-point argument or return value called by code
16491 compiled with @option{-mno-fp-regs} must also be compiled with that
16492 option.
16493
16494 A typical use of this option is building a kernel that does not use,
16495 and hence need not save and restore, any floating-point registers.
16496
16497 @item -mieee
16498 @opindex mieee
16499 The Alpha architecture implements floating-point hardware optimized for
16500 maximum performance. It is mostly compliant with the IEEE floating-point
16501 standard. However, for full compliance, software assistance is
16502 required. This option generates code fully IEEE-compliant code
16503 @emph{except} that the @var{inexact-flag} is not maintained (see below).
16504 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
16505 defined during compilation. The resulting code is less efficient but is
16506 able to correctly support denormalized numbers and exceptional IEEE
16507 values such as not-a-number and plus/minus infinity. Other Alpha
16508 compilers call this option @option{-ieee_with_no_inexact}.
16509
16510 @item -mieee-with-inexact
16511 @opindex mieee-with-inexact
16512 This is like @option{-mieee} except the generated code also maintains
16513 the IEEE @var{inexact-flag}. Turning on this option causes the
16514 generated code to implement fully-compliant IEEE math. In addition to
16515 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
16516 macro. On some Alpha implementations the resulting code may execute
16517 significantly slower than the code generated by default. Since there is
16518 very little code that depends on the @var{inexact-flag}, you should
16519 normally not specify this option. Other Alpha compilers call this
16520 option @option{-ieee_with_inexact}.
16521
16522 @item -mfp-trap-mode=@var{trap-mode}
16523 @opindex mfp-trap-mode
16524 This option controls what floating-point related traps are enabled.
16525 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
16526 The trap mode can be set to one of four values:
16527
16528 @table @samp
16529 @item n
16530 This is the default (normal) setting. The only traps that are enabled
16531 are the ones that cannot be disabled in software (e.g., division by zero
16532 trap).
16533
16534 @item u
16535 In addition to the traps enabled by @samp{n}, underflow traps are enabled
16536 as well.
16537
16538 @item su
16539 Like @samp{u}, but the instructions are marked to be safe for software
16540 completion (see Alpha architecture manual for details).
16541
16542 @item sui
16543 Like @samp{su}, but inexact traps are enabled as well.
16544 @end table
16545
16546 @item -mfp-rounding-mode=@var{rounding-mode}
16547 @opindex mfp-rounding-mode
16548 Selects the IEEE rounding mode. Other Alpha compilers call this option
16549 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
16550 of:
16551
16552 @table @samp
16553 @item n
16554 Normal IEEE rounding mode. Floating-point numbers are rounded towards
16555 the nearest machine number or towards the even machine number in case
16556 of a tie.
16557
16558 @item m
16559 Round towards minus infinity.
16560
16561 @item c
16562 Chopped rounding mode. Floating-point numbers are rounded towards zero.
16563
16564 @item d
16565 Dynamic rounding mode. A field in the floating-point control register
16566 (@var{fpcr}, see Alpha architecture reference manual) controls the
16567 rounding mode in effect. The C library initializes this register for
16568 rounding towards plus infinity. Thus, unless your program modifies the
16569 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
16570 @end table
16571
16572 @item -mtrap-precision=@var{trap-precision}
16573 @opindex mtrap-precision
16574 In the Alpha architecture, floating-point traps are imprecise. This
16575 means without software assistance it is impossible to recover from a
16576 floating trap and program execution normally needs to be terminated.
16577 GCC can generate code that can assist operating system trap handlers
16578 in determining the exact location that caused a floating-point trap.
16579 Depending on the requirements of an application, different levels of
16580 precisions can be selected:
16581
16582 @table @samp
16583 @item p
16584 Program precision. This option is the default and means a trap handler
16585 can only identify which program caused a floating-point exception.
16586
16587 @item f
16588 Function precision. The trap handler can determine the function that
16589 caused a floating-point exception.
16590
16591 @item i
16592 Instruction precision. The trap handler can determine the exact
16593 instruction that caused a floating-point exception.
16594 @end table
16595
16596 Other Alpha compilers provide the equivalent options called
16597 @option{-scope_safe} and @option{-resumption_safe}.
16598
16599 @item -mieee-conformant
16600 @opindex mieee-conformant
16601 This option marks the generated code as IEEE conformant. You must not
16602 use this option unless you also specify @option{-mtrap-precision=i} and either
16603 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
16604 is to emit the line @samp{.eflag 48} in the function prologue of the
16605 generated assembly file.
16606
16607 @item -mbuild-constants
16608 @opindex mbuild-constants
16609 Normally GCC examines a 32- or 64-bit integer constant to
16610 see if it can construct it from smaller constants in two or three
16611 instructions. If it cannot, it outputs the constant as a literal and
16612 generates code to load it from the data segment at run time.
16613
16614 Use this option to require GCC to construct @emph{all} integer constants
16615 using code, even if it takes more instructions (the maximum is six).
16616
16617 You typically use this option to build a shared library dynamic
16618 loader. Itself a shared library, it must relocate itself in memory
16619 before it can find the variables and constants in its own data segment.
16620
16621 @item -mbwx
16622 @itemx -mno-bwx
16623 @itemx -mcix
16624 @itemx -mno-cix
16625 @itemx -mfix
16626 @itemx -mno-fix
16627 @itemx -mmax
16628 @itemx -mno-max
16629 @opindex mbwx
16630 @opindex mno-bwx
16631 @opindex mcix
16632 @opindex mno-cix
16633 @opindex mfix
16634 @opindex mno-fix
16635 @opindex mmax
16636 @opindex mno-max
16637 Indicate whether GCC should generate code to use the optional BWX,
16638 CIX, FIX and MAX instruction sets. The default is to use the instruction
16639 sets supported by the CPU type specified via @option{-mcpu=} option or that
16640 of the CPU on which GCC was built if none is specified.
16641
16642 @item -mfloat-vax
16643 @itemx -mfloat-ieee
16644 @opindex mfloat-vax
16645 @opindex mfloat-ieee
16646 Generate code that uses (does not use) VAX F and G floating-point
16647 arithmetic instead of IEEE single and double precision.
16648
16649 @item -mexplicit-relocs
16650 @itemx -mno-explicit-relocs
16651 @opindex mexplicit-relocs
16652 @opindex mno-explicit-relocs
16653 Older Alpha assemblers provided no way to generate symbol relocations
16654 except via assembler macros. Use of these macros does not allow
16655 optimal instruction scheduling. GNU binutils as of version 2.12
16656 supports a new syntax that allows the compiler to explicitly mark
16657 which relocations should apply to which instructions. This option
16658 is mostly useful for debugging, as GCC detects the capabilities of
16659 the assembler when it is built and sets the default accordingly.
16660
16661 @item -msmall-data
16662 @itemx -mlarge-data
16663 @opindex msmall-data
16664 @opindex mlarge-data
16665 When @option{-mexplicit-relocs} is in effect, static data is
16666 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
16667 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
16668 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
16669 16-bit relocations off of the @code{$gp} register. This limits the
16670 size of the small data area to 64KB, but allows the variables to be
16671 directly accessed via a single instruction.
16672
16673 The default is @option{-mlarge-data}. With this option the data area
16674 is limited to just below 2GB@. Programs that require more than 2GB of
16675 data must use @code{malloc} or @code{mmap} to allocate the data in the
16676 heap instead of in the program's data segment.
16677
16678 When generating code for shared libraries, @option{-fpic} implies
16679 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
16680
16681 @item -msmall-text
16682 @itemx -mlarge-text
16683 @opindex msmall-text
16684 @opindex mlarge-text
16685 When @option{-msmall-text} is used, the compiler assumes that the
16686 code of the entire program (or shared library) fits in 4MB, and is
16687 thus reachable with a branch instruction. When @option{-msmall-data}
16688 is used, the compiler can assume that all local symbols share the
16689 same @code{$gp} value, and thus reduce the number of instructions
16690 required for a function call from 4 to 1.
16691
16692 The default is @option{-mlarge-text}.
16693
16694 @item -mcpu=@var{cpu_type}
16695 @opindex mcpu
16696 Set the instruction set and instruction scheduling parameters for
16697 machine type @var{cpu_type}. You can specify either the @samp{EV}
16698 style name or the corresponding chip number. GCC supports scheduling
16699 parameters for the EV4, EV5 and EV6 family of processors and
16700 chooses the default values for the instruction set from the processor
16701 you specify. If you do not specify a processor type, GCC defaults
16702 to the processor on which the compiler was built.
16703
16704 Supported values for @var{cpu_type} are
16705
16706 @table @samp
16707 @item ev4
16708 @itemx ev45
16709 @itemx 21064
16710 Schedules as an EV4 and has no instruction set extensions.
16711
16712 @item ev5
16713 @itemx 21164
16714 Schedules as an EV5 and has no instruction set extensions.
16715
16716 @item ev56
16717 @itemx 21164a
16718 Schedules as an EV5 and supports the BWX extension.
16719
16720 @item pca56
16721 @itemx 21164pc
16722 @itemx 21164PC
16723 Schedules as an EV5 and supports the BWX and MAX extensions.
16724
16725 @item ev6
16726 @itemx 21264
16727 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
16728
16729 @item ev67
16730 @itemx 21264a
16731 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
16732 @end table
16733
16734 Native toolchains also support the value @samp{native},
16735 which selects the best architecture option for the host processor.
16736 @option{-mcpu=native} has no effect if GCC does not recognize
16737 the processor.
16738
16739 @item -mtune=@var{cpu_type}
16740 @opindex mtune
16741 Set only the instruction scheduling parameters for machine type
16742 @var{cpu_type}. The instruction set is not changed.
16743
16744 Native toolchains also support the value @samp{native},
16745 which selects the best architecture option for the host processor.
16746 @option{-mtune=native} has no effect if GCC does not recognize
16747 the processor.
16748
16749 @item -mmemory-latency=@var{time}
16750 @opindex mmemory-latency
16751 Sets the latency the scheduler should assume for typical memory
16752 references as seen by the application. This number is highly
16753 dependent on the memory access patterns used by the application
16754 and the size of the external cache on the machine.
16755
16756 Valid options for @var{time} are
16757
16758 @table @samp
16759 @item @var{number}
16760 A decimal number representing clock cycles.
16761
16762 @item L1
16763 @itemx L2
16764 @itemx L3
16765 @itemx main
16766 The compiler contains estimates of the number of clock cycles for
16767 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
16768 (also called Dcache, Scache, and Bcache), as well as to main memory.
16769 Note that L3 is only valid for EV5.
16770
16771 @end table
16772 @end table
16773
16774 @node FR30 Options
16775 @subsection FR30 Options
16776 @cindex FR30 Options
16777
16778 These options are defined specifically for the FR30 port.
16779
16780 @table @gcctabopt
16781
16782 @item -msmall-model
16783 @opindex msmall-model
16784 Use the small address space model. This can produce smaller code, but
16785 it does assume that all symbolic values and addresses fit into a
16786 20-bit range.
16787
16788 @item -mno-lsim
16789 @opindex mno-lsim
16790 Assume that runtime support has been provided and so there is no need
16791 to include the simulator library (@file{libsim.a}) on the linker
16792 command line.
16793
16794 @end table
16795
16796 @node FT32 Options
16797 @subsection FT32 Options
16798 @cindex FT32 Options
16799
16800 These options are defined specifically for the FT32 port.
16801
16802 @table @gcctabopt
16803
16804 @item -msim
16805 @opindex msim
16806 Specifies that the program will be run on the simulator. This causes
16807 an alternate runtime startup and library to be linked.
16808 You must not use this option when generating programs that will run on
16809 real hardware; you must provide your own runtime library for whatever
16810 I/O functions are needed.
16811
16812 @item -mlra
16813 @opindex mlra
16814 Enable Local Register Allocation. This is still experimental for FT32,
16815 so by default the compiler uses standard reload.
16816
16817 @item -mnodiv
16818 @opindex mnodiv
16819 Do not use div and mod instructions.
16820
16821 @end table
16822
16823 @node FRV Options
16824 @subsection FRV Options
16825 @cindex FRV Options
16826
16827 @table @gcctabopt
16828 @item -mgpr-32
16829 @opindex mgpr-32
16830
16831 Only use the first 32 general-purpose registers.
16832
16833 @item -mgpr-64
16834 @opindex mgpr-64
16835
16836 Use all 64 general-purpose registers.
16837
16838 @item -mfpr-32
16839 @opindex mfpr-32
16840
16841 Use only the first 32 floating-point registers.
16842
16843 @item -mfpr-64
16844 @opindex mfpr-64
16845
16846 Use all 64 floating-point registers.
16847
16848 @item -mhard-float
16849 @opindex mhard-float
16850
16851 Use hardware instructions for floating-point operations.
16852
16853 @item -msoft-float
16854 @opindex msoft-float
16855
16856 Use library routines for floating-point operations.
16857
16858 @item -malloc-cc
16859 @opindex malloc-cc
16860
16861 Dynamically allocate condition code registers.
16862
16863 @item -mfixed-cc
16864 @opindex mfixed-cc
16865
16866 Do not try to dynamically allocate condition code registers, only
16867 use @code{icc0} and @code{fcc0}.
16868
16869 @item -mdword
16870 @opindex mdword
16871
16872 Change ABI to use double word insns.
16873
16874 @item -mno-dword
16875 @opindex mno-dword
16876
16877 Do not use double word instructions.
16878
16879 @item -mdouble
16880 @opindex mdouble
16881
16882 Use floating-point double instructions.
16883
16884 @item -mno-double
16885 @opindex mno-double
16886
16887 Do not use floating-point double instructions.
16888
16889 @item -mmedia
16890 @opindex mmedia
16891
16892 Use media instructions.
16893
16894 @item -mno-media
16895 @opindex mno-media
16896
16897 Do not use media instructions.
16898
16899 @item -mmuladd
16900 @opindex mmuladd
16901
16902 Use multiply and add/subtract instructions.
16903
16904 @item -mno-muladd
16905 @opindex mno-muladd
16906
16907 Do not use multiply and add/subtract instructions.
16908
16909 @item -mfdpic
16910 @opindex mfdpic
16911
16912 Select the FDPIC ABI, which uses function descriptors to represent
16913 pointers to functions. Without any PIC/PIE-related options, it
16914 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
16915 assumes GOT entries and small data are within a 12-bit range from the
16916 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
16917 are computed with 32 bits.
16918 With a @samp{bfin-elf} target, this option implies @option{-msim}.
16919
16920 @item -minline-plt
16921 @opindex minline-plt
16922
16923 Enable inlining of PLT entries in function calls to functions that are
16924 not known to bind locally. It has no effect without @option{-mfdpic}.
16925 It's enabled by default if optimizing for speed and compiling for
16926 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
16927 optimization option such as @option{-O3} or above is present in the
16928 command line.
16929
16930 @item -mTLS
16931 @opindex mTLS
16932
16933 Assume a large TLS segment when generating thread-local code.
16934
16935 @item -mtls
16936 @opindex mtls
16937
16938 Do not assume a large TLS segment when generating thread-local code.
16939
16940 @item -mgprel-ro
16941 @opindex mgprel-ro
16942
16943 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
16944 that is known to be in read-only sections. It's enabled by default,
16945 except for @option{-fpic} or @option{-fpie}: even though it may help
16946 make the global offset table smaller, it trades 1 instruction for 4.
16947 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
16948 one of which may be shared by multiple symbols, and it avoids the need
16949 for a GOT entry for the referenced symbol, so it's more likely to be a
16950 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
16951
16952 @item -multilib-library-pic
16953 @opindex multilib-library-pic
16954
16955 Link with the (library, not FD) pic libraries. It's implied by
16956 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
16957 @option{-fpic} without @option{-mfdpic}. You should never have to use
16958 it explicitly.
16959
16960 @item -mlinked-fp
16961 @opindex mlinked-fp
16962
16963 Follow the EABI requirement of always creating a frame pointer whenever
16964 a stack frame is allocated. This option is enabled by default and can
16965 be disabled with @option{-mno-linked-fp}.
16966
16967 @item -mlong-calls
16968 @opindex mlong-calls
16969
16970 Use indirect addressing to call functions outside the current
16971 compilation unit. This allows the functions to be placed anywhere
16972 within the 32-bit address space.
16973
16974 @item -malign-labels
16975 @opindex malign-labels
16976
16977 Try to align labels to an 8-byte boundary by inserting NOPs into the
16978 previous packet. This option only has an effect when VLIW packing
16979 is enabled. It doesn't create new packets; it merely adds NOPs to
16980 existing ones.
16981
16982 @item -mlibrary-pic
16983 @opindex mlibrary-pic
16984
16985 Generate position-independent EABI code.
16986
16987 @item -macc-4
16988 @opindex macc-4
16989
16990 Use only the first four media accumulator registers.
16991
16992 @item -macc-8
16993 @opindex macc-8
16994
16995 Use all eight media accumulator registers.
16996
16997 @item -mpack
16998 @opindex mpack
16999
17000 Pack VLIW instructions.
17001
17002 @item -mno-pack
17003 @opindex mno-pack
17004
17005 Do not pack VLIW instructions.
17006
17007 @item -mno-eflags
17008 @opindex mno-eflags
17009
17010 Do not mark ABI switches in e_flags.
17011
17012 @item -mcond-move
17013 @opindex mcond-move
17014
17015 Enable the use of conditional-move instructions (default).
17016
17017 This switch is mainly for debugging the compiler and will likely be removed
17018 in a future version.
17019
17020 @item -mno-cond-move
17021 @opindex mno-cond-move
17022
17023 Disable the use of conditional-move instructions.
17024
17025 This switch is mainly for debugging the compiler and will likely be removed
17026 in a future version.
17027
17028 @item -mscc
17029 @opindex mscc
17030
17031 Enable the use of conditional set instructions (default).
17032
17033 This switch is mainly for debugging the compiler and will likely be removed
17034 in a future version.
17035
17036 @item -mno-scc
17037 @opindex mno-scc
17038
17039 Disable the use of conditional set instructions.
17040
17041 This switch is mainly for debugging the compiler and will likely be removed
17042 in a future version.
17043
17044 @item -mcond-exec
17045 @opindex mcond-exec
17046
17047 Enable the use of conditional execution (default).
17048
17049 This switch is mainly for debugging the compiler and will likely be removed
17050 in a future version.
17051
17052 @item -mno-cond-exec
17053 @opindex mno-cond-exec
17054
17055 Disable the use of conditional execution.
17056
17057 This switch is mainly for debugging the compiler and will likely be removed
17058 in a future version.
17059
17060 @item -mvliw-branch
17061 @opindex mvliw-branch
17062
17063 Run a pass to pack branches into VLIW instructions (default).
17064
17065 This switch is mainly for debugging the compiler and will likely be removed
17066 in a future version.
17067
17068 @item -mno-vliw-branch
17069 @opindex mno-vliw-branch
17070
17071 Do not run a pass to pack branches into VLIW instructions.
17072
17073 This switch is mainly for debugging the compiler and will likely be removed
17074 in a future version.
17075
17076 @item -mmulti-cond-exec
17077 @opindex mmulti-cond-exec
17078
17079 Enable optimization of @code{&&} and @code{||} in conditional execution
17080 (default).
17081
17082 This switch is mainly for debugging the compiler and will likely be removed
17083 in a future version.
17084
17085 @item -mno-multi-cond-exec
17086 @opindex mno-multi-cond-exec
17087
17088 Disable optimization of @code{&&} and @code{||} in conditional execution.
17089
17090 This switch is mainly for debugging the compiler and will likely be removed
17091 in a future version.
17092
17093 @item -mnested-cond-exec
17094 @opindex mnested-cond-exec
17095
17096 Enable nested conditional execution optimizations (default).
17097
17098 This switch is mainly for debugging the compiler and will likely be removed
17099 in a future version.
17100
17101 @item -mno-nested-cond-exec
17102 @opindex mno-nested-cond-exec
17103
17104 Disable nested conditional execution optimizations.
17105
17106 This switch is mainly for debugging the compiler and will likely be removed
17107 in a future version.
17108
17109 @item -moptimize-membar
17110 @opindex moptimize-membar
17111
17112 This switch removes redundant @code{membar} instructions from the
17113 compiler-generated code. It is enabled by default.
17114
17115 @item -mno-optimize-membar
17116 @opindex mno-optimize-membar
17117
17118 This switch disables the automatic removal of redundant @code{membar}
17119 instructions from the generated code.
17120
17121 @item -mtomcat-stats
17122 @opindex mtomcat-stats
17123
17124 Cause gas to print out tomcat statistics.
17125
17126 @item -mcpu=@var{cpu}
17127 @opindex mcpu
17128
17129 Select the processor type for which to generate code. Possible values are
17130 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
17131 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
17132
17133 @end table
17134
17135 @node GNU/Linux Options
17136 @subsection GNU/Linux Options
17137
17138 These @samp{-m} options are defined for GNU/Linux targets:
17139
17140 @table @gcctabopt
17141 @item -mglibc
17142 @opindex mglibc
17143 Use the GNU C library. This is the default except
17144 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
17145 @samp{*-*-linux-*android*} targets.
17146
17147 @item -muclibc
17148 @opindex muclibc
17149 Use uClibc C library. This is the default on
17150 @samp{*-*-linux-*uclibc*} targets.
17151
17152 @item -mmusl
17153 @opindex mmusl
17154 Use the musl C library. This is the default on
17155 @samp{*-*-linux-*musl*} targets.
17156
17157 @item -mbionic
17158 @opindex mbionic
17159 Use Bionic C library. This is the default on
17160 @samp{*-*-linux-*android*} targets.
17161
17162 @item -mandroid
17163 @opindex mandroid
17164 Compile code compatible with Android platform. This is the default on
17165 @samp{*-*-linux-*android*} targets.
17166
17167 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
17168 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
17169 this option makes the GCC driver pass Android-specific options to the linker.
17170 Finally, this option causes the preprocessor macro @code{__ANDROID__}
17171 to be defined.
17172
17173 @item -tno-android-cc
17174 @opindex tno-android-cc
17175 Disable compilation effects of @option{-mandroid}, i.e., do not enable
17176 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
17177 @option{-fno-rtti} by default.
17178
17179 @item -tno-android-ld
17180 @opindex tno-android-ld
17181 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
17182 linking options to the linker.
17183
17184 @end table
17185
17186 @node H8/300 Options
17187 @subsection H8/300 Options
17188
17189 These @samp{-m} options are defined for the H8/300 implementations:
17190
17191 @table @gcctabopt
17192 @item -mrelax
17193 @opindex mrelax
17194 Shorten some address references at link time, when possible; uses the
17195 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
17196 ld, Using ld}, for a fuller description.
17197
17198 @item -mh
17199 @opindex mh
17200 Generate code for the H8/300H@.
17201
17202 @item -ms
17203 @opindex ms
17204 Generate code for the H8S@.
17205
17206 @item -mn
17207 @opindex mn
17208 Generate code for the H8S and H8/300H in the normal mode. This switch
17209 must be used either with @option{-mh} or @option{-ms}.
17210
17211 @item -ms2600
17212 @opindex ms2600
17213 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
17214
17215 @item -mexr
17216 @opindex mexr
17217 Extended registers are stored on stack before execution of function
17218 with monitor attribute. Default option is @option{-mexr}.
17219 This option is valid only for H8S targets.
17220
17221 @item -mno-exr
17222 @opindex mno-exr
17223 Extended registers are not stored on stack before execution of function
17224 with monitor attribute. Default option is @option{-mno-exr}.
17225 This option is valid only for H8S targets.
17226
17227 @item -mint32
17228 @opindex mint32
17229 Make @code{int} data 32 bits by default.
17230
17231 @item -malign-300
17232 @opindex malign-300
17233 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
17234 The default for the H8/300H and H8S is to align longs and floats on
17235 4-byte boundaries.
17236 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
17237 This option has no effect on the H8/300.
17238 @end table
17239
17240 @node HPPA Options
17241 @subsection HPPA Options
17242 @cindex HPPA Options
17243
17244 These @samp{-m} options are defined for the HPPA family of computers:
17245
17246 @table @gcctabopt
17247 @item -march=@var{architecture-type}
17248 @opindex march
17249 Generate code for the specified architecture. The choices for
17250 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
17251 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
17252 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
17253 architecture option for your machine. Code compiled for lower numbered
17254 architectures runs on higher numbered architectures, but not the
17255 other way around.
17256
17257 @item -mpa-risc-1-0
17258 @itemx -mpa-risc-1-1
17259 @itemx -mpa-risc-2-0
17260 @opindex mpa-risc-1-0
17261 @opindex mpa-risc-1-1
17262 @opindex mpa-risc-2-0
17263 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
17264
17265 @item -mjump-in-delay
17266 @opindex mjump-in-delay
17267 This option is ignored and provided for compatibility purposes only.
17268
17269 @item -mdisable-fpregs
17270 @opindex mdisable-fpregs
17271 Prevent floating-point registers from being used in any manner. This is
17272 necessary for compiling kernels that perform lazy context switching of
17273 floating-point registers. If you use this option and attempt to perform
17274 floating-point operations, the compiler aborts.
17275
17276 @item -mdisable-indexing
17277 @opindex mdisable-indexing
17278 Prevent the compiler from using indexing address modes. This avoids some
17279 rather obscure problems when compiling MIG generated code under MACH@.
17280
17281 @item -mno-space-regs
17282 @opindex mno-space-regs
17283 Generate code that assumes the target has no space registers. This allows
17284 GCC to generate faster indirect calls and use unscaled index address modes.
17285
17286 Such code is suitable for level 0 PA systems and kernels.
17287
17288 @item -mfast-indirect-calls
17289 @opindex mfast-indirect-calls
17290 Generate code that assumes calls never cross space boundaries. This
17291 allows GCC to emit code that performs faster indirect calls.
17292
17293 This option does not work in the presence of shared libraries or nested
17294 functions.
17295
17296 @item -mfixed-range=@var{register-range}
17297 @opindex mfixed-range
17298 Generate code treating the given register range as fixed registers.
17299 A fixed register is one that the register allocator cannot use. This is
17300 useful when compiling kernel code. A register range is specified as
17301 two registers separated by a dash. Multiple register ranges can be
17302 specified separated by a comma.
17303
17304 @item -mlong-load-store
17305 @opindex mlong-load-store
17306 Generate 3-instruction load and store sequences as sometimes required by
17307 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
17308 the HP compilers.
17309
17310 @item -mportable-runtime
17311 @opindex mportable-runtime
17312 Use the portable calling conventions proposed by HP for ELF systems.
17313
17314 @item -mgas
17315 @opindex mgas
17316 Enable the use of assembler directives only GAS understands.
17317
17318 @item -mschedule=@var{cpu-type}
17319 @opindex mschedule
17320 Schedule code according to the constraints for the machine type
17321 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
17322 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
17323 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
17324 proper scheduling option for your machine. The default scheduling is
17325 @samp{8000}.
17326
17327 @item -mlinker-opt
17328 @opindex mlinker-opt
17329 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
17330 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
17331 linkers in which they give bogus error messages when linking some programs.
17332
17333 @item -msoft-float
17334 @opindex msoft-float
17335 Generate output containing library calls for floating point.
17336 @strong{Warning:} the requisite libraries are not available for all HPPA
17337 targets. Normally the facilities of the machine's usual C compiler are
17338 used, but this cannot be done directly in cross-compilation. You must make
17339 your own arrangements to provide suitable library functions for
17340 cross-compilation.
17341
17342 @option{-msoft-float} changes the calling convention in the output file;
17343 therefore, it is only useful if you compile @emph{all} of a program with
17344 this option. In particular, you need to compile @file{libgcc.a}, the
17345 library that comes with GCC, with @option{-msoft-float} in order for
17346 this to work.
17347
17348 @item -msio
17349 @opindex msio
17350 Generate the predefine, @code{_SIO}, for server IO@. The default is
17351 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
17352 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
17353 options are available under HP-UX and HI-UX@.
17354
17355 @item -mgnu-ld
17356 @opindex mgnu-ld
17357 Use options specific to GNU @command{ld}.
17358 This passes @option{-shared} to @command{ld} when
17359 building a shared library. It is the default when GCC is configured,
17360 explicitly or implicitly, with the GNU linker. This option does not
17361 affect which @command{ld} is called; it only changes what parameters
17362 are passed to that @command{ld}.
17363 The @command{ld} that is called is determined by the
17364 @option{--with-ld} configure option, GCC's program search path, and
17365 finally by the user's @env{PATH}. The linker used by GCC can be printed
17366 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
17367 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
17368
17369 @item -mhp-ld
17370 @opindex mhp-ld
17371 Use options specific to HP @command{ld}.
17372 This passes @option{-b} to @command{ld} when building
17373 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
17374 links. It is the default when GCC is configured, explicitly or
17375 implicitly, with the HP linker. This option does not affect
17376 which @command{ld} is called; it only changes what parameters are passed to that
17377 @command{ld}.
17378 The @command{ld} that is called is determined by the @option{--with-ld}
17379 configure option, GCC's program search path, and finally by the user's
17380 @env{PATH}. The linker used by GCC can be printed using @samp{which
17381 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
17382 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
17383
17384 @item -mlong-calls
17385 @opindex mno-long-calls
17386 Generate code that uses long call sequences. This ensures that a call
17387 is always able to reach linker generated stubs. The default is to generate
17388 long calls only when the distance from the call site to the beginning
17389 of the function or translation unit, as the case may be, exceeds a
17390 predefined limit set by the branch type being used. The limits for
17391 normal calls are 7,600,000 and 240,000 bytes, respectively for the
17392 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
17393 240,000 bytes.
17394
17395 Distances are measured from the beginning of functions when using the
17396 @option{-ffunction-sections} option, or when using the @option{-mgas}
17397 and @option{-mno-portable-runtime} options together under HP-UX with
17398 the SOM linker.
17399
17400 It is normally not desirable to use this option as it degrades
17401 performance. However, it may be useful in large applications,
17402 particularly when partial linking is used to build the application.
17403
17404 The types of long calls used depends on the capabilities of the
17405 assembler and linker, and the type of code being generated. The
17406 impact on systems that support long absolute calls, and long pic
17407 symbol-difference or pc-relative calls should be relatively small.
17408 However, an indirect call is used on 32-bit ELF systems in pic code
17409 and it is quite long.
17410
17411 @item -munix=@var{unix-std}
17412 @opindex march
17413 Generate compiler predefines and select a startfile for the specified
17414 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
17415 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
17416 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
17417 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
17418 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
17419 and later.
17420
17421 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
17422 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
17423 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
17424 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
17425 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
17426 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
17427
17428 It is @emph{important} to note that this option changes the interfaces
17429 for various library routines. It also affects the operational behavior
17430 of the C library. Thus, @emph{extreme} care is needed in using this
17431 option.
17432
17433 Library code that is intended to operate with more than one UNIX
17434 standard must test, set and restore the variable @code{__xpg4_extended_mask}
17435 as appropriate. Most GNU software doesn't provide this capability.
17436
17437 @item -nolibdld
17438 @opindex nolibdld
17439 Suppress the generation of link options to search libdld.sl when the
17440 @option{-static} option is specified on HP-UX 10 and later.
17441
17442 @item -static
17443 @opindex static
17444 The HP-UX implementation of setlocale in libc has a dependency on
17445 libdld.sl. There isn't an archive version of libdld.sl. Thus,
17446 when the @option{-static} option is specified, special link options
17447 are needed to resolve this dependency.
17448
17449 On HP-UX 10 and later, the GCC driver adds the necessary options to
17450 link with libdld.sl when the @option{-static} option is specified.
17451 This causes the resulting binary to be dynamic. On the 64-bit port,
17452 the linkers generate dynamic binaries by default in any case. The
17453 @option{-nolibdld} option can be used to prevent the GCC driver from
17454 adding these link options.
17455
17456 @item -threads
17457 @opindex threads
17458 Add support for multithreading with the @dfn{dce thread} library
17459 under HP-UX@. This option sets flags for both the preprocessor and
17460 linker.
17461 @end table
17462
17463 @node IA-64 Options
17464 @subsection IA-64 Options
17465 @cindex IA-64 Options
17466
17467 These are the @samp{-m} options defined for the Intel IA-64 architecture.
17468
17469 @table @gcctabopt
17470 @item -mbig-endian
17471 @opindex mbig-endian
17472 Generate code for a big-endian target. This is the default for HP-UX@.
17473
17474 @item -mlittle-endian
17475 @opindex mlittle-endian
17476 Generate code for a little-endian target. This is the default for AIX5
17477 and GNU/Linux.
17478
17479 @item -mgnu-as
17480 @itemx -mno-gnu-as
17481 @opindex mgnu-as
17482 @opindex mno-gnu-as
17483 Generate (or don't) code for the GNU assembler. This is the default.
17484 @c Also, this is the default if the configure option @option{--with-gnu-as}
17485 @c is used.
17486
17487 @item -mgnu-ld
17488 @itemx -mno-gnu-ld
17489 @opindex mgnu-ld
17490 @opindex mno-gnu-ld
17491 Generate (or don't) code for the GNU linker. This is the default.
17492 @c Also, this is the default if the configure option @option{--with-gnu-ld}
17493 @c is used.
17494
17495 @item -mno-pic
17496 @opindex mno-pic
17497 Generate code that does not use a global pointer register. The result
17498 is not position independent code, and violates the IA-64 ABI@.
17499
17500 @item -mvolatile-asm-stop
17501 @itemx -mno-volatile-asm-stop
17502 @opindex mvolatile-asm-stop
17503 @opindex mno-volatile-asm-stop
17504 Generate (or don't) a stop bit immediately before and after volatile asm
17505 statements.
17506
17507 @item -mregister-names
17508 @itemx -mno-register-names
17509 @opindex mregister-names
17510 @opindex mno-register-names
17511 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
17512 the stacked registers. This may make assembler output more readable.
17513
17514 @item -mno-sdata
17515 @itemx -msdata
17516 @opindex mno-sdata
17517 @opindex msdata
17518 Disable (or enable) optimizations that use the small data section. This may
17519 be useful for working around optimizer bugs.
17520
17521 @item -mconstant-gp
17522 @opindex mconstant-gp
17523 Generate code that uses a single constant global pointer value. This is
17524 useful when compiling kernel code.
17525
17526 @item -mauto-pic
17527 @opindex mauto-pic
17528 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
17529 This is useful when compiling firmware code.
17530
17531 @item -minline-float-divide-min-latency
17532 @opindex minline-float-divide-min-latency
17533 Generate code for inline divides of floating-point values
17534 using the minimum latency algorithm.
17535
17536 @item -minline-float-divide-max-throughput
17537 @opindex minline-float-divide-max-throughput
17538 Generate code for inline divides of floating-point values
17539 using the maximum throughput algorithm.
17540
17541 @item -mno-inline-float-divide
17542 @opindex mno-inline-float-divide
17543 Do not generate inline code for divides of floating-point values.
17544
17545 @item -minline-int-divide-min-latency
17546 @opindex minline-int-divide-min-latency
17547 Generate code for inline divides of integer values
17548 using the minimum latency algorithm.
17549
17550 @item -minline-int-divide-max-throughput
17551 @opindex minline-int-divide-max-throughput
17552 Generate code for inline divides of integer values
17553 using the maximum throughput algorithm.
17554
17555 @item -mno-inline-int-divide
17556 @opindex mno-inline-int-divide
17557 Do not generate inline code for divides of integer values.
17558
17559 @item -minline-sqrt-min-latency
17560 @opindex minline-sqrt-min-latency
17561 Generate code for inline square roots
17562 using the minimum latency algorithm.
17563
17564 @item -minline-sqrt-max-throughput
17565 @opindex minline-sqrt-max-throughput
17566 Generate code for inline square roots
17567 using the maximum throughput algorithm.
17568
17569 @item -mno-inline-sqrt
17570 @opindex mno-inline-sqrt
17571 Do not generate inline code for @code{sqrt}.
17572
17573 @item -mfused-madd
17574 @itemx -mno-fused-madd
17575 @opindex mfused-madd
17576 @opindex mno-fused-madd
17577 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
17578 instructions. The default is to use these instructions.
17579
17580 @item -mno-dwarf2-asm
17581 @itemx -mdwarf2-asm
17582 @opindex mno-dwarf2-asm
17583 @opindex mdwarf2-asm
17584 Don't (or do) generate assembler code for the DWARF line number debugging
17585 info. This may be useful when not using the GNU assembler.
17586
17587 @item -mearly-stop-bits
17588 @itemx -mno-early-stop-bits
17589 @opindex mearly-stop-bits
17590 @opindex mno-early-stop-bits
17591 Allow stop bits to be placed earlier than immediately preceding the
17592 instruction that triggered the stop bit. This can improve instruction
17593 scheduling, but does not always do so.
17594
17595 @item -mfixed-range=@var{register-range}
17596 @opindex mfixed-range
17597 Generate code treating the given register range as fixed registers.
17598 A fixed register is one that the register allocator cannot use. This is
17599 useful when compiling kernel code. A register range is specified as
17600 two registers separated by a dash. Multiple register ranges can be
17601 specified separated by a comma.
17602
17603 @item -mtls-size=@var{tls-size}
17604 @opindex mtls-size
17605 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
17606 64.
17607
17608 @item -mtune=@var{cpu-type}
17609 @opindex mtune
17610 Tune the instruction scheduling for a particular CPU, Valid values are
17611 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
17612 and @samp{mckinley}.
17613
17614 @item -milp32
17615 @itemx -mlp64
17616 @opindex milp32
17617 @opindex mlp64
17618 Generate code for a 32-bit or 64-bit environment.
17619 The 32-bit environment sets int, long and pointer to 32 bits.
17620 The 64-bit environment sets int to 32 bits and long and pointer
17621 to 64 bits. These are HP-UX specific flags.
17622
17623 @item -mno-sched-br-data-spec
17624 @itemx -msched-br-data-spec
17625 @opindex mno-sched-br-data-spec
17626 @opindex msched-br-data-spec
17627 (Dis/En)able data speculative scheduling before reload.
17628 This results in generation of @code{ld.a} instructions and
17629 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17630 The default setting is disabled.
17631
17632 @item -msched-ar-data-spec
17633 @itemx -mno-sched-ar-data-spec
17634 @opindex msched-ar-data-spec
17635 @opindex mno-sched-ar-data-spec
17636 (En/Dis)able data speculative scheduling after reload.
17637 This results in generation of @code{ld.a} instructions and
17638 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17639 The default setting is enabled.
17640
17641 @item -mno-sched-control-spec
17642 @itemx -msched-control-spec
17643 @opindex mno-sched-control-spec
17644 @opindex msched-control-spec
17645 (Dis/En)able control speculative scheduling. This feature is
17646 available only during region scheduling (i.e.@: before reload).
17647 This results in generation of the @code{ld.s} instructions and
17648 the corresponding check instructions @code{chk.s}.
17649 The default setting is disabled.
17650
17651 @item -msched-br-in-data-spec
17652 @itemx -mno-sched-br-in-data-spec
17653 @opindex msched-br-in-data-spec
17654 @opindex mno-sched-br-in-data-spec
17655 (En/Dis)able speculative scheduling of the instructions that
17656 are dependent on the data speculative loads before reload.
17657 This is effective only with @option{-msched-br-data-spec} enabled.
17658 The default setting is enabled.
17659
17660 @item -msched-ar-in-data-spec
17661 @itemx -mno-sched-ar-in-data-spec
17662 @opindex msched-ar-in-data-spec
17663 @opindex mno-sched-ar-in-data-spec
17664 (En/Dis)able speculative scheduling of the instructions that
17665 are dependent on the data speculative loads after reload.
17666 This is effective only with @option{-msched-ar-data-spec} enabled.
17667 The default setting is enabled.
17668
17669 @item -msched-in-control-spec
17670 @itemx -mno-sched-in-control-spec
17671 @opindex msched-in-control-spec
17672 @opindex mno-sched-in-control-spec
17673 (En/Dis)able speculative scheduling of the instructions that
17674 are dependent on the control speculative loads.
17675 This is effective only with @option{-msched-control-spec} enabled.
17676 The default setting is enabled.
17677
17678 @item -mno-sched-prefer-non-data-spec-insns
17679 @itemx -msched-prefer-non-data-spec-insns
17680 @opindex mno-sched-prefer-non-data-spec-insns
17681 @opindex msched-prefer-non-data-spec-insns
17682 If enabled, data-speculative instructions are chosen for schedule
17683 only if there are no other choices at the moment. This makes
17684 the use of the data speculation much more conservative.
17685 The default setting is disabled.
17686
17687 @item -mno-sched-prefer-non-control-spec-insns
17688 @itemx -msched-prefer-non-control-spec-insns
17689 @opindex mno-sched-prefer-non-control-spec-insns
17690 @opindex msched-prefer-non-control-spec-insns
17691 If enabled, control-speculative instructions are chosen for schedule
17692 only if there are no other choices at the moment. This makes
17693 the use of the control speculation much more conservative.
17694 The default setting is disabled.
17695
17696 @item -mno-sched-count-spec-in-critical-path
17697 @itemx -msched-count-spec-in-critical-path
17698 @opindex mno-sched-count-spec-in-critical-path
17699 @opindex msched-count-spec-in-critical-path
17700 If enabled, speculative dependencies are considered during
17701 computation of the instructions priorities. This makes the use of the
17702 speculation a bit more conservative.
17703 The default setting is disabled.
17704
17705 @item -msched-spec-ldc
17706 @opindex msched-spec-ldc
17707 Use a simple data speculation check. This option is on by default.
17708
17709 @item -msched-control-spec-ldc
17710 @opindex msched-spec-ldc
17711 Use a simple check for control speculation. This option is on by default.
17712
17713 @item -msched-stop-bits-after-every-cycle
17714 @opindex msched-stop-bits-after-every-cycle
17715 Place a stop bit after every cycle when scheduling. This option is on
17716 by default.
17717
17718 @item -msched-fp-mem-deps-zero-cost
17719 @opindex msched-fp-mem-deps-zero-cost
17720 Assume that floating-point stores and loads are not likely to cause a conflict
17721 when placed into the same instruction group. This option is disabled by
17722 default.
17723
17724 @item -msel-sched-dont-check-control-spec
17725 @opindex msel-sched-dont-check-control-spec
17726 Generate checks for control speculation in selective scheduling.
17727 This flag is disabled by default.
17728
17729 @item -msched-max-memory-insns=@var{max-insns}
17730 @opindex msched-max-memory-insns
17731 Limit on the number of memory insns per instruction group, giving lower
17732 priority to subsequent memory insns attempting to schedule in the same
17733 instruction group. Frequently useful to prevent cache bank conflicts.
17734 The default value is 1.
17735
17736 @item -msched-max-memory-insns-hard-limit
17737 @opindex msched-max-memory-insns-hard-limit
17738 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
17739 disallowing more than that number in an instruction group.
17740 Otherwise, the limit is ``soft'', meaning that non-memory operations
17741 are preferred when the limit is reached, but memory operations may still
17742 be scheduled.
17743
17744 @end table
17745
17746 @node LM32 Options
17747 @subsection LM32 Options
17748 @cindex LM32 options
17749
17750 These @option{-m} options are defined for the LatticeMico32 architecture:
17751
17752 @table @gcctabopt
17753 @item -mbarrel-shift-enabled
17754 @opindex mbarrel-shift-enabled
17755 Enable barrel-shift instructions.
17756
17757 @item -mdivide-enabled
17758 @opindex mdivide-enabled
17759 Enable divide and modulus instructions.
17760
17761 @item -mmultiply-enabled
17762 @opindex multiply-enabled
17763 Enable multiply instructions.
17764
17765 @item -msign-extend-enabled
17766 @opindex msign-extend-enabled
17767 Enable sign extend instructions.
17768
17769 @item -muser-enabled
17770 @opindex muser-enabled
17771 Enable user-defined instructions.
17772
17773 @end table
17774
17775 @node M32C Options
17776 @subsection M32C Options
17777 @cindex M32C options
17778
17779 @table @gcctabopt
17780 @item -mcpu=@var{name}
17781 @opindex mcpu=
17782 Select the CPU for which code is generated. @var{name} may be one of
17783 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
17784 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
17785 the M32C/80 series.
17786
17787 @item -msim
17788 @opindex msim
17789 Specifies that the program will be run on the simulator. This causes
17790 an alternate runtime library to be linked in which supports, for
17791 example, file I/O@. You must not use this option when generating
17792 programs that will run on real hardware; you must provide your own
17793 runtime library for whatever I/O functions are needed.
17794
17795 @item -memregs=@var{number}
17796 @opindex memregs=
17797 Specifies the number of memory-based pseudo-registers GCC uses
17798 during code generation. These pseudo-registers are used like real
17799 registers, so there is a tradeoff between GCC's ability to fit the
17800 code into available registers, and the performance penalty of using
17801 memory instead of registers. Note that all modules in a program must
17802 be compiled with the same value for this option. Because of that, you
17803 must not use this option with GCC's default runtime libraries.
17804
17805 @end table
17806
17807 @node M32R/D Options
17808 @subsection M32R/D Options
17809 @cindex M32R/D options
17810
17811 These @option{-m} options are defined for Renesas M32R/D architectures:
17812
17813 @table @gcctabopt
17814 @item -m32r2
17815 @opindex m32r2
17816 Generate code for the M32R/2@.
17817
17818 @item -m32rx
17819 @opindex m32rx
17820 Generate code for the M32R/X@.
17821
17822 @item -m32r
17823 @opindex m32r
17824 Generate code for the M32R@. This is the default.
17825
17826 @item -mmodel=small
17827 @opindex mmodel=small
17828 Assume all objects live in the lower 16MB of memory (so that their addresses
17829 can be loaded with the @code{ld24} instruction), and assume all subroutines
17830 are reachable with the @code{bl} instruction.
17831 This is the default.
17832
17833 The addressability of a particular object can be set with the
17834 @code{model} attribute.
17835
17836 @item -mmodel=medium
17837 @opindex mmodel=medium
17838 Assume objects may be anywhere in the 32-bit address space (the compiler
17839 generates @code{seth/add3} instructions to load their addresses), and
17840 assume all subroutines are reachable with the @code{bl} instruction.
17841
17842 @item -mmodel=large
17843 @opindex mmodel=large
17844 Assume objects may be anywhere in the 32-bit address space (the compiler
17845 generates @code{seth/add3} instructions to load their addresses), and
17846 assume subroutines may not be reachable with the @code{bl} instruction
17847 (the compiler generates the much slower @code{seth/add3/jl}
17848 instruction sequence).
17849
17850 @item -msdata=none
17851 @opindex msdata=none
17852 Disable use of the small data area. Variables are put into
17853 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
17854 @code{section} attribute has been specified).
17855 This is the default.
17856
17857 The small data area consists of sections @code{.sdata} and @code{.sbss}.
17858 Objects may be explicitly put in the small data area with the
17859 @code{section} attribute using one of these sections.
17860
17861 @item -msdata=sdata
17862 @opindex msdata=sdata
17863 Put small global and static data in the small data area, but do not
17864 generate special code to reference them.
17865
17866 @item -msdata=use
17867 @opindex msdata=use
17868 Put small global and static data in the small data area, and generate
17869 special instructions to reference them.
17870
17871 @item -G @var{num}
17872 @opindex G
17873 @cindex smaller data references
17874 Put global and static objects less than or equal to @var{num} bytes
17875 into the small data or BSS sections instead of the normal data or BSS
17876 sections. The default value of @var{num} is 8.
17877 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
17878 for this option to have any effect.
17879
17880 All modules should be compiled with the same @option{-G @var{num}} value.
17881 Compiling with different values of @var{num} may or may not work; if it
17882 doesn't the linker gives an error message---incorrect code is not
17883 generated.
17884
17885 @item -mdebug
17886 @opindex mdebug
17887 Makes the M32R-specific code in the compiler display some statistics
17888 that might help in debugging programs.
17889
17890 @item -malign-loops
17891 @opindex malign-loops
17892 Align all loops to a 32-byte boundary.
17893
17894 @item -mno-align-loops
17895 @opindex mno-align-loops
17896 Do not enforce a 32-byte alignment for loops. This is the default.
17897
17898 @item -missue-rate=@var{number}
17899 @opindex missue-rate=@var{number}
17900 Issue @var{number} instructions per cycle. @var{number} can only be 1
17901 or 2.
17902
17903 @item -mbranch-cost=@var{number}
17904 @opindex mbranch-cost=@var{number}
17905 @var{number} can only be 1 or 2. If it is 1 then branches are
17906 preferred over conditional code, if it is 2, then the opposite applies.
17907
17908 @item -mflush-trap=@var{number}
17909 @opindex mflush-trap=@var{number}
17910 Specifies the trap number to use to flush the cache. The default is
17911 12. Valid numbers are between 0 and 15 inclusive.
17912
17913 @item -mno-flush-trap
17914 @opindex mno-flush-trap
17915 Specifies that the cache cannot be flushed by using a trap.
17916
17917 @item -mflush-func=@var{name}
17918 @opindex mflush-func=@var{name}
17919 Specifies the name of the operating system function to call to flush
17920 the cache. The default is @samp{_flush_cache}, but a function call
17921 is only used if a trap is not available.
17922
17923 @item -mno-flush-func
17924 @opindex mno-flush-func
17925 Indicates that there is no OS function for flushing the cache.
17926
17927 @end table
17928
17929 @node M680x0 Options
17930 @subsection M680x0 Options
17931 @cindex M680x0 options
17932
17933 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
17934 The default settings depend on which architecture was selected when
17935 the compiler was configured; the defaults for the most common choices
17936 are given below.
17937
17938 @table @gcctabopt
17939 @item -march=@var{arch}
17940 @opindex march
17941 Generate code for a specific M680x0 or ColdFire instruction set
17942 architecture. Permissible values of @var{arch} for M680x0
17943 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
17944 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
17945 architectures are selected according to Freescale's ISA classification
17946 and the permissible values are: @samp{isaa}, @samp{isaaplus},
17947 @samp{isab} and @samp{isac}.
17948
17949 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
17950 code for a ColdFire target. The @var{arch} in this macro is one of the
17951 @option{-march} arguments given above.
17952
17953 When used together, @option{-march} and @option{-mtune} select code
17954 that runs on a family of similar processors but that is optimized
17955 for a particular microarchitecture.
17956
17957 @item -mcpu=@var{cpu}
17958 @opindex mcpu
17959 Generate code for a specific M680x0 or ColdFire processor.
17960 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
17961 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
17962 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
17963 below, which also classifies the CPUs into families:
17964
17965 @multitable @columnfractions 0.20 0.80
17966 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
17967 @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}
17968 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
17969 @item @samp{5206e} @tab @samp{5206e}
17970 @item @samp{5208} @tab @samp{5207} @samp{5208}
17971 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
17972 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
17973 @item @samp{5216} @tab @samp{5214} @samp{5216}
17974 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
17975 @item @samp{5225} @tab @samp{5224} @samp{5225}
17976 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
17977 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
17978 @item @samp{5249} @tab @samp{5249}
17979 @item @samp{5250} @tab @samp{5250}
17980 @item @samp{5271} @tab @samp{5270} @samp{5271}
17981 @item @samp{5272} @tab @samp{5272}
17982 @item @samp{5275} @tab @samp{5274} @samp{5275}
17983 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
17984 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
17985 @item @samp{5307} @tab @samp{5307}
17986 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
17987 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
17988 @item @samp{5407} @tab @samp{5407}
17989 @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}
17990 @end multitable
17991
17992 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
17993 @var{arch} is compatible with @var{cpu}. Other combinations of
17994 @option{-mcpu} and @option{-march} are rejected.
17995
17996 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
17997 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
17998 where the value of @var{family} is given by the table above.
17999
18000 @item -mtune=@var{tune}
18001 @opindex mtune
18002 Tune the code for a particular microarchitecture within the
18003 constraints set by @option{-march} and @option{-mcpu}.
18004 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
18005 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
18006 and @samp{cpu32}. The ColdFire microarchitectures
18007 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
18008
18009 You can also use @option{-mtune=68020-40} for code that needs
18010 to run relatively well on 68020, 68030 and 68040 targets.
18011 @option{-mtune=68020-60} is similar but includes 68060 targets
18012 as well. These two options select the same tuning decisions as
18013 @option{-m68020-40} and @option{-m68020-60} respectively.
18014
18015 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
18016 when tuning for 680x0 architecture @var{arch}. It also defines
18017 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
18018 option is used. If GCC is tuning for a range of architectures,
18019 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
18020 it defines the macros for every architecture in the range.
18021
18022 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
18023 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
18024 of the arguments given above.
18025
18026 @item -m68000
18027 @itemx -mc68000
18028 @opindex m68000
18029 @opindex mc68000
18030 Generate output for a 68000. This is the default
18031 when the compiler is configured for 68000-based systems.
18032 It is equivalent to @option{-march=68000}.
18033
18034 Use this option for microcontrollers with a 68000 or EC000 core,
18035 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
18036
18037 @item -m68010
18038 @opindex m68010
18039 Generate output for a 68010. This is the default
18040 when the compiler is configured for 68010-based systems.
18041 It is equivalent to @option{-march=68010}.
18042
18043 @item -m68020
18044 @itemx -mc68020
18045 @opindex m68020
18046 @opindex mc68020
18047 Generate output for a 68020. This is the default
18048 when the compiler is configured for 68020-based systems.
18049 It is equivalent to @option{-march=68020}.
18050
18051 @item -m68030
18052 @opindex m68030
18053 Generate output for a 68030. This is the default when the compiler is
18054 configured for 68030-based systems. It is equivalent to
18055 @option{-march=68030}.
18056
18057 @item -m68040
18058 @opindex m68040
18059 Generate output for a 68040. This is the default when the compiler is
18060 configured for 68040-based systems. It is equivalent to
18061 @option{-march=68040}.
18062
18063 This option inhibits the use of 68881/68882 instructions that have to be
18064 emulated by software on the 68040. Use this option if your 68040 does not
18065 have code to emulate those instructions.
18066
18067 @item -m68060
18068 @opindex m68060
18069 Generate output for a 68060. This is the default when the compiler is
18070 configured for 68060-based systems. It is equivalent to
18071 @option{-march=68060}.
18072
18073 This option inhibits the use of 68020 and 68881/68882 instructions that
18074 have to be emulated by software on the 68060. Use this option if your 68060
18075 does not have code to emulate those instructions.
18076
18077 @item -mcpu32
18078 @opindex mcpu32
18079 Generate output for a CPU32. This is the default
18080 when the compiler is configured for CPU32-based systems.
18081 It is equivalent to @option{-march=cpu32}.
18082
18083 Use this option for microcontrollers with a
18084 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
18085 68336, 68340, 68341, 68349 and 68360.
18086
18087 @item -m5200
18088 @opindex m5200
18089 Generate output for a 520X ColdFire CPU@. This is the default
18090 when the compiler is configured for 520X-based systems.
18091 It is equivalent to @option{-mcpu=5206}, and is now deprecated
18092 in favor of that option.
18093
18094 Use this option for microcontroller with a 5200 core, including
18095 the MCF5202, MCF5203, MCF5204 and MCF5206.
18096
18097 @item -m5206e
18098 @opindex m5206e
18099 Generate output for a 5206e ColdFire CPU@. The option is now
18100 deprecated in favor of the equivalent @option{-mcpu=5206e}.
18101
18102 @item -m528x
18103 @opindex m528x
18104 Generate output for a member of the ColdFire 528X family.
18105 The option is now deprecated in favor of the equivalent
18106 @option{-mcpu=528x}.
18107
18108 @item -m5307
18109 @opindex m5307
18110 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
18111 in favor of the equivalent @option{-mcpu=5307}.
18112
18113 @item -m5407
18114 @opindex m5407
18115 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
18116 in favor of the equivalent @option{-mcpu=5407}.
18117
18118 @item -mcfv4e
18119 @opindex mcfv4e
18120 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
18121 This includes use of hardware floating-point instructions.
18122 The option is equivalent to @option{-mcpu=547x}, and is now
18123 deprecated in favor of that option.
18124
18125 @item -m68020-40
18126 @opindex m68020-40
18127 Generate output for a 68040, without using any of the new instructions.
18128 This results in code that can run relatively efficiently on either a
18129 68020/68881 or a 68030 or a 68040. The generated code does use the
18130 68881 instructions that are emulated on the 68040.
18131
18132 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
18133
18134 @item -m68020-60
18135 @opindex m68020-60
18136 Generate output for a 68060, without using any of the new instructions.
18137 This results in code that can run relatively efficiently on either a
18138 68020/68881 or a 68030 or a 68040. The generated code does use the
18139 68881 instructions that are emulated on the 68060.
18140
18141 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
18142
18143 @item -mhard-float
18144 @itemx -m68881
18145 @opindex mhard-float
18146 @opindex m68881
18147 Generate floating-point instructions. This is the default for 68020
18148 and above, and for ColdFire devices that have an FPU@. It defines the
18149 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
18150 on ColdFire targets.
18151
18152 @item -msoft-float
18153 @opindex msoft-float
18154 Do not generate floating-point instructions; use library calls instead.
18155 This is the default for 68000, 68010, and 68832 targets. It is also
18156 the default for ColdFire devices that have no FPU.
18157
18158 @item -mdiv
18159 @itemx -mno-div
18160 @opindex mdiv
18161 @opindex mno-div
18162 Generate (do not generate) ColdFire hardware divide and remainder
18163 instructions. If @option{-march} is used without @option{-mcpu},
18164 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
18165 architectures. Otherwise, the default is taken from the target CPU
18166 (either the default CPU, or the one specified by @option{-mcpu}). For
18167 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
18168 @option{-mcpu=5206e}.
18169
18170 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
18171
18172 @item -mshort
18173 @opindex mshort
18174 Consider type @code{int} to be 16 bits wide, like @code{short int}.
18175 Additionally, parameters passed on the stack are also aligned to a
18176 16-bit boundary even on targets whose API mandates promotion to 32-bit.
18177
18178 @item -mno-short
18179 @opindex mno-short
18180 Do not consider type @code{int} to be 16 bits wide. This is the default.
18181
18182 @item -mnobitfield
18183 @itemx -mno-bitfield
18184 @opindex mnobitfield
18185 @opindex mno-bitfield
18186 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
18187 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
18188
18189 @item -mbitfield
18190 @opindex mbitfield
18191 Do use the bit-field instructions. The @option{-m68020} option implies
18192 @option{-mbitfield}. This is the default if you use a configuration
18193 designed for a 68020.
18194
18195 @item -mrtd
18196 @opindex mrtd
18197 Use a different function-calling convention, in which functions
18198 that take a fixed number of arguments return with the @code{rtd}
18199 instruction, which pops their arguments while returning. This
18200 saves one instruction in the caller since there is no need to pop
18201 the arguments there.
18202
18203 This calling convention is incompatible with the one normally
18204 used on Unix, so you cannot use it if you need to call libraries
18205 compiled with the Unix compiler.
18206
18207 Also, you must provide function prototypes for all functions that
18208 take variable numbers of arguments (including @code{printf});
18209 otherwise incorrect code is generated for calls to those
18210 functions.
18211
18212 In addition, seriously incorrect code results if you call a
18213 function with too many arguments. (Normally, extra arguments are
18214 harmlessly ignored.)
18215
18216 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
18217 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
18218
18219 @item -mno-rtd
18220 @opindex mno-rtd
18221 Do not use the calling conventions selected by @option{-mrtd}.
18222 This is the default.
18223
18224 @item -malign-int
18225 @itemx -mno-align-int
18226 @opindex malign-int
18227 @opindex mno-align-int
18228 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
18229 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
18230 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
18231 Aligning variables on 32-bit boundaries produces code that runs somewhat
18232 faster on processors with 32-bit busses at the expense of more memory.
18233
18234 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
18235 aligns structures containing the above types differently than
18236 most published application binary interface specifications for the m68k.
18237
18238 @item -mpcrel
18239 @opindex mpcrel
18240 Use the pc-relative addressing mode of the 68000 directly, instead of
18241 using a global offset table. At present, this option implies @option{-fpic},
18242 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
18243 not presently supported with @option{-mpcrel}, though this could be supported for
18244 68020 and higher processors.
18245
18246 @item -mno-strict-align
18247 @itemx -mstrict-align
18248 @opindex mno-strict-align
18249 @opindex mstrict-align
18250 Do not (do) assume that unaligned memory references are handled by
18251 the system.
18252
18253 @item -msep-data
18254 Generate code that allows the data segment to be located in a different
18255 area of memory from the text segment. This allows for execute-in-place in
18256 an environment without virtual memory management. This option implies
18257 @option{-fPIC}.
18258
18259 @item -mno-sep-data
18260 Generate code that assumes that the data segment follows the text segment.
18261 This is the default.
18262
18263 @item -mid-shared-library
18264 Generate code that supports shared libraries via the library ID method.
18265 This allows for execute-in-place and shared libraries in an environment
18266 without virtual memory management. This option implies @option{-fPIC}.
18267
18268 @item -mno-id-shared-library
18269 Generate code that doesn't assume ID-based shared libraries are being used.
18270 This is the default.
18271
18272 @item -mshared-library-id=n
18273 Specifies the identification number of the ID-based shared library being
18274 compiled. Specifying a value of 0 generates more compact code; specifying
18275 other values forces the allocation of that number to the current
18276 library, but is no more space- or time-efficient than omitting this option.
18277
18278 @item -mxgot
18279 @itemx -mno-xgot
18280 @opindex mxgot
18281 @opindex mno-xgot
18282 When generating position-independent code for ColdFire, generate code
18283 that works if the GOT has more than 8192 entries. This code is
18284 larger and slower than code generated without this option. On M680x0
18285 processors, this option is not needed; @option{-fPIC} suffices.
18286
18287 GCC normally uses a single instruction to load values from the GOT@.
18288 While this is relatively efficient, it only works if the GOT
18289 is smaller than about 64k. Anything larger causes the linker
18290 to report an error such as:
18291
18292 @cindex relocation truncated to fit (ColdFire)
18293 @smallexample
18294 relocation truncated to fit: R_68K_GOT16O foobar
18295 @end smallexample
18296
18297 If this happens, you should recompile your code with @option{-mxgot}.
18298 It should then work with very large GOTs. However, code generated with
18299 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
18300 the value of a global symbol.
18301
18302 Note that some linkers, including newer versions of the GNU linker,
18303 can create multiple GOTs and sort GOT entries. If you have such a linker,
18304 you should only need to use @option{-mxgot} when compiling a single
18305 object file that accesses more than 8192 GOT entries. Very few do.
18306
18307 These options have no effect unless GCC is generating
18308 position-independent code.
18309
18310 @end table
18311
18312 @node MCore Options
18313 @subsection MCore Options
18314 @cindex MCore options
18315
18316 These are the @samp{-m} options defined for the Motorola M*Core
18317 processors.
18318
18319 @table @gcctabopt
18320
18321 @item -mhardlit
18322 @itemx -mno-hardlit
18323 @opindex mhardlit
18324 @opindex mno-hardlit
18325 Inline constants into the code stream if it can be done in two
18326 instructions or less.
18327
18328 @item -mdiv
18329 @itemx -mno-div
18330 @opindex mdiv
18331 @opindex mno-div
18332 Use the divide instruction. (Enabled by default).
18333
18334 @item -mrelax-immediate
18335 @itemx -mno-relax-immediate
18336 @opindex mrelax-immediate
18337 @opindex mno-relax-immediate
18338 Allow arbitrary-sized immediates in bit operations.
18339
18340 @item -mwide-bitfields
18341 @itemx -mno-wide-bitfields
18342 @opindex mwide-bitfields
18343 @opindex mno-wide-bitfields
18344 Always treat bit-fields as @code{int}-sized.
18345
18346 @item -m4byte-functions
18347 @itemx -mno-4byte-functions
18348 @opindex m4byte-functions
18349 @opindex mno-4byte-functions
18350 Force all functions to be aligned to a 4-byte boundary.
18351
18352 @item -mcallgraph-data
18353 @itemx -mno-callgraph-data
18354 @opindex mcallgraph-data
18355 @opindex mno-callgraph-data
18356 Emit callgraph information.
18357
18358 @item -mslow-bytes
18359 @itemx -mno-slow-bytes
18360 @opindex mslow-bytes
18361 @opindex mno-slow-bytes
18362 Prefer word access when reading byte quantities.
18363
18364 @item -mlittle-endian
18365 @itemx -mbig-endian
18366 @opindex mlittle-endian
18367 @opindex mbig-endian
18368 Generate code for a little-endian target.
18369
18370 @item -m210
18371 @itemx -m340
18372 @opindex m210
18373 @opindex m340
18374 Generate code for the 210 processor.
18375
18376 @item -mno-lsim
18377 @opindex mno-lsim
18378 Assume that runtime support has been provided and so omit the
18379 simulator library (@file{libsim.a)} from the linker command line.
18380
18381 @item -mstack-increment=@var{size}
18382 @opindex mstack-increment
18383 Set the maximum amount for a single stack increment operation. Large
18384 values can increase the speed of programs that contain functions
18385 that need a large amount of stack space, but they can also trigger a
18386 segmentation fault if the stack is extended too much. The default
18387 value is 0x1000.
18388
18389 @end table
18390
18391 @node MeP Options
18392 @subsection MeP Options
18393 @cindex MeP options
18394
18395 @table @gcctabopt
18396
18397 @item -mabsdiff
18398 @opindex mabsdiff
18399 Enables the @code{abs} instruction, which is the absolute difference
18400 between two registers.
18401
18402 @item -mall-opts
18403 @opindex mall-opts
18404 Enables all the optional instructions---average, multiply, divide, bit
18405 operations, leading zero, absolute difference, min/max, clip, and
18406 saturation.
18407
18408
18409 @item -maverage
18410 @opindex maverage
18411 Enables the @code{ave} instruction, which computes the average of two
18412 registers.
18413
18414 @item -mbased=@var{n}
18415 @opindex mbased=
18416 Variables of size @var{n} bytes or smaller are placed in the
18417 @code{.based} section by default. Based variables use the @code{$tp}
18418 register as a base register, and there is a 128-byte limit to the
18419 @code{.based} section.
18420
18421 @item -mbitops
18422 @opindex mbitops
18423 Enables the bit operation instructions---bit test (@code{btstm}), set
18424 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
18425 test-and-set (@code{tas}).
18426
18427 @item -mc=@var{name}
18428 @opindex mc=
18429 Selects which section constant data is placed in. @var{name} may
18430 be @samp{tiny}, @samp{near}, or @samp{far}.
18431
18432 @item -mclip
18433 @opindex mclip
18434 Enables the @code{clip} instruction. Note that @option{-mclip} is not
18435 useful unless you also provide @option{-mminmax}.
18436
18437 @item -mconfig=@var{name}
18438 @opindex mconfig=
18439 Selects one of the built-in core configurations. Each MeP chip has
18440 one or more modules in it; each module has a core CPU and a variety of
18441 coprocessors, optional instructions, and peripherals. The
18442 @code{MeP-Integrator} tool, not part of GCC, provides these
18443 configurations through this option; using this option is the same as
18444 using all the corresponding command-line options. The default
18445 configuration is @samp{default}.
18446
18447 @item -mcop
18448 @opindex mcop
18449 Enables the coprocessor instructions. By default, this is a 32-bit
18450 coprocessor. Note that the coprocessor is normally enabled via the
18451 @option{-mconfig=} option.
18452
18453 @item -mcop32
18454 @opindex mcop32
18455 Enables the 32-bit coprocessor's instructions.
18456
18457 @item -mcop64
18458 @opindex mcop64
18459 Enables the 64-bit coprocessor's instructions.
18460
18461 @item -mivc2
18462 @opindex mivc2
18463 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
18464
18465 @item -mdc
18466 @opindex mdc
18467 Causes constant variables to be placed in the @code{.near} section.
18468
18469 @item -mdiv
18470 @opindex mdiv
18471 Enables the @code{div} and @code{divu} instructions.
18472
18473 @item -meb
18474 @opindex meb
18475 Generate big-endian code.
18476
18477 @item -mel
18478 @opindex mel
18479 Generate little-endian code.
18480
18481 @item -mio-volatile
18482 @opindex mio-volatile
18483 Tells the compiler that any variable marked with the @code{io}
18484 attribute is to be considered volatile.
18485
18486 @item -ml
18487 @opindex ml
18488 Causes variables to be assigned to the @code{.far} section by default.
18489
18490 @item -mleadz
18491 @opindex mleadz
18492 Enables the @code{leadz} (leading zero) instruction.
18493
18494 @item -mm
18495 @opindex mm
18496 Causes variables to be assigned to the @code{.near} section by default.
18497
18498 @item -mminmax
18499 @opindex mminmax
18500 Enables the @code{min} and @code{max} instructions.
18501
18502 @item -mmult
18503 @opindex mmult
18504 Enables the multiplication and multiply-accumulate instructions.
18505
18506 @item -mno-opts
18507 @opindex mno-opts
18508 Disables all the optional instructions enabled by @option{-mall-opts}.
18509
18510 @item -mrepeat
18511 @opindex mrepeat
18512 Enables the @code{repeat} and @code{erepeat} instructions, used for
18513 low-overhead looping.
18514
18515 @item -ms
18516 @opindex ms
18517 Causes all variables to default to the @code{.tiny} section. Note
18518 that there is a 65536-byte limit to this section. Accesses to these
18519 variables use the @code{%gp} base register.
18520
18521 @item -msatur
18522 @opindex msatur
18523 Enables the saturation instructions. Note that the compiler does not
18524 currently generate these itself, but this option is included for
18525 compatibility with other tools, like @code{as}.
18526
18527 @item -msdram
18528 @opindex msdram
18529 Link the SDRAM-based runtime instead of the default ROM-based runtime.
18530
18531 @item -msim
18532 @opindex msim
18533 Link the simulator run-time libraries.
18534
18535 @item -msimnovec
18536 @opindex msimnovec
18537 Link the simulator runtime libraries, excluding built-in support
18538 for reset and exception vectors and tables.
18539
18540 @item -mtf
18541 @opindex mtf
18542 Causes all functions to default to the @code{.far} section. Without
18543 this option, functions default to the @code{.near} section.
18544
18545 @item -mtiny=@var{n}
18546 @opindex mtiny=
18547 Variables that are @var{n} bytes or smaller are allocated to the
18548 @code{.tiny} section. These variables use the @code{$gp} base
18549 register. The default for this option is 4, but note that there's a
18550 65536-byte limit to the @code{.tiny} section.
18551
18552 @end table
18553
18554 @node MicroBlaze Options
18555 @subsection MicroBlaze Options
18556 @cindex MicroBlaze Options
18557
18558 @table @gcctabopt
18559
18560 @item -msoft-float
18561 @opindex msoft-float
18562 Use software emulation for floating point (default).
18563
18564 @item -mhard-float
18565 @opindex mhard-float
18566 Use hardware floating-point instructions.
18567
18568 @item -mmemcpy
18569 @opindex mmemcpy
18570 Do not optimize block moves, use @code{memcpy}.
18571
18572 @item -mno-clearbss
18573 @opindex mno-clearbss
18574 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
18575
18576 @item -mcpu=@var{cpu-type}
18577 @opindex mcpu=
18578 Use features of, and schedule code for, the given CPU.
18579 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
18580 where @var{X} is a major version, @var{YY} is the minor version, and
18581 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
18582 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
18583
18584 @item -mxl-soft-mul
18585 @opindex mxl-soft-mul
18586 Use software multiply emulation (default).
18587
18588 @item -mxl-soft-div
18589 @opindex mxl-soft-div
18590 Use software emulation for divides (default).
18591
18592 @item -mxl-barrel-shift
18593 @opindex mxl-barrel-shift
18594 Use the hardware barrel shifter.
18595
18596 @item -mxl-pattern-compare
18597 @opindex mxl-pattern-compare
18598 Use pattern compare instructions.
18599
18600 @item -msmall-divides
18601 @opindex msmall-divides
18602 Use table lookup optimization for small signed integer divisions.
18603
18604 @item -mxl-stack-check
18605 @opindex mxl-stack-check
18606 This option is deprecated. Use @option{-fstack-check} instead.
18607
18608 @item -mxl-gp-opt
18609 @opindex mxl-gp-opt
18610 Use GP-relative @code{.sdata}/@code{.sbss} sections.
18611
18612 @item -mxl-multiply-high
18613 @opindex mxl-multiply-high
18614 Use multiply high instructions for high part of 32x32 multiply.
18615
18616 @item -mxl-float-convert
18617 @opindex mxl-float-convert
18618 Use hardware floating-point conversion instructions.
18619
18620 @item -mxl-float-sqrt
18621 @opindex mxl-float-sqrt
18622 Use hardware floating-point square root instruction.
18623
18624 @item -mbig-endian
18625 @opindex mbig-endian
18626 Generate code for a big-endian target.
18627
18628 @item -mlittle-endian
18629 @opindex mlittle-endian
18630 Generate code for a little-endian target.
18631
18632 @item -mxl-reorder
18633 @opindex mxl-reorder
18634 Use reorder instructions (swap and byte reversed load/store).
18635
18636 @item -mxl-mode-@var{app-model}
18637 Select application model @var{app-model}. Valid models are
18638 @table @samp
18639 @item executable
18640 normal executable (default), uses startup code @file{crt0.o}.
18641
18642 @item xmdstub
18643 for use with Xilinx Microprocessor Debugger (XMD) based
18644 software intrusive debug agent called xmdstub. This uses startup file
18645 @file{crt1.o} and sets the start address of the program to 0x800.
18646
18647 @item bootstrap
18648 for applications that are loaded using a bootloader.
18649 This model uses startup file @file{crt2.o} which does not contain a processor
18650 reset vector handler. This is suitable for transferring control on a
18651 processor reset to the bootloader rather than the application.
18652
18653 @item novectors
18654 for applications that do not require any of the
18655 MicroBlaze vectors. This option may be useful for applications running
18656 within a monitoring application. This model uses @file{crt3.o} as a startup file.
18657 @end table
18658
18659 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
18660 @option{-mxl-mode-@var{app-model}}.
18661
18662 @end table
18663
18664 @node MIPS Options
18665 @subsection MIPS Options
18666 @cindex MIPS options
18667
18668 @table @gcctabopt
18669
18670 @item -EB
18671 @opindex EB
18672 Generate big-endian code.
18673
18674 @item -EL
18675 @opindex EL
18676 Generate little-endian code. This is the default for @samp{mips*el-*-*}
18677 configurations.
18678
18679 @item -march=@var{arch}
18680 @opindex march
18681 Generate code that runs on @var{arch}, which can be the name of a
18682 generic MIPS ISA, or the name of a particular processor.
18683 The ISA names are:
18684 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
18685 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
18686 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
18687 @samp{mips64r5} and @samp{mips64r6}.
18688 The processor names are:
18689 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
18690 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
18691 @samp{5kc}, @samp{5kf},
18692 @samp{20kc},
18693 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
18694 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
18695 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
18696 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
18697 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
18698 @samp{i6400},
18699 @samp{interaptiv},
18700 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
18701 @samp{m4k},
18702 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
18703 @samp{m5100}, @samp{m5101},
18704 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
18705 @samp{orion},
18706 @samp{p5600},
18707 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
18708 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
18709 @samp{rm7000}, @samp{rm9000},
18710 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
18711 @samp{sb1},
18712 @samp{sr71000},
18713 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
18714 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
18715 @samp{xlr} and @samp{xlp}.
18716 The special value @samp{from-abi} selects the
18717 most compatible architecture for the selected ABI (that is,
18718 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
18719
18720 The native Linux/GNU toolchain also supports the value @samp{native},
18721 which selects the best architecture option for the host processor.
18722 @option{-march=native} has no effect if GCC does not recognize
18723 the processor.
18724
18725 In processor names, a final @samp{000} can be abbreviated as @samp{k}
18726 (for example, @option{-march=r2k}). Prefixes are optional, and
18727 @samp{vr} may be written @samp{r}.
18728
18729 Names of the form @samp{@var{n}f2_1} refer to processors with
18730 FPUs clocked at half the rate of the core, names of the form
18731 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
18732 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
18733 processors with FPUs clocked a ratio of 3:2 with respect to the core.
18734 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
18735 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
18736 accepted as synonyms for @samp{@var{n}f1_1}.
18737
18738 GCC defines two macros based on the value of this option. The first
18739 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
18740 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
18741 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
18742 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
18743 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
18744
18745 Note that the @code{_MIPS_ARCH} macro uses the processor names given
18746 above. In other words, it has the full prefix and does not
18747 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
18748 the macro names the resolved architecture (either @code{"mips1"} or
18749 @code{"mips3"}). It names the default architecture when no
18750 @option{-march} option is given.
18751
18752 @item -mtune=@var{arch}
18753 @opindex mtune
18754 Optimize for @var{arch}. Among other things, this option controls
18755 the way instructions are scheduled, and the perceived cost of arithmetic
18756 operations. The list of @var{arch} values is the same as for
18757 @option{-march}.
18758
18759 When this option is not used, GCC optimizes for the processor
18760 specified by @option{-march}. By using @option{-march} and
18761 @option{-mtune} together, it is possible to generate code that
18762 runs on a family of processors, but optimize the code for one
18763 particular member of that family.
18764
18765 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
18766 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
18767 @option{-march} ones described above.
18768
18769 @item -mips1
18770 @opindex mips1
18771 Equivalent to @option{-march=mips1}.
18772
18773 @item -mips2
18774 @opindex mips2
18775 Equivalent to @option{-march=mips2}.
18776
18777 @item -mips3
18778 @opindex mips3
18779 Equivalent to @option{-march=mips3}.
18780
18781 @item -mips4
18782 @opindex mips4
18783 Equivalent to @option{-march=mips4}.
18784
18785 @item -mips32
18786 @opindex mips32
18787 Equivalent to @option{-march=mips32}.
18788
18789 @item -mips32r3
18790 @opindex mips32r3
18791 Equivalent to @option{-march=mips32r3}.
18792
18793 @item -mips32r5
18794 @opindex mips32r5
18795 Equivalent to @option{-march=mips32r5}.
18796
18797 @item -mips32r6
18798 @opindex mips32r6
18799 Equivalent to @option{-march=mips32r6}.
18800
18801 @item -mips64
18802 @opindex mips64
18803 Equivalent to @option{-march=mips64}.
18804
18805 @item -mips64r2
18806 @opindex mips64r2
18807 Equivalent to @option{-march=mips64r2}.
18808
18809 @item -mips64r3
18810 @opindex mips64r3
18811 Equivalent to @option{-march=mips64r3}.
18812
18813 @item -mips64r5
18814 @opindex mips64r5
18815 Equivalent to @option{-march=mips64r5}.
18816
18817 @item -mips64r6
18818 @opindex mips64r6
18819 Equivalent to @option{-march=mips64r6}.
18820
18821 @item -mips16
18822 @itemx -mno-mips16
18823 @opindex mips16
18824 @opindex mno-mips16
18825 Generate (do not generate) MIPS16 code. If GCC is targeting a
18826 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
18827
18828 MIPS16 code generation can also be controlled on a per-function basis
18829 by means of @code{mips16} and @code{nomips16} attributes.
18830 @xref{Function Attributes}, for more information.
18831
18832 @item -mflip-mips16
18833 @opindex mflip-mips16
18834 Generate MIPS16 code on alternating functions. This option is provided
18835 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
18836 not intended for ordinary use in compiling user code.
18837
18838 @item -minterlink-compressed
18839 @item -mno-interlink-compressed
18840 @opindex minterlink-compressed
18841 @opindex mno-interlink-compressed
18842 Require (do not require) that code using the standard (uncompressed) MIPS ISA
18843 be link-compatible with MIPS16 and microMIPS code, and vice versa.
18844
18845 For example, code using the standard ISA encoding cannot jump directly
18846 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
18847 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
18848 knows that the target of the jump is not compressed.
18849
18850 @item -minterlink-mips16
18851 @itemx -mno-interlink-mips16
18852 @opindex minterlink-mips16
18853 @opindex mno-interlink-mips16
18854 Aliases of @option{-minterlink-compressed} and
18855 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
18856 and are retained for backwards compatibility.
18857
18858 @item -mabi=32
18859 @itemx -mabi=o64
18860 @itemx -mabi=n32
18861 @itemx -mabi=64
18862 @itemx -mabi=eabi
18863 @opindex mabi=32
18864 @opindex mabi=o64
18865 @opindex mabi=n32
18866 @opindex mabi=64
18867 @opindex mabi=eabi
18868 Generate code for the given ABI@.
18869
18870 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
18871 generates 64-bit code when you select a 64-bit architecture, but you
18872 can use @option{-mgp32} to get 32-bit code instead.
18873
18874 For information about the O64 ABI, see
18875 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
18876
18877 GCC supports a variant of the o32 ABI in which floating-point registers
18878 are 64 rather than 32 bits wide. You can select this combination with
18879 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
18880 and @code{mfhc1} instructions and is therefore only supported for
18881 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
18882
18883 The register assignments for arguments and return values remain the
18884 same, but each scalar value is passed in a single 64-bit register
18885 rather than a pair of 32-bit registers. For example, scalar
18886 floating-point values are returned in @samp{$f0} only, not a
18887 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
18888 remains the same in that the even-numbered double-precision registers
18889 are saved.
18890
18891 Two additional variants of the o32 ABI are supported to enable
18892 a transition from 32-bit to 64-bit registers. These are FPXX
18893 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
18894 The FPXX extension mandates that all code must execute correctly
18895 when run using 32-bit or 64-bit registers. The code can be interlinked
18896 with either FP32 or FP64, but not both.
18897 The FP64A extension is similar to the FP64 extension but forbids the
18898 use of odd-numbered single-precision registers. This can be used
18899 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
18900 processors and allows both FP32 and FP64A code to interlink and
18901 run in the same process without changing FPU modes.
18902
18903 @item -mabicalls
18904 @itemx -mno-abicalls
18905 @opindex mabicalls
18906 @opindex mno-abicalls
18907 Generate (do not generate) code that is suitable for SVR4-style
18908 dynamic objects. @option{-mabicalls} is the default for SVR4-based
18909 systems.
18910
18911 @item -mshared
18912 @itemx -mno-shared
18913 Generate (do not generate) code that is fully position-independent,
18914 and that can therefore be linked into shared libraries. This option
18915 only affects @option{-mabicalls}.
18916
18917 All @option{-mabicalls} code has traditionally been position-independent,
18918 regardless of options like @option{-fPIC} and @option{-fpic}. However,
18919 as an extension, the GNU toolchain allows executables to use absolute
18920 accesses for locally-binding symbols. It can also use shorter GP
18921 initialization sequences and generate direct calls to locally-defined
18922 functions. This mode is selected by @option{-mno-shared}.
18923
18924 @option{-mno-shared} depends on binutils 2.16 or higher and generates
18925 objects that can only be linked by the GNU linker. However, the option
18926 does not affect the ABI of the final executable; it only affects the ABI
18927 of relocatable objects. Using @option{-mno-shared} generally makes
18928 executables both smaller and quicker.
18929
18930 @option{-mshared} is the default.
18931
18932 @item -mplt
18933 @itemx -mno-plt
18934 @opindex mplt
18935 @opindex mno-plt
18936 Assume (do not assume) that the static and dynamic linkers
18937 support PLTs and copy relocations. This option only affects
18938 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
18939 has no effect without @option{-msym32}.
18940
18941 You can make @option{-mplt} the default by configuring
18942 GCC with @option{--with-mips-plt}. The default is
18943 @option{-mno-plt} otherwise.
18944
18945 @item -mxgot
18946 @itemx -mno-xgot
18947 @opindex mxgot
18948 @opindex mno-xgot
18949 Lift (do not lift) the usual restrictions on the size of the global
18950 offset table.
18951
18952 GCC normally uses a single instruction to load values from the GOT@.
18953 While this is relatively efficient, it only works if the GOT
18954 is smaller than about 64k. Anything larger causes the linker
18955 to report an error such as:
18956
18957 @cindex relocation truncated to fit (MIPS)
18958 @smallexample
18959 relocation truncated to fit: R_MIPS_GOT16 foobar
18960 @end smallexample
18961
18962 If this happens, you should recompile your code with @option{-mxgot}.
18963 This works with very large GOTs, although the code is also
18964 less efficient, since it takes three instructions to fetch the
18965 value of a global symbol.
18966
18967 Note that some linkers can create multiple GOTs. If you have such a
18968 linker, you should only need to use @option{-mxgot} when a single object
18969 file accesses more than 64k's worth of GOT entries. Very few do.
18970
18971 These options have no effect unless GCC is generating position
18972 independent code.
18973
18974 @item -mgp32
18975 @opindex mgp32
18976 Assume that general-purpose registers are 32 bits wide.
18977
18978 @item -mgp64
18979 @opindex mgp64
18980 Assume that general-purpose registers are 64 bits wide.
18981
18982 @item -mfp32
18983 @opindex mfp32
18984 Assume that floating-point registers are 32 bits wide.
18985
18986 @item -mfp64
18987 @opindex mfp64
18988 Assume that floating-point registers are 64 bits wide.
18989
18990 @item -mfpxx
18991 @opindex mfpxx
18992 Do not assume the width of floating-point registers.
18993
18994 @item -mhard-float
18995 @opindex mhard-float
18996 Use floating-point coprocessor instructions.
18997
18998 @item -msoft-float
18999 @opindex msoft-float
19000 Do not use floating-point coprocessor instructions. Implement
19001 floating-point calculations using library calls instead.
19002
19003 @item -mno-float
19004 @opindex mno-float
19005 Equivalent to @option{-msoft-float}, but additionally asserts that the
19006 program being compiled does not perform any floating-point operations.
19007 This option is presently supported only by some bare-metal MIPS
19008 configurations, where it may select a special set of libraries
19009 that lack all floating-point support (including, for example, the
19010 floating-point @code{printf} formats).
19011 If code compiled with @option{-mno-float} accidentally contains
19012 floating-point operations, it is likely to suffer a link-time
19013 or run-time failure.
19014
19015 @item -msingle-float
19016 @opindex msingle-float
19017 Assume that the floating-point coprocessor only supports single-precision
19018 operations.
19019
19020 @item -mdouble-float
19021 @opindex mdouble-float
19022 Assume that the floating-point coprocessor supports double-precision
19023 operations. This is the default.
19024
19025 @item -modd-spreg
19026 @itemx -mno-odd-spreg
19027 @opindex modd-spreg
19028 @opindex mno-odd-spreg
19029 Enable the use of odd-numbered single-precision floating-point registers
19030 for the o32 ABI. This is the default for processors that are known to
19031 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
19032 is set by default.
19033
19034 @item -mabs=2008
19035 @itemx -mabs=legacy
19036 @opindex mabs=2008
19037 @opindex mabs=legacy
19038 These options control the treatment of the special not-a-number (NaN)
19039 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
19040 @code{neg.@i{fmt}} machine instructions.
19041
19042 By default or when @option{-mabs=legacy} is used the legacy
19043 treatment is selected. In this case these instructions are considered
19044 arithmetic and avoided where correct operation is required and the
19045 input operand might be a NaN. A longer sequence of instructions that
19046 manipulate the sign bit of floating-point datum manually is used
19047 instead unless the @option{-ffinite-math-only} option has also been
19048 specified.
19049
19050 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
19051 this case these instructions are considered non-arithmetic and therefore
19052 operating correctly in all cases, including in particular where the
19053 input operand is a NaN. These instructions are therefore always used
19054 for the respective operations.
19055
19056 @item -mnan=2008
19057 @itemx -mnan=legacy
19058 @opindex mnan=2008
19059 @opindex mnan=legacy
19060 These options control the encoding of the special not-a-number (NaN)
19061 IEEE 754 floating-point data.
19062
19063 The @option{-mnan=legacy} option selects the legacy encoding. In this
19064 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
19065 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
19066 by the first bit of their trailing significand field being 1.
19067
19068 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
19069 this case qNaNs are denoted by the first bit of their trailing
19070 significand field being 1, whereas sNaNs are denoted by the first bit of
19071 their trailing significand field being 0.
19072
19073 The default is @option{-mnan=legacy} unless GCC has been configured with
19074 @option{--with-nan=2008}.
19075
19076 @item -mllsc
19077 @itemx -mno-llsc
19078 @opindex mllsc
19079 @opindex mno-llsc
19080 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
19081 implement atomic memory built-in functions. When neither option is
19082 specified, GCC uses the instructions if the target architecture
19083 supports them.
19084
19085 @option{-mllsc} is useful if the runtime environment can emulate the
19086 instructions and @option{-mno-llsc} can be useful when compiling for
19087 nonstandard ISAs. You can make either option the default by
19088 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
19089 respectively. @option{--with-llsc} is the default for some
19090 configurations; see the installation documentation for details.
19091
19092 @item -mdsp
19093 @itemx -mno-dsp
19094 @opindex mdsp
19095 @opindex mno-dsp
19096 Use (do not use) revision 1 of the MIPS DSP ASE@.
19097 @xref{MIPS DSP Built-in Functions}. This option defines the
19098 preprocessor macro @code{__mips_dsp}. It also defines
19099 @code{__mips_dsp_rev} to 1.
19100
19101 @item -mdspr2
19102 @itemx -mno-dspr2
19103 @opindex mdspr2
19104 @opindex mno-dspr2
19105 Use (do not use) revision 2 of the MIPS DSP ASE@.
19106 @xref{MIPS DSP Built-in Functions}. This option defines the
19107 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
19108 It also defines @code{__mips_dsp_rev} to 2.
19109
19110 @item -msmartmips
19111 @itemx -mno-smartmips
19112 @opindex msmartmips
19113 @opindex mno-smartmips
19114 Use (do not use) the MIPS SmartMIPS ASE.
19115
19116 @item -mpaired-single
19117 @itemx -mno-paired-single
19118 @opindex mpaired-single
19119 @opindex mno-paired-single
19120 Use (do not use) paired-single floating-point instructions.
19121 @xref{MIPS Paired-Single Support}. This option requires
19122 hardware floating-point support to be enabled.
19123
19124 @item -mdmx
19125 @itemx -mno-mdmx
19126 @opindex mdmx
19127 @opindex mno-mdmx
19128 Use (do not use) MIPS Digital Media Extension instructions.
19129 This option can only be used when generating 64-bit code and requires
19130 hardware floating-point support to be enabled.
19131
19132 @item -mips3d
19133 @itemx -mno-mips3d
19134 @opindex mips3d
19135 @opindex mno-mips3d
19136 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
19137 The option @option{-mips3d} implies @option{-mpaired-single}.
19138
19139 @item -mmicromips
19140 @itemx -mno-micromips
19141 @opindex mmicromips
19142 @opindex mno-mmicromips
19143 Generate (do not generate) microMIPS code.
19144
19145 MicroMIPS code generation can also be controlled on a per-function basis
19146 by means of @code{micromips} and @code{nomicromips} attributes.
19147 @xref{Function Attributes}, for more information.
19148
19149 @item -mmt
19150 @itemx -mno-mt
19151 @opindex mmt
19152 @opindex mno-mt
19153 Use (do not use) MT Multithreading instructions.
19154
19155 @item -mmcu
19156 @itemx -mno-mcu
19157 @opindex mmcu
19158 @opindex mno-mcu
19159 Use (do not use) the MIPS MCU ASE instructions.
19160
19161 @item -meva
19162 @itemx -mno-eva
19163 @opindex meva
19164 @opindex mno-eva
19165 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
19166
19167 @item -mvirt
19168 @itemx -mno-virt
19169 @opindex mvirt
19170 @opindex mno-virt
19171 Use (do not use) the MIPS Virtualization Application Specific instructions.
19172
19173 @item -mxpa
19174 @itemx -mno-xpa
19175 @opindex mxpa
19176 @opindex mno-xpa
19177 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
19178
19179 @item -mlong64
19180 @opindex mlong64
19181 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
19182 an explanation of the default and the way that the pointer size is
19183 determined.
19184
19185 @item -mlong32
19186 @opindex mlong32
19187 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
19188
19189 The default size of @code{int}s, @code{long}s and pointers depends on
19190 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
19191 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
19192 32-bit @code{long}s. Pointers are the same size as @code{long}s,
19193 or the same size as integer registers, whichever is smaller.
19194
19195 @item -msym32
19196 @itemx -mno-sym32
19197 @opindex msym32
19198 @opindex mno-sym32
19199 Assume (do not assume) that all symbols have 32-bit values, regardless
19200 of the selected ABI@. This option is useful in combination with
19201 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
19202 to generate shorter and faster references to symbolic addresses.
19203
19204 @item -G @var{num}
19205 @opindex G
19206 Put definitions of externally-visible data in a small data section
19207 if that data is no bigger than @var{num} bytes. GCC can then generate
19208 more efficient accesses to the data; see @option{-mgpopt} for details.
19209
19210 The default @option{-G} option depends on the configuration.
19211
19212 @item -mlocal-sdata
19213 @itemx -mno-local-sdata
19214 @opindex mlocal-sdata
19215 @opindex mno-local-sdata
19216 Extend (do not extend) the @option{-G} behavior to local data too,
19217 such as to static variables in C@. @option{-mlocal-sdata} is the
19218 default for all configurations.
19219
19220 If the linker complains that an application is using too much small data,
19221 you might want to try rebuilding the less performance-critical parts with
19222 @option{-mno-local-sdata}. You might also want to build large
19223 libraries with @option{-mno-local-sdata}, so that the libraries leave
19224 more room for the main program.
19225
19226 @item -mextern-sdata
19227 @itemx -mno-extern-sdata
19228 @opindex mextern-sdata
19229 @opindex mno-extern-sdata
19230 Assume (do not assume) that externally-defined data is in
19231 a small data section if the size of that data is within the @option{-G} limit.
19232 @option{-mextern-sdata} is the default for all configurations.
19233
19234 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
19235 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
19236 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
19237 is placed in a small data section. If @var{Var} is defined by another
19238 module, you must either compile that module with a high-enough
19239 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
19240 definition. If @var{Var} is common, you must link the application
19241 with a high-enough @option{-G} setting.
19242
19243 The easiest way of satisfying these restrictions is to compile
19244 and link every module with the same @option{-G} option. However,
19245 you may wish to build a library that supports several different
19246 small data limits. You can do this by compiling the library with
19247 the highest supported @option{-G} setting and additionally using
19248 @option{-mno-extern-sdata} to stop the library from making assumptions
19249 about externally-defined data.
19250
19251 @item -mgpopt
19252 @itemx -mno-gpopt
19253 @opindex mgpopt
19254 @opindex mno-gpopt
19255 Use (do not use) GP-relative accesses for symbols that are known to be
19256 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
19257 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
19258 configurations.
19259
19260 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
19261 might not hold the value of @code{_gp}. For example, if the code is
19262 part of a library that might be used in a boot monitor, programs that
19263 call boot monitor routines pass an unknown value in @code{$gp}.
19264 (In such situations, the boot monitor itself is usually compiled
19265 with @option{-G0}.)
19266
19267 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
19268 @option{-mno-extern-sdata}.
19269
19270 @item -membedded-data
19271 @itemx -mno-embedded-data
19272 @opindex membedded-data
19273 @opindex mno-embedded-data
19274 Allocate variables to the read-only data section first if possible, then
19275 next in the small data section if possible, otherwise in data. This gives
19276 slightly slower code than the default, but reduces the amount of RAM required
19277 when executing, and thus may be preferred for some embedded systems.
19278
19279 @item -muninit-const-in-rodata
19280 @itemx -mno-uninit-const-in-rodata
19281 @opindex muninit-const-in-rodata
19282 @opindex mno-uninit-const-in-rodata
19283 Put uninitialized @code{const} variables in the read-only data section.
19284 This option is only meaningful in conjunction with @option{-membedded-data}.
19285
19286 @item -mcode-readable=@var{setting}
19287 @opindex mcode-readable
19288 Specify whether GCC may generate code that reads from executable sections.
19289 There are three possible settings:
19290
19291 @table @gcctabopt
19292 @item -mcode-readable=yes
19293 Instructions may freely access executable sections. This is the
19294 default setting.
19295
19296 @item -mcode-readable=pcrel
19297 MIPS16 PC-relative load instructions can access executable sections,
19298 but other instructions must not do so. This option is useful on 4KSc
19299 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
19300 It is also useful on processors that can be configured to have a dual
19301 instruction/data SRAM interface and that, like the M4K, automatically
19302 redirect PC-relative loads to the instruction RAM.
19303
19304 @item -mcode-readable=no
19305 Instructions must not access executable sections. This option can be
19306 useful on targets that are configured to have a dual instruction/data
19307 SRAM interface but that (unlike the M4K) do not automatically redirect
19308 PC-relative loads to the instruction RAM.
19309 @end table
19310
19311 @item -msplit-addresses
19312 @itemx -mno-split-addresses
19313 @opindex msplit-addresses
19314 @opindex mno-split-addresses
19315 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
19316 relocation operators. This option has been superseded by
19317 @option{-mexplicit-relocs} but is retained for backwards compatibility.
19318
19319 @item -mexplicit-relocs
19320 @itemx -mno-explicit-relocs
19321 @opindex mexplicit-relocs
19322 @opindex mno-explicit-relocs
19323 Use (do not use) assembler relocation operators when dealing with symbolic
19324 addresses. The alternative, selected by @option{-mno-explicit-relocs},
19325 is to use assembler macros instead.
19326
19327 @option{-mexplicit-relocs} is the default if GCC was configured
19328 to use an assembler that supports relocation operators.
19329
19330 @item -mcheck-zero-division
19331 @itemx -mno-check-zero-division
19332 @opindex mcheck-zero-division
19333 @opindex mno-check-zero-division
19334 Trap (do not trap) on integer division by zero.
19335
19336 The default is @option{-mcheck-zero-division}.
19337
19338 @item -mdivide-traps
19339 @itemx -mdivide-breaks
19340 @opindex mdivide-traps
19341 @opindex mdivide-breaks
19342 MIPS systems check for division by zero by generating either a
19343 conditional trap or a break instruction. Using traps results in
19344 smaller code, but is only supported on MIPS II and later. Also, some
19345 versions of the Linux kernel have a bug that prevents trap from
19346 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
19347 allow conditional traps on architectures that support them and
19348 @option{-mdivide-breaks} to force the use of breaks.
19349
19350 The default is usually @option{-mdivide-traps}, but this can be
19351 overridden at configure time using @option{--with-divide=breaks}.
19352 Divide-by-zero checks can be completely disabled using
19353 @option{-mno-check-zero-division}.
19354
19355 @item -mmemcpy
19356 @itemx -mno-memcpy
19357 @opindex mmemcpy
19358 @opindex mno-memcpy
19359 Force (do not force) the use of @code{memcpy} for non-trivial block
19360 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
19361 most constant-sized copies.
19362
19363 @item -mlong-calls
19364 @itemx -mno-long-calls
19365 @opindex mlong-calls
19366 @opindex mno-long-calls
19367 Disable (do not disable) use of the @code{jal} instruction. Calling
19368 functions using @code{jal} is more efficient but requires the caller
19369 and callee to be in the same 256 megabyte segment.
19370
19371 This option has no effect on abicalls code. The default is
19372 @option{-mno-long-calls}.
19373
19374 @item -mmad
19375 @itemx -mno-mad
19376 @opindex mmad
19377 @opindex mno-mad
19378 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
19379 instructions, as provided by the R4650 ISA@.
19380
19381 @item -mimadd
19382 @itemx -mno-imadd
19383 @opindex mimadd
19384 @opindex mno-imadd
19385 Enable (disable) use of the @code{madd} and @code{msub} integer
19386 instructions. The default is @option{-mimadd} on architectures
19387 that support @code{madd} and @code{msub} except for the 74k
19388 architecture where it was found to generate slower code.
19389
19390 @item -mfused-madd
19391 @itemx -mno-fused-madd
19392 @opindex mfused-madd
19393 @opindex mno-fused-madd
19394 Enable (disable) use of the floating-point multiply-accumulate
19395 instructions, when they are available. The default is
19396 @option{-mfused-madd}.
19397
19398 On the R8000 CPU when multiply-accumulate instructions are used,
19399 the intermediate product is calculated to infinite precision
19400 and is not subject to the FCSR Flush to Zero bit. This may be
19401 undesirable in some circumstances. On other processors the result
19402 is numerically identical to the equivalent computation using
19403 separate multiply, add, subtract and negate instructions.
19404
19405 @item -nocpp
19406 @opindex nocpp
19407 Tell the MIPS assembler to not run its preprocessor over user
19408 assembler files (with a @samp{.s} suffix) when assembling them.
19409
19410 @item -mfix-24k
19411 @item -mno-fix-24k
19412 @opindex mfix-24k
19413 @opindex mno-fix-24k
19414 Work around the 24K E48 (lost data on stores during refill) errata.
19415 The workarounds are implemented by the assembler rather than by GCC@.
19416
19417 @item -mfix-r4000
19418 @itemx -mno-fix-r4000
19419 @opindex mfix-r4000
19420 @opindex mno-fix-r4000
19421 Work around certain R4000 CPU errata:
19422 @itemize @minus
19423 @item
19424 A double-word or a variable shift may give an incorrect result if executed
19425 immediately after starting an integer division.
19426 @item
19427 A double-word or a variable shift may give an incorrect result if executed
19428 while an integer multiplication is in progress.
19429 @item
19430 An integer division may give an incorrect result if started in a delay slot
19431 of a taken branch or a jump.
19432 @end itemize
19433
19434 @item -mfix-r4400
19435 @itemx -mno-fix-r4400
19436 @opindex mfix-r4400
19437 @opindex mno-fix-r4400
19438 Work around certain R4400 CPU errata:
19439 @itemize @minus
19440 @item
19441 A double-word or a variable shift may give an incorrect result if executed
19442 immediately after starting an integer division.
19443 @end itemize
19444
19445 @item -mfix-r10000
19446 @itemx -mno-fix-r10000
19447 @opindex mfix-r10000
19448 @opindex mno-fix-r10000
19449 Work around certain R10000 errata:
19450 @itemize @minus
19451 @item
19452 @code{ll}/@code{sc} sequences may not behave atomically on revisions
19453 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
19454 @end itemize
19455
19456 This option can only be used if the target architecture supports
19457 branch-likely instructions. @option{-mfix-r10000} is the default when
19458 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
19459 otherwise.
19460
19461 @item -mfix-rm7000
19462 @itemx -mno-fix-rm7000
19463 @opindex mfix-rm7000
19464 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
19465 workarounds are implemented by the assembler rather than by GCC@.
19466
19467 @item -mfix-vr4120
19468 @itemx -mno-fix-vr4120
19469 @opindex mfix-vr4120
19470 Work around certain VR4120 errata:
19471 @itemize @minus
19472 @item
19473 @code{dmultu} does not always produce the correct result.
19474 @item
19475 @code{div} and @code{ddiv} do not always produce the correct result if one
19476 of the operands is negative.
19477 @end itemize
19478 The workarounds for the division errata rely on special functions in
19479 @file{libgcc.a}. At present, these functions are only provided by
19480 the @code{mips64vr*-elf} configurations.
19481
19482 Other VR4120 errata require a NOP to be inserted between certain pairs of
19483 instructions. These errata are handled by the assembler, not by GCC itself.
19484
19485 @item -mfix-vr4130
19486 @opindex mfix-vr4130
19487 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
19488 workarounds are implemented by the assembler rather than by GCC,
19489 although GCC avoids using @code{mflo} and @code{mfhi} if the
19490 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
19491 instructions are available instead.
19492
19493 @item -mfix-sb1
19494 @itemx -mno-fix-sb1
19495 @opindex mfix-sb1
19496 Work around certain SB-1 CPU core errata.
19497 (This flag currently works around the SB-1 revision 2
19498 ``F1'' and ``F2'' floating-point errata.)
19499
19500 @item -mr10k-cache-barrier=@var{setting}
19501 @opindex mr10k-cache-barrier
19502 Specify whether GCC should insert cache barriers to avoid the
19503 side-effects of speculation on R10K processors.
19504
19505 In common with many processors, the R10K tries to predict the outcome
19506 of a conditional branch and speculatively executes instructions from
19507 the ``taken'' branch. It later aborts these instructions if the
19508 predicted outcome is wrong. However, on the R10K, even aborted
19509 instructions can have side effects.
19510
19511 This problem only affects kernel stores and, depending on the system,
19512 kernel loads. As an example, a speculatively-executed store may load
19513 the target memory into cache and mark the cache line as dirty, even if
19514 the store itself is later aborted. If a DMA operation writes to the
19515 same area of memory before the ``dirty'' line is flushed, the cached
19516 data overwrites the DMA-ed data. See the R10K processor manual
19517 for a full description, including other potential problems.
19518
19519 One workaround is to insert cache barrier instructions before every memory
19520 access that might be speculatively executed and that might have side
19521 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
19522 controls GCC's implementation of this workaround. It assumes that
19523 aborted accesses to any byte in the following regions does not have
19524 side effects:
19525
19526 @enumerate
19527 @item
19528 the memory occupied by the current function's stack frame;
19529
19530 @item
19531 the memory occupied by an incoming stack argument;
19532
19533 @item
19534 the memory occupied by an object with a link-time-constant address.
19535 @end enumerate
19536
19537 It is the kernel's responsibility to ensure that speculative
19538 accesses to these regions are indeed safe.
19539
19540 If the input program contains a function declaration such as:
19541
19542 @smallexample
19543 void foo (void);
19544 @end smallexample
19545
19546 then the implementation of @code{foo} must allow @code{j foo} and
19547 @code{jal foo} to be executed speculatively. GCC honors this
19548 restriction for functions it compiles itself. It expects non-GCC
19549 functions (such as hand-written assembly code) to do the same.
19550
19551 The option has three forms:
19552
19553 @table @gcctabopt
19554 @item -mr10k-cache-barrier=load-store
19555 Insert a cache barrier before a load or store that might be
19556 speculatively executed and that might have side effects even
19557 if aborted.
19558
19559 @item -mr10k-cache-barrier=store
19560 Insert a cache barrier before a store that might be speculatively
19561 executed and that might have side effects even if aborted.
19562
19563 @item -mr10k-cache-barrier=none
19564 Disable the insertion of cache barriers. This is the default setting.
19565 @end table
19566
19567 @item -mflush-func=@var{func}
19568 @itemx -mno-flush-func
19569 @opindex mflush-func
19570 Specifies the function to call to flush the I and D caches, or to not
19571 call any such function. If called, the function must take the same
19572 arguments as the common @code{_flush_func}, that is, the address of the
19573 memory range for which the cache is being flushed, the size of the
19574 memory range, and the number 3 (to flush both caches). The default
19575 depends on the target GCC was configured for, but commonly is either
19576 @code{_flush_func} or @code{__cpu_flush}.
19577
19578 @item mbranch-cost=@var{num}
19579 @opindex mbranch-cost
19580 Set the cost of branches to roughly @var{num} ``simple'' instructions.
19581 This cost is only a heuristic and is not guaranteed to produce
19582 consistent results across releases. A zero cost redundantly selects
19583 the default, which is based on the @option{-mtune} setting.
19584
19585 @item -mbranch-likely
19586 @itemx -mno-branch-likely
19587 @opindex mbranch-likely
19588 @opindex mno-branch-likely
19589 Enable or disable use of Branch Likely instructions, regardless of the
19590 default for the selected architecture. By default, Branch Likely
19591 instructions may be generated if they are supported by the selected
19592 architecture. An exception is for the MIPS32 and MIPS64 architectures
19593 and processors that implement those architectures; for those, Branch
19594 Likely instructions are not be generated by default because the MIPS32
19595 and MIPS64 architectures specifically deprecate their use.
19596
19597 @item -mcompact-branches=never
19598 @itemx -mcompact-branches=optimal
19599 @itemx -mcompact-branches=always
19600 @opindex mcompact-branches=never
19601 @opindex mcompact-branches=optimal
19602 @opindex mcompact-branches=always
19603 These options control which form of branches will be generated. The
19604 default is @option{-mcompact-branches=optimal}.
19605
19606 The @option{-mcompact-branches=never} option ensures that compact branch
19607 instructions will never be generated.
19608
19609 The @option{-mcompact-branches=always} option ensures that a compact
19610 branch instruction will be generated if available. If a compact branch
19611 instruction is not available, a delay slot form of the branch will be
19612 used instead.
19613
19614 This option is supported from MIPS Release 6 onwards.
19615
19616 The @option{-mcompact-branches=optimal} option will cause a delay slot
19617 branch to be used if one is available in the current ISA and the delay
19618 slot is successfully filled. If the delay slot is not filled, a compact
19619 branch will be chosen if one is available.
19620
19621 @item -mfp-exceptions
19622 @itemx -mno-fp-exceptions
19623 @opindex mfp-exceptions
19624 Specifies whether FP exceptions are enabled. This affects how
19625 FP instructions are scheduled for some processors.
19626 The default is that FP exceptions are
19627 enabled.
19628
19629 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
19630 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
19631 FP pipe.
19632
19633 @item -mvr4130-align
19634 @itemx -mno-vr4130-align
19635 @opindex mvr4130-align
19636 The VR4130 pipeline is two-way superscalar, but can only issue two
19637 instructions together if the first one is 8-byte aligned. When this
19638 option is enabled, GCC aligns pairs of instructions that it
19639 thinks should execute in parallel.
19640
19641 This option only has an effect when optimizing for the VR4130.
19642 It normally makes code faster, but at the expense of making it bigger.
19643 It is enabled by default at optimization level @option{-O3}.
19644
19645 @item -msynci
19646 @itemx -mno-synci
19647 @opindex msynci
19648 Enable (disable) generation of @code{synci} instructions on
19649 architectures that support it. The @code{synci} instructions (if
19650 enabled) are generated when @code{__builtin___clear_cache} is
19651 compiled.
19652
19653 This option defaults to @option{-mno-synci}, but the default can be
19654 overridden by configuring GCC with @option{--with-synci}.
19655
19656 When compiling code for single processor systems, it is generally safe
19657 to use @code{synci}. However, on many multi-core (SMP) systems, it
19658 does not invalidate the instruction caches on all cores and may lead
19659 to undefined behavior.
19660
19661 @item -mrelax-pic-calls
19662 @itemx -mno-relax-pic-calls
19663 @opindex mrelax-pic-calls
19664 Try to turn PIC calls that are normally dispatched via register
19665 @code{$25} into direct calls. This is only possible if the linker can
19666 resolve the destination at link time and if the destination is within
19667 range for a direct call.
19668
19669 @option{-mrelax-pic-calls} is the default if GCC was configured to use
19670 an assembler and a linker that support the @code{.reloc} assembly
19671 directive and @option{-mexplicit-relocs} is in effect. With
19672 @option{-mno-explicit-relocs}, this optimization can be performed by the
19673 assembler and the linker alone without help from the compiler.
19674
19675 @item -mmcount-ra-address
19676 @itemx -mno-mcount-ra-address
19677 @opindex mmcount-ra-address
19678 @opindex mno-mcount-ra-address
19679 Emit (do not emit) code that allows @code{_mcount} to modify the
19680 calling function's return address. When enabled, this option extends
19681 the usual @code{_mcount} interface with a new @var{ra-address}
19682 parameter, which has type @code{intptr_t *} and is passed in register
19683 @code{$12}. @code{_mcount} can then modify the return address by
19684 doing both of the following:
19685 @itemize
19686 @item
19687 Returning the new address in register @code{$31}.
19688 @item
19689 Storing the new address in @code{*@var{ra-address}},
19690 if @var{ra-address} is nonnull.
19691 @end itemize
19692
19693 The default is @option{-mno-mcount-ra-address}.
19694
19695 @item -mframe-header-opt
19696 @itemx -mno-frame-header-opt
19697 @opindex mframe-header-opt
19698 Enable (disable) frame header optimization in the o32 ABI. When using the
19699 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
19700 function to write out register arguments. When enabled, this optimization
19701 will suppress the allocation of the frame header if it can be determined that
19702 it is unused.
19703
19704 This optimization is off by default at all optimization levels.
19705
19706 @end table
19707
19708 @node MMIX Options
19709 @subsection MMIX Options
19710 @cindex MMIX Options
19711
19712 These options are defined for the MMIX:
19713
19714 @table @gcctabopt
19715 @item -mlibfuncs
19716 @itemx -mno-libfuncs
19717 @opindex mlibfuncs
19718 @opindex mno-libfuncs
19719 Specify that intrinsic library functions are being compiled, passing all
19720 values in registers, no matter the size.
19721
19722 @item -mepsilon
19723 @itemx -mno-epsilon
19724 @opindex mepsilon
19725 @opindex mno-epsilon
19726 Generate floating-point comparison instructions that compare with respect
19727 to the @code{rE} epsilon register.
19728
19729 @item -mabi=mmixware
19730 @itemx -mabi=gnu
19731 @opindex mabi=mmixware
19732 @opindex mabi=gnu
19733 Generate code that passes function parameters and return values that (in
19734 the called function) are seen as registers @code{$0} and up, as opposed to
19735 the GNU ABI which uses global registers @code{$231} and up.
19736
19737 @item -mzero-extend
19738 @itemx -mno-zero-extend
19739 @opindex mzero-extend
19740 @opindex mno-zero-extend
19741 When reading data from memory in sizes shorter than 64 bits, use (do not
19742 use) zero-extending load instructions by default, rather than
19743 sign-extending ones.
19744
19745 @item -mknuthdiv
19746 @itemx -mno-knuthdiv
19747 @opindex mknuthdiv
19748 @opindex mno-knuthdiv
19749 Make the result of a division yielding a remainder have the same sign as
19750 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
19751 remainder follows the sign of the dividend. Both methods are
19752 arithmetically valid, the latter being almost exclusively used.
19753
19754 @item -mtoplevel-symbols
19755 @itemx -mno-toplevel-symbols
19756 @opindex mtoplevel-symbols
19757 @opindex mno-toplevel-symbols
19758 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
19759 code can be used with the @code{PREFIX} assembly directive.
19760
19761 @item -melf
19762 @opindex melf
19763 Generate an executable in the ELF format, rather than the default
19764 @samp{mmo} format used by the @command{mmix} simulator.
19765
19766 @item -mbranch-predict
19767 @itemx -mno-branch-predict
19768 @opindex mbranch-predict
19769 @opindex mno-branch-predict
19770 Use (do not use) the probable-branch instructions, when static branch
19771 prediction indicates a probable branch.
19772
19773 @item -mbase-addresses
19774 @itemx -mno-base-addresses
19775 @opindex mbase-addresses
19776 @opindex mno-base-addresses
19777 Generate (do not generate) code that uses @emph{base addresses}. Using a
19778 base address automatically generates a request (handled by the assembler
19779 and the linker) for a constant to be set up in a global register. The
19780 register is used for one or more base address requests within the range 0
19781 to 255 from the value held in the register. The generally leads to short
19782 and fast code, but the number of different data items that can be
19783 addressed is limited. This means that a program that uses lots of static
19784 data may require @option{-mno-base-addresses}.
19785
19786 @item -msingle-exit
19787 @itemx -mno-single-exit
19788 @opindex msingle-exit
19789 @opindex mno-single-exit
19790 Force (do not force) generated code to have a single exit point in each
19791 function.
19792 @end table
19793
19794 @node MN10300 Options
19795 @subsection MN10300 Options
19796 @cindex MN10300 options
19797
19798 These @option{-m} options are defined for Matsushita MN10300 architectures:
19799
19800 @table @gcctabopt
19801 @item -mmult-bug
19802 @opindex mmult-bug
19803 Generate code to avoid bugs in the multiply instructions for the MN10300
19804 processors. This is the default.
19805
19806 @item -mno-mult-bug
19807 @opindex mno-mult-bug
19808 Do not generate code to avoid bugs in the multiply instructions for the
19809 MN10300 processors.
19810
19811 @item -mam33
19812 @opindex mam33
19813 Generate code using features specific to the AM33 processor.
19814
19815 @item -mno-am33
19816 @opindex mno-am33
19817 Do not generate code using features specific to the AM33 processor. This
19818 is the default.
19819
19820 @item -mam33-2
19821 @opindex mam33-2
19822 Generate code using features specific to the AM33/2.0 processor.
19823
19824 @item -mam34
19825 @opindex mam34
19826 Generate code using features specific to the AM34 processor.
19827
19828 @item -mtune=@var{cpu-type}
19829 @opindex mtune
19830 Use the timing characteristics of the indicated CPU type when
19831 scheduling instructions. This does not change the targeted processor
19832 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
19833 @samp{am33-2} or @samp{am34}.
19834
19835 @item -mreturn-pointer-on-d0
19836 @opindex mreturn-pointer-on-d0
19837 When generating a function that returns a pointer, return the pointer
19838 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
19839 only in @code{a0}, and attempts to call such functions without a prototype
19840 result in errors. Note that this option is on by default; use
19841 @option{-mno-return-pointer-on-d0} to disable it.
19842
19843 @item -mno-crt0
19844 @opindex mno-crt0
19845 Do not link in the C run-time initialization object file.
19846
19847 @item -mrelax
19848 @opindex mrelax
19849 Indicate to the linker that it should perform a relaxation optimization pass
19850 to shorten branches, calls and absolute memory addresses. This option only
19851 has an effect when used on the command line for the final link step.
19852
19853 This option makes symbolic debugging impossible.
19854
19855 @item -mliw
19856 @opindex mliw
19857 Allow the compiler to generate @emph{Long Instruction Word}
19858 instructions if the target is the @samp{AM33} or later. This is the
19859 default. This option defines the preprocessor macro @code{__LIW__}.
19860
19861 @item -mnoliw
19862 @opindex mnoliw
19863 Do not allow the compiler to generate @emph{Long Instruction Word}
19864 instructions. This option defines the preprocessor macro
19865 @code{__NO_LIW__}.
19866
19867 @item -msetlb
19868 @opindex msetlb
19869 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
19870 instructions if the target is the @samp{AM33} or later. This is the
19871 default. This option defines the preprocessor macro @code{__SETLB__}.
19872
19873 @item -mnosetlb
19874 @opindex mnosetlb
19875 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
19876 instructions. This option defines the preprocessor macro
19877 @code{__NO_SETLB__}.
19878
19879 @end table
19880
19881 @node Moxie Options
19882 @subsection Moxie Options
19883 @cindex Moxie Options
19884
19885 @table @gcctabopt
19886
19887 @item -meb
19888 @opindex meb
19889 Generate big-endian code. This is the default for @samp{moxie-*-*}
19890 configurations.
19891
19892 @item -mel
19893 @opindex mel
19894 Generate little-endian code.
19895
19896 @item -mmul.x
19897 @opindex mmul.x
19898 Generate mul.x and umul.x instructions. This is the default for
19899 @samp{moxiebox-*-*} configurations.
19900
19901 @item -mno-crt0
19902 @opindex mno-crt0
19903 Do not link in the C run-time initialization object file.
19904
19905 @end table
19906
19907 @node MSP430 Options
19908 @subsection MSP430 Options
19909 @cindex MSP430 Options
19910
19911 These options are defined for the MSP430:
19912
19913 @table @gcctabopt
19914
19915 @item -masm-hex
19916 @opindex masm-hex
19917 Force assembly output to always use hex constants. Normally such
19918 constants are signed decimals, but this option is available for
19919 testsuite and/or aesthetic purposes.
19920
19921 @item -mmcu=
19922 @opindex mmcu=
19923 Select the MCU to target. This is used to create a C preprocessor
19924 symbol based upon the MCU name, converted to upper case and pre- and
19925 post-fixed with @samp{__}. This in turn is used by the
19926 @file{msp430.h} header file to select an MCU-specific supplementary
19927 header file.
19928
19929 The option also sets the ISA to use. If the MCU name is one that is
19930 known to only support the 430 ISA then that is selected, otherwise the
19931 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
19932 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
19933 name selects the 430X ISA.
19934
19935 In addition an MCU-specific linker script is added to the linker
19936 command line. The script's name is the name of the MCU with
19937 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
19938 command line defines the C preprocessor symbol @code{__XXX__} and
19939 cause the linker to search for a script called @file{xxx.ld}.
19940
19941 This option is also passed on to the assembler.
19942
19943 @item -mwarn-mcu
19944 @itemx -mno-warn-mcu
19945 @opindex mwarn-mcu
19946 @opindex mno-warn-mcu
19947 This option enables or disables warnings about conflicts between the
19948 MCU name specified by the @option{-mmcu} option and the ISA set by the
19949 @option{-mcpu} option and/or the hardware multiply support set by the
19950 @option{-mhwmult} option. It also toggles warnings about unrecognized
19951 MCU names. This option is on by default.
19952
19953 @item -mcpu=
19954 @opindex mcpu=
19955 Specifies the ISA to use. Accepted values are @samp{msp430},
19956 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
19957 @option{-mmcu=} option should be used to select the ISA.
19958
19959 @item -msim
19960 @opindex msim
19961 Link to the simulator runtime libraries and linker script. Overrides
19962 any scripts that would be selected by the @option{-mmcu=} option.
19963
19964 @item -mlarge
19965 @opindex mlarge
19966 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
19967
19968 @item -msmall
19969 @opindex msmall
19970 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
19971
19972 @item -mrelax
19973 @opindex mrelax
19974 This option is passed to the assembler and linker, and allows the
19975 linker to perform certain optimizations that cannot be done until
19976 the final link.
19977
19978 @item mhwmult=
19979 @opindex mhwmult=
19980 Describes the type of hardware multiply supported by the target.
19981 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
19982 for the original 16-bit-only multiply supported by early MCUs.
19983 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
19984 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
19985 A value of @samp{auto} can also be given. This tells GCC to deduce
19986 the hardware multiply support based upon the MCU name provided by the
19987 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
19988 the MCU name is not recognized then no hardware multiply support is
19989 assumed. @code{auto} is the default setting.
19990
19991 Hardware multiplies are normally performed by calling a library
19992 routine. This saves space in the generated code. When compiling at
19993 @option{-O3} or higher however the hardware multiplier is invoked
19994 inline. This makes for bigger, but faster code.
19995
19996 The hardware multiply routines disable interrupts whilst running and
19997 restore the previous interrupt state when they finish. This makes
19998 them safe to use inside interrupt handlers as well as in normal code.
19999
20000 @item -minrt
20001 @opindex minrt
20002 Enable the use of a minimum runtime environment - no static
20003 initializers or constructors. This is intended for memory-constrained
20004 devices. The compiler includes special symbols in some objects
20005 that tell the linker and runtime which code fragments are required.
20006
20007 @item -mcode-region=
20008 @itemx -mdata-region=
20009 @opindex mcode-region
20010 @opindex mdata-region
20011 These options tell the compiler where to place functions and data that
20012 do not have one of the @code{lower}, @code{upper}, @code{either} or
20013 @code{section} attributes. Possible values are @code{lower},
20014 @code{upper}, @code{either} or @code{any}. The first three behave
20015 like the corresponding attribute. The fourth possible value -
20016 @code{any} - is the default. It leaves placement entirely up to the
20017 linker script and how it assigns the standard sections
20018 (@code{.text}, @code{.data}, etc) to the memory regions.
20019
20020 @item -msilicon-errata=
20021 @opindex msilicon-errata
20022 This option passes on a request to assembler to enable the fixes for
20023 the named silicon errata.
20024
20025 @item -msilicon-errata-warn=
20026 @opindex msilicon-errata-warn
20027 This option passes on a request to the assembler to enable warning
20028 messages when a silicon errata might need to be applied.
20029
20030 @end table
20031
20032 @node NDS32 Options
20033 @subsection NDS32 Options
20034 @cindex NDS32 Options
20035
20036 These options are defined for NDS32 implementations:
20037
20038 @table @gcctabopt
20039
20040 @item -mbig-endian
20041 @opindex mbig-endian
20042 Generate code in big-endian mode.
20043
20044 @item -mlittle-endian
20045 @opindex mlittle-endian
20046 Generate code in little-endian mode.
20047
20048 @item -mreduced-regs
20049 @opindex mreduced-regs
20050 Use reduced-set registers for register allocation.
20051
20052 @item -mfull-regs
20053 @opindex mfull-regs
20054 Use full-set registers for register allocation.
20055
20056 @item -mcmov
20057 @opindex mcmov
20058 Generate conditional move instructions.
20059
20060 @item -mno-cmov
20061 @opindex mno-cmov
20062 Do not generate conditional move instructions.
20063
20064 @item -mperf-ext
20065 @opindex mperf-ext
20066 Generate performance extension instructions.
20067
20068 @item -mno-perf-ext
20069 @opindex mno-perf-ext
20070 Do not generate performance extension instructions.
20071
20072 @item -mv3push
20073 @opindex mv3push
20074 Generate v3 push25/pop25 instructions.
20075
20076 @item -mno-v3push
20077 @opindex mno-v3push
20078 Do not generate v3 push25/pop25 instructions.
20079
20080 @item -m16-bit
20081 @opindex m16-bit
20082 Generate 16-bit instructions.
20083
20084 @item -mno-16-bit
20085 @opindex mno-16-bit
20086 Do not generate 16-bit instructions.
20087
20088 @item -misr-vector-size=@var{num}
20089 @opindex misr-vector-size
20090 Specify the size of each interrupt vector, which must be 4 or 16.
20091
20092 @item -mcache-block-size=@var{num}
20093 @opindex mcache-block-size
20094 Specify the size of each cache block,
20095 which must be a power of 2 between 4 and 512.
20096
20097 @item -march=@var{arch}
20098 @opindex march
20099 Specify the name of the target architecture.
20100
20101 @item -mcmodel=@var{code-model}
20102 @opindex mcmodel
20103 Set the code model to one of
20104 @table @asis
20105 @item @samp{small}
20106 All the data and read-only data segments must be within 512KB addressing space.
20107 The text segment must be within 16MB addressing space.
20108 @item @samp{medium}
20109 The data segment must be within 512KB while the read-only data segment can be
20110 within 4GB addressing space. The text segment should be still within 16MB
20111 addressing space.
20112 @item @samp{large}
20113 All the text and data segments can be within 4GB addressing space.
20114 @end table
20115
20116 @item -mctor-dtor
20117 @opindex mctor-dtor
20118 Enable constructor/destructor feature.
20119
20120 @item -mrelax
20121 @opindex mrelax
20122 Guide linker to relax instructions.
20123
20124 @end table
20125
20126 @node Nios II Options
20127 @subsection Nios II Options
20128 @cindex Nios II options
20129 @cindex Altera Nios II options
20130
20131 These are the options defined for the Altera Nios II processor.
20132
20133 @table @gcctabopt
20134
20135 @item -G @var{num}
20136 @opindex G
20137 @cindex smaller data references
20138 Put global and static objects less than or equal to @var{num} bytes
20139 into the small data or BSS sections instead of the normal data or BSS
20140 sections. The default value of @var{num} is 8.
20141
20142 @item -mgpopt=@var{option}
20143 @item -mgpopt
20144 @itemx -mno-gpopt
20145 @opindex mgpopt
20146 @opindex mno-gpopt
20147 Generate (do not generate) GP-relative accesses. The following
20148 @var{option} names are recognized:
20149
20150 @table @samp
20151
20152 @item none
20153 Do not generate GP-relative accesses.
20154
20155 @item local
20156 Generate GP-relative accesses for small data objects that are not
20157 external, weak, or uninitialized common symbols.
20158 Also use GP-relative addressing for objects that
20159 have been explicitly placed in a small data section via a @code{section}
20160 attribute.
20161
20162 @item global
20163 As for @samp{local}, but also generate GP-relative accesses for
20164 small data objects that are external, weak, or common. If you use this option,
20165 you must ensure that all parts of your program (including libraries) are
20166 compiled with the same @option{-G} setting.
20167
20168 @item data
20169 Generate GP-relative accesses for all data objects in the program. If you
20170 use this option, the entire data and BSS segments
20171 of your program must fit in 64K of memory and you must use an appropriate
20172 linker script to allocate them within the addressable range of the
20173 global pointer.
20174
20175 @item all
20176 Generate GP-relative addresses for function pointers as well as data
20177 pointers. If you use this option, the entire text, data, and BSS segments
20178 of your program must fit in 64K of memory and you must use an appropriate
20179 linker script to allocate them within the addressable range of the
20180 global pointer.
20181
20182 @end table
20183
20184 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
20185 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
20186
20187 The default is @option{-mgpopt} except when @option{-fpic} or
20188 @option{-fPIC} is specified to generate position-independent code.
20189 Note that the Nios II ABI does not permit GP-relative accesses from
20190 shared libraries.
20191
20192 You may need to specify @option{-mno-gpopt} explicitly when building
20193 programs that include large amounts of small data, including large
20194 GOT data sections. In this case, the 16-bit offset for GP-relative
20195 addressing may not be large enough to allow access to the entire
20196 small data section.
20197
20198 @item -mel
20199 @itemx -meb
20200 @opindex mel
20201 @opindex meb
20202 Generate little-endian (default) or big-endian (experimental) code,
20203 respectively.
20204
20205 @item -march=@var{arch}
20206 @opindex march
20207 This specifies the name of the target Nios II architecture. GCC uses this
20208 name to determine what kind of instructions it can emit when generating
20209 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
20210
20211 The preprocessor macro @code{__nios2_arch__} is available to programs,
20212 with value 1 or 2, indicating the targeted ISA level.
20213
20214 @item -mbypass-cache
20215 @itemx -mno-bypass-cache
20216 @opindex mno-bypass-cache
20217 @opindex mbypass-cache
20218 Force all load and store instructions to always bypass cache by
20219 using I/O variants of the instructions. The default is not to
20220 bypass the cache.
20221
20222 @item -mno-cache-volatile
20223 @itemx -mcache-volatile
20224 @opindex mcache-volatile
20225 @opindex mno-cache-volatile
20226 Volatile memory access bypass the cache using the I/O variants of
20227 the load and store instructions. The default is not to bypass the cache.
20228
20229 @item -mno-fast-sw-div
20230 @itemx -mfast-sw-div
20231 @opindex mno-fast-sw-div
20232 @opindex mfast-sw-div
20233 Do not use table-based fast divide for small numbers. The default
20234 is to use the fast divide at @option{-O3} and above.
20235
20236 @item -mno-hw-mul
20237 @itemx -mhw-mul
20238 @itemx -mno-hw-mulx
20239 @itemx -mhw-mulx
20240 @itemx -mno-hw-div
20241 @itemx -mhw-div
20242 @opindex mno-hw-mul
20243 @opindex mhw-mul
20244 @opindex mno-hw-mulx
20245 @opindex mhw-mulx
20246 @opindex mno-hw-div
20247 @opindex mhw-div
20248 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
20249 instructions by the compiler. The default is to emit @code{mul}
20250 and not emit @code{div} and @code{mulx}.
20251
20252 @item -mbmx
20253 @itemx -mno-bmx
20254 @itemx -mcdx
20255 @itemx -mno-cdx
20256 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
20257 CDX (code density) instructions. Enabling these instructions also
20258 requires @option{-march=r2}. Since these instructions are optional
20259 extensions to the R2 architecture, the default is not to emit them.
20260
20261 @item -mcustom-@var{insn}=@var{N}
20262 @itemx -mno-custom-@var{insn}
20263 @opindex mcustom-@var{insn}
20264 @opindex mno-custom-@var{insn}
20265 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
20266 custom instruction with encoding @var{N} when generating code that uses
20267 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
20268 instruction 253 for single-precision floating-point add operations instead
20269 of the default behavior of using a library call.
20270
20271 The following values of @var{insn} are supported. Except as otherwise
20272 noted, floating-point operations are expected to be implemented with
20273 normal IEEE 754 semantics and correspond directly to the C operators or the
20274 equivalent GCC built-in functions (@pxref{Other Builtins}).
20275
20276 Single-precision floating point:
20277 @table @asis
20278
20279 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
20280 Binary arithmetic operations.
20281
20282 @item @samp{fnegs}
20283 Unary negation.
20284
20285 @item @samp{fabss}
20286 Unary absolute value.
20287
20288 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
20289 Comparison operations.
20290
20291 @item @samp{fmins}, @samp{fmaxs}
20292 Floating-point minimum and maximum. These instructions are only
20293 generated if @option{-ffinite-math-only} is specified.
20294
20295 @item @samp{fsqrts}
20296 Unary square root operation.
20297
20298 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
20299 Floating-point trigonometric and exponential functions. These instructions
20300 are only generated if @option{-funsafe-math-optimizations} is also specified.
20301
20302 @end table
20303
20304 Double-precision floating point:
20305 @table @asis
20306
20307 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
20308 Binary arithmetic operations.
20309
20310 @item @samp{fnegd}
20311 Unary negation.
20312
20313 @item @samp{fabsd}
20314 Unary absolute value.
20315
20316 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
20317 Comparison operations.
20318
20319 @item @samp{fmind}, @samp{fmaxd}
20320 Double-precision minimum and maximum. These instructions are only
20321 generated if @option{-ffinite-math-only} is specified.
20322
20323 @item @samp{fsqrtd}
20324 Unary square root operation.
20325
20326 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
20327 Double-precision trigonometric and exponential functions. These instructions
20328 are only generated if @option{-funsafe-math-optimizations} is also specified.
20329
20330 @end table
20331
20332 Conversions:
20333 @table @asis
20334 @item @samp{fextsd}
20335 Conversion from single precision to double precision.
20336
20337 @item @samp{ftruncds}
20338 Conversion from double precision to single precision.
20339
20340 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
20341 Conversion from floating point to signed or unsigned integer types, with
20342 truncation towards zero.
20343
20344 @item @samp{round}
20345 Conversion from single-precision floating point to signed integer,
20346 rounding to the nearest integer and ties away from zero.
20347 This corresponds to the @code{__builtin_lroundf} function when
20348 @option{-fno-math-errno} is used.
20349
20350 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
20351 Conversion from signed or unsigned integer types to floating-point types.
20352
20353 @end table
20354
20355 In addition, all of the following transfer instructions for internal
20356 registers X and Y must be provided to use any of the double-precision
20357 floating-point instructions. Custom instructions taking two
20358 double-precision source operands expect the first operand in the
20359 64-bit register X. The other operand (or only operand of a unary
20360 operation) is given to the custom arithmetic instruction with the
20361 least significant half in source register @var{src1} and the most
20362 significant half in @var{src2}. A custom instruction that returns a
20363 double-precision result returns the most significant 32 bits in the
20364 destination register and the other half in 32-bit register Y.
20365 GCC automatically generates the necessary code sequences to write
20366 register X and/or read register Y when double-precision floating-point
20367 instructions are used.
20368
20369 @table @asis
20370
20371 @item @samp{fwrx}
20372 Write @var{src1} into the least significant half of X and @var{src2} into
20373 the most significant half of X.
20374
20375 @item @samp{fwry}
20376 Write @var{src1} into Y.
20377
20378 @item @samp{frdxhi}, @samp{frdxlo}
20379 Read the most or least (respectively) significant half of X and store it in
20380 @var{dest}.
20381
20382 @item @samp{frdy}
20383 Read the value of Y and store it into @var{dest}.
20384 @end table
20385
20386 Note that you can gain more local control over generation of Nios II custom
20387 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
20388 and @code{target("no-custom-@var{insn}")} function attributes
20389 (@pxref{Function Attributes})
20390 or pragmas (@pxref{Function Specific Option Pragmas}).
20391
20392 @item -mcustom-fpu-cfg=@var{name}
20393 @opindex mcustom-fpu-cfg
20394
20395 This option enables a predefined, named set of custom instruction encodings
20396 (see @option{-mcustom-@var{insn}} above).
20397 Currently, the following sets are defined:
20398
20399 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
20400 @gccoptlist{-mcustom-fmuls=252 @gol
20401 -mcustom-fadds=253 @gol
20402 -mcustom-fsubs=254 @gol
20403 -fsingle-precision-constant}
20404
20405 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
20406 @gccoptlist{-mcustom-fmuls=252 @gol
20407 -mcustom-fadds=253 @gol
20408 -mcustom-fsubs=254 @gol
20409 -mcustom-fdivs=255 @gol
20410 -fsingle-precision-constant}
20411
20412 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
20413 @gccoptlist{-mcustom-floatus=243 @gol
20414 -mcustom-fixsi=244 @gol
20415 -mcustom-floatis=245 @gol
20416 -mcustom-fcmpgts=246 @gol
20417 -mcustom-fcmples=249 @gol
20418 -mcustom-fcmpeqs=250 @gol
20419 -mcustom-fcmpnes=251 @gol
20420 -mcustom-fmuls=252 @gol
20421 -mcustom-fadds=253 @gol
20422 -mcustom-fsubs=254 @gol
20423 -mcustom-fdivs=255 @gol
20424 -fsingle-precision-constant}
20425
20426 Custom instruction assignments given by individual
20427 @option{-mcustom-@var{insn}=} options override those given by
20428 @option{-mcustom-fpu-cfg=}, regardless of the
20429 order of the options on the command line.
20430
20431 Note that you can gain more local control over selection of a FPU
20432 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
20433 function attribute (@pxref{Function Attributes})
20434 or pragma (@pxref{Function Specific Option Pragmas}).
20435
20436 @end table
20437
20438 These additional @samp{-m} options are available for the Altera Nios II
20439 ELF (bare-metal) target:
20440
20441 @table @gcctabopt
20442
20443 @item -mhal
20444 @opindex mhal
20445 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
20446 startup and termination code, and is typically used in conjunction with
20447 @option{-msys-crt0=} to specify the location of the alternate startup code
20448 provided by the HAL BSP.
20449
20450 @item -msmallc
20451 @opindex msmallc
20452 Link with a limited version of the C library, @option{-lsmallc}, rather than
20453 Newlib.
20454
20455 @item -msys-crt0=@var{startfile}
20456 @opindex msys-crt0
20457 @var{startfile} is the file name of the startfile (crt0) to use
20458 when linking. This option is only useful in conjunction with @option{-mhal}.
20459
20460 @item -msys-lib=@var{systemlib}
20461 @opindex msys-lib
20462 @var{systemlib} is the library name of the library that provides
20463 low-level system calls required by the C library,
20464 e.g. @code{read} and @code{write}.
20465 This option is typically used to link with a library provided by a HAL BSP.
20466
20467 @end table
20468
20469 @node Nvidia PTX Options
20470 @subsection Nvidia PTX Options
20471 @cindex Nvidia PTX options
20472 @cindex nvptx options
20473
20474 These options are defined for Nvidia PTX:
20475
20476 @table @gcctabopt
20477
20478 @item -m32
20479 @itemx -m64
20480 @opindex m32
20481 @opindex m64
20482 Generate code for 32-bit or 64-bit ABI.
20483
20484 @item -mmainkernel
20485 @opindex mmainkernel
20486 Link in code for a __main kernel. This is for stand-alone instead of
20487 offloading execution.
20488
20489 @item -moptimize
20490 @opindex moptimize
20491 Apply partitioned execution optimizations. This is the default when any
20492 level of optimization is selected.
20493
20494 @end table
20495
20496 @node PDP-11 Options
20497 @subsection PDP-11 Options
20498 @cindex PDP-11 Options
20499
20500 These options are defined for the PDP-11:
20501
20502 @table @gcctabopt
20503 @item -mfpu
20504 @opindex mfpu
20505 Use hardware FPP floating point. This is the default. (FIS floating
20506 point on the PDP-11/40 is not supported.)
20507
20508 @item -msoft-float
20509 @opindex msoft-float
20510 Do not use hardware floating point.
20511
20512 @item -mac0
20513 @opindex mac0
20514 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
20515
20516 @item -mno-ac0
20517 @opindex mno-ac0
20518 Return floating-point results in memory. This is the default.
20519
20520 @item -m40
20521 @opindex m40
20522 Generate code for a PDP-11/40.
20523
20524 @item -m45
20525 @opindex m45
20526 Generate code for a PDP-11/45. This is the default.
20527
20528 @item -m10
20529 @opindex m10
20530 Generate code for a PDP-11/10.
20531
20532 @item -mbcopy-builtin
20533 @opindex mbcopy-builtin
20534 Use inline @code{movmemhi} patterns for copying memory. This is the
20535 default.
20536
20537 @item -mbcopy
20538 @opindex mbcopy
20539 Do not use inline @code{movmemhi} patterns for copying memory.
20540
20541 @item -mint16
20542 @itemx -mno-int32
20543 @opindex mint16
20544 @opindex mno-int32
20545 Use 16-bit @code{int}. This is the default.
20546
20547 @item -mint32
20548 @itemx -mno-int16
20549 @opindex mint32
20550 @opindex mno-int16
20551 Use 32-bit @code{int}.
20552
20553 @item -mfloat64
20554 @itemx -mno-float32
20555 @opindex mfloat64
20556 @opindex mno-float32
20557 Use 64-bit @code{float}. This is the default.
20558
20559 @item -mfloat32
20560 @itemx -mno-float64
20561 @opindex mfloat32
20562 @opindex mno-float64
20563 Use 32-bit @code{float}.
20564
20565 @item -mabshi
20566 @opindex mabshi
20567 Use @code{abshi2} pattern. This is the default.
20568
20569 @item -mno-abshi
20570 @opindex mno-abshi
20571 Do not use @code{abshi2} pattern.
20572
20573 @item -mbranch-expensive
20574 @opindex mbranch-expensive
20575 Pretend that branches are expensive. This is for experimenting with
20576 code generation only.
20577
20578 @item -mbranch-cheap
20579 @opindex mbranch-cheap
20580 Do not pretend that branches are expensive. This is the default.
20581
20582 @item -munix-asm
20583 @opindex munix-asm
20584 Use Unix assembler syntax. This is the default when configured for
20585 @samp{pdp11-*-bsd}.
20586
20587 @item -mdec-asm
20588 @opindex mdec-asm
20589 Use DEC assembler syntax. This is the default when configured for any
20590 PDP-11 target other than @samp{pdp11-*-bsd}.
20591 @end table
20592
20593 @node picoChip Options
20594 @subsection picoChip Options
20595 @cindex picoChip options
20596
20597 These @samp{-m} options are defined for picoChip implementations:
20598
20599 @table @gcctabopt
20600
20601 @item -mae=@var{ae_type}
20602 @opindex mcpu
20603 Set the instruction set, register set, and instruction scheduling
20604 parameters for array element type @var{ae_type}. Supported values
20605 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
20606
20607 @option{-mae=ANY} selects a completely generic AE type. Code
20608 generated with this option runs on any of the other AE types. The
20609 code is not as efficient as it would be if compiled for a specific
20610 AE type, and some types of operation (e.g., multiplication) do not
20611 work properly on all types of AE.
20612
20613 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
20614 for compiled code, and is the default.
20615
20616 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
20617 option may suffer from poor performance of byte (char) manipulation,
20618 since the DSP AE does not provide hardware support for byte load/stores.
20619
20620 @item -msymbol-as-address
20621 Enable the compiler to directly use a symbol name as an address in a
20622 load/store instruction, without first loading it into a
20623 register. Typically, the use of this option generates larger
20624 programs, which run faster than when the option isn't used. However, the
20625 results vary from program to program, so it is left as a user option,
20626 rather than being permanently enabled.
20627
20628 @item -mno-inefficient-warnings
20629 Disables warnings about the generation of inefficient code. These
20630 warnings can be generated, for example, when compiling code that
20631 performs byte-level memory operations on the MAC AE type. The MAC AE has
20632 no hardware support for byte-level memory operations, so all byte
20633 load/stores must be synthesized from word load/store operations. This is
20634 inefficient and a warning is generated to indicate
20635 that you should rewrite the code to avoid byte operations, or to target
20636 an AE type that has the necessary hardware support. This option disables
20637 these warnings.
20638
20639 @end table
20640
20641 @node PowerPC Options
20642 @subsection PowerPC Options
20643 @cindex PowerPC options
20644
20645 These are listed under @xref{RS/6000 and PowerPC Options}.
20646
20647 @node RL78 Options
20648 @subsection RL78 Options
20649 @cindex RL78 Options
20650
20651 @table @gcctabopt
20652
20653 @item -msim
20654 @opindex msim
20655 Links in additional target libraries to support operation within a
20656 simulator.
20657
20658 @item -mmul=none
20659 @itemx -mmul=g10
20660 @itemx -mmul=g13
20661 @itemx -mmul=g14
20662 @itemx -mmul=rl78
20663 @opindex mmul
20664 Specifies the type of hardware multiplication and division support to
20665 be used. The simplest is @code{none}, which uses software for both
20666 multiplication and division. This is the default. The @code{g13}
20667 value is for the hardware multiply/divide peripheral found on the
20668 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
20669 the multiplication and division instructions supported by the RL78/G14
20670 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
20671 the value @code{mg10} is an alias for @code{none}.
20672
20673 In addition a C preprocessor macro is defined, based upon the setting
20674 of this option. Possible values are: @code{__RL78_MUL_NONE__},
20675 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
20676
20677 @item -mcpu=g10
20678 @itemx -mcpu=g13
20679 @itemx -mcpu=g14
20680 @itemx -mcpu=rl78
20681 @opindex mcpu
20682 Specifies the RL78 core to target. The default is the G14 core, also
20683 known as an S3 core or just RL78. The G13 or S2 core does not have
20684 multiply or divide instructions, instead it uses a hardware peripheral
20685 for these operations. The G10 or S1 core does not have register
20686 banks, so it uses a different calling convention.
20687
20688 If this option is set it also selects the type of hardware multiply
20689 support to use, unless this is overridden by an explicit
20690 @option{-mmul=none} option on the command line. Thus specifying
20691 @option{-mcpu=g13} enables the use of the G13 hardware multiply
20692 peripheral and specifying @option{-mcpu=g10} disables the use of
20693 hardware multiplications altogether.
20694
20695 Note, although the RL78/G14 core is the default target, specifying
20696 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
20697 change the behavior of the toolchain since it also enables G14
20698 hardware multiply support. If these options are not specified on the
20699 command line then software multiplication routines will be used even
20700 though the code targets the RL78 core. This is for backwards
20701 compatibility with older toolchains which did not have hardware
20702 multiply and divide support.
20703
20704 In addition a C preprocessor macro is defined, based upon the setting
20705 of this option. Possible values are: @code{__RL78_G10__},
20706 @code{__RL78_G13__} or @code{__RL78_G14__}.
20707
20708 @item -mg10
20709 @itemx -mg13
20710 @itemx -mg14
20711 @itemx -mrl78
20712 @opindex mg10
20713 @opindex mg13
20714 @opindex mg14
20715 @opindex mrl78
20716 These are aliases for the corresponding @option{-mcpu=} option. They
20717 are provided for backwards compatibility.
20718
20719 @item -mallregs
20720 @opindex mallregs
20721 Allow the compiler to use all of the available registers. By default
20722 registers @code{r24..r31} are reserved for use in interrupt handlers.
20723 With this option enabled these registers can be used in ordinary
20724 functions as well.
20725
20726 @item -m64bit-doubles
20727 @itemx -m32bit-doubles
20728 @opindex m64bit-doubles
20729 @opindex m32bit-doubles
20730 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
20731 or 32 bits (@option{-m32bit-doubles}) in size. The default is
20732 @option{-m32bit-doubles}.
20733
20734 @item -msave-mduc-in-interrupts
20735 @item -mno-save-mduc-in-interrupts
20736 @opindex msave-mduc-in-interrupts
20737 @opindex mno-save-mduc-in-interrupts
20738 Specifies that interrupt handler functions should preserve the
20739 MDUC registers. This is only necessary if normal code might use
20740 the MDUC registers, for example because it performs multiplication
20741 and division operations. The default is to ignore the MDUC registers
20742 as this makes the interrupt handlers faster. The target option -mg13
20743 needs to be passed for this to work as this feature is only available
20744 on the G13 target (S2 core). The MDUC registers will only be saved
20745 if the interrupt handler performs a multiplication or division
20746 operation or it calls another function.
20747
20748 @end table
20749
20750 @node RS/6000 and PowerPC Options
20751 @subsection IBM RS/6000 and PowerPC Options
20752 @cindex RS/6000 and PowerPC Options
20753 @cindex IBM RS/6000 and PowerPC Options
20754
20755 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
20756 @table @gcctabopt
20757 @item -mpowerpc-gpopt
20758 @itemx -mno-powerpc-gpopt
20759 @itemx -mpowerpc-gfxopt
20760 @itemx -mno-powerpc-gfxopt
20761 @need 800
20762 @itemx -mpowerpc64
20763 @itemx -mno-powerpc64
20764 @itemx -mmfcrf
20765 @itemx -mno-mfcrf
20766 @itemx -mpopcntb
20767 @itemx -mno-popcntb
20768 @itemx -mpopcntd
20769 @itemx -mno-popcntd
20770 @itemx -mfprnd
20771 @itemx -mno-fprnd
20772 @need 800
20773 @itemx -mcmpb
20774 @itemx -mno-cmpb
20775 @itemx -mmfpgpr
20776 @itemx -mno-mfpgpr
20777 @itemx -mhard-dfp
20778 @itemx -mno-hard-dfp
20779 @opindex mpowerpc-gpopt
20780 @opindex mno-powerpc-gpopt
20781 @opindex mpowerpc-gfxopt
20782 @opindex mno-powerpc-gfxopt
20783 @opindex mpowerpc64
20784 @opindex mno-powerpc64
20785 @opindex mmfcrf
20786 @opindex mno-mfcrf
20787 @opindex mpopcntb
20788 @opindex mno-popcntb
20789 @opindex mpopcntd
20790 @opindex mno-popcntd
20791 @opindex mfprnd
20792 @opindex mno-fprnd
20793 @opindex mcmpb
20794 @opindex mno-cmpb
20795 @opindex mmfpgpr
20796 @opindex mno-mfpgpr
20797 @opindex mhard-dfp
20798 @opindex mno-hard-dfp
20799 You use these options to specify which instructions are available on the
20800 processor you are using. The default value of these options is
20801 determined when configuring GCC@. Specifying the
20802 @option{-mcpu=@var{cpu_type}} overrides the specification of these
20803 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
20804 rather than the options listed above.
20805
20806 Specifying @option{-mpowerpc-gpopt} allows
20807 GCC to use the optional PowerPC architecture instructions in the
20808 General Purpose group, including floating-point square root. Specifying
20809 @option{-mpowerpc-gfxopt} allows GCC to
20810 use the optional PowerPC architecture instructions in the Graphics
20811 group, including floating-point select.
20812
20813 The @option{-mmfcrf} option allows GCC to generate the move from
20814 condition register field instruction implemented on the POWER4
20815 processor and other processors that support the PowerPC V2.01
20816 architecture.
20817 The @option{-mpopcntb} option allows GCC to generate the popcount and
20818 double-precision FP reciprocal estimate instruction implemented on the
20819 POWER5 processor and other processors that support the PowerPC V2.02
20820 architecture.
20821 The @option{-mpopcntd} option allows GCC to generate the popcount
20822 instruction implemented on the POWER7 processor and other processors
20823 that support the PowerPC V2.06 architecture.
20824 The @option{-mfprnd} option allows GCC to generate the FP round to
20825 integer instructions implemented on the POWER5+ processor and other
20826 processors that support the PowerPC V2.03 architecture.
20827 The @option{-mcmpb} option allows GCC to generate the compare bytes
20828 instruction implemented on the POWER6 processor and other processors
20829 that support the PowerPC V2.05 architecture.
20830 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
20831 general-purpose register instructions implemented on the POWER6X
20832 processor and other processors that support the extended PowerPC V2.05
20833 architecture.
20834 The @option{-mhard-dfp} option allows GCC to generate the decimal
20835 floating-point instructions implemented on some POWER processors.
20836
20837 The @option{-mpowerpc64} option allows GCC to generate the additional
20838 64-bit instructions that are found in the full PowerPC64 architecture
20839 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
20840 @option{-mno-powerpc64}.
20841
20842 @item -mcpu=@var{cpu_type}
20843 @opindex mcpu
20844 Set architecture type, register usage, and
20845 instruction scheduling parameters for machine type @var{cpu_type}.
20846 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
20847 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
20848 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
20849 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
20850 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
20851 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
20852 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
20853 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
20854 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
20855 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
20856 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
20857 and @samp{rs64}.
20858
20859 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
20860 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
20861 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
20862 architecture machine types, with an appropriate, generic processor
20863 model assumed for scheduling purposes.
20864
20865 The other options specify a specific processor. Code generated under
20866 those options runs best on that processor, and may not run at all on
20867 others.
20868
20869 The @option{-mcpu} options automatically enable or disable the
20870 following options:
20871
20872 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
20873 -mpopcntb -mpopcntd -mpowerpc64 @gol
20874 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
20875 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
20876 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
20877 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
20878
20879 The particular options set for any particular CPU varies between
20880 compiler versions, depending on what setting seems to produce optimal
20881 code for that CPU; it doesn't necessarily reflect the actual hardware's
20882 capabilities. If you wish to set an individual option to a particular
20883 value, you may specify it after the @option{-mcpu} option, like
20884 @option{-mcpu=970 -mno-altivec}.
20885
20886 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
20887 not enabled or disabled by the @option{-mcpu} option at present because
20888 AIX does not have full support for these options. You may still
20889 enable or disable them individually if you're sure it'll work in your
20890 environment.
20891
20892 @item -mtune=@var{cpu_type}
20893 @opindex mtune
20894 Set the instruction scheduling parameters for machine type
20895 @var{cpu_type}, but do not set the architecture type or register usage,
20896 as @option{-mcpu=@var{cpu_type}} does. The same
20897 values for @var{cpu_type} are used for @option{-mtune} as for
20898 @option{-mcpu}. If both are specified, the code generated uses the
20899 architecture and registers set by @option{-mcpu}, but the
20900 scheduling parameters set by @option{-mtune}.
20901
20902 @item -mcmodel=small
20903 @opindex mcmodel=small
20904 Generate PowerPC64 code for the small model: The TOC is limited to
20905 64k.
20906
20907 @item -mcmodel=medium
20908 @opindex mcmodel=medium
20909 Generate PowerPC64 code for the medium model: The TOC and other static
20910 data may be up to a total of 4G in size.
20911
20912 @item -mcmodel=large
20913 @opindex mcmodel=large
20914 Generate PowerPC64 code for the large model: The TOC may be up to 4G
20915 in size. Other data and code is only limited by the 64-bit address
20916 space.
20917
20918 @item -maltivec
20919 @itemx -mno-altivec
20920 @opindex maltivec
20921 @opindex mno-altivec
20922 Generate code that uses (does not use) AltiVec instructions, and also
20923 enable the use of built-in functions that allow more direct access to
20924 the AltiVec instruction set. You may also need to set
20925 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
20926 enhancements.
20927
20928 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
20929 @option{-maltivec=be}, the element order for AltiVec intrinsics such
20930 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
20931 match array element order corresponding to the endianness of the
20932 target. That is, element zero identifies the leftmost element in a
20933 vector register when targeting a big-endian platform, and identifies
20934 the rightmost element in a vector register when targeting a
20935 little-endian platform.
20936
20937 @item -maltivec=be
20938 @opindex maltivec=be
20939 Generate AltiVec instructions using big-endian element order,
20940 regardless of whether the target is big- or little-endian. This is
20941 the default when targeting a big-endian platform.
20942
20943 The element order is used to interpret element numbers in AltiVec
20944 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20945 @code{vec_insert}. By default, these match array element order
20946 corresponding to the endianness for the target.
20947
20948 @item -maltivec=le
20949 @opindex maltivec=le
20950 Generate AltiVec instructions using little-endian element order,
20951 regardless of whether the target is big- or little-endian. This is
20952 the default when targeting a little-endian platform. This option is
20953 currently ignored when targeting a big-endian platform.
20954
20955 The element order is used to interpret element numbers in AltiVec
20956 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20957 @code{vec_insert}. By default, these match array element order
20958 corresponding to the endianness for the target.
20959
20960 @item -mvrsave
20961 @itemx -mno-vrsave
20962 @opindex mvrsave
20963 @opindex mno-vrsave
20964 Generate VRSAVE instructions when generating AltiVec code.
20965
20966 @item -mgen-cell-microcode
20967 @opindex mgen-cell-microcode
20968 Generate Cell microcode instructions.
20969
20970 @item -mwarn-cell-microcode
20971 @opindex mwarn-cell-microcode
20972 Warn when a Cell microcode instruction is emitted. An example
20973 of a Cell microcode instruction is a variable shift.
20974
20975 @item -msecure-plt
20976 @opindex msecure-plt
20977 Generate code that allows @command{ld} and @command{ld.so}
20978 to build executables and shared
20979 libraries with non-executable @code{.plt} and @code{.got} sections.
20980 This is a PowerPC
20981 32-bit SYSV ABI option.
20982
20983 @item -mbss-plt
20984 @opindex mbss-plt
20985 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
20986 fills in, and
20987 requires @code{.plt} and @code{.got}
20988 sections that are both writable and executable.
20989 This is a PowerPC 32-bit SYSV ABI option.
20990
20991 @item -misel
20992 @itemx -mno-isel
20993 @opindex misel
20994 @opindex mno-isel
20995 This switch enables or disables the generation of ISEL instructions.
20996
20997 @item -misel=@var{yes/no}
20998 This switch has been deprecated. Use @option{-misel} and
20999 @option{-mno-isel} instead.
21000
21001 @item -mlra
21002 @opindex mlra
21003 Enable Local Register Allocation. This is still experimental for PowerPC,
21004 so by default the compiler uses standard reload
21005 (i.e. @option{-mno-lra}).
21006
21007 @item -mspe
21008 @itemx -mno-spe
21009 @opindex mspe
21010 @opindex mno-spe
21011 This switch enables or disables the generation of SPE simd
21012 instructions.
21013
21014 @item -mpaired
21015 @itemx -mno-paired
21016 @opindex mpaired
21017 @opindex mno-paired
21018 This switch enables or disables the generation of PAIRED simd
21019 instructions.
21020
21021 @item -mspe=@var{yes/no}
21022 This option has been deprecated. Use @option{-mspe} and
21023 @option{-mno-spe} instead.
21024
21025 @item -mvsx
21026 @itemx -mno-vsx
21027 @opindex mvsx
21028 @opindex mno-vsx
21029 Generate code that uses (does not use) vector/scalar (VSX)
21030 instructions, and also enable the use of built-in functions that allow
21031 more direct access to the VSX instruction set.
21032
21033 @item -mcrypto
21034 @itemx -mno-crypto
21035 @opindex mcrypto
21036 @opindex mno-crypto
21037 Enable the use (disable) of the built-in functions that allow direct
21038 access to the cryptographic instructions that were added in version
21039 2.07 of the PowerPC ISA.
21040
21041 @item -mdirect-move
21042 @itemx -mno-direct-move
21043 @opindex mdirect-move
21044 @opindex mno-direct-move
21045 Generate code that uses (does not use) the instructions to move data
21046 between the general purpose registers and the vector/scalar (VSX)
21047 registers that were added in version 2.07 of the PowerPC ISA.
21048
21049 @item -mhtm
21050 @itemx -mno-htm
21051 @opindex mhtm
21052 @opindex mno-htm
21053 Enable (disable) the use of the built-in functions that allow direct
21054 access to the Hardware Transactional Memory (HTM) instructions that
21055 were added in version 2.07 of the PowerPC ISA.
21056
21057 @item -mpower8-fusion
21058 @itemx -mno-power8-fusion
21059 @opindex mpower8-fusion
21060 @opindex mno-power8-fusion
21061 Generate code that keeps (does not keeps) some integer operations
21062 adjacent so that the instructions can be fused together on power8 and
21063 later processors.
21064
21065 @item -mpower8-vector
21066 @itemx -mno-power8-vector
21067 @opindex mpower8-vector
21068 @opindex mno-power8-vector
21069 Generate code that uses (does not use) the vector and scalar
21070 instructions that were added in version 2.07 of the PowerPC ISA. Also
21071 enable the use of built-in functions that allow more direct access to
21072 the vector instructions.
21073
21074 @item -mquad-memory
21075 @itemx -mno-quad-memory
21076 @opindex mquad-memory
21077 @opindex mno-quad-memory
21078 Generate code that uses (does not use) the non-atomic quad word memory
21079 instructions. The @option{-mquad-memory} option requires use of
21080 64-bit mode.
21081
21082 @item -mquad-memory-atomic
21083 @itemx -mno-quad-memory-atomic
21084 @opindex mquad-memory-atomic
21085 @opindex mno-quad-memory-atomic
21086 Generate code that uses (does not use) the atomic quad word memory
21087 instructions. The @option{-mquad-memory-atomic} option requires use of
21088 64-bit mode.
21089
21090 @item -mupper-regs-di
21091 @itemx -mno-upper-regs-di
21092 @opindex mupper-regs-di
21093 @opindex mno-upper-regs-di
21094 Generate code that uses (does not use) the scalar instructions that
21095 target all 64 registers in the vector/scalar floating point register
21096 set that were added in version 2.06 of the PowerPC ISA when processing
21097 integers. @option{-mupper-regs-di} is turned on by default if you use
21098 any of the @option{-mcpu=power7}, @option{-mcpu=power8},
21099 @option{-mcpu=power9}, or @option{-mvsx} options.
21100
21101 @item -mupper-regs-df
21102 @itemx -mno-upper-regs-df
21103 @opindex mupper-regs-df
21104 @opindex mno-upper-regs-df
21105 Generate code that uses (does not use) the scalar double precision
21106 instructions that target all 64 registers in the vector/scalar
21107 floating point register set that were added in version 2.06 of the
21108 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
21109 use any of the @option{-mcpu=power7}, @option{-mcpu=power8},
21110 @option{-mcpu=power9}, or @option{-mvsx} options.
21111
21112 @item -mupper-regs-sf
21113 @itemx -mno-upper-regs-sf
21114 @opindex mupper-regs-sf
21115 @opindex mno-upper-regs-sf
21116 Generate code that uses (does not use) the scalar single precision
21117 instructions that target all 64 registers in the vector/scalar
21118 floating point register set that were added in version 2.07 of the
21119 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
21120 use either of the @option{-mcpu=power8}, @option{-mpower8-vector}, or
21121 @option{-mcpu=power9} options.
21122
21123 @item -mupper-regs
21124 @itemx -mno-upper-regs
21125 @opindex mupper-regs
21126 @opindex mno-upper-regs
21127 Generate code that uses (does not use) the scalar
21128 instructions that target all 64 registers in the vector/scalar
21129 floating point register set, depending on the model of the machine.
21130
21131 If the @option{-mno-upper-regs} option is used, it turns off both
21132 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
21133
21134 @item -mfloat128
21135 @itemx -mno-float128
21136 @opindex mfloat128
21137 @opindex mno-float128
21138 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
21139 and use either software emulation for IEEE 128-bit floating point or
21140 hardware instructions.
21141
21142 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
21143 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
21144 option. The @option{-mfloat128} option only works on PowerPC 64-bit
21145 Linux systems.
21146
21147 If you use the ISA 3.0 instruction set (@option{-mcpu=power9}), the
21148 @option{-mfloat128} option will also enable the generation of ISA 3.0
21149 IEEE 128-bit floating point instructions. Otherwise, IEEE 128-bit
21150 floating point will be done with software emulation.
21151
21152 @item -mfloat128-hardware
21153 @itemx -mno-float128-hardware
21154 @opindex mfloat128-hardware
21155 @opindex mno-float128-hardware
21156 Enable/disable using ISA 3.0 hardware instructions to support the
21157 @var{__float128} data type.
21158
21159 If you use @option{-mfloat128-hardware}, it will enable the option
21160 @option{-mfloat128} as well.
21161
21162 If you select ISA 3.0 instructions with @option{-mcpu=power9}, but do
21163 not use either @option{-mfloat128} or @option{-mfloat128-hardware},
21164 the IEEE 128-bit floating point support will not be enabled.
21165
21166 @item -mfloat-gprs=@var{yes/single/double/no}
21167 @itemx -mfloat-gprs
21168 @opindex mfloat-gprs
21169 This switch enables or disables the generation of floating-point
21170 operations on the general-purpose registers for architectures that
21171 support it.
21172
21173 The argument @samp{yes} or @samp{single} enables the use of
21174 single-precision floating-point operations.
21175
21176 The argument @samp{double} enables the use of single and
21177 double-precision floating-point operations.
21178
21179 The argument @samp{no} disables floating-point operations on the
21180 general-purpose registers.
21181
21182 This option is currently only available on the MPC854x.
21183
21184 @item -m32
21185 @itemx -m64
21186 @opindex m32
21187 @opindex m64
21188 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
21189 targets (including GNU/Linux). The 32-bit environment sets int, long
21190 and pointer to 32 bits and generates code that runs on any PowerPC
21191 variant. The 64-bit environment sets int to 32 bits and long and
21192 pointer to 64 bits, and generates code for PowerPC64, as for
21193 @option{-mpowerpc64}.
21194
21195 @item -mfull-toc
21196 @itemx -mno-fp-in-toc
21197 @itemx -mno-sum-in-toc
21198 @itemx -mminimal-toc
21199 @opindex mfull-toc
21200 @opindex mno-fp-in-toc
21201 @opindex mno-sum-in-toc
21202 @opindex mminimal-toc
21203 Modify generation of the TOC (Table Of Contents), which is created for
21204 every executable file. The @option{-mfull-toc} option is selected by
21205 default. In that case, GCC allocates at least one TOC entry for
21206 each unique non-automatic variable reference in your program. GCC
21207 also places floating-point constants in the TOC@. However, only
21208 16,384 entries are available in the TOC@.
21209
21210 If you receive a linker error message that saying you have overflowed
21211 the available TOC space, you can reduce the amount of TOC space used
21212 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
21213 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
21214 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
21215 generate code to calculate the sum of an address and a constant at
21216 run time instead of putting that sum into the TOC@. You may specify one
21217 or both of these options. Each causes GCC to produce very slightly
21218 slower and larger code at the expense of conserving TOC space.
21219
21220 If you still run out of space in the TOC even when you specify both of
21221 these options, specify @option{-mminimal-toc} instead. This option causes
21222 GCC to make only one TOC entry for every file. When you specify this
21223 option, GCC produces code that is slower and larger but which
21224 uses extremely little TOC space. You may wish to use this option
21225 only on files that contain less frequently-executed code.
21226
21227 @item -maix64
21228 @itemx -maix32
21229 @opindex maix64
21230 @opindex maix32
21231 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
21232 @code{long} type, and the infrastructure needed to support them.
21233 Specifying @option{-maix64} implies @option{-mpowerpc64},
21234 while @option{-maix32} disables the 64-bit ABI and
21235 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
21236
21237 @item -mxl-compat
21238 @itemx -mno-xl-compat
21239 @opindex mxl-compat
21240 @opindex mno-xl-compat
21241 Produce code that conforms more closely to IBM XL compiler semantics
21242 when using AIX-compatible ABI@. Pass floating-point arguments to
21243 prototyped functions beyond the register save area (RSA) on the stack
21244 in addition to argument FPRs. Do not assume that most significant
21245 double in 128-bit long double value is properly rounded when comparing
21246 values and converting to double. Use XL symbol names for long double
21247 support routines.
21248
21249 The AIX calling convention was extended but not initially documented to
21250 handle an obscure K&R C case of calling a function that takes the
21251 address of its arguments with fewer arguments than declared. IBM XL
21252 compilers access floating-point arguments that do not fit in the
21253 RSA from the stack when a subroutine is compiled without
21254 optimization. Because always storing floating-point arguments on the
21255 stack is inefficient and rarely needed, this option is not enabled by
21256 default and only is necessary when calling subroutines compiled by IBM
21257 XL compilers without optimization.
21258
21259 @item -mpe
21260 @opindex mpe
21261 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
21262 application written to use message passing with special startup code to
21263 enable the application to run. The system must have PE installed in the
21264 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
21265 must be overridden with the @option{-specs=} option to specify the
21266 appropriate directory location. The Parallel Environment does not
21267 support threads, so the @option{-mpe} option and the @option{-pthread}
21268 option are incompatible.
21269
21270 @item -malign-natural
21271 @itemx -malign-power
21272 @opindex malign-natural
21273 @opindex malign-power
21274 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
21275 @option{-malign-natural} overrides the ABI-defined alignment of larger
21276 types, such as floating-point doubles, on their natural size-based boundary.
21277 The option @option{-malign-power} instructs GCC to follow the ABI-specified
21278 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
21279
21280 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
21281 is not supported.
21282
21283 @item -msoft-float
21284 @itemx -mhard-float
21285 @opindex msoft-float
21286 @opindex mhard-float
21287 Generate code that does not use (uses) the floating-point register set.
21288 Software floating-point emulation is provided if you use the
21289 @option{-msoft-float} option, and pass the option to GCC when linking.
21290
21291 @item -msingle-float
21292 @itemx -mdouble-float
21293 @opindex msingle-float
21294 @opindex mdouble-float
21295 Generate code for single- or double-precision floating-point operations.
21296 @option{-mdouble-float} implies @option{-msingle-float}.
21297
21298 @item -msimple-fpu
21299 @opindex msimple-fpu
21300 Do not generate @code{sqrt} and @code{div} instructions for hardware
21301 floating-point unit.
21302
21303 @item -mfpu=@var{name}
21304 @opindex mfpu
21305 Specify type of floating-point unit. Valid values for @var{name} are
21306 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
21307 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
21308 @samp{sp_full} (equivalent to @option{-msingle-float}),
21309 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
21310
21311 @item -mxilinx-fpu
21312 @opindex mxilinx-fpu
21313 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
21314
21315 @item -mmultiple
21316 @itemx -mno-multiple
21317 @opindex mmultiple
21318 @opindex mno-multiple
21319 Generate code that uses (does not use) the load multiple word
21320 instructions and the store multiple word instructions. These
21321 instructions are generated by default on POWER systems, and not
21322 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
21323 PowerPC systems, since those instructions do not work when the
21324 processor is in little-endian mode. The exceptions are PPC740 and
21325 PPC750 which permit these instructions in little-endian mode.
21326
21327 @item -mstring
21328 @itemx -mno-string
21329 @opindex mstring
21330 @opindex mno-string
21331 Generate code that uses (does not use) the load string instructions
21332 and the store string word instructions to save multiple registers and
21333 do small block moves. These instructions are generated by default on
21334 POWER systems, and not generated on PowerPC systems. Do not use
21335 @option{-mstring} on little-endian PowerPC systems, since those
21336 instructions do not work when the processor is in little-endian mode.
21337 The exceptions are PPC740 and PPC750 which permit these instructions
21338 in little-endian mode.
21339
21340 @item -mupdate
21341 @itemx -mno-update
21342 @opindex mupdate
21343 @opindex mno-update
21344 Generate code that uses (does not use) the load or store instructions
21345 that update the base register to the address of the calculated memory
21346 location. These instructions are generated by default. If you use
21347 @option{-mno-update}, there is a small window between the time that the
21348 stack pointer is updated and the address of the previous frame is
21349 stored, which means code that walks the stack frame across interrupts or
21350 signals may get corrupted data.
21351
21352 @item -mavoid-indexed-addresses
21353 @itemx -mno-avoid-indexed-addresses
21354 @opindex mavoid-indexed-addresses
21355 @opindex mno-avoid-indexed-addresses
21356 Generate code that tries to avoid (not avoid) the use of indexed load
21357 or store instructions. These instructions can incur a performance
21358 penalty on Power6 processors in certain situations, such as when
21359 stepping through large arrays that cross a 16M boundary. This option
21360 is enabled by default when targeting Power6 and disabled otherwise.
21361
21362 @item -mfused-madd
21363 @itemx -mno-fused-madd
21364 @opindex mfused-madd
21365 @opindex mno-fused-madd
21366 Generate code that uses (does not use) the floating-point multiply and
21367 accumulate instructions. These instructions are generated by default
21368 if hardware floating point is used. The machine-dependent
21369 @option{-mfused-madd} option is now mapped to the machine-independent
21370 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
21371 mapped to @option{-ffp-contract=off}.
21372
21373 @item -mmulhw
21374 @itemx -mno-mulhw
21375 @opindex mmulhw
21376 @opindex mno-mulhw
21377 Generate code that uses (does not use) the half-word multiply and
21378 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
21379 These instructions are generated by default when targeting those
21380 processors.
21381
21382 @item -mdlmzb
21383 @itemx -mno-dlmzb
21384 @opindex mdlmzb
21385 @opindex mno-dlmzb
21386 Generate code that uses (does not use) the string-search @samp{dlmzb}
21387 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
21388 generated by default when targeting those processors.
21389
21390 @item -mno-bit-align
21391 @itemx -mbit-align
21392 @opindex mno-bit-align
21393 @opindex mbit-align
21394 On System V.4 and embedded PowerPC systems do not (do) force structures
21395 and unions that contain bit-fields to be aligned to the base type of the
21396 bit-field.
21397
21398 For example, by default a structure containing nothing but 8
21399 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
21400 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
21401 the structure is aligned to a 1-byte boundary and is 1 byte in
21402 size.
21403
21404 @item -mno-strict-align
21405 @itemx -mstrict-align
21406 @opindex mno-strict-align
21407 @opindex mstrict-align
21408 On System V.4 and embedded PowerPC systems do not (do) assume that
21409 unaligned memory references are handled by the system.
21410
21411 @item -mrelocatable
21412 @itemx -mno-relocatable
21413 @opindex mrelocatable
21414 @opindex mno-relocatable
21415 Generate code that allows (does not allow) a static executable to be
21416 relocated to a different address at run time. A simple embedded
21417 PowerPC system loader should relocate the entire contents of
21418 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
21419 a table of 32-bit addresses generated by this option. For this to
21420 work, all objects linked together must be compiled with
21421 @option{-mrelocatable} or @option{-mrelocatable-lib}.
21422 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
21423
21424 @item -mrelocatable-lib
21425 @itemx -mno-relocatable-lib
21426 @opindex mrelocatable-lib
21427 @opindex mno-relocatable-lib
21428 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
21429 @code{.fixup} section to allow static executables to be relocated at
21430 run time, but @option{-mrelocatable-lib} does not use the smaller stack
21431 alignment of @option{-mrelocatable}. Objects compiled with
21432 @option{-mrelocatable-lib} may be linked with objects compiled with
21433 any combination of the @option{-mrelocatable} options.
21434
21435 @item -mno-toc
21436 @itemx -mtoc
21437 @opindex mno-toc
21438 @opindex mtoc
21439 On System V.4 and embedded PowerPC systems do not (do) assume that
21440 register 2 contains a pointer to a global area pointing to the addresses
21441 used in the program.
21442
21443 @item -mlittle
21444 @itemx -mlittle-endian
21445 @opindex mlittle
21446 @opindex mlittle-endian
21447 On System V.4 and embedded PowerPC systems compile code for the
21448 processor in little-endian mode. The @option{-mlittle-endian} option is
21449 the same as @option{-mlittle}.
21450
21451 @item -mbig
21452 @itemx -mbig-endian
21453 @opindex mbig
21454 @opindex mbig-endian
21455 On System V.4 and embedded PowerPC systems compile code for the
21456 processor in big-endian mode. The @option{-mbig-endian} option is
21457 the same as @option{-mbig}.
21458
21459 @item -mdynamic-no-pic
21460 @opindex mdynamic-no-pic
21461 On Darwin and Mac OS X systems, compile code so that it is not
21462 relocatable, but that its external references are relocatable. The
21463 resulting code is suitable for applications, but not shared
21464 libraries.
21465
21466 @item -msingle-pic-base
21467 @opindex msingle-pic-base
21468 Treat the register used for PIC addressing as read-only, rather than
21469 loading it in the prologue for each function. The runtime system is
21470 responsible for initializing this register with an appropriate value
21471 before execution begins.
21472
21473 @item -mprioritize-restricted-insns=@var{priority}
21474 @opindex mprioritize-restricted-insns
21475 This option controls the priority that is assigned to
21476 dispatch-slot restricted instructions during the second scheduling
21477 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
21478 or @samp{2} to assign no, highest, or second-highest (respectively)
21479 priority to dispatch-slot restricted
21480 instructions.
21481
21482 @item -msched-costly-dep=@var{dependence_type}
21483 @opindex msched-costly-dep
21484 This option controls which dependences are considered costly
21485 by the target during instruction scheduling. The argument
21486 @var{dependence_type} takes one of the following values:
21487
21488 @table @asis
21489 @item @samp{no}
21490 No dependence is costly.
21491
21492 @item @samp{all}
21493 All dependences are costly.
21494
21495 @item @samp{true_store_to_load}
21496 A true dependence from store to load is costly.
21497
21498 @item @samp{store_to_load}
21499 Any dependence from store to load is costly.
21500
21501 @item @var{number}
21502 Any dependence for which the latency is greater than or equal to
21503 @var{number} is costly.
21504 @end table
21505
21506 @item -minsert-sched-nops=@var{scheme}
21507 @opindex minsert-sched-nops
21508 This option controls which NOP insertion scheme is used during
21509 the second scheduling pass. The argument @var{scheme} takes one of the
21510 following values:
21511
21512 @table @asis
21513 @item @samp{no}
21514 Don't insert NOPs.
21515
21516 @item @samp{pad}
21517 Pad with NOPs any dispatch group that has vacant issue slots,
21518 according to the scheduler's grouping.
21519
21520 @item @samp{regroup_exact}
21521 Insert NOPs to force costly dependent insns into
21522 separate groups. Insert exactly as many NOPs as needed to force an insn
21523 to a new group, according to the estimated processor grouping.
21524
21525 @item @var{number}
21526 Insert NOPs to force costly dependent insns into
21527 separate groups. Insert @var{number} NOPs to force an insn to a new group.
21528 @end table
21529
21530 @item -mcall-sysv
21531 @opindex mcall-sysv
21532 On System V.4 and embedded PowerPC systems compile code using calling
21533 conventions that adhere to the March 1995 draft of the System V
21534 Application Binary Interface, PowerPC processor supplement. This is the
21535 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
21536
21537 @item -mcall-sysv-eabi
21538 @itemx -mcall-eabi
21539 @opindex mcall-sysv-eabi
21540 @opindex mcall-eabi
21541 Specify both @option{-mcall-sysv} and @option{-meabi} options.
21542
21543 @item -mcall-sysv-noeabi
21544 @opindex mcall-sysv-noeabi
21545 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
21546
21547 @item -mcall-aixdesc
21548 @opindex m
21549 On System V.4 and embedded PowerPC systems compile code for the AIX
21550 operating system.
21551
21552 @item -mcall-linux
21553 @opindex mcall-linux
21554 On System V.4 and embedded PowerPC systems compile code for the
21555 Linux-based GNU system.
21556
21557 @item -mcall-freebsd
21558 @opindex mcall-freebsd
21559 On System V.4 and embedded PowerPC systems compile code for the
21560 FreeBSD operating system.
21561
21562 @item -mcall-netbsd
21563 @opindex mcall-netbsd
21564 On System V.4 and embedded PowerPC systems compile code for the
21565 NetBSD operating system.
21566
21567 @item -mcall-openbsd
21568 @opindex mcall-netbsd
21569 On System V.4 and embedded PowerPC systems compile code for the
21570 OpenBSD operating system.
21571
21572 @item -maix-struct-return
21573 @opindex maix-struct-return
21574 Return all structures in memory (as specified by the AIX ABI)@.
21575
21576 @item -msvr4-struct-return
21577 @opindex msvr4-struct-return
21578 Return structures smaller than 8 bytes in registers (as specified by the
21579 SVR4 ABI)@.
21580
21581 @item -mabi=@var{abi-type}
21582 @opindex mabi
21583 Extend the current ABI with a particular extension, or remove such extension.
21584 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
21585 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
21586 @samp{elfv1}, @samp{elfv2}@.
21587
21588 @item -mabi=spe
21589 @opindex mabi=spe
21590 Extend the current ABI with SPE ABI extensions. This does not change
21591 the default ABI, instead it adds the SPE ABI extensions to the current
21592 ABI@.
21593
21594 @item -mabi=no-spe
21595 @opindex mabi=no-spe
21596 Disable Book-E SPE ABI extensions for the current ABI@.
21597
21598 @item -mabi=ibmlongdouble
21599 @opindex mabi=ibmlongdouble
21600 Change the current ABI to use IBM extended-precision long double.
21601 This is a PowerPC 32-bit SYSV ABI option.
21602
21603 @item -mabi=ieeelongdouble
21604 @opindex mabi=ieeelongdouble
21605 Change the current ABI to use IEEE extended-precision long double.
21606 This is a PowerPC 32-bit Linux ABI option.
21607
21608 @item -mabi=elfv1
21609 @opindex mabi=elfv1
21610 Change the current ABI to use the ELFv1 ABI.
21611 This is the default ABI for big-endian PowerPC 64-bit Linux.
21612 Overriding the default ABI requires special system support and is
21613 likely to fail in spectacular ways.
21614
21615 @item -mabi=elfv2
21616 @opindex mabi=elfv2
21617 Change the current ABI to use the ELFv2 ABI.
21618 This is the default ABI for little-endian PowerPC 64-bit Linux.
21619 Overriding the default ABI requires special system support and is
21620 likely to fail in spectacular ways.
21621
21622 @item -mgnu-attribute
21623 @itemx -mno-gnu-attribute
21624 @opindex mgnu-attribute
21625 @opindex mno-gnu-attribute
21626 Emit .gnu_attribute assembly directives to set tag/value pairs in a
21627 .gnu.attributes section that specify ABI variations in function
21628 parameters or return values.
21629
21630 @item -mprototype
21631 @itemx -mno-prototype
21632 @opindex mprototype
21633 @opindex mno-prototype
21634 On System V.4 and embedded PowerPC systems assume that all calls to
21635 variable argument functions are properly prototyped. Otherwise, the
21636 compiler must insert an instruction before every non-prototyped call to
21637 set or clear bit 6 of the condition code register (@code{CR}) to
21638 indicate whether floating-point values are passed in the floating-point
21639 registers in case the function takes variable arguments. With
21640 @option{-mprototype}, only calls to prototyped variable argument functions
21641 set or clear the bit.
21642
21643 @item -msim
21644 @opindex msim
21645 On embedded PowerPC systems, assume that the startup module is called
21646 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
21647 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
21648 configurations.
21649
21650 @item -mmvme
21651 @opindex mmvme
21652 On embedded PowerPC systems, assume that the startup module is called
21653 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
21654 @file{libc.a}.
21655
21656 @item -mads
21657 @opindex mads
21658 On embedded PowerPC systems, assume that the startup module is called
21659 @file{crt0.o} and the standard C libraries are @file{libads.a} and
21660 @file{libc.a}.
21661
21662 @item -myellowknife
21663 @opindex myellowknife
21664 On embedded PowerPC systems, assume that the startup module is called
21665 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
21666 @file{libc.a}.
21667
21668 @item -mvxworks
21669 @opindex mvxworks
21670 On System V.4 and embedded PowerPC systems, specify that you are
21671 compiling for a VxWorks system.
21672
21673 @item -memb
21674 @opindex memb
21675 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
21676 header to indicate that @samp{eabi} extended relocations are used.
21677
21678 @item -meabi
21679 @itemx -mno-eabi
21680 @opindex meabi
21681 @opindex mno-eabi
21682 On System V.4 and embedded PowerPC systems do (do not) adhere to the
21683 Embedded Applications Binary Interface (EABI), which is a set of
21684 modifications to the System V.4 specifications. Selecting @option{-meabi}
21685 means that the stack is aligned to an 8-byte boundary, a function
21686 @code{__eabi} is called from @code{main} to set up the EABI
21687 environment, and the @option{-msdata} option can use both @code{r2} and
21688 @code{r13} to point to two separate small data areas. Selecting
21689 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
21690 no EABI initialization function is called from @code{main}, and the
21691 @option{-msdata} option only uses @code{r13} to point to a single
21692 small data area. The @option{-meabi} option is on by default if you
21693 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
21694
21695 @item -msdata=eabi
21696 @opindex msdata=eabi
21697 On System V.4 and embedded PowerPC systems, put small initialized
21698 @code{const} global and static data in the @code{.sdata2} section, which
21699 is pointed to by register @code{r2}. Put small initialized
21700 non-@code{const} global and static data in the @code{.sdata} section,
21701 which is pointed to by register @code{r13}. Put small uninitialized
21702 global and static data in the @code{.sbss} section, which is adjacent to
21703 the @code{.sdata} section. The @option{-msdata=eabi} option is
21704 incompatible with the @option{-mrelocatable} option. The
21705 @option{-msdata=eabi} option also sets the @option{-memb} option.
21706
21707 @item -msdata=sysv
21708 @opindex msdata=sysv
21709 On System V.4 and embedded PowerPC systems, put small global and static
21710 data in the @code{.sdata} section, which is pointed to by register
21711 @code{r13}. Put small uninitialized global and static data in the
21712 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
21713 The @option{-msdata=sysv} option is incompatible with the
21714 @option{-mrelocatable} option.
21715
21716 @item -msdata=default
21717 @itemx -msdata
21718 @opindex msdata=default
21719 @opindex msdata
21720 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
21721 compile code the same as @option{-msdata=eabi}, otherwise compile code the
21722 same as @option{-msdata=sysv}.
21723
21724 @item -msdata=data
21725 @opindex msdata=data
21726 On System V.4 and embedded PowerPC systems, put small global
21727 data in the @code{.sdata} section. Put small uninitialized global
21728 data in the @code{.sbss} section. Do not use register @code{r13}
21729 to address small data however. This is the default behavior unless
21730 other @option{-msdata} options are used.
21731
21732 @item -msdata=none
21733 @itemx -mno-sdata
21734 @opindex msdata=none
21735 @opindex mno-sdata
21736 On embedded PowerPC systems, put all initialized global and static data
21737 in the @code{.data} section, and all uninitialized data in the
21738 @code{.bss} section.
21739
21740 @item -mblock-move-inline-limit=@var{num}
21741 @opindex mblock-move-inline-limit
21742 Inline all block moves (such as calls to @code{memcpy} or structure
21743 copies) less than or equal to @var{num} bytes. The minimum value for
21744 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
21745 targets. The default value is target-specific.
21746
21747 @item -G @var{num}
21748 @opindex G
21749 @cindex smaller data references (PowerPC)
21750 @cindex .sdata/.sdata2 references (PowerPC)
21751 On embedded PowerPC systems, put global and static items less than or
21752 equal to @var{num} bytes into the small data or BSS sections instead of
21753 the normal data or BSS section. By default, @var{num} is 8. The
21754 @option{-G @var{num}} switch is also passed to the linker.
21755 All modules should be compiled with the same @option{-G @var{num}} value.
21756
21757 @item -mregnames
21758 @itemx -mno-regnames
21759 @opindex mregnames
21760 @opindex mno-regnames
21761 On System V.4 and embedded PowerPC systems do (do not) emit register
21762 names in the assembly language output using symbolic forms.
21763
21764 @item -mlongcall
21765 @itemx -mno-longcall
21766 @opindex mlongcall
21767 @opindex mno-longcall
21768 By default assume that all calls are far away so that a longer and more
21769 expensive calling sequence is required. This is required for calls
21770 farther than 32 megabytes (33,554,432 bytes) from the current location.
21771 A short call is generated if the compiler knows
21772 the call cannot be that far away. This setting can be overridden by
21773 the @code{shortcall} function attribute, or by @code{#pragma
21774 longcall(0)}.
21775
21776 Some linkers are capable of detecting out-of-range calls and generating
21777 glue code on the fly. On these systems, long calls are unnecessary and
21778 generate slower code. As of this writing, the AIX linker can do this,
21779 as can the GNU linker for PowerPC/64. It is planned to add this feature
21780 to the GNU linker for 32-bit PowerPC systems as well.
21781
21782 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
21783 callee, L42}, plus a @dfn{branch island} (glue code). The two target
21784 addresses represent the callee and the branch island. The
21785 Darwin/PPC linker prefers the first address and generates a @code{bl
21786 callee} if the PPC @code{bl} instruction reaches the callee directly;
21787 otherwise, the linker generates @code{bl L42} to call the branch
21788 island. The branch island is appended to the body of the
21789 calling function; it computes the full 32-bit address of the callee
21790 and jumps to it.
21791
21792 On Mach-O (Darwin) systems, this option directs the compiler emit to
21793 the glue for every direct call, and the Darwin linker decides whether
21794 to use or discard it.
21795
21796 In the future, GCC may ignore all longcall specifications
21797 when the linker is known to generate glue.
21798
21799 @item -mtls-markers
21800 @itemx -mno-tls-markers
21801 @opindex mtls-markers
21802 @opindex mno-tls-markers
21803 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
21804 specifying the function argument. The relocation allows the linker to
21805 reliably associate function call with argument setup instructions for
21806 TLS optimization, which in turn allows GCC to better schedule the
21807 sequence.
21808
21809 @item -pthread
21810 @opindex pthread
21811 Adds support for multithreading with the @dfn{pthreads} library.
21812 This option sets flags for both the preprocessor and linker.
21813
21814 @item -mrecip
21815 @itemx -mno-recip
21816 @opindex mrecip
21817 This option enables use of the reciprocal estimate and
21818 reciprocal square root estimate instructions with additional
21819 Newton-Raphson steps to increase precision instead of doing a divide or
21820 square root and divide for floating-point arguments. You should use
21821 the @option{-ffast-math} option when using @option{-mrecip} (or at
21822 least @option{-funsafe-math-optimizations},
21823 @option{-ffinite-math-only}, @option{-freciprocal-math} and
21824 @option{-fno-trapping-math}). Note that while the throughput of the
21825 sequence is generally higher than the throughput of the non-reciprocal
21826 instruction, the precision of the sequence can be decreased by up to 2
21827 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
21828 roots.
21829
21830 @item -mrecip=@var{opt}
21831 @opindex mrecip=opt
21832 This option controls which reciprocal estimate instructions
21833 may be used. @var{opt} is a comma-separated list of options, which may
21834 be preceded by a @code{!} to invert the option:
21835
21836 @table @samp
21837
21838 @item all
21839 Enable all estimate instructions.
21840
21841 @item default
21842 Enable the default instructions, equivalent to @option{-mrecip}.
21843
21844 @item none
21845 Disable all estimate instructions, equivalent to @option{-mno-recip}.
21846
21847 @item div
21848 Enable the reciprocal approximation instructions for both
21849 single and double precision.
21850
21851 @item divf
21852 Enable the single-precision reciprocal approximation instructions.
21853
21854 @item divd
21855 Enable the double-precision reciprocal approximation instructions.
21856
21857 @item rsqrt
21858 Enable the reciprocal square root approximation instructions for both
21859 single and double precision.
21860
21861 @item rsqrtf
21862 Enable the single-precision reciprocal square root approximation instructions.
21863
21864 @item rsqrtd
21865 Enable the double-precision reciprocal square root approximation instructions.
21866
21867 @end table
21868
21869 So, for example, @option{-mrecip=all,!rsqrtd} enables
21870 all of the reciprocal estimate instructions, except for the
21871 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
21872 which handle the double-precision reciprocal square root calculations.
21873
21874 @item -mrecip-precision
21875 @itemx -mno-recip-precision
21876 @opindex mrecip-precision
21877 Assume (do not assume) that the reciprocal estimate instructions
21878 provide higher-precision estimates than is mandated by the PowerPC
21879 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
21880 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
21881 The double-precision square root estimate instructions are not generated by
21882 default on low-precision machines, since they do not provide an
21883 estimate that converges after three steps.
21884
21885 @item -mveclibabi=@var{type}
21886 @opindex mveclibabi
21887 Specifies the ABI type to use for vectorizing intrinsics using an
21888 external library. The only type supported at present is @samp{mass},
21889 which specifies to use IBM's Mathematical Acceleration Subsystem
21890 (MASS) libraries for vectorizing intrinsics using external libraries.
21891 GCC currently emits calls to @code{acosd2}, @code{acosf4},
21892 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
21893 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
21894 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
21895 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
21896 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
21897 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
21898 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
21899 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
21900 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
21901 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
21902 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
21903 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
21904 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
21905 for power7. Both @option{-ftree-vectorize} and
21906 @option{-funsafe-math-optimizations} must also be enabled. The MASS
21907 libraries must be specified at link time.
21908
21909 @item -mfriz
21910 @itemx -mno-friz
21911 @opindex mfriz
21912 Generate (do not generate) the @code{friz} instruction when the
21913 @option{-funsafe-math-optimizations} option is used to optimize
21914 rounding of floating-point values to 64-bit integer and back to floating
21915 point. The @code{friz} instruction does not return the same value if
21916 the floating-point number is too large to fit in an integer.
21917
21918 @item -mpointers-to-nested-functions
21919 @itemx -mno-pointers-to-nested-functions
21920 @opindex mpointers-to-nested-functions
21921 Generate (do not generate) code to load up the static chain register
21922 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
21923 systems where a function pointer points to a 3-word descriptor giving
21924 the function address, TOC value to be loaded in register @code{r2}, and
21925 static chain value to be loaded in register @code{r11}. The
21926 @option{-mpointers-to-nested-functions} is on by default. You cannot
21927 call through pointers to nested functions or pointers
21928 to functions compiled in other languages that use the static chain if
21929 you use @option{-mno-pointers-to-nested-functions}.
21930
21931 @item -msave-toc-indirect
21932 @itemx -mno-save-toc-indirect
21933 @opindex msave-toc-indirect
21934 Generate (do not generate) code to save the TOC value in the reserved
21935 stack location in the function prologue if the function calls through
21936 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
21937 saved in the prologue, it is saved just before the call through the
21938 pointer. The @option{-mno-save-toc-indirect} option is the default.
21939
21940 @item -mcompat-align-parm
21941 @itemx -mno-compat-align-parm
21942 @opindex mcompat-align-parm
21943 Generate (do not generate) code to pass structure parameters with a
21944 maximum alignment of 64 bits, for compatibility with older versions
21945 of GCC.
21946
21947 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
21948 structure parameter on a 128-bit boundary when that structure contained
21949 a member requiring 128-bit alignment. This is corrected in more
21950 recent versions of GCC. This option may be used to generate code
21951 that is compatible with functions compiled with older versions of
21952 GCC.
21953
21954 The @option{-mno-compat-align-parm} option is the default.
21955 @end table
21956
21957 @node RX Options
21958 @subsection RX Options
21959 @cindex RX Options
21960
21961 These command-line options are defined for RX targets:
21962
21963 @table @gcctabopt
21964 @item -m64bit-doubles
21965 @itemx -m32bit-doubles
21966 @opindex m64bit-doubles
21967 @opindex m32bit-doubles
21968 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
21969 or 32 bits (@option{-m32bit-doubles}) in size. The default is
21970 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
21971 works on 32-bit values, which is why the default is
21972 @option{-m32bit-doubles}.
21973
21974 @item -fpu
21975 @itemx -nofpu
21976 @opindex fpu
21977 @opindex nofpu
21978 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
21979 floating-point hardware. The default is enabled for the RX600
21980 series and disabled for the RX200 series.
21981
21982 Floating-point instructions are only generated for 32-bit floating-point
21983 values, however, so the FPU hardware is not used for doubles if the
21984 @option{-m64bit-doubles} option is used.
21985
21986 @emph{Note} If the @option{-fpu} option is enabled then
21987 @option{-funsafe-math-optimizations} is also enabled automatically.
21988 This is because the RX FPU instructions are themselves unsafe.
21989
21990 @item -mcpu=@var{name}
21991 @opindex mcpu
21992 Selects the type of RX CPU to be targeted. Currently three types are
21993 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
21994 the specific @samp{RX610} CPU. The default is @samp{RX600}.
21995
21996 The only difference between @samp{RX600} and @samp{RX610} is that the
21997 @samp{RX610} does not support the @code{MVTIPL} instruction.
21998
21999 The @samp{RX200} series does not have a hardware floating-point unit
22000 and so @option{-nofpu} is enabled by default when this type is
22001 selected.
22002
22003 @item -mbig-endian-data
22004 @itemx -mlittle-endian-data
22005 @opindex mbig-endian-data
22006 @opindex mlittle-endian-data
22007 Store data (but not code) in the big-endian format. The default is
22008 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
22009 format.
22010
22011 @item -msmall-data-limit=@var{N}
22012 @opindex msmall-data-limit
22013 Specifies the maximum size in bytes of global and static variables
22014 which can be placed into the small data area. Using the small data
22015 area can lead to smaller and faster code, but the size of area is
22016 limited and it is up to the programmer to ensure that the area does
22017 not overflow. Also when the small data area is used one of the RX's
22018 registers (usually @code{r13}) is reserved for use pointing to this
22019 area, so it is no longer available for use by the compiler. This
22020 could result in slower and/or larger code if variables are pushed onto
22021 the stack instead of being held in this register.
22022
22023 Note, common variables (variables that have not been initialized) and
22024 constants are not placed into the small data area as they are assigned
22025 to other sections in the output executable.
22026
22027 The default value is zero, which disables this feature. Note, this
22028 feature is not enabled by default with higher optimization levels
22029 (@option{-O2} etc) because of the potentially detrimental effects of
22030 reserving a register. It is up to the programmer to experiment and
22031 discover whether this feature is of benefit to their program. See the
22032 description of the @option{-mpid} option for a description of how the
22033 actual register to hold the small data area pointer is chosen.
22034
22035 @item -msim
22036 @itemx -mno-sim
22037 @opindex msim
22038 @opindex mno-sim
22039 Use the simulator runtime. The default is to use the libgloss
22040 board-specific runtime.
22041
22042 @item -mas100-syntax
22043 @itemx -mno-as100-syntax
22044 @opindex mas100-syntax
22045 @opindex mno-as100-syntax
22046 When generating assembler output use a syntax that is compatible with
22047 Renesas's AS100 assembler. This syntax can also be handled by the GAS
22048 assembler, but it has some restrictions so it is not generated by default.
22049
22050 @item -mmax-constant-size=@var{N}
22051 @opindex mmax-constant-size
22052 Specifies the maximum size, in bytes, of a constant that can be used as
22053 an operand in a RX instruction. Although the RX instruction set does
22054 allow constants of up to 4 bytes in length to be used in instructions,
22055 a longer value equates to a longer instruction. Thus in some
22056 circumstances it can be beneficial to restrict the size of constants
22057 that are used in instructions. Constants that are too big are instead
22058 placed into a constant pool and referenced via register indirection.
22059
22060 The value @var{N} can be between 0 and 4. A value of 0 (the default)
22061 or 4 means that constants of any size are allowed.
22062
22063 @item -mrelax
22064 @opindex mrelax
22065 Enable linker relaxation. Linker relaxation is a process whereby the
22066 linker attempts to reduce the size of a program by finding shorter
22067 versions of various instructions. Disabled by default.
22068
22069 @item -mint-register=@var{N}
22070 @opindex mint-register
22071 Specify the number of registers to reserve for fast interrupt handler
22072 functions. The value @var{N} can be between 0 and 4. A value of 1
22073 means that register @code{r13} is reserved for the exclusive use
22074 of fast interrupt handlers. A value of 2 reserves @code{r13} and
22075 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
22076 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
22077 A value of 0, the default, does not reserve any registers.
22078
22079 @item -msave-acc-in-interrupts
22080 @opindex msave-acc-in-interrupts
22081 Specifies that interrupt handler functions should preserve the
22082 accumulator register. This is only necessary if normal code might use
22083 the accumulator register, for example because it performs 64-bit
22084 multiplications. The default is to ignore the accumulator as this
22085 makes the interrupt handlers faster.
22086
22087 @item -mpid
22088 @itemx -mno-pid
22089 @opindex mpid
22090 @opindex mno-pid
22091 Enables the generation of position independent data. When enabled any
22092 access to constant data is done via an offset from a base address
22093 held in a register. This allows the location of constant data to be
22094 determined at run time without requiring the executable to be
22095 relocated, which is a benefit to embedded applications with tight
22096 memory constraints. Data that can be modified is not affected by this
22097 option.
22098
22099 Note, using this feature reserves a register, usually @code{r13}, for
22100 the constant data base address. This can result in slower and/or
22101 larger code, especially in complicated functions.
22102
22103 The actual register chosen to hold the constant data base address
22104 depends upon whether the @option{-msmall-data-limit} and/or the
22105 @option{-mint-register} command-line options are enabled. Starting
22106 with register @code{r13} and proceeding downwards, registers are
22107 allocated first to satisfy the requirements of @option{-mint-register},
22108 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
22109 is possible for the small data area register to be @code{r8} if both
22110 @option{-mint-register=4} and @option{-mpid} are specified on the
22111 command line.
22112
22113 By default this feature is not enabled. The default can be restored
22114 via the @option{-mno-pid} command-line option.
22115
22116 @item -mno-warn-multiple-fast-interrupts
22117 @itemx -mwarn-multiple-fast-interrupts
22118 @opindex mno-warn-multiple-fast-interrupts
22119 @opindex mwarn-multiple-fast-interrupts
22120 Prevents GCC from issuing a warning message if it finds more than one
22121 fast interrupt handler when it is compiling a file. The default is to
22122 issue a warning for each extra fast interrupt handler found, as the RX
22123 only supports one such interrupt.
22124
22125 @item -mallow-string-insns
22126 @itemx -mno-allow-string-insns
22127 @opindex mallow-string-insns
22128 @opindex mno-allow-string-insns
22129 Enables or disables the use of the string manipulation instructions
22130 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
22131 @code{SWHILE} and also the @code{RMPA} instruction. These
22132 instructions may prefetch data, which is not safe to do if accessing
22133 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
22134 for more information).
22135
22136 The default is to allow these instructions, but it is not possible for
22137 GCC to reliably detect all circumstances where a string instruction
22138 might be used to access an I/O register, so their use cannot be
22139 disabled automatically. Instead it is reliant upon the programmer to
22140 use the @option{-mno-allow-string-insns} option if their program
22141 accesses I/O space.
22142
22143 When the instructions are enabled GCC defines the C preprocessor
22144 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
22145 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
22146
22147 @item -mjsr
22148 @itemx -mno-jsr
22149 @opindex mjsr
22150 @opindex mno-jsr
22151 Use only (or not only) @code{JSR} instructions to access functions.
22152 This option can be used when code size exceeds the range of @code{BSR}
22153 instructions. Note that @option{-mno-jsr} does not mean to not use
22154 @code{JSR} but instead means that any type of branch may be used.
22155 @end table
22156
22157 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
22158 has special significance to the RX port when used with the
22159 @code{interrupt} function attribute. This attribute indicates a
22160 function intended to process fast interrupts. GCC ensures
22161 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
22162 and/or @code{r13} and only provided that the normal use of the
22163 corresponding registers have been restricted via the
22164 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
22165 options.
22166
22167 @node S/390 and zSeries Options
22168 @subsection S/390 and zSeries Options
22169 @cindex S/390 and zSeries Options
22170
22171 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
22172
22173 @table @gcctabopt
22174 @item -mhard-float
22175 @itemx -msoft-float
22176 @opindex mhard-float
22177 @opindex msoft-float
22178 Use (do not use) the hardware floating-point instructions and registers
22179 for floating-point operations. When @option{-msoft-float} is specified,
22180 functions in @file{libgcc.a} are used to perform floating-point
22181 operations. When @option{-mhard-float} is specified, the compiler
22182 generates IEEE floating-point instructions. This is the default.
22183
22184 @item -mhard-dfp
22185 @itemx -mno-hard-dfp
22186 @opindex mhard-dfp
22187 @opindex mno-hard-dfp
22188 Use (do not use) the hardware decimal-floating-point instructions for
22189 decimal-floating-point operations. When @option{-mno-hard-dfp} is
22190 specified, functions in @file{libgcc.a} are used to perform
22191 decimal-floating-point operations. When @option{-mhard-dfp} is
22192 specified, the compiler generates decimal-floating-point hardware
22193 instructions. This is the default for @option{-march=z9-ec} or higher.
22194
22195 @item -mlong-double-64
22196 @itemx -mlong-double-128
22197 @opindex mlong-double-64
22198 @opindex mlong-double-128
22199 These switches control the size of @code{long double} type. A size
22200 of 64 bits makes the @code{long double} type equivalent to the @code{double}
22201 type. This is the default.
22202
22203 @item -mbackchain
22204 @itemx -mno-backchain
22205 @opindex mbackchain
22206 @opindex mno-backchain
22207 Store (do not store) the address of the caller's frame as backchain pointer
22208 into the callee's stack frame.
22209 A backchain may be needed to allow debugging using tools that do not understand
22210 DWARF call frame information.
22211 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
22212 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
22213 the backchain is placed into the topmost word of the 96/160 byte register
22214 save area.
22215
22216 In general, code compiled with @option{-mbackchain} is call-compatible with
22217 code compiled with @option{-mmo-backchain}; however, use of the backchain
22218 for debugging purposes usually requires that the whole binary is built with
22219 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
22220 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
22221 to build a linux kernel use @option{-msoft-float}.
22222
22223 The default is to not maintain the backchain.
22224
22225 @item -mpacked-stack
22226 @itemx -mno-packed-stack
22227 @opindex mpacked-stack
22228 @opindex mno-packed-stack
22229 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
22230 specified, the compiler uses the all fields of the 96/160 byte register save
22231 area only for their default purpose; unused fields still take up stack space.
22232 When @option{-mpacked-stack} is specified, register save slots are densely
22233 packed at the top of the register save area; unused space is reused for other
22234 purposes, allowing for more efficient use of the available stack space.
22235 However, when @option{-mbackchain} is also in effect, the topmost word of
22236 the save area is always used to store the backchain, and the return address
22237 register is always saved two words below the backchain.
22238
22239 As long as the stack frame backchain is not used, code generated with
22240 @option{-mpacked-stack} is call-compatible with code generated with
22241 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
22242 S/390 or zSeries generated code that uses the stack frame backchain at run
22243 time, not just for debugging purposes. Such code is not call-compatible
22244 with code compiled with @option{-mpacked-stack}. Also, note that the
22245 combination of @option{-mbackchain},
22246 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
22247 to build a linux kernel use @option{-msoft-float}.
22248
22249 The default is to not use the packed stack layout.
22250
22251 @item -msmall-exec
22252 @itemx -mno-small-exec
22253 @opindex msmall-exec
22254 @opindex mno-small-exec
22255 Generate (or do not generate) code using the @code{bras} instruction
22256 to do subroutine calls.
22257 This only works reliably if the total executable size does not
22258 exceed 64k. The default is to use the @code{basr} instruction instead,
22259 which does not have this limitation.
22260
22261 @item -m64
22262 @itemx -m31
22263 @opindex m64
22264 @opindex m31
22265 When @option{-m31} is specified, generate code compliant to the
22266 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
22267 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
22268 particular to generate 64-bit instructions. For the @samp{s390}
22269 targets, the default is @option{-m31}, while the @samp{s390x}
22270 targets default to @option{-m64}.
22271
22272 @item -mzarch
22273 @itemx -mesa
22274 @opindex mzarch
22275 @opindex mesa
22276 When @option{-mzarch} is specified, generate code using the
22277 instructions available on z/Architecture.
22278 When @option{-mesa} is specified, generate code using the
22279 instructions available on ESA/390. Note that @option{-mesa} is
22280 not possible with @option{-m64}.
22281 When generating code compliant to the GNU/Linux for S/390 ABI,
22282 the default is @option{-mesa}. When generating code compliant
22283 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
22284
22285 @item -mhtm
22286 @itemx -mno-htm
22287 @opindex mhtm
22288 @opindex mno-htm
22289 The @option{-mhtm} option enables a set of builtins making use of
22290 instructions available with the transactional execution facility
22291 introduced with the IBM zEnterprise EC12 machine generation
22292 @ref{S/390 System z Built-in Functions}.
22293 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
22294
22295 @item -mvx
22296 @itemx -mno-vx
22297 @opindex mvx
22298 @opindex mno-vx
22299 When @option{-mvx} is specified, generate code using the instructions
22300 available with the vector extension facility introduced with the IBM
22301 z13 machine generation.
22302 This option changes the ABI for some vector type values with regard to
22303 alignment and calling conventions. In case vector type values are
22304 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
22305 command will be added to mark the resulting binary with the ABI used.
22306 @option{-mvx} is enabled by default when using @option{-march=z13}.
22307
22308 @item -mzvector
22309 @itemx -mno-zvector
22310 @opindex mzvector
22311 @opindex mno-zvector
22312 The @option{-mzvector} option enables vector language extensions and
22313 builtins using instructions available with the vector extension
22314 facility introduced with the IBM z13 machine generation.
22315 This option adds support for @samp{vector} to be used as a keyword to
22316 define vector type variables and arguments. @samp{vector} is only
22317 available when GNU extensions are enabled. It will not be expanded
22318 when requesting strict standard compliance e.g. with @option{-std=c99}.
22319 In addition to the GCC low-level builtins @option{-mzvector} enables
22320 a set of builtins added for compatibility with AltiVec-style
22321 implementations like Power and Cell. In order to make use of these
22322 builtins the header file @file{vecintrin.h} needs to be included.
22323 @option{-mzvector} is disabled by default.
22324
22325 @item -mmvcle
22326 @itemx -mno-mvcle
22327 @opindex mmvcle
22328 @opindex mno-mvcle
22329 Generate (or do not generate) code using the @code{mvcle} instruction
22330 to perform block moves. When @option{-mno-mvcle} is specified,
22331 use a @code{mvc} loop instead. This is the default unless optimizing for
22332 size.
22333
22334 @item -mdebug
22335 @itemx -mno-debug
22336 @opindex mdebug
22337 @opindex mno-debug
22338 Print (or do not print) additional debug information when compiling.
22339 The default is to not print debug information.
22340
22341 @item -march=@var{cpu-type}
22342 @opindex march
22343 Generate code that runs on @var{cpu-type}, which is the name of a
22344 system representing a certain processor type. Possible values for
22345 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
22346 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
22347 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
22348 @samp{native}.
22349
22350 The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and
22351 @samp{g6} are deprecated and will be removed with future releases.
22352
22353 Specifying @samp{native} as cpu type can be used to select the best
22354 architecture option for the host processor.
22355 @option{-march=native} has no effect if GCC does not recognize the
22356 processor.
22357
22358 @item -mtune=@var{cpu-type}
22359 @opindex mtune
22360 Tune to @var{cpu-type} everything applicable about the generated code,
22361 except for the ABI and the set of available instructions.
22362 The list of @var{cpu-type} values is the same as for @option{-march}.
22363 The default is the value used for @option{-march}.
22364
22365 @item -mtpf-trace
22366 @itemx -mno-tpf-trace
22367 @opindex mtpf-trace
22368 @opindex mno-tpf-trace
22369 Generate code that adds (does not add) in TPF OS specific branches to trace
22370 routines in the operating system. This option is off by default, even
22371 when compiling for the TPF OS@.
22372
22373 @item -mfused-madd
22374 @itemx -mno-fused-madd
22375 @opindex mfused-madd
22376 @opindex mno-fused-madd
22377 Generate code that uses (does not use) the floating-point multiply and
22378 accumulate instructions. These instructions are generated by default if
22379 hardware floating point is used.
22380
22381 @item -mwarn-framesize=@var{framesize}
22382 @opindex mwarn-framesize
22383 Emit a warning if the current function exceeds the given frame size. Because
22384 this is a compile-time check it doesn't need to be a real problem when the program
22385 runs. It is intended to identify functions that most probably cause
22386 a stack overflow. It is useful to be used in an environment with limited stack
22387 size e.g.@: the linux kernel.
22388
22389 @item -mwarn-dynamicstack
22390 @opindex mwarn-dynamicstack
22391 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
22392 arrays. This is generally a bad idea with a limited stack size.
22393
22394 @item -mstack-guard=@var{stack-guard}
22395 @itemx -mstack-size=@var{stack-size}
22396 @opindex mstack-guard
22397 @opindex mstack-size
22398 If these options are provided the S/390 back end emits additional instructions in
22399 the function prologue that trigger a trap if the stack size is @var{stack-guard}
22400 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
22401 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
22402 the frame size of the compiled function is chosen.
22403 These options are intended to be used to help debugging stack overflow problems.
22404 The additionally emitted code causes only little overhead and hence can also be
22405 used in production-like systems without greater performance degradation. The given
22406 values have to be exact powers of 2 and @var{stack-size} has to be greater than
22407 @var{stack-guard} without exceeding 64k.
22408 In order to be efficient the extra code makes the assumption that the stack starts
22409 at an address aligned to the value given by @var{stack-size}.
22410 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
22411
22412 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
22413 @opindex mhotpatch
22414 If the hotpatch option is enabled, a ``hot-patching'' function
22415 prologue is generated for all functions in the compilation unit.
22416 The funtion label is prepended with the given number of two-byte
22417 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
22418 the label, 2 * @var{post-halfwords} bytes are appended, using the
22419 largest NOP like instructions the architecture allows (maximum
22420 1000000).
22421
22422 If both arguments are zero, hotpatching is disabled.
22423
22424 This option can be overridden for individual functions with the
22425 @code{hotpatch} attribute.
22426 @end table
22427
22428 @node Score Options
22429 @subsection Score Options
22430 @cindex Score Options
22431
22432 These options are defined for Score implementations:
22433
22434 @table @gcctabopt
22435 @item -meb
22436 @opindex meb
22437 Compile code for big-endian mode. This is the default.
22438
22439 @item -mel
22440 @opindex mel
22441 Compile code for little-endian mode.
22442
22443 @item -mnhwloop
22444 @opindex mnhwloop
22445 Disable generation of @code{bcnz} instructions.
22446
22447 @item -muls
22448 @opindex muls
22449 Enable generation of unaligned load and store instructions.
22450
22451 @item -mmac
22452 @opindex mmac
22453 Enable the use of multiply-accumulate instructions. Disabled by default.
22454
22455 @item -mscore5
22456 @opindex mscore5
22457 Specify the SCORE5 as the target architecture.
22458
22459 @item -mscore5u
22460 @opindex mscore5u
22461 Specify the SCORE5U of the target architecture.
22462
22463 @item -mscore7
22464 @opindex mscore7
22465 Specify the SCORE7 as the target architecture. This is the default.
22466
22467 @item -mscore7d
22468 @opindex mscore7d
22469 Specify the SCORE7D as the target architecture.
22470 @end table
22471
22472 @node SH Options
22473 @subsection SH Options
22474
22475 These @samp{-m} options are defined for the SH implementations:
22476
22477 @table @gcctabopt
22478 @item -m1
22479 @opindex m1
22480 Generate code for the SH1.
22481
22482 @item -m2
22483 @opindex m2
22484 Generate code for the SH2.
22485
22486 @item -m2e
22487 Generate code for the SH2e.
22488
22489 @item -m2a-nofpu
22490 @opindex m2a-nofpu
22491 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
22492 that the floating-point unit is not used.
22493
22494 @item -m2a-single-only
22495 @opindex m2a-single-only
22496 Generate code for the SH2a-FPU, in such a way that no double-precision
22497 floating-point operations are used.
22498
22499 @item -m2a-single
22500 @opindex m2a-single
22501 Generate code for the SH2a-FPU assuming the floating-point unit is in
22502 single-precision mode by default.
22503
22504 @item -m2a
22505 @opindex m2a
22506 Generate code for the SH2a-FPU assuming the floating-point unit is in
22507 double-precision mode by default.
22508
22509 @item -m3
22510 @opindex m3
22511 Generate code for the SH3.
22512
22513 @item -m3e
22514 @opindex m3e
22515 Generate code for the SH3e.
22516
22517 @item -m4-nofpu
22518 @opindex m4-nofpu
22519 Generate code for the SH4 without a floating-point unit.
22520
22521 @item -m4-single-only
22522 @opindex m4-single-only
22523 Generate code for the SH4 with a floating-point unit that only
22524 supports single-precision arithmetic.
22525
22526 @item -m4-single
22527 @opindex m4-single
22528 Generate code for the SH4 assuming the floating-point unit is in
22529 single-precision mode by default.
22530
22531 @item -m4
22532 @opindex m4
22533 Generate code for the SH4.
22534
22535 @item -m4-100
22536 @opindex m4-100
22537 Generate code for SH4-100.
22538
22539 @item -m4-100-nofpu
22540 @opindex m4-100-nofpu
22541 Generate code for SH4-100 in such a way that the
22542 floating-point unit is not used.
22543
22544 @item -m4-100-single
22545 @opindex m4-100-single
22546 Generate code for SH4-100 assuming the floating-point unit is in
22547 single-precision mode by default.
22548
22549 @item -m4-100-single-only
22550 @opindex m4-100-single-only
22551 Generate code for SH4-100 in such a way that no double-precision
22552 floating-point operations are used.
22553
22554 @item -m4-200
22555 @opindex m4-200
22556 Generate code for SH4-200.
22557
22558 @item -m4-200-nofpu
22559 @opindex m4-200-nofpu
22560 Generate code for SH4-200 without in such a way that the
22561 floating-point unit is not used.
22562
22563 @item -m4-200-single
22564 @opindex m4-200-single
22565 Generate code for SH4-200 assuming the floating-point unit is in
22566 single-precision mode by default.
22567
22568 @item -m4-200-single-only
22569 @opindex m4-200-single-only
22570 Generate code for SH4-200 in such a way that no double-precision
22571 floating-point operations are used.
22572
22573 @item -m4-300
22574 @opindex m4-300
22575 Generate code for SH4-300.
22576
22577 @item -m4-300-nofpu
22578 @opindex m4-300-nofpu
22579 Generate code for SH4-300 without in such a way that the
22580 floating-point unit is not used.
22581
22582 @item -m4-300-single
22583 @opindex m4-300-single
22584 Generate code for SH4-300 in such a way that no double-precision
22585 floating-point operations are used.
22586
22587 @item -m4-300-single-only
22588 @opindex m4-300-single-only
22589 Generate code for SH4-300 in such a way that no double-precision
22590 floating-point operations are used.
22591
22592 @item -m4-340
22593 @opindex m4-340
22594 Generate code for SH4-340 (no MMU, no FPU).
22595
22596 @item -m4-500
22597 @opindex m4-500
22598 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
22599 assembler.
22600
22601 @item -m4a-nofpu
22602 @opindex m4a-nofpu
22603 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
22604 floating-point unit is not used.
22605
22606 @item -m4a-single-only
22607 @opindex m4a-single-only
22608 Generate code for the SH4a, in such a way that no double-precision
22609 floating-point operations are used.
22610
22611 @item -m4a-single
22612 @opindex m4a-single
22613 Generate code for the SH4a assuming the floating-point unit is in
22614 single-precision mode by default.
22615
22616 @item -m4a
22617 @opindex m4a
22618 Generate code for the SH4a.
22619
22620 @item -m4al
22621 @opindex m4al
22622 Same as @option{-m4a-nofpu}, except that it implicitly passes
22623 @option{-dsp} to the assembler. GCC doesn't generate any DSP
22624 instructions at the moment.
22625
22626 @item -mb
22627 @opindex mb
22628 Compile code for the processor in big-endian mode.
22629
22630 @item -ml
22631 @opindex ml
22632 Compile code for the processor in little-endian mode.
22633
22634 @item -mdalign
22635 @opindex mdalign
22636 Align doubles at 64-bit boundaries. Note that this changes the calling
22637 conventions, and thus some functions from the standard C library do
22638 not work unless you recompile it first with @option{-mdalign}.
22639
22640 @item -mrelax
22641 @opindex mrelax
22642 Shorten some address references at link time, when possible; uses the
22643 linker option @option{-relax}.
22644
22645 @item -mbigtable
22646 @opindex mbigtable
22647 Use 32-bit offsets in @code{switch} tables. The default is to use
22648 16-bit offsets.
22649
22650 @item -mbitops
22651 @opindex mbitops
22652 Enable the use of bit manipulation instructions on SH2A.
22653
22654 @item -mfmovd
22655 @opindex mfmovd
22656 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
22657 alignment constraints.
22658
22659 @item -mrenesas
22660 @opindex mrenesas
22661 Comply with the calling conventions defined by Renesas.
22662
22663 @item -mno-renesas
22664 @opindex mno-renesas
22665 Comply with the calling conventions defined for GCC before the Renesas
22666 conventions were available. This option is the default for all
22667 targets of the SH toolchain.
22668
22669 @item -mnomacsave
22670 @opindex mnomacsave
22671 Mark the @code{MAC} register as call-clobbered, even if
22672 @option{-mrenesas} is given.
22673
22674 @item -mieee
22675 @itemx -mno-ieee
22676 @opindex mieee
22677 @opindex mno-ieee
22678 Control the IEEE compliance of floating-point comparisons, which affects the
22679 handling of cases where the result of a comparison is unordered. By default
22680 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
22681 enabled @option{-mno-ieee} is implicitly set, which results in faster
22682 floating-point greater-equal and less-equal comparisons. The implicit settings
22683 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
22684
22685 @item -minline-ic_invalidate
22686 @opindex minline-ic_invalidate
22687 Inline code to invalidate instruction cache entries after setting up
22688 nested function trampolines.
22689 This option has no effect if @option{-musermode} is in effect and the selected
22690 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
22691 instruction.
22692 If the selected code generation option does not allow the use of the @code{icbi}
22693 instruction, and @option{-musermode} is not in effect, the inlined code
22694 manipulates the instruction cache address array directly with an associative
22695 write. This not only requires privileged mode at run time, but it also
22696 fails if the cache line had been mapped via the TLB and has become unmapped.
22697
22698 @item -misize
22699 @opindex misize
22700 Dump instruction size and location in the assembly code.
22701
22702 @item -mpadstruct
22703 @opindex mpadstruct
22704 This option is deprecated. It pads structures to multiple of 4 bytes,
22705 which is incompatible with the SH ABI@.
22706
22707 @item -matomic-model=@var{model}
22708 @opindex matomic-model=@var{model}
22709 Sets the model of atomic operations and additional parameters as a comma
22710 separated list. For details on the atomic built-in functions see
22711 @ref{__atomic Builtins}. The following models and parameters are supported:
22712
22713 @table @samp
22714
22715 @item none
22716 Disable compiler generated atomic sequences and emit library calls for atomic
22717 operations. This is the default if the target is not @code{sh*-*-linux*}.
22718
22719 @item soft-gusa
22720 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
22721 built-in functions. The generated atomic sequences require additional support
22722 from the interrupt/exception handling code of the system and are only suitable
22723 for SH3* and SH4* single-core systems. This option is enabled by default when
22724 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
22725 this option also partially utilizes the hardware atomic instructions
22726 @code{movli.l} and @code{movco.l} to create more efficient code, unless
22727 @samp{strict} is specified.
22728
22729 @item soft-tcb
22730 Generate software atomic sequences that use a variable in the thread control
22731 block. This is a variation of the gUSA sequences which can also be used on
22732 SH1* and SH2* targets. The generated atomic sequences require additional
22733 support from the interrupt/exception handling code of the system and are only
22734 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
22735 parameter has to be specified as well.
22736
22737 @item soft-imask
22738 Generate software atomic sequences that temporarily disable interrupts by
22739 setting @code{SR.IMASK = 1111}. This model works only when the program runs
22740 in privileged mode and is only suitable for single-core systems. Additional
22741 support from the interrupt/exception handling code of the system is not
22742 required. This model is enabled by default when the target is
22743 @code{sh*-*-linux*} and SH1* or SH2*.
22744
22745 @item hard-llcs
22746 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
22747 instructions only. This is only available on SH4A and is suitable for
22748 multi-core systems. Since the hardware instructions support only 32 bit atomic
22749 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
22750 Code compiled with this option is also compatible with other software
22751 atomic model interrupt/exception handling systems if executed on an SH4A
22752 system. Additional support from the interrupt/exception handling code of the
22753 system is not required for this model.
22754
22755 @item gbr-offset=
22756 This parameter specifies the offset in bytes of the variable in the thread
22757 control block structure that should be used by the generated atomic sequences
22758 when the @samp{soft-tcb} model has been selected. For other models this
22759 parameter is ignored. The specified value must be an integer multiple of four
22760 and in the range 0-1020.
22761
22762 @item strict
22763 This parameter prevents mixed usage of multiple atomic models, even if they
22764 are compatible, and makes the compiler generate atomic sequences of the
22765 specified model only.
22766
22767 @end table
22768
22769 @item -mtas
22770 @opindex mtas
22771 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
22772 Notice that depending on the particular hardware and software configuration
22773 this can degrade overall performance due to the operand cache line flushes
22774 that are implied by the @code{tas.b} instruction. On multi-core SH4A
22775 processors the @code{tas.b} instruction must be used with caution since it
22776 can result in data corruption for certain cache configurations.
22777
22778 @item -mprefergot
22779 @opindex mprefergot
22780 When generating position-independent code, emit function calls using
22781 the Global Offset Table instead of the Procedure Linkage Table.
22782
22783 @item -musermode
22784 @itemx -mno-usermode
22785 @opindex musermode
22786 @opindex mno-usermode
22787 Don't allow (allow) the compiler generating privileged mode code. Specifying
22788 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
22789 inlined code would not work in user mode. @option{-musermode} is the default
22790 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
22791 @option{-musermode} has no effect, since there is no user mode.
22792
22793 @item -multcost=@var{number}
22794 @opindex multcost=@var{number}
22795 Set the cost to assume for a multiply insn.
22796
22797 @item -mdiv=@var{strategy}
22798 @opindex mdiv=@var{strategy}
22799 Set the division strategy to be used for integer division operations.
22800 @var{strategy} can be one of:
22801
22802 @table @samp
22803
22804 @item call-div1
22805 Calls a library function that uses the single-step division instruction
22806 @code{div1} to perform the operation. Division by zero calculates an
22807 unspecified result and does not trap. This is the default except for SH4,
22808 SH2A and SHcompact.
22809
22810 @item call-fp
22811 Calls a library function that performs the operation in double precision
22812 floating point. Division by zero causes a floating-point exception. This is
22813 the default for SHcompact with FPU. Specifying this for targets that do not
22814 have a double precision FPU defaults to @code{call-div1}.
22815
22816 @item call-table
22817 Calls a library function that uses a lookup table for small divisors and
22818 the @code{div1} instruction with case distinction for larger divisors. Division
22819 by zero calculates an unspecified result and does not trap. This is the default
22820 for SH4. Specifying this for targets that do not have dynamic shift
22821 instructions defaults to @code{call-div1}.
22822
22823 @end table
22824
22825 When a division strategy has not been specified the default strategy is
22826 selected based on the current target. For SH2A the default strategy is to
22827 use the @code{divs} and @code{divu} instructions instead of library function
22828 calls.
22829
22830 @item -maccumulate-outgoing-args
22831 @opindex maccumulate-outgoing-args
22832 Reserve space once for outgoing arguments in the function prologue rather
22833 than around each call. Generally beneficial for performance and size. Also
22834 needed for unwinding to avoid changing the stack frame around conditional code.
22835
22836 @item -mdivsi3_libfunc=@var{name}
22837 @opindex mdivsi3_libfunc=@var{name}
22838 Set the name of the library function used for 32-bit signed division to
22839 @var{name}.
22840 This only affects the name used in the @samp{call} division strategies, and
22841 the compiler still expects the same sets of input/output/clobbered registers as
22842 if this option were not present.
22843
22844 @item -mfixed-range=@var{register-range}
22845 @opindex mfixed-range
22846 Generate code treating the given register range as fixed registers.
22847 A fixed register is one that the register allocator can not use. This is
22848 useful when compiling kernel code. A register range is specified as
22849 two registers separated by a dash. Multiple register ranges can be
22850 specified separated by a comma.
22851
22852 @item -mbranch-cost=@var{num}
22853 @opindex mbranch-cost=@var{num}
22854 Assume @var{num} to be the cost for a branch instruction. Higher numbers
22855 make the compiler try to generate more branch-free code if possible.
22856 If not specified the value is selected depending on the processor type that
22857 is being compiled for.
22858
22859 @item -mzdcbranch
22860 @itemx -mno-zdcbranch
22861 @opindex mzdcbranch
22862 @opindex mno-zdcbranch
22863 Assume (do not assume) that zero displacement conditional branch instructions
22864 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
22865 compiler prefers zero displacement branch code sequences. This is
22866 enabled by default when generating code for SH4 and SH4A. It can be explicitly
22867 disabled by specifying @option{-mno-zdcbranch}.
22868
22869 @item -mcbranch-force-delay-slot
22870 @opindex mcbranch-force-delay-slot
22871 Force the usage of delay slots for conditional branches, which stuffs the delay
22872 slot with a @code{nop} if a suitable instruction can't be found. By default
22873 this option is disabled. It can be enabled to work around hardware bugs as
22874 found in the original SH7055.
22875
22876 @item -mfused-madd
22877 @itemx -mno-fused-madd
22878 @opindex mfused-madd
22879 @opindex mno-fused-madd
22880 Generate code that uses (does not use) the floating-point multiply and
22881 accumulate instructions. These instructions are generated by default
22882 if hardware floating point is used. The machine-dependent
22883 @option{-mfused-madd} option is now mapped to the machine-independent
22884 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22885 mapped to @option{-ffp-contract=off}.
22886
22887 @item -mfsca
22888 @itemx -mno-fsca
22889 @opindex mfsca
22890 @opindex mno-fsca
22891 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
22892 and cosine approximations. The option @option{-mfsca} must be used in
22893 combination with @option{-funsafe-math-optimizations}. It is enabled by default
22894 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
22895 approximations even if @option{-funsafe-math-optimizations} is in effect.
22896
22897 @item -mfsrra
22898 @itemx -mno-fsrra
22899 @opindex mfsrra
22900 @opindex mno-fsrra
22901 Allow or disallow the compiler to emit the @code{fsrra} instruction for
22902 reciprocal square root approximations. The option @option{-mfsrra} must be used
22903 in combination with @option{-funsafe-math-optimizations} and
22904 @option{-ffinite-math-only}. It is enabled by default when generating code for
22905 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
22906 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
22907 in effect.
22908
22909 @item -mpretend-cmove
22910 @opindex mpretend-cmove
22911 Prefer zero-displacement conditional branches for conditional move instruction
22912 patterns. This can result in faster code on the SH4 processor.
22913
22914 @item -mfdpic
22915 @opindex fdpic
22916 Generate code using the FDPIC ABI.
22917
22918 @end table
22919
22920 @node Solaris 2 Options
22921 @subsection Solaris 2 Options
22922 @cindex Solaris 2 options
22923
22924 These @samp{-m} options are supported on Solaris 2:
22925
22926 @table @gcctabopt
22927 @item -mclear-hwcap
22928 @opindex mclear-hwcap
22929 @option{-mclear-hwcap} tells the compiler to remove the hardware
22930 capabilities generated by the Solaris assembler. This is only necessary
22931 when object files use ISA extensions not supported by the current
22932 machine, but check at runtime whether or not to use them.
22933
22934 @item -mimpure-text
22935 @opindex mimpure-text
22936 @option{-mimpure-text}, used in addition to @option{-shared}, tells
22937 the compiler to not pass @option{-z text} to the linker when linking a
22938 shared object. Using this option, you can link position-dependent
22939 code into a shared object.
22940
22941 @option{-mimpure-text} suppresses the ``relocations remain against
22942 allocatable but non-writable sections'' linker error message.
22943 However, the necessary relocations trigger copy-on-write, and the
22944 shared object is not actually shared across processes. Instead of
22945 using @option{-mimpure-text}, you should compile all source code with
22946 @option{-fpic} or @option{-fPIC}.
22947
22948 @end table
22949
22950 These switches are supported in addition to the above on Solaris 2:
22951
22952 @table @gcctabopt
22953 @item -pthreads
22954 @opindex pthreads
22955 Add support for multithreading using the POSIX threads library. This
22956 option sets flags for both the preprocessor and linker. This option does
22957 not affect the thread safety of object code produced by the compiler or
22958 that of libraries supplied with it.
22959
22960 @item -pthread
22961 @opindex pthread
22962 This is a synonym for @option{-pthreads}.
22963 @end table
22964
22965 @node SPARC Options
22966 @subsection SPARC Options
22967 @cindex SPARC options
22968
22969 These @samp{-m} options are supported on the SPARC:
22970
22971 @table @gcctabopt
22972 @item -mno-app-regs
22973 @itemx -mapp-regs
22974 @opindex mno-app-regs
22975 @opindex mapp-regs
22976 Specify @option{-mapp-regs} to generate output using the global registers
22977 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
22978 global register 1, each global register 2 through 4 is then treated as an
22979 allocable register that is clobbered by function calls. This is the default.
22980
22981 To be fully SVR4 ABI-compliant at the cost of some performance loss,
22982 specify @option{-mno-app-regs}. You should compile libraries and system
22983 software with this option.
22984
22985 @item -mflat
22986 @itemx -mno-flat
22987 @opindex mflat
22988 @opindex mno-flat
22989 With @option{-mflat}, the compiler does not generate save/restore instructions
22990 and uses a ``flat'' or single register window model. This model is compatible
22991 with the regular register window model. The local registers and the input
22992 registers (0--5) are still treated as ``call-saved'' registers and are
22993 saved on the stack as needed.
22994
22995 With @option{-mno-flat} (the default), the compiler generates save/restore
22996 instructions (except for leaf functions). This is the normal operating mode.
22997
22998 @item -mfpu
22999 @itemx -mhard-float
23000 @opindex mfpu
23001 @opindex mhard-float
23002 Generate output containing floating-point instructions. This is the
23003 default.
23004
23005 @item -mno-fpu
23006 @itemx -msoft-float
23007 @opindex mno-fpu
23008 @opindex msoft-float
23009 Generate output containing library calls for floating point.
23010 @strong{Warning:} the requisite libraries are not available for all SPARC
23011 targets. Normally the facilities of the machine's usual C compiler are
23012 used, but this cannot be done directly in cross-compilation. You must make
23013 your own arrangements to provide suitable library functions for
23014 cross-compilation. The embedded targets @samp{sparc-*-aout} and
23015 @samp{sparclite-*-*} do provide software floating-point support.
23016
23017 @option{-msoft-float} changes the calling convention in the output file;
23018 therefore, it is only useful if you compile @emph{all} of a program with
23019 this option. In particular, you need to compile @file{libgcc.a}, the
23020 library that comes with GCC, with @option{-msoft-float} in order for
23021 this to work.
23022
23023 @item -mhard-quad-float
23024 @opindex mhard-quad-float
23025 Generate output containing quad-word (long double) floating-point
23026 instructions.
23027
23028 @item -msoft-quad-float
23029 @opindex msoft-quad-float
23030 Generate output containing library calls for quad-word (long double)
23031 floating-point instructions. The functions called are those specified
23032 in the SPARC ABI@. This is the default.
23033
23034 As of this writing, there are no SPARC implementations that have hardware
23035 support for the quad-word floating-point instructions. They all invoke
23036 a trap handler for one of these instructions, and then the trap handler
23037 emulates the effect of the instruction. Because of the trap handler overhead,
23038 this is much slower than calling the ABI library routines. Thus the
23039 @option{-msoft-quad-float} option is the default.
23040
23041 @item -mno-unaligned-doubles
23042 @itemx -munaligned-doubles
23043 @opindex mno-unaligned-doubles
23044 @opindex munaligned-doubles
23045 Assume that doubles have 8-byte alignment. This is the default.
23046
23047 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
23048 alignment only if they are contained in another type, or if they have an
23049 absolute address. Otherwise, it assumes they have 4-byte alignment.
23050 Specifying this option avoids some rare compatibility problems with code
23051 generated by other compilers. It is not the default because it results
23052 in a performance loss, especially for floating-point code.
23053
23054 @item -muser-mode
23055 @itemx -mno-user-mode
23056 @opindex muser-mode
23057 @opindex mno-user-mode
23058 Do not generate code that can only run in supervisor mode. This is relevant
23059 only for the @code{casa} instruction emitted for the LEON3 processor. This
23060 is the default.
23061
23062 @item -mfaster-structs
23063 @itemx -mno-faster-structs
23064 @opindex mfaster-structs
23065 @opindex mno-faster-structs
23066 With @option{-mfaster-structs}, the compiler assumes that structures
23067 should have 8-byte alignment. This enables the use of pairs of
23068 @code{ldd} and @code{std} instructions for copies in structure
23069 assignment, in place of twice as many @code{ld} and @code{st} pairs.
23070 However, the use of this changed alignment directly violates the SPARC
23071 ABI@. Thus, it's intended only for use on targets where the developer
23072 acknowledges that their resulting code is not directly in line with
23073 the rules of the ABI@.
23074
23075 @item -mstd-struct-return
23076 @itemx -mno-std-struct-return
23077 @opindex mstd-struct-return
23078 @opindex mno-std-struct-return
23079 With @option{-mstd-struct-return}, the compiler generates checking code
23080 in functions returning structures or unions to detect size mismatches
23081 between the two sides of function calls, as per the 32-bit ABI@.
23082
23083 The default is @option{-mno-std-struct-return}. This option has no effect
23084 in 64-bit mode.
23085
23086 @item -mcpu=@var{cpu_type}
23087 @opindex mcpu
23088 Set the instruction set, register set, and instruction scheduling parameters
23089 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23090 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
23091 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
23092 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
23093 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
23094 @samp{niagara3}, @samp{niagara4} and @samp{niagara7}.
23095
23096 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
23097 which selects the best architecture option for the host processor.
23098 @option{-mcpu=native} has no effect if GCC does not recognize
23099 the processor.
23100
23101 Default instruction scheduling parameters are used for values that select
23102 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
23103 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
23104
23105 Here is a list of each supported architecture and their supported
23106 implementations.
23107
23108 @table @asis
23109 @item v7
23110 cypress, leon3v7
23111
23112 @item v8
23113 supersparc, hypersparc, leon, leon3
23114
23115 @item sparclite
23116 f930, f934, sparclite86x
23117
23118 @item sparclet
23119 tsc701
23120
23121 @item v9
23122 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7
23123 @end table
23124
23125 By default (unless configured otherwise), GCC generates code for the V7
23126 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
23127 additionally optimizes it for the Cypress CY7C602 chip, as used in the
23128 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
23129 SPARCStation 1, 2, IPX etc.
23130
23131 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
23132 architecture. The only difference from V7 code is that the compiler emits
23133 the integer multiply and integer divide instructions which exist in SPARC-V8
23134 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
23135 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
23136 2000 series.
23137
23138 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
23139 the SPARC architecture. This adds the integer multiply, integer divide step
23140 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
23141 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
23142 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
23143 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
23144 MB86934 chip, which is the more recent SPARClite with FPU@.
23145
23146 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
23147 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
23148 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
23149 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
23150 optimizes it for the TEMIC SPARClet chip.
23151
23152 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
23153 architecture. This adds 64-bit integer and floating-point move instructions,
23154 3 additional floating-point condition code registers and conditional move
23155 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
23156 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
23157 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
23158 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
23159 @option{-mcpu=niagara}, the compiler additionally optimizes it for
23160 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
23161 additionally optimizes it for Sun UltraSPARC T2 chips. With
23162 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
23163 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
23164 additionally optimizes it for Sun UltraSPARC T4 chips. With
23165 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
23166 Oracle SPARC M7 chips.
23167
23168 @item -mtune=@var{cpu_type}
23169 @opindex mtune
23170 Set the instruction scheduling parameters for machine type
23171 @var{cpu_type}, but do not set the instruction set or register set that the
23172 option @option{-mcpu=@var{cpu_type}} does.
23173
23174 The same values for @option{-mcpu=@var{cpu_type}} can be used for
23175 @option{-mtune=@var{cpu_type}}, but the only useful values are those
23176 that select a particular CPU implementation. Those are
23177 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
23178 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
23179 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
23180 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
23181 @samp{niagara4} and @samp{niagara7}. With native Solaris and
23182 GNU/Linux toolchains, @samp{native} can also be used.
23183
23184 @item -mv8plus
23185 @itemx -mno-v8plus
23186 @opindex mv8plus
23187 @opindex mno-v8plus
23188 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
23189 difference from the V8 ABI is that the global and out registers are
23190 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
23191 mode for all SPARC-V9 processors.
23192
23193 @item -mvis
23194 @itemx -mno-vis
23195 @opindex mvis
23196 @opindex mno-vis
23197 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
23198 Visual Instruction Set extensions. The default is @option{-mno-vis}.
23199
23200 @item -mvis2
23201 @itemx -mno-vis2
23202 @opindex mvis2
23203 @opindex mno-vis2
23204 With @option{-mvis2}, GCC generates code that takes advantage of
23205 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
23206 default is @option{-mvis2} when targeting a cpu that supports such
23207 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
23208 also sets @option{-mvis}.
23209
23210 @item -mvis3
23211 @itemx -mno-vis3
23212 @opindex mvis3
23213 @opindex mno-vis3
23214 With @option{-mvis3}, GCC generates code that takes advantage of
23215 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
23216 default is @option{-mvis3} when targeting a cpu that supports such
23217 instructions, such as niagara-3 and later. Setting @option{-mvis3}
23218 also sets @option{-mvis2} and @option{-mvis}.
23219
23220 @item -mvis4
23221 @itemx -mno-vis4
23222 @opindex mvis4
23223 @opindex mno-vis4
23224 With @option{-mvis4}, GCC generates code that takes advantage of
23225 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
23226 default is @option{-mvis4} when targeting a cpu that supports such
23227 instructions, such as niagara-7 and later. Setting @option{-mvis4}
23228 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
23229
23230 @item -mcbcond
23231 @itemx -mno-cbcond
23232 @opindex mcbcond
23233 @opindex mno-cbcond
23234 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
23235 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
23236 when targeting a CPU that supports such instructions, such as Niagara-4 and
23237 later.
23238
23239 @item -mfmaf
23240 @itemx -mno-fmaf
23241 @opindex mfmaf
23242 @opindex mno-fmaf
23243 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
23244 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
23245 when targeting a CPU that supports such instructions, such as Niagara-3 and
23246 later.
23247
23248 @item -mpopc
23249 @itemx -mno-popc
23250 @opindex mpopc
23251 @opindex mno-popc
23252 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
23253 Population Count instruction. The default is @option{-mpopc}
23254 when targeting a CPU that supports such an instruction, such as Niagara-2 and
23255 later.
23256
23257 @item -msubxc
23258 @itemx -mno-subxc
23259 @opindex msubxc
23260 @opindex mno-subxc
23261 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
23262 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
23263 when targeting a CPU that supports such an instruction, such as Niagara-7 and
23264 later.
23265
23266 @item -mfix-at697f
23267 @opindex mfix-at697f
23268 Enable the documented workaround for the single erratum of the Atmel AT697F
23269 processor (which corresponds to erratum #13 of the AT697E processor).
23270
23271 @item -mfix-ut699
23272 @opindex mfix-ut699
23273 Enable the documented workarounds for the floating-point errata and the data
23274 cache nullify errata of the UT699 processor.
23275 @end table
23276
23277 These @samp{-m} options are supported in addition to the above
23278 on SPARC-V9 processors in 64-bit environments:
23279
23280 @table @gcctabopt
23281 @item -m32
23282 @itemx -m64
23283 @opindex m32
23284 @opindex m64
23285 Generate code for a 32-bit or 64-bit environment.
23286 The 32-bit environment sets int, long and pointer to 32 bits.
23287 The 64-bit environment sets int to 32 bits and long and pointer
23288 to 64 bits.
23289
23290 @item -mcmodel=@var{which}
23291 @opindex mcmodel
23292 Set the code model to one of
23293
23294 @table @samp
23295 @item medlow
23296 The Medium/Low code model: 64-bit addresses, programs
23297 must be linked in the low 32 bits of memory. Programs can be statically
23298 or dynamically linked.
23299
23300 @item medmid
23301 The Medium/Middle code model: 64-bit addresses, programs
23302 must be linked in the low 44 bits of memory, the text and data segments must
23303 be less than 2GB in size and the data segment must be located within 2GB of
23304 the text segment.
23305
23306 @item medany
23307 The Medium/Anywhere code model: 64-bit addresses, programs
23308 may be linked anywhere in memory, the text and data segments must be less
23309 than 2GB in size and the data segment must be located within 2GB of the
23310 text segment.
23311
23312 @item embmedany
23313 The Medium/Anywhere code model for embedded systems:
23314 64-bit addresses, the text and data segments must be less than 2GB in
23315 size, both starting anywhere in memory (determined at link time). The
23316 global register %g4 points to the base of the data segment. Programs
23317 are statically linked and PIC is not supported.
23318 @end table
23319
23320 @item -mmemory-model=@var{mem-model}
23321 @opindex mmemory-model
23322 Set the memory model in force on the processor to one of
23323
23324 @table @samp
23325 @item default
23326 The default memory model for the processor and operating system.
23327
23328 @item rmo
23329 Relaxed Memory Order
23330
23331 @item pso
23332 Partial Store Order
23333
23334 @item tso
23335 Total Store Order
23336
23337 @item sc
23338 Sequential Consistency
23339 @end table
23340
23341 These memory models are formally defined in Appendix D of the Sparc V9
23342 architecture manual, as set in the processor's @code{PSTATE.MM} field.
23343
23344 @item -mstack-bias
23345 @itemx -mno-stack-bias
23346 @opindex mstack-bias
23347 @opindex mno-stack-bias
23348 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
23349 frame pointer if present, are offset by @minus{}2047 which must be added back
23350 when making stack frame references. This is the default in 64-bit mode.
23351 Otherwise, assume no such offset is present.
23352 @end table
23353
23354 @node SPU Options
23355 @subsection SPU Options
23356 @cindex SPU options
23357
23358 These @samp{-m} options are supported on the SPU:
23359
23360 @table @gcctabopt
23361 @item -mwarn-reloc
23362 @itemx -merror-reloc
23363 @opindex mwarn-reloc
23364 @opindex merror-reloc
23365
23366 The loader for SPU does not handle dynamic relocations. By default, GCC
23367 gives an error when it generates code that requires a dynamic
23368 relocation. @option{-mno-error-reloc} disables the error,
23369 @option{-mwarn-reloc} generates a warning instead.
23370
23371 @item -msafe-dma
23372 @itemx -munsafe-dma
23373 @opindex msafe-dma
23374 @opindex munsafe-dma
23375
23376 Instructions that initiate or test completion of DMA must not be
23377 reordered with respect to loads and stores of the memory that is being
23378 accessed.
23379 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
23380 memory accesses, but that can lead to inefficient code in places where the
23381 memory is known to not change. Rather than mark the memory as volatile,
23382 you can use @option{-msafe-dma} to tell the compiler to treat
23383 the DMA instructions as potentially affecting all memory.
23384
23385 @item -mbranch-hints
23386 @opindex mbranch-hints
23387
23388 By default, GCC generates a branch hint instruction to avoid
23389 pipeline stalls for always-taken or probably-taken branches. A hint
23390 is not generated closer than 8 instructions away from its branch.
23391 There is little reason to disable them, except for debugging purposes,
23392 or to make an object a little bit smaller.
23393
23394 @item -msmall-mem
23395 @itemx -mlarge-mem
23396 @opindex msmall-mem
23397 @opindex mlarge-mem
23398
23399 By default, GCC generates code assuming that addresses are never larger
23400 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
23401 a full 32-bit address.
23402
23403 @item -mstdmain
23404 @opindex mstdmain
23405
23406 By default, GCC links against startup code that assumes the SPU-style
23407 main function interface (which has an unconventional parameter list).
23408 With @option{-mstdmain}, GCC links your program against startup
23409 code that assumes a C99-style interface to @code{main}, including a
23410 local copy of @code{argv} strings.
23411
23412 @item -mfixed-range=@var{register-range}
23413 @opindex mfixed-range
23414 Generate code treating the given register range as fixed registers.
23415 A fixed register is one that the register allocator cannot use. This is
23416 useful when compiling kernel code. A register range is specified as
23417 two registers separated by a dash. Multiple register ranges can be
23418 specified separated by a comma.
23419
23420 @item -mea32
23421 @itemx -mea64
23422 @opindex mea32
23423 @opindex mea64
23424 Compile code assuming that pointers to the PPU address space accessed
23425 via the @code{__ea} named address space qualifier are either 32 or 64
23426 bits wide. The default is 32 bits. As this is an ABI-changing option,
23427 all object code in an executable must be compiled with the same setting.
23428
23429 @item -maddress-space-conversion
23430 @itemx -mno-address-space-conversion
23431 @opindex maddress-space-conversion
23432 @opindex mno-address-space-conversion
23433 Allow/disallow treating the @code{__ea} address space as superset
23434 of the generic address space. This enables explicit type casts
23435 between @code{__ea} and generic pointer as well as implicit
23436 conversions of generic pointers to @code{__ea} pointers. The
23437 default is to allow address space pointer conversions.
23438
23439 @item -mcache-size=@var{cache-size}
23440 @opindex mcache-size
23441 This option controls the version of libgcc that the compiler links to an
23442 executable and selects a software-managed cache for accessing variables
23443 in the @code{__ea} address space with a particular cache size. Possible
23444 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
23445 and @samp{128}. The default cache size is 64KB.
23446
23447 @item -matomic-updates
23448 @itemx -mno-atomic-updates
23449 @opindex matomic-updates
23450 @opindex mno-atomic-updates
23451 This option controls the version of libgcc that the compiler links to an
23452 executable and selects whether atomic updates to the software-managed
23453 cache of PPU-side variables are used. If you use atomic updates, changes
23454 to a PPU variable from SPU code using the @code{__ea} named address space
23455 qualifier do not interfere with changes to other PPU variables residing
23456 in the same cache line from PPU code. If you do not use atomic updates,
23457 such interference may occur; however, writing back cache lines is
23458 more efficient. The default behavior is to use atomic updates.
23459
23460 @item -mdual-nops
23461 @itemx -mdual-nops=@var{n}
23462 @opindex mdual-nops
23463 By default, GCC inserts NOPs to increase dual issue when it expects
23464 it to increase performance. @var{n} can be a value from 0 to 10. A
23465 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
23466 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
23467
23468 @item -mhint-max-nops=@var{n}
23469 @opindex mhint-max-nops
23470 Maximum number of NOPs to insert for a branch hint. A branch hint must
23471 be at least 8 instructions away from the branch it is affecting. GCC
23472 inserts up to @var{n} NOPs to enforce this, otherwise it does not
23473 generate the branch hint.
23474
23475 @item -mhint-max-distance=@var{n}
23476 @opindex mhint-max-distance
23477 The encoding of the branch hint instruction limits the hint to be within
23478 256 instructions of the branch it is affecting. By default, GCC makes
23479 sure it is within 125.
23480
23481 @item -msafe-hints
23482 @opindex msafe-hints
23483 Work around a hardware bug that causes the SPU to stall indefinitely.
23484 By default, GCC inserts the @code{hbrp} instruction to make sure
23485 this stall won't happen.
23486
23487 @end table
23488
23489 @node System V Options
23490 @subsection Options for System V
23491
23492 These additional options are available on System V Release 4 for
23493 compatibility with other compilers on those systems:
23494
23495 @table @gcctabopt
23496 @item -G
23497 @opindex G
23498 Create a shared object.
23499 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
23500
23501 @item -Qy
23502 @opindex Qy
23503 Identify the versions of each tool used by the compiler, in a
23504 @code{.ident} assembler directive in the output.
23505
23506 @item -Qn
23507 @opindex Qn
23508 Refrain from adding @code{.ident} directives to the output file (this is
23509 the default).
23510
23511 @item -YP,@var{dirs}
23512 @opindex YP
23513 Search the directories @var{dirs}, and no others, for libraries
23514 specified with @option{-l}.
23515
23516 @item -Ym,@var{dir}
23517 @opindex Ym
23518 Look in the directory @var{dir} to find the M4 preprocessor.
23519 The assembler uses this option.
23520 @c This is supposed to go with a -Yd for predefined M4 macro files, but
23521 @c the generic assembler that comes with Solaris takes just -Ym.
23522 @end table
23523
23524 @node TILE-Gx Options
23525 @subsection TILE-Gx Options
23526 @cindex TILE-Gx options
23527
23528 These @samp{-m} options are supported on the TILE-Gx:
23529
23530 @table @gcctabopt
23531 @item -mcmodel=small
23532 @opindex mcmodel=small
23533 Generate code for the small model. The distance for direct calls is
23534 limited to 500M in either direction. PC-relative addresses are 32
23535 bits. Absolute addresses support the full address range.
23536
23537 @item -mcmodel=large
23538 @opindex mcmodel=large
23539 Generate code for the large model. There is no limitation on call
23540 distance, pc-relative addresses, or absolute addresses.
23541
23542 @item -mcpu=@var{name}
23543 @opindex mcpu
23544 Selects the type of CPU to be targeted. Currently the only supported
23545 type is @samp{tilegx}.
23546
23547 @item -m32
23548 @itemx -m64
23549 @opindex m32
23550 @opindex m64
23551 Generate code for a 32-bit or 64-bit environment. The 32-bit
23552 environment sets int, long, and pointer to 32 bits. The 64-bit
23553 environment sets int to 32 bits and long and pointer to 64 bits.
23554
23555 @item -mbig-endian
23556 @itemx -mlittle-endian
23557 @opindex mbig-endian
23558 @opindex mlittle-endian
23559 Generate code in big/little endian mode, respectively.
23560 @end table
23561
23562 @node TILEPro Options
23563 @subsection TILEPro Options
23564 @cindex TILEPro options
23565
23566 These @samp{-m} options are supported on the TILEPro:
23567
23568 @table @gcctabopt
23569 @item -mcpu=@var{name}
23570 @opindex mcpu
23571 Selects the type of CPU to be targeted. Currently the only supported
23572 type is @samp{tilepro}.
23573
23574 @item -m32
23575 @opindex m32
23576 Generate code for a 32-bit environment, which sets int, long, and
23577 pointer to 32 bits. This is the only supported behavior so the flag
23578 is essentially ignored.
23579 @end table
23580
23581 @node V850 Options
23582 @subsection V850 Options
23583 @cindex V850 Options
23584
23585 These @samp{-m} options are defined for V850 implementations:
23586
23587 @table @gcctabopt
23588 @item -mlong-calls
23589 @itemx -mno-long-calls
23590 @opindex mlong-calls
23591 @opindex mno-long-calls
23592 Treat all calls as being far away (near). If calls are assumed to be
23593 far away, the compiler always loads the function's address into a
23594 register, and calls indirect through the pointer.
23595
23596 @item -mno-ep
23597 @itemx -mep
23598 @opindex mno-ep
23599 @opindex mep
23600 Do not optimize (do optimize) basic blocks that use the same index
23601 pointer 4 or more times to copy pointer into the @code{ep} register, and
23602 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
23603 option is on by default if you optimize.
23604
23605 @item -mno-prolog-function
23606 @itemx -mprolog-function
23607 @opindex mno-prolog-function
23608 @opindex mprolog-function
23609 Do not use (do use) external functions to save and restore registers
23610 at the prologue and epilogue of a function. The external functions
23611 are slower, but use less code space if more than one function saves
23612 the same number of registers. The @option{-mprolog-function} option
23613 is on by default if you optimize.
23614
23615 @item -mspace
23616 @opindex mspace
23617 Try to make the code as small as possible. At present, this just turns
23618 on the @option{-mep} and @option{-mprolog-function} options.
23619
23620 @item -mtda=@var{n}
23621 @opindex mtda
23622 Put static or global variables whose size is @var{n} bytes or less into
23623 the tiny data area that register @code{ep} points to. The tiny data
23624 area can hold up to 256 bytes in total (128 bytes for byte references).
23625
23626 @item -msda=@var{n}
23627 @opindex msda
23628 Put static or global variables whose size is @var{n} bytes or less into
23629 the small data area that register @code{gp} points to. The small data
23630 area can hold up to 64 kilobytes.
23631
23632 @item -mzda=@var{n}
23633 @opindex mzda
23634 Put static or global variables whose size is @var{n} bytes or less into
23635 the first 32 kilobytes of memory.
23636
23637 @item -mv850
23638 @opindex mv850
23639 Specify that the target processor is the V850.
23640
23641 @item -mv850e3v5
23642 @opindex mv850e3v5
23643 Specify that the target processor is the V850E3V5. The preprocessor
23644 constant @code{__v850e3v5__} is defined if this option is used.
23645
23646 @item -mv850e2v4
23647 @opindex mv850e2v4
23648 Specify that the target processor is the V850E3V5. This is an alias for
23649 the @option{-mv850e3v5} option.
23650
23651 @item -mv850e2v3
23652 @opindex mv850e2v3
23653 Specify that the target processor is the V850E2V3. The preprocessor
23654 constant @code{__v850e2v3__} is defined if this option is used.
23655
23656 @item -mv850e2
23657 @opindex mv850e2
23658 Specify that the target processor is the V850E2. The preprocessor
23659 constant @code{__v850e2__} is defined if this option is used.
23660
23661 @item -mv850e1
23662 @opindex mv850e1
23663 Specify that the target processor is the V850E1. The preprocessor
23664 constants @code{__v850e1__} and @code{__v850e__} are defined if
23665 this option is used.
23666
23667 @item -mv850es
23668 @opindex mv850es
23669 Specify that the target processor is the V850ES. This is an alias for
23670 the @option{-mv850e1} option.
23671
23672 @item -mv850e
23673 @opindex mv850e
23674 Specify that the target processor is the V850E@. The preprocessor
23675 constant @code{__v850e__} is defined if this option is used.
23676
23677 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
23678 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
23679 are defined then a default target processor is chosen and the
23680 relevant @samp{__v850*__} preprocessor constant is defined.
23681
23682 The preprocessor constants @code{__v850} and @code{__v851__} are always
23683 defined, regardless of which processor variant is the target.
23684
23685 @item -mdisable-callt
23686 @itemx -mno-disable-callt
23687 @opindex mdisable-callt
23688 @opindex mno-disable-callt
23689 This option suppresses generation of the @code{CALLT} instruction for the
23690 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
23691 architecture.
23692
23693 This option is enabled by default when the RH850 ABI is
23694 in use (see @option{-mrh850-abi}), and disabled by default when the
23695 GCC ABI is in use. If @code{CALLT} instructions are being generated
23696 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
23697
23698 @item -mrelax
23699 @itemx -mno-relax
23700 @opindex mrelax
23701 @opindex mno-relax
23702 Pass on (or do not pass on) the @option{-mrelax} command-line option
23703 to the assembler.
23704
23705 @item -mlong-jumps
23706 @itemx -mno-long-jumps
23707 @opindex mlong-jumps
23708 @opindex mno-long-jumps
23709 Disable (or re-enable) the generation of PC-relative jump instructions.
23710
23711 @item -msoft-float
23712 @itemx -mhard-float
23713 @opindex msoft-float
23714 @opindex mhard-float
23715 Disable (or re-enable) the generation of hardware floating point
23716 instructions. This option is only significant when the target
23717 architecture is @samp{V850E2V3} or higher. If hardware floating point
23718 instructions are being generated then the C preprocessor symbol
23719 @code{__FPU_OK__} is defined, otherwise the symbol
23720 @code{__NO_FPU__} is defined.
23721
23722 @item -mloop
23723 @opindex mloop
23724 Enables the use of the e3v5 LOOP instruction. The use of this
23725 instruction is not enabled by default when the e3v5 architecture is
23726 selected because its use is still experimental.
23727
23728 @item -mrh850-abi
23729 @itemx -mghs
23730 @opindex mrh850-abi
23731 @opindex mghs
23732 Enables support for the RH850 version of the V850 ABI. This is the
23733 default. With this version of the ABI the following rules apply:
23734
23735 @itemize
23736 @item
23737 Integer sized structures and unions are returned via a memory pointer
23738 rather than a register.
23739
23740 @item
23741 Large structures and unions (more than 8 bytes in size) are passed by
23742 value.
23743
23744 @item
23745 Functions are aligned to 16-bit boundaries.
23746
23747 @item
23748 The @option{-m8byte-align} command-line option is supported.
23749
23750 @item
23751 The @option{-mdisable-callt} command-line option is enabled by
23752 default. The @option{-mno-disable-callt} command-line option is not
23753 supported.
23754 @end itemize
23755
23756 When this version of the ABI is enabled the C preprocessor symbol
23757 @code{__V850_RH850_ABI__} is defined.
23758
23759 @item -mgcc-abi
23760 @opindex mgcc-abi
23761 Enables support for the old GCC version of the V850 ABI. With this
23762 version of the ABI the following rules apply:
23763
23764 @itemize
23765 @item
23766 Integer sized structures and unions are returned in register @code{r10}.
23767
23768 @item
23769 Large structures and unions (more than 8 bytes in size) are passed by
23770 reference.
23771
23772 @item
23773 Functions are aligned to 32-bit boundaries, unless optimizing for
23774 size.
23775
23776 @item
23777 The @option{-m8byte-align} command-line option is not supported.
23778
23779 @item
23780 The @option{-mdisable-callt} command-line option is supported but not
23781 enabled by default.
23782 @end itemize
23783
23784 When this version of the ABI is enabled the C preprocessor symbol
23785 @code{__V850_GCC_ABI__} is defined.
23786
23787 @item -m8byte-align
23788 @itemx -mno-8byte-align
23789 @opindex m8byte-align
23790 @opindex mno-8byte-align
23791 Enables support for @code{double} and @code{long long} types to be
23792 aligned on 8-byte boundaries. The default is to restrict the
23793 alignment of all objects to at most 4-bytes. When
23794 @option{-m8byte-align} is in effect the C preprocessor symbol
23795 @code{__V850_8BYTE_ALIGN__} is defined.
23796
23797 @item -mbig-switch
23798 @opindex mbig-switch
23799 Generate code suitable for big switch tables. Use this option only if
23800 the assembler/linker complain about out of range branches within a switch
23801 table.
23802
23803 @item -mapp-regs
23804 @opindex mapp-regs
23805 This option causes r2 and r5 to be used in the code generated by
23806 the compiler. This setting is the default.
23807
23808 @item -mno-app-regs
23809 @opindex mno-app-regs
23810 This option causes r2 and r5 to be treated as fixed registers.
23811
23812 @end table
23813
23814 @node VAX Options
23815 @subsection VAX Options
23816 @cindex VAX options
23817
23818 These @samp{-m} options are defined for the VAX:
23819
23820 @table @gcctabopt
23821 @item -munix
23822 @opindex munix
23823 Do not output certain jump instructions (@code{aobleq} and so on)
23824 that the Unix assembler for the VAX cannot handle across long
23825 ranges.
23826
23827 @item -mgnu
23828 @opindex mgnu
23829 Do output those jump instructions, on the assumption that the
23830 GNU assembler is being used.
23831
23832 @item -mg
23833 @opindex mg
23834 Output code for G-format floating-point numbers instead of D-format.
23835 @end table
23836
23837 @node Visium Options
23838 @subsection Visium Options
23839 @cindex Visium options
23840
23841 @table @gcctabopt
23842
23843 @item -mdebug
23844 @opindex mdebug
23845 A program which performs file I/O and is destined to run on an MCM target
23846 should be linked with this option. It causes the libraries libc.a and
23847 libdebug.a to be linked. The program should be run on the target under
23848 the control of the GDB remote debugging stub.
23849
23850 @item -msim
23851 @opindex msim
23852 A program which performs file I/O and is destined to run on the simulator
23853 should be linked with option. This causes libraries libc.a and libsim.a to
23854 be linked.
23855
23856 @item -mfpu
23857 @itemx -mhard-float
23858 @opindex mfpu
23859 @opindex mhard-float
23860 Generate code containing floating-point instructions. This is the
23861 default.
23862
23863 @item -mno-fpu
23864 @itemx -msoft-float
23865 @opindex mno-fpu
23866 @opindex msoft-float
23867 Generate code containing library calls for floating-point.
23868
23869 @option{-msoft-float} changes the calling convention in the output file;
23870 therefore, it is only useful if you compile @emph{all} of a program with
23871 this option. In particular, you need to compile @file{libgcc.a}, the
23872 library that comes with GCC, with @option{-msoft-float} in order for
23873 this to work.
23874
23875 @item -mcpu=@var{cpu_type}
23876 @opindex mcpu
23877 Set the instruction set, register set, and instruction scheduling parameters
23878 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23879 @samp{mcm}, @samp{gr5} and @samp{gr6}.
23880
23881 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
23882
23883 By default (unless configured otherwise), GCC generates code for the GR5
23884 variant of the Visium architecture.
23885
23886 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
23887 architecture. The only difference from GR5 code is that the compiler will
23888 generate block move instructions.
23889
23890 @item -mtune=@var{cpu_type}
23891 @opindex mtune
23892 Set the instruction scheduling parameters for machine type @var{cpu_type},
23893 but do not set the instruction set or register set that the option
23894 @option{-mcpu=@var{cpu_type}} would.
23895
23896 @item -msv-mode
23897 @opindex msv-mode
23898 Generate code for the supervisor mode, where there are no restrictions on
23899 the access to general registers. This is the default.
23900
23901 @item -muser-mode
23902 @opindex muser-mode
23903 Generate code for the user mode, where the access to some general registers
23904 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
23905 mode; on the GR6, only registers r29 to r31 are affected.
23906 @end table
23907
23908 @node VMS Options
23909 @subsection VMS Options
23910
23911 These @samp{-m} options are defined for the VMS implementations:
23912
23913 @table @gcctabopt
23914 @item -mvms-return-codes
23915 @opindex mvms-return-codes
23916 Return VMS condition codes from @code{main}. The default is to return POSIX-style
23917 condition (e.g.@ error) codes.
23918
23919 @item -mdebug-main=@var{prefix}
23920 @opindex mdebug-main=@var{prefix}
23921 Flag the first routine whose name starts with @var{prefix} as the main
23922 routine for the debugger.
23923
23924 @item -mmalloc64
23925 @opindex mmalloc64
23926 Default to 64-bit memory allocation routines.
23927
23928 @item -mpointer-size=@var{size}
23929 @opindex mpointer-size=@var{size}
23930 Set the default size of pointers. Possible options for @var{size} are
23931 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
23932 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
23933 The later option disables @code{pragma pointer_size}.
23934 @end table
23935
23936 @node VxWorks Options
23937 @subsection VxWorks Options
23938 @cindex VxWorks Options
23939
23940 The options in this section are defined for all VxWorks targets.
23941 Options specific to the target hardware are listed with the other
23942 options for that target.
23943
23944 @table @gcctabopt
23945 @item -mrtp
23946 @opindex mrtp
23947 GCC can generate code for both VxWorks kernels and real time processes
23948 (RTPs). This option switches from the former to the latter. It also
23949 defines the preprocessor macro @code{__RTP__}.
23950
23951 @item -non-static
23952 @opindex non-static
23953 Link an RTP executable against shared libraries rather than static
23954 libraries. The options @option{-static} and @option{-shared} can
23955 also be used for RTPs (@pxref{Link Options}); @option{-static}
23956 is the default.
23957
23958 @item -Bstatic
23959 @itemx -Bdynamic
23960 @opindex Bstatic
23961 @opindex Bdynamic
23962 These options are passed down to the linker. They are defined for
23963 compatibility with Diab.
23964
23965 @item -Xbind-lazy
23966 @opindex Xbind-lazy
23967 Enable lazy binding of function calls. This option is equivalent to
23968 @option{-Wl,-z,now} and is defined for compatibility with Diab.
23969
23970 @item -Xbind-now
23971 @opindex Xbind-now
23972 Disable lazy binding of function calls. This option is the default and
23973 is defined for compatibility with Diab.
23974 @end table
23975
23976 @node x86 Options
23977 @subsection x86 Options
23978 @cindex x86 Options
23979
23980 These @samp{-m} options are defined for the x86 family of computers.
23981
23982 @table @gcctabopt
23983
23984 @item -march=@var{cpu-type}
23985 @opindex march
23986 Generate instructions for the machine type @var{cpu-type}. In contrast to
23987 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
23988 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
23989 to generate code that may not run at all on processors other than the one
23990 indicated. Specifying @option{-march=@var{cpu-type}} implies
23991 @option{-mtune=@var{cpu-type}}.
23992
23993 The choices for @var{cpu-type} are:
23994
23995 @table @samp
23996 @item native
23997 This selects the CPU to generate code for at compilation time by determining
23998 the processor type of the compiling machine. Using @option{-march=native}
23999 enables all instruction subsets supported by the local machine (hence
24000 the result might not run on different machines). Using @option{-mtune=native}
24001 produces code optimized for the local machine under the constraints
24002 of the selected instruction set.
24003
24004 @item i386
24005 Original Intel i386 CPU@.
24006
24007 @item i486
24008 Intel i486 CPU@. (No scheduling is implemented for this chip.)
24009
24010 @item i586
24011 @itemx pentium
24012 Intel Pentium CPU with no MMX support.
24013
24014 @item lakemont
24015 Intel Lakemont MCU, based on Intel Pentium CPU.
24016
24017 @item pentium-mmx
24018 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
24019
24020 @item pentiumpro
24021 Intel Pentium Pro CPU@.
24022
24023 @item i686
24024 When used with @option{-march}, the Pentium Pro
24025 instruction set is used, so the code runs on all i686 family chips.
24026 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
24027
24028 @item pentium2
24029 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
24030 support.
24031
24032 @item pentium3
24033 @itemx pentium3m
24034 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
24035 set support.
24036
24037 @item pentium-m
24038 Intel Pentium M; low-power version of Intel Pentium III CPU
24039 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
24040
24041 @item pentium4
24042 @itemx pentium4m
24043 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
24044
24045 @item prescott
24046 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
24047 set support.
24048
24049 @item nocona
24050 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
24051 SSE2 and SSE3 instruction set support.
24052
24053 @item core2
24054 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
24055 instruction set support.
24056
24057 @item nehalem
24058 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24059 SSE4.1, SSE4.2 and POPCNT instruction set support.
24060
24061 @item westmere
24062 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24063 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
24064
24065 @item sandybridge
24066 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24067 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
24068
24069 @item ivybridge
24070 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24071 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
24072 instruction set support.
24073
24074 @item haswell
24075 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24076 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24077 BMI, BMI2 and F16C instruction set support.
24078
24079 @item broadwell
24080 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24081 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24082 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
24083
24084 @item skylake
24085 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24086 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24087 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
24088 XSAVES instruction set support.
24089
24090 @item bonnell
24091 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
24092 instruction set support.
24093
24094 @item silvermont
24095 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24096 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
24097
24098 @item knl
24099 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
24100 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24101 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
24102 AVX512CD instruction set support.
24103
24104 @item skylake-avx512
24105 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
24106 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24107 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
24108 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
24109
24110 @item k6
24111 AMD K6 CPU with MMX instruction set support.
24112
24113 @item k6-2
24114 @itemx k6-3
24115 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
24116
24117 @item athlon
24118 @itemx athlon-tbird
24119 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
24120 support.
24121
24122 @item athlon-4
24123 @itemx athlon-xp
24124 @itemx athlon-mp
24125 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
24126 instruction set support.
24127
24128 @item k8
24129 @itemx opteron
24130 @itemx athlon64
24131 @itemx athlon-fx
24132 Processors based on the AMD K8 core with x86-64 instruction set support,
24133 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
24134 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
24135 instruction set extensions.)
24136
24137 @item k8-sse3
24138 @itemx opteron-sse3
24139 @itemx athlon64-sse3
24140 Improved versions of AMD K8 cores with SSE3 instruction set support.
24141
24142 @item amdfam10
24143 @itemx barcelona
24144 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
24145 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
24146 instruction set extensions.)
24147
24148 @item bdver1
24149 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
24150 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
24151 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
24152 @item bdver2
24153 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
24154 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
24155 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
24156 extensions.)
24157 @item bdver3
24158 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
24159 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
24160 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
24161 64-bit instruction set extensions.
24162 @item bdver4
24163 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
24164 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
24165 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
24166 SSE4.2, ABM and 64-bit instruction set extensions.
24167
24168 @item znver1
24169 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
24170 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
24171 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
24172 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
24173 instruction set extensions.
24174
24175 @item btver1
24176 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
24177 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
24178 instruction set extensions.)
24179
24180 @item btver2
24181 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
24182 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
24183 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
24184
24185 @item winchip-c6
24186 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
24187 set support.
24188
24189 @item winchip2
24190 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
24191 instruction set support.
24192
24193 @item c3
24194 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
24195 (No scheduling is implemented for this chip.)
24196
24197 @item c3-2
24198 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
24199 (No scheduling is implemented for this chip.)
24200
24201 @item c7
24202 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
24203 (No scheduling is implemented for this chip.)
24204
24205 @item samuel-2
24206 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
24207 (No scheduling is implemented for this chip.)
24208
24209 @item nehemiah
24210 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
24211 (No scheduling is implemented for this chip.)
24212
24213 @item esther
24214 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
24215 (No scheduling is implemented for this chip.)
24216
24217 @item eden-x2
24218 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
24219 (No scheduling is implemented for this chip.)
24220
24221 @item eden-x4
24222 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
24223 AVX and AVX2 instruction set support.
24224 (No scheduling is implemented for this chip.)
24225
24226 @item nano
24227 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24228 instruction set support.
24229 (No scheduling is implemented for this chip.)
24230
24231 @item nano-1000
24232 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24233 instruction set support.
24234 (No scheduling is implemented for this chip.)
24235
24236 @item nano-2000
24237 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24238 instruction set support.
24239 (No scheduling is implemented for this chip.)
24240
24241 @item nano-3000
24242 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
24243 instruction set support.
24244 (No scheduling is implemented for this chip.)
24245
24246 @item nano-x2
24247 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
24248 instruction set support.
24249 (No scheduling is implemented for this chip.)
24250
24251 @item nano-x4
24252 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
24253 instruction set support.
24254 (No scheduling is implemented for this chip.)
24255
24256 @item geode
24257 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
24258 @end table
24259
24260 @item -mtune=@var{cpu-type}
24261 @opindex mtune
24262 Tune to @var{cpu-type} everything applicable about the generated code, except
24263 for the ABI and the set of available instructions.
24264 While picking a specific @var{cpu-type} schedules things appropriately
24265 for that particular chip, the compiler does not generate any code that
24266 cannot run on the default machine type unless you use a
24267 @option{-march=@var{cpu-type}} option.
24268 For example, if GCC is configured for i686-pc-linux-gnu
24269 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
24270 but still runs on i686 machines.
24271
24272 The choices for @var{cpu-type} are the same as for @option{-march}.
24273 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
24274
24275 @table @samp
24276 @item generic
24277 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
24278 If you know the CPU on which your code will run, then you should use
24279 the corresponding @option{-mtune} or @option{-march} option instead of
24280 @option{-mtune=generic}. But, if you do not know exactly what CPU users
24281 of your application will have, then you should use this option.
24282
24283 As new processors are deployed in the marketplace, the behavior of this
24284 option will change. Therefore, if you upgrade to a newer version of
24285 GCC, code generation controlled by this option will change to reflect
24286 the processors
24287 that are most common at the time that version of GCC is released.
24288
24289 There is no @option{-march=generic} option because @option{-march}
24290 indicates the instruction set the compiler can use, and there is no
24291 generic instruction set applicable to all processors. In contrast,
24292 @option{-mtune} indicates the processor (or, in this case, collection of
24293 processors) for which the code is optimized.
24294
24295 @item intel
24296 Produce code optimized for the most current Intel processors, which are
24297 Haswell and Silvermont for this version of GCC. If you know the CPU
24298 on which your code will run, then you should use the corresponding
24299 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
24300 But, if you want your application performs better on both Haswell and
24301 Silvermont, then you should use this option.
24302
24303 As new Intel processors are deployed in the marketplace, the behavior of
24304 this option will change. Therefore, if you upgrade to a newer version of
24305 GCC, code generation controlled by this option will change to reflect
24306 the most current Intel processors at the time that version of GCC is
24307 released.
24308
24309 There is no @option{-march=intel} option because @option{-march} indicates
24310 the instruction set the compiler can use, and there is no common
24311 instruction set applicable to all processors. In contrast,
24312 @option{-mtune} indicates the processor (or, in this case, collection of
24313 processors) for which the code is optimized.
24314 @end table
24315
24316 @item -mcpu=@var{cpu-type}
24317 @opindex mcpu
24318 A deprecated synonym for @option{-mtune}.
24319
24320 @item -mfpmath=@var{unit}
24321 @opindex mfpmath
24322 Generate floating-point arithmetic for selected unit @var{unit}. The choices
24323 for @var{unit} are:
24324
24325 @table @samp
24326 @item 387
24327 Use the standard 387 floating-point coprocessor present on the majority of chips and
24328 emulated otherwise. Code compiled with this option runs almost everywhere.
24329 The temporary results are computed in 80-bit precision instead of the precision
24330 specified by the type, resulting in slightly different results compared to most
24331 of other chips. See @option{-ffloat-store} for more detailed description.
24332
24333 This is the default choice for x86-32 targets.
24334
24335 @item sse
24336 Use scalar floating-point instructions present in the SSE instruction set.
24337 This instruction set is supported by Pentium III and newer chips,
24338 and in the AMD line
24339 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
24340 instruction set supports only single-precision arithmetic, thus the double and
24341 extended-precision arithmetic are still done using 387. A later version, present
24342 only in Pentium 4 and AMD x86-64 chips, supports double-precision
24343 arithmetic too.
24344
24345 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
24346 or @option{-msse2} switches to enable SSE extensions and make this option
24347 effective. For the x86-64 compiler, these extensions are enabled by default.
24348
24349 The resulting code should be considerably faster in the majority of cases and avoid
24350 the numerical instability problems of 387 code, but may break some existing
24351 code that expects temporaries to be 80 bits.
24352
24353 This is the default choice for the x86-64 compiler.
24354
24355 @item sse,387
24356 @itemx sse+387
24357 @itemx both
24358 Attempt to utilize both instruction sets at once. This effectively doubles the
24359 amount of available registers, and on chips with separate execution units for
24360 387 and SSE the execution resources too. Use this option with care, as it is
24361 still experimental, because the GCC register allocator does not model separate
24362 functional units well, resulting in unstable performance.
24363 @end table
24364
24365 @item -masm=@var{dialect}
24366 @opindex masm=@var{dialect}
24367 Output assembly instructions using selected @var{dialect}. Also affects
24368 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
24369 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
24370 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
24371 not support @samp{intel}.
24372
24373 @item -mieee-fp
24374 @itemx -mno-ieee-fp
24375 @opindex mieee-fp
24376 @opindex mno-ieee-fp
24377 Control whether or not the compiler uses IEEE floating-point
24378 comparisons. These correctly handle the case where the result of a
24379 comparison is unordered.
24380
24381 @item -m80387
24382 @item -mhard-float
24383 @opindex 80387
24384 @opindex mhard-float
24385 Generate output containing 80387 instructions for floating point.
24386
24387 @item -mno-80387
24388 @item -msoft-float
24389 @opindex no-80387
24390 @opindex msoft-float
24391 Generate output containing library calls for floating point.
24392
24393 @strong{Warning:} the requisite libraries are not part of GCC@.
24394 Normally the facilities of the machine's usual C compiler are used, but
24395 this can't be done directly in cross-compilation. You must make your
24396 own arrangements to provide suitable library functions for
24397 cross-compilation.
24398
24399 On machines where a function returns floating-point results in the 80387
24400 register stack, some floating-point opcodes may be emitted even if
24401 @option{-msoft-float} is used.
24402
24403 @item -mno-fp-ret-in-387
24404 @opindex mno-fp-ret-in-387
24405 Do not use the FPU registers for return values of functions.
24406
24407 The usual calling convention has functions return values of types
24408 @code{float} and @code{double} in an FPU register, even if there
24409 is no FPU@. The idea is that the operating system should emulate
24410 an FPU@.
24411
24412 The option @option{-mno-fp-ret-in-387} causes such values to be returned
24413 in ordinary CPU registers instead.
24414
24415 @item -mno-fancy-math-387
24416 @opindex mno-fancy-math-387
24417 Some 387 emulators do not support the @code{sin}, @code{cos} and
24418 @code{sqrt} instructions for the 387. Specify this option to avoid
24419 generating those instructions. This option is the default on
24420 OpenBSD and NetBSD@. This option is overridden when @option{-march}
24421 indicates that the target CPU always has an FPU and so the
24422 instruction does not need emulation. These
24423 instructions are not generated unless you also use the
24424 @option{-funsafe-math-optimizations} switch.
24425
24426 @item -malign-double
24427 @itemx -mno-align-double
24428 @opindex malign-double
24429 @opindex mno-align-double
24430 Control whether GCC aligns @code{double}, @code{long double}, and
24431 @code{long long} variables on a two-word boundary or a one-word
24432 boundary. Aligning @code{double} variables on a two-word boundary
24433 produces code that runs somewhat faster on a Pentium at the
24434 expense of more memory.
24435
24436 On x86-64, @option{-malign-double} is enabled by default.
24437
24438 @strong{Warning:} if you use the @option{-malign-double} switch,
24439 structures containing the above types are aligned differently than
24440 the published application binary interface specifications for the x86-32
24441 and are not binary compatible with structures in code compiled
24442 without that switch.
24443
24444 @item -m96bit-long-double
24445 @itemx -m128bit-long-double
24446 @opindex m96bit-long-double
24447 @opindex m128bit-long-double
24448 These switches control the size of @code{long double} type. The x86-32
24449 application binary interface specifies the size to be 96 bits,
24450 so @option{-m96bit-long-double} is the default in 32-bit mode.
24451
24452 Modern architectures (Pentium and newer) prefer @code{long double}
24453 to be aligned to an 8- or 16-byte boundary. In arrays or structures
24454 conforming to the ABI, this is not possible. So specifying
24455 @option{-m128bit-long-double} aligns @code{long double}
24456 to a 16-byte boundary by padding the @code{long double} with an additional
24457 32-bit zero.
24458
24459 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
24460 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
24461
24462 Notice that neither of these options enable any extra precision over the x87
24463 standard of 80 bits for a @code{long double}.
24464
24465 @strong{Warning:} if you override the default value for your target ABI, this
24466 changes the size of
24467 structures and arrays containing @code{long double} variables,
24468 as well as modifying the function calling convention for functions taking
24469 @code{long double}. Hence they are not binary-compatible
24470 with code compiled without that switch.
24471
24472 @item -mlong-double-64
24473 @itemx -mlong-double-80
24474 @itemx -mlong-double-128
24475 @opindex mlong-double-64
24476 @opindex mlong-double-80
24477 @opindex mlong-double-128
24478 These switches control the size of @code{long double} type. A size
24479 of 64 bits makes the @code{long double} type equivalent to the @code{double}
24480 type. This is the default for 32-bit Bionic C library. A size
24481 of 128 bits makes the @code{long double} type equivalent to the
24482 @code{__float128} type. This is the default for 64-bit Bionic C library.
24483
24484 @strong{Warning:} if you override the default value for your target ABI, this
24485 changes the size of
24486 structures and arrays containing @code{long double} variables,
24487 as well as modifying the function calling convention for functions taking
24488 @code{long double}. Hence they are not binary-compatible
24489 with code compiled without that switch.
24490
24491 @item -malign-data=@var{type}
24492 @opindex malign-data
24493 Control how GCC aligns variables. Supported values for @var{type} are
24494 @samp{compat} uses increased alignment value compatible uses GCC 4.8
24495 and earlier, @samp{abi} uses alignment value as specified by the
24496 psABI, and @samp{cacheline} uses increased alignment value to match
24497 the cache line size. @samp{compat} is the default.
24498
24499 @item -mlarge-data-threshold=@var{threshold}
24500 @opindex mlarge-data-threshold
24501 When @option{-mcmodel=medium} is specified, data objects larger than
24502 @var{threshold} are placed in the large data section. This value must be the
24503 same across all objects linked into the binary, and defaults to 65535.
24504
24505 @item -mrtd
24506 @opindex mrtd
24507 Use a different function-calling convention, in which functions that
24508 take a fixed number of arguments return with the @code{ret @var{num}}
24509 instruction, which pops their arguments while returning. This saves one
24510 instruction in the caller since there is no need to pop the arguments
24511 there.
24512
24513 You can specify that an individual function is called with this calling
24514 sequence with the function attribute @code{stdcall}. You can also
24515 override the @option{-mrtd} option by using the function attribute
24516 @code{cdecl}. @xref{Function Attributes}.
24517
24518 @strong{Warning:} this calling convention is incompatible with the one
24519 normally used on Unix, so you cannot use it if you need to call
24520 libraries compiled with the Unix compiler.
24521
24522 Also, you must provide function prototypes for all functions that
24523 take variable numbers of arguments (including @code{printf});
24524 otherwise incorrect code is generated for calls to those
24525 functions.
24526
24527 In addition, seriously incorrect code results if you call a
24528 function with too many arguments. (Normally, extra arguments are
24529 harmlessly ignored.)
24530
24531 @item -mregparm=@var{num}
24532 @opindex mregparm
24533 Control how many registers are used to pass integer arguments. By
24534 default, no registers are used to pass arguments, and at most 3
24535 registers can be used. You can control this behavior for a specific
24536 function by using the function attribute @code{regparm}.
24537 @xref{Function Attributes}.
24538
24539 @strong{Warning:} if you use this switch, and
24540 @var{num} is nonzero, then you must build all modules with the same
24541 value, including any libraries. This includes the system libraries and
24542 startup modules.
24543
24544 @item -msseregparm
24545 @opindex msseregparm
24546 Use SSE register passing conventions for float and double arguments
24547 and return values. You can control this behavior for a specific
24548 function by using the function attribute @code{sseregparm}.
24549 @xref{Function Attributes}.
24550
24551 @strong{Warning:} if you use this switch then you must build all
24552 modules with the same value, including any libraries. This includes
24553 the system libraries and startup modules.
24554
24555 @item -mvect8-ret-in-mem
24556 @opindex mvect8-ret-in-mem
24557 Return 8-byte vectors in memory instead of MMX registers. This is the
24558 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
24559 Studio compilers until version 12. Later compiler versions (starting
24560 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
24561 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
24562 you need to remain compatible with existing code produced by those
24563 previous compiler versions or older versions of GCC@.
24564
24565 @item -mpc32
24566 @itemx -mpc64
24567 @itemx -mpc80
24568 @opindex mpc32
24569 @opindex mpc64
24570 @opindex mpc80
24571
24572 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
24573 is specified, the significands of results of floating-point operations are
24574 rounded to 24 bits (single precision); @option{-mpc64} rounds the
24575 significands of results of floating-point operations to 53 bits (double
24576 precision) and @option{-mpc80} rounds the significands of results of
24577 floating-point operations to 64 bits (extended double precision), which is
24578 the default. When this option is used, floating-point operations in higher
24579 precisions are not available to the programmer without setting the FPU
24580 control word explicitly.
24581
24582 Setting the rounding of floating-point operations to less than the default
24583 80 bits can speed some programs by 2% or more. Note that some mathematical
24584 libraries assume that extended-precision (80-bit) floating-point operations
24585 are enabled by default; routines in such libraries could suffer significant
24586 loss of accuracy, typically through so-called ``catastrophic cancellation'',
24587 when this option is used to set the precision to less than extended precision.
24588
24589 @item -mstackrealign
24590 @opindex mstackrealign
24591 Realign the stack at entry. On the x86, the @option{-mstackrealign}
24592 option generates an alternate prologue and epilogue that realigns the
24593 run-time stack if necessary. This supports mixing legacy codes that keep
24594 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
24595 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
24596 applicable to individual functions.
24597
24598 @item -mpreferred-stack-boundary=@var{num}
24599 @opindex mpreferred-stack-boundary
24600 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24601 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24602 the default is 4 (16 bytes or 128 bits).
24603
24604 @strong{Warning:} When generating code for the x86-64 architecture with
24605 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
24606 used to keep the stack boundary aligned to 8 byte boundary. Since
24607 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
24608 intended to be used in controlled environment where stack space is
24609 important limitation. This option leads to wrong code when functions
24610 compiled with 16 byte stack alignment (such as functions from a standard
24611 library) are called with misaligned stack. In this case, SSE
24612 instructions may lead to misaligned memory access traps. In addition,
24613 variable arguments are handled incorrectly for 16 byte aligned
24614 objects (including x87 long double and __int128), leading to wrong
24615 results. You must build all modules with
24616 @option{-mpreferred-stack-boundary=3}, including any libraries. This
24617 includes the system libraries and startup modules.
24618
24619 @item -mincoming-stack-boundary=@var{num}
24620 @opindex mincoming-stack-boundary
24621 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
24622 boundary. If @option{-mincoming-stack-boundary} is not specified,
24623 the one specified by @option{-mpreferred-stack-boundary} is used.
24624
24625 On Pentium and Pentium Pro, @code{double} and @code{long double} values
24626 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
24627 suffer significant run time performance penalties. On Pentium III, the
24628 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
24629 properly if it is not 16-byte aligned.
24630
24631 To ensure proper alignment of this values on the stack, the stack boundary
24632 must be as aligned as that required by any value stored on the stack.
24633 Further, every function must be generated such that it keeps the stack
24634 aligned. Thus calling a function compiled with a higher preferred
24635 stack boundary from a function compiled with a lower preferred stack
24636 boundary most likely misaligns the stack. It is recommended that
24637 libraries that use callbacks always use the default setting.
24638
24639 This extra alignment does consume extra stack space, and generally
24640 increases code size. Code that is sensitive to stack space usage, such
24641 as embedded systems and operating system kernels, may want to reduce the
24642 preferred alignment to @option{-mpreferred-stack-boundary=2}.
24643
24644 @need 200
24645 @item -mmmx
24646 @opindex mmmx
24647 @need 200
24648 @itemx -msse
24649 @opindex msse
24650 @need 200
24651 @itemx -msse2
24652 @opindex msse2
24653 @need 200
24654 @itemx -msse3
24655 @opindex msse3
24656 @need 200
24657 @itemx -mssse3
24658 @opindex mssse3
24659 @need 200
24660 @itemx -msse4
24661 @opindex msse4
24662 @need 200
24663 @itemx -msse4a
24664 @opindex msse4a
24665 @need 200
24666 @itemx -msse4.1
24667 @opindex msse4.1
24668 @need 200
24669 @itemx -msse4.2
24670 @opindex msse4.2
24671 @need 200
24672 @itemx -mavx
24673 @opindex mavx
24674 @need 200
24675 @itemx -mavx2
24676 @opindex mavx2
24677 @need 200
24678 @itemx -mavx512f
24679 @opindex mavx512f
24680 @need 200
24681 @itemx -mavx512pf
24682 @opindex mavx512pf
24683 @need 200
24684 @itemx -mavx512er
24685 @opindex mavx512er
24686 @need 200
24687 @itemx -mavx512cd
24688 @opindex mavx512cd
24689 @need 200
24690 @itemx -mavx512vl
24691 @opindex mavx512vl
24692 @need 200
24693 @itemx -mavx512bw
24694 @opindex mavx512bw
24695 @need 200
24696 @itemx -mavx512dq
24697 @opindex mavx512dq
24698 @need 200
24699 @itemx -mavx512ifma
24700 @opindex mavx512ifma
24701 @need 200
24702 @itemx -mavx512vbmi
24703 @opindex mavx512vbmi
24704 @need 200
24705 @itemx -msha
24706 @opindex msha
24707 @need 200
24708 @itemx -maes
24709 @opindex maes
24710 @need 200
24711 @itemx -mpclmul
24712 @opindex mpclmul
24713 @need 200
24714 @itemx -mclfushopt
24715 @opindex mclfushopt
24716 @need 200
24717 @itemx -mfsgsbase
24718 @opindex mfsgsbase
24719 @need 200
24720 @itemx -mrdrnd
24721 @opindex mrdrnd
24722 @need 200
24723 @itemx -mf16c
24724 @opindex mf16c
24725 @need 200
24726 @itemx -mfma
24727 @opindex mfma
24728 @need 200
24729 @itemx -mfma4
24730 @opindex mfma4
24731 @need 200
24732 @itemx -mprefetchwt1
24733 @opindex mprefetchwt1
24734 @need 200
24735 @itemx -mxop
24736 @opindex mxop
24737 @need 200
24738 @itemx -mlwp
24739 @opindex mlwp
24740 @need 200
24741 @itemx -m3dnow
24742 @opindex m3dnow
24743 @need 200
24744 @itemx -mpopcnt
24745 @opindex mpopcnt
24746 @need 200
24747 @itemx -mabm
24748 @opindex mabm
24749 @need 200
24750 @itemx -mbmi
24751 @opindex mbmi
24752 @need 200
24753 @itemx -mbmi2
24754 @need 200
24755 @itemx -mlzcnt
24756 @opindex mlzcnt
24757 @need 200
24758 @itemx -mfxsr
24759 @opindex mfxsr
24760 @need 200
24761 @itemx -mxsave
24762 @opindex mxsave
24763 @need 200
24764 @itemx -mxsaveopt
24765 @opindex mxsaveopt
24766 @need 200
24767 @itemx -mxsavec
24768 @opindex mxsavec
24769 @need 200
24770 @itemx -mxsaves
24771 @opindex mxsaves
24772 @need 200
24773 @itemx -mrtm
24774 @opindex mrtm
24775 @need 200
24776 @itemx -mtbm
24777 @opindex mtbm
24778 @need 200
24779 @itemx -mmpx
24780 @opindex mmpx
24781 @need 200
24782 @itemx -mmwaitx
24783 @opindex mmwaitx
24784 @need 200
24785 @itemx -mclzero
24786 @opindex mclzero
24787 @itemx -mpku
24788 @opindex mpku
24789 These switches enable the use of instructions in the MMX, SSE,
24790 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
24791 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
24792 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
24793 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU or 3DNow!@:
24794 extended instruction sets. Each has a corresponding @option{-mno-} option
24795 to disable use of these instructions.
24796
24797 These extensions are also available as built-in functions: see
24798 @ref{x86 Built-in Functions}, for details of the functions enabled and
24799 disabled by these switches.
24800
24801 To generate SSE/SSE2 instructions automatically from floating-point
24802 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
24803
24804 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
24805 generates new AVX instructions or AVX equivalence for all SSEx instructions
24806 when needed.
24807
24808 These options enable GCC to use these extended instructions in
24809 generated code, even without @option{-mfpmath=sse}. Applications that
24810 perform run-time CPU detection must compile separate files for each
24811 supported architecture, using the appropriate flags. In particular,
24812 the file containing the CPU detection code should be compiled without
24813 these options.
24814
24815 @item -mdump-tune-features
24816 @opindex mdump-tune-features
24817 This option instructs GCC to dump the names of the x86 performance
24818 tuning features and default settings. The names can be used in
24819 @option{-mtune-ctrl=@var{feature-list}}.
24820
24821 @item -mtune-ctrl=@var{feature-list}
24822 @opindex mtune-ctrl=@var{feature-list}
24823 This option is used to do fine grain control of x86 code generation features.
24824 @var{feature-list} is a comma separated list of @var{feature} names. See also
24825 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
24826 on if it is not preceded with @samp{^}, otherwise, it is turned off.
24827 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
24828 developers. Using it may lead to code paths not covered by testing and can
24829 potentially result in compiler ICEs or runtime errors.
24830
24831 @item -mno-default
24832 @opindex mno-default
24833 This option instructs GCC to turn off all tunable features. See also
24834 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
24835
24836 @item -mcld
24837 @opindex mcld
24838 This option instructs GCC to emit a @code{cld} instruction in the prologue
24839 of functions that use string instructions. String instructions depend on
24840 the DF flag to select between autoincrement or autodecrement mode. While the
24841 ABI specifies the DF flag to be cleared on function entry, some operating
24842 systems violate this specification by not clearing the DF flag in their
24843 exception dispatchers. The exception handler can be invoked with the DF flag
24844 set, which leads to wrong direction mode when string instructions are used.
24845 This option can be enabled by default on 32-bit x86 targets by configuring
24846 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
24847 instructions can be suppressed with the @option{-mno-cld} compiler option
24848 in this case.
24849
24850 @item -mvzeroupper
24851 @opindex mvzeroupper
24852 This option instructs GCC to emit a @code{vzeroupper} instruction
24853 before a transfer of control flow out of the function to minimize
24854 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
24855 intrinsics.
24856
24857 @item -mprefer-avx128
24858 @opindex mprefer-avx128
24859 This option instructs GCC to use 128-bit AVX instructions instead of
24860 256-bit AVX instructions in the auto-vectorizer.
24861
24862 @item -mcx16
24863 @opindex mcx16
24864 This option enables GCC to generate @code{CMPXCHG16B} instructions.
24865 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
24866 (or oword) data types.
24867 This is useful for high-resolution counters that can be updated
24868 by multiple processors (or cores). This instruction is generated as part of
24869 atomic built-in functions: see @ref{__sync Builtins} or
24870 @ref{__atomic Builtins} for details.
24871
24872 @item -msahf
24873 @opindex msahf
24874 This option enables generation of @code{SAHF} instructions in 64-bit code.
24875 Early Intel Pentium 4 CPUs with Intel 64 support,
24876 prior to the introduction of Pentium 4 G1 step in December 2005,
24877 lacked the @code{LAHF} and @code{SAHF} instructions
24878 which are supported by AMD64.
24879 These are load and store instructions, respectively, for certain status flags.
24880 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
24881 @code{drem}, and @code{remainder} built-in functions;
24882 see @ref{Other Builtins} for details.
24883
24884 @item -mmovbe
24885 @opindex mmovbe
24886 This option enables use of the @code{movbe} instruction to implement
24887 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
24888
24889 @item -mcrc32
24890 @opindex mcrc32
24891 This option enables built-in functions @code{__builtin_ia32_crc32qi},
24892 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
24893 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
24894
24895 @item -mrecip
24896 @opindex mrecip
24897 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
24898 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
24899 with an additional Newton-Raphson step
24900 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
24901 (and their vectorized
24902 variants) for single-precision floating-point arguments. These instructions
24903 are generated only when @option{-funsafe-math-optimizations} is enabled
24904 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
24905 Note that while the throughput of the sequence is higher than the throughput
24906 of the non-reciprocal instruction, the precision of the sequence can be
24907 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
24908
24909 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
24910 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
24911 combination), and doesn't need @option{-mrecip}.
24912
24913 Also note that GCC emits the above sequence with additional Newton-Raphson step
24914 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
24915 already with @option{-ffast-math} (or the above option combination), and
24916 doesn't need @option{-mrecip}.
24917
24918 @item -mrecip=@var{opt}
24919 @opindex mrecip=opt
24920 This option controls which reciprocal estimate instructions
24921 may be used. @var{opt} is a comma-separated list of options, which may
24922 be preceded by a @samp{!} to invert the option:
24923
24924 @table @samp
24925 @item all
24926 Enable all estimate instructions.
24927
24928 @item default
24929 Enable the default instructions, equivalent to @option{-mrecip}.
24930
24931 @item none
24932 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24933
24934 @item div
24935 Enable the approximation for scalar division.
24936
24937 @item vec-div
24938 Enable the approximation for vectorized division.
24939
24940 @item sqrt
24941 Enable the approximation for scalar square root.
24942
24943 @item vec-sqrt
24944 Enable the approximation for vectorized square root.
24945 @end table
24946
24947 So, for example, @option{-mrecip=all,!sqrt} enables
24948 all of the reciprocal approximations, except for square root.
24949
24950 @item -mveclibabi=@var{type}
24951 @opindex mveclibabi
24952 Specifies the ABI type to use for vectorizing intrinsics using an
24953 external library. Supported values for @var{type} are @samp{svml}
24954 for the Intel short
24955 vector math library and @samp{acml} for the AMD math core library.
24956 To use this option, both @option{-ftree-vectorize} and
24957 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
24958 ABI-compatible library must be specified at link time.
24959
24960 GCC currently emits calls to @code{vmldExp2},
24961 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
24962 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
24963 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
24964 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
24965 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
24966 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
24967 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
24968 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
24969 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
24970 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
24971 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
24972 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
24973 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
24974 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
24975 when @option{-mveclibabi=acml} is used.
24976
24977 @item -mabi=@var{name}
24978 @opindex mabi
24979 Generate code for the specified calling convention. Permissible values
24980 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
24981 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
24982 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
24983 You can control this behavior for specific functions by
24984 using the function attributes @code{ms_abi} and @code{sysv_abi}.
24985 @xref{Function Attributes}.
24986
24987 @item -mtls-dialect=@var{type}
24988 @opindex mtls-dialect
24989 Generate code to access thread-local storage using the @samp{gnu} or
24990 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
24991 @samp{gnu2} is more efficient, but it may add compile- and run-time
24992 requirements that cannot be satisfied on all systems.
24993
24994 @item -mpush-args
24995 @itemx -mno-push-args
24996 @opindex mpush-args
24997 @opindex mno-push-args
24998 Use PUSH operations to store outgoing parameters. This method is shorter
24999 and usually equally fast as method using SUB/MOV operations and is enabled
25000 by default. In some cases disabling it may improve performance because of
25001 improved scheduling and reduced dependencies.
25002
25003 @item -maccumulate-outgoing-args
25004 @opindex maccumulate-outgoing-args
25005 If enabled, the maximum amount of space required for outgoing arguments is
25006 computed in the function prologue. This is faster on most modern CPUs
25007 because of reduced dependencies, improved scheduling and reduced stack usage
25008 when the preferred stack boundary is not equal to 2. The drawback is a notable
25009 increase in code size. This switch implies @option{-mno-push-args}.
25010
25011 @item -mthreads
25012 @opindex mthreads
25013 Support thread-safe exception handling on MinGW. Programs that rely
25014 on thread-safe exception handling must compile and link all code with the
25015 @option{-mthreads} option. When compiling, @option{-mthreads} defines
25016 @option{-D_MT}; when linking, it links in a special thread helper library
25017 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
25018
25019 @item -mms-bitfields
25020 @itemx -mno-ms-bitfields
25021 @opindex mms-bitfields
25022 @opindex mno-ms-bitfields
25023
25024 Enable/disable bit-field layout compatible with the native Microsoft
25025 Windows compiler.
25026
25027 If @code{packed} is used on a structure, or if bit-fields are used,
25028 it may be that the Microsoft ABI lays out the structure differently
25029 than the way GCC normally does. Particularly when moving packed
25030 data between functions compiled with GCC and the native Microsoft compiler
25031 (either via function call or as data in a file), it may be necessary to access
25032 either format.
25033
25034 This option is enabled by default for Microsoft Windows
25035 targets. This behavior can also be controlled locally by use of variable
25036 or type attributes. For more information, see @ref{x86 Variable Attributes}
25037 and @ref{x86 Type Attributes}.
25038
25039 The Microsoft structure layout algorithm is fairly simple with the exception
25040 of the bit-field packing.
25041 The padding and alignment of members of structures and whether a bit-field
25042 can straddle a storage-unit boundary are determine by these rules:
25043
25044 @enumerate
25045 @item Structure members are stored sequentially in the order in which they are
25046 declared: the first member has the lowest memory address and the last member
25047 the highest.
25048
25049 @item Every data object has an alignment requirement. The alignment requirement
25050 for all data except structures, unions, and arrays is either the size of the
25051 object or the current packing size (specified with either the
25052 @code{aligned} attribute or the @code{pack} pragma),
25053 whichever is less. For structures, unions, and arrays,
25054 the alignment requirement is the largest alignment requirement of its members.
25055 Every object is allocated an offset so that:
25056
25057 @smallexample
25058 offset % alignment_requirement == 0
25059 @end smallexample
25060
25061 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
25062 unit if the integral types are the same size and if the next bit-field fits
25063 into the current allocation unit without crossing the boundary imposed by the
25064 common alignment requirements of the bit-fields.
25065 @end enumerate
25066
25067 MSVC interprets zero-length bit-fields in the following ways:
25068
25069 @enumerate
25070 @item If a zero-length bit-field is inserted between two bit-fields that
25071 are normally coalesced, the bit-fields are not coalesced.
25072
25073 For example:
25074
25075 @smallexample
25076 struct
25077 @{
25078 unsigned long bf_1 : 12;
25079 unsigned long : 0;
25080 unsigned long bf_2 : 12;
25081 @} t1;
25082 @end smallexample
25083
25084 @noindent
25085 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
25086 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
25087
25088 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
25089 alignment of the zero-length bit-field is greater than the member that follows it,
25090 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
25091
25092 For example:
25093
25094 @smallexample
25095 struct
25096 @{
25097 char foo : 4;
25098 short : 0;
25099 char bar;
25100 @} t2;
25101
25102 struct
25103 @{
25104 char foo : 4;
25105 short : 0;
25106 double bar;
25107 @} t3;
25108 @end smallexample
25109
25110 @noindent
25111 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
25112 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
25113 bit-field does not affect the alignment of @code{bar} or, as a result, the size
25114 of the structure.
25115
25116 Taking this into account, it is important to note the following:
25117
25118 @enumerate
25119 @item If a zero-length bit-field follows a normal bit-field, the type of the
25120 zero-length bit-field may affect the alignment of the structure as whole. For
25121 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
25122 normal bit-field, and is of type short.
25123
25124 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
25125 still affect the alignment of the structure:
25126
25127 @smallexample
25128 struct
25129 @{
25130 char foo : 6;
25131 long : 0;
25132 @} t4;
25133 @end smallexample
25134
25135 @noindent
25136 Here, @code{t4} takes up 4 bytes.
25137 @end enumerate
25138
25139 @item Zero-length bit-fields following non-bit-field members are ignored:
25140
25141 @smallexample
25142 struct
25143 @{
25144 char foo;
25145 long : 0;
25146 char bar;
25147 @} t5;
25148 @end smallexample
25149
25150 @noindent
25151 Here, @code{t5} takes up 2 bytes.
25152 @end enumerate
25153
25154
25155 @item -mno-align-stringops
25156 @opindex mno-align-stringops
25157 Do not align the destination of inlined string operations. This switch reduces
25158 code size and improves performance in case the destination is already aligned,
25159 but GCC doesn't know about it.
25160
25161 @item -minline-all-stringops
25162 @opindex minline-all-stringops
25163 By default GCC inlines string operations only when the destination is
25164 known to be aligned to least a 4-byte boundary.
25165 This enables more inlining and increases code
25166 size, but may improve performance of code that depends on fast
25167 @code{memcpy}, @code{strlen},
25168 and @code{memset} for short lengths.
25169
25170 @item -minline-stringops-dynamically
25171 @opindex minline-stringops-dynamically
25172 For string operations of unknown size, use run-time checks with
25173 inline code for small blocks and a library call for large blocks.
25174
25175 @item -mstringop-strategy=@var{alg}
25176 @opindex mstringop-strategy=@var{alg}
25177 Override the internal decision heuristic for the particular algorithm to use
25178 for inlining string operations. The allowed values for @var{alg} are:
25179
25180 @table @samp
25181 @item rep_byte
25182 @itemx rep_4byte
25183 @itemx rep_8byte
25184 Expand using i386 @code{rep} prefix of the specified size.
25185
25186 @item byte_loop
25187 @itemx loop
25188 @itemx unrolled_loop
25189 Expand into an inline loop.
25190
25191 @item libcall
25192 Always use a library call.
25193 @end table
25194
25195 @item -mmemcpy-strategy=@var{strategy}
25196 @opindex mmemcpy-strategy=@var{strategy}
25197 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
25198 should be inlined and what inline algorithm to use when the expected size
25199 of the copy operation is known. @var{strategy}
25200 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
25201 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
25202 the max byte size with which inline algorithm @var{alg} is allowed. For the last
25203 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
25204 in the list must be specified in increasing order. The minimal byte size for
25205 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
25206 preceding range.
25207
25208 @item -mmemset-strategy=@var{strategy}
25209 @opindex mmemset-strategy=@var{strategy}
25210 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
25211 @code{__builtin_memset} expansion.
25212
25213 @item -momit-leaf-frame-pointer
25214 @opindex momit-leaf-frame-pointer
25215 Don't keep the frame pointer in a register for leaf functions. This
25216 avoids the instructions to save, set up, and restore frame pointers and
25217 makes an extra register available in leaf functions. The option
25218 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
25219 which might make debugging harder.
25220
25221 @item -mtls-direct-seg-refs
25222 @itemx -mno-tls-direct-seg-refs
25223 @opindex mtls-direct-seg-refs
25224 Controls whether TLS variables may be accessed with offsets from the
25225 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
25226 or whether the thread base pointer must be added. Whether or not this
25227 is valid depends on the operating system, and whether it maps the
25228 segment to cover the entire TLS area.
25229
25230 For systems that use the GNU C Library, the default is on.
25231
25232 @item -msse2avx
25233 @itemx -mno-sse2avx
25234 @opindex msse2avx
25235 Specify that the assembler should encode SSE instructions with VEX
25236 prefix. The option @option{-mavx} turns this on by default.
25237
25238 @item -mfentry
25239 @itemx -mno-fentry
25240 @opindex mfentry
25241 If profiling is active (@option{-pg}), put the profiling
25242 counter call before the prologue.
25243 Note: On x86 architectures the attribute @code{ms_hook_prologue}
25244 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
25245
25246 @item -mrecord-mcount
25247 @itemx -mno-record-mcount
25248 @opindex mrecord-mcount
25249 If profiling is active (@option{-pg}), generate a __mcount_loc section
25250 that contains pointers to each profiling call. This is useful for
25251 automatically patching and out calls.
25252
25253 @item -mnop-mcount
25254 @itemx -mno-nop-mcount
25255 @opindex mnop-mcount
25256 If profiling is active (@option{-pg}), generate the calls to
25257 the profiling functions as NOPs. This is useful when they
25258 should be patched in later dynamically. This is likely only
25259 useful together with @option{-mrecord-mcount}.
25260
25261 @item -mskip-rax-setup
25262 @itemx -mno-skip-rax-setup
25263 @opindex mskip-rax-setup
25264 When generating code for the x86-64 architecture with SSE extensions
25265 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
25266 register when there are no variable arguments passed in vector registers.
25267
25268 @strong{Warning:} Since RAX register is used to avoid unnecessarily
25269 saving vector registers on stack when passing variable arguments, the
25270 impacts of this option are callees may waste some stack space,
25271 misbehave or jump to a random location. GCC 4.4 or newer don't have
25272 those issues, regardless the RAX register value.
25273
25274 @item -m8bit-idiv
25275 @itemx -mno-8bit-idiv
25276 @opindex m8bit-idiv
25277 On some processors, like Intel Atom, 8-bit unsigned integer divide is
25278 much faster than 32-bit/64-bit integer divide. This option generates a
25279 run-time check. If both dividend and divisor are within range of 0
25280 to 255, 8-bit unsigned integer divide is used instead of
25281 32-bit/64-bit integer divide.
25282
25283 @item -mavx256-split-unaligned-load
25284 @itemx -mavx256-split-unaligned-store
25285 @opindex mavx256-split-unaligned-load
25286 @opindex mavx256-split-unaligned-store
25287 Split 32-byte AVX unaligned load and store.
25288
25289 @item -mstack-protector-guard=@var{guard}
25290 @opindex mstack-protector-guard=@var{guard}
25291 Generate stack protection code using canary at @var{guard}. Supported
25292 locations are @samp{global} for global canary or @samp{tls} for per-thread
25293 canary in the TLS block (the default). This option has effect only when
25294 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
25295
25296 @item -mmitigate-rop
25297 @opindex mmitigate-rop
25298 Try to avoid generating code sequences that contain unintended return
25299 opcodes, to mitigate against certain forms of attack. At the moment,
25300 this option is limited in what it can do and should not be relied
25301 on to provide serious protection.
25302
25303 @item -mgeneral-regs-only
25304 @opindex mgeneral-regs-only
25305 Generate code that uses only the general-purpose registers. This
25306 prevents the compiler from using floating-point, vector, mask and bound
25307 registers.
25308
25309 @end table
25310
25311 These @samp{-m} switches are supported in addition to the above
25312 on x86-64 processors in 64-bit environments.
25313
25314 @table @gcctabopt
25315 @item -m32
25316 @itemx -m64
25317 @itemx -mx32
25318 @itemx -m16
25319 @itemx -miamcu
25320 @opindex m32
25321 @opindex m64
25322 @opindex mx32
25323 @opindex m16
25324 @opindex miamcu
25325 Generate code for a 16-bit, 32-bit or 64-bit environment.
25326 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
25327 to 32 bits, and
25328 generates code that runs on any i386 system.
25329
25330 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
25331 types to 64 bits, and generates code for the x86-64 architecture.
25332 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
25333 and @option{-mdynamic-no-pic} options.
25334
25335 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
25336 to 32 bits, and
25337 generates code for the x86-64 architecture.
25338
25339 The @option{-m16} option is the same as @option{-m32}, except for that
25340 it outputs the @code{.code16gcc} assembly directive at the beginning of
25341 the assembly output so that the binary can run in 16-bit mode.
25342
25343 The @option{-miamcu} option generates code which conforms to Intel MCU
25344 psABI. It requires the @option{-m32} option to be turned on.
25345
25346 @item -mno-red-zone
25347 @opindex mno-red-zone
25348 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
25349 by the x86-64 ABI; it is a 128-byte area beyond the location of the
25350 stack pointer that is not modified by signal or interrupt handlers
25351 and therefore can be used for temporary data without adjusting the stack
25352 pointer. The flag @option{-mno-red-zone} disables this red zone.
25353
25354 @item -mcmodel=small
25355 @opindex mcmodel=small
25356 Generate code for the small code model: the program and its symbols must
25357 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
25358 Programs can be statically or dynamically linked. This is the default
25359 code model.
25360
25361 @item -mcmodel=kernel
25362 @opindex mcmodel=kernel
25363 Generate code for the kernel code model. The kernel runs in the
25364 negative 2 GB of the address space.
25365 This model has to be used for Linux kernel code.
25366
25367 @item -mcmodel=medium
25368 @opindex mcmodel=medium
25369 Generate code for the medium model: the program is linked in the lower 2
25370 GB of the address space. Small symbols are also placed there. Symbols
25371 with sizes larger than @option{-mlarge-data-threshold} are put into
25372 large data or BSS sections and can be located above 2GB. Programs can
25373 be statically or dynamically linked.
25374
25375 @item -mcmodel=large
25376 @opindex mcmodel=large
25377 Generate code for the large model. This model makes no assumptions
25378 about addresses and sizes of sections.
25379
25380 @item -maddress-mode=long
25381 @opindex maddress-mode=long
25382 Generate code for long address mode. This is only supported for 64-bit
25383 and x32 environments. It is the default address mode for 64-bit
25384 environments.
25385
25386 @item -maddress-mode=short
25387 @opindex maddress-mode=short
25388 Generate code for short address mode. This is only supported for 32-bit
25389 and x32 environments. It is the default address mode for 32-bit and
25390 x32 environments.
25391 @end table
25392
25393 @node x86 Windows Options
25394 @subsection x86 Windows Options
25395 @cindex x86 Windows Options
25396 @cindex Windows Options for x86
25397
25398 These additional options are available for Microsoft Windows targets:
25399
25400 @table @gcctabopt
25401 @item -mconsole
25402 @opindex mconsole
25403 This option
25404 specifies that a console application is to be generated, by
25405 instructing the linker to set the PE header subsystem type
25406 required for console applications.
25407 This option is available for Cygwin and MinGW targets and is
25408 enabled by default on those targets.
25409
25410 @item -mdll
25411 @opindex mdll
25412 This option is available for Cygwin and MinGW targets. It
25413 specifies that a DLL---a dynamic link library---is to be
25414 generated, enabling the selection of the required runtime
25415 startup object and entry point.
25416
25417 @item -mnop-fun-dllimport
25418 @opindex mnop-fun-dllimport
25419 This option is available for Cygwin and MinGW targets. It
25420 specifies that the @code{dllimport} attribute should be ignored.
25421
25422 @item -mthread
25423 @opindex mthread
25424 This option is available for MinGW targets. It specifies
25425 that MinGW-specific thread support is to be used.
25426
25427 @item -municode
25428 @opindex municode
25429 This option is available for MinGW-w64 targets. It causes
25430 the @code{UNICODE} preprocessor macro to be predefined, and
25431 chooses Unicode-capable runtime startup code.
25432
25433 @item -mwin32
25434 @opindex mwin32
25435 This option is available for Cygwin and MinGW targets. It
25436 specifies that the typical Microsoft Windows predefined macros are to
25437 be set in the pre-processor, but does not influence the choice
25438 of runtime library/startup code.
25439
25440 @item -mwindows
25441 @opindex mwindows
25442 This option is available for Cygwin and MinGW targets. It
25443 specifies that a GUI application is to be generated by
25444 instructing the linker to set the PE header subsystem type
25445 appropriately.
25446
25447 @item -fno-set-stack-executable
25448 @opindex fno-set-stack-executable
25449 This option is available for MinGW targets. It specifies that
25450 the executable flag for the stack used by nested functions isn't
25451 set. This is necessary for binaries running in kernel mode of
25452 Microsoft Windows, as there the User32 API, which is used to set executable
25453 privileges, isn't available.
25454
25455 @item -fwritable-relocated-rdata
25456 @opindex fno-writable-relocated-rdata
25457 This option is available for MinGW and Cygwin targets. It specifies
25458 that relocated-data in read-only section is put into the @code{.data}
25459 section. This is a necessary for older runtimes not supporting
25460 modification of @code{.rdata} sections for pseudo-relocation.
25461
25462 @item -mpe-aligned-commons
25463 @opindex mpe-aligned-commons
25464 This option is available for Cygwin and MinGW targets. It
25465 specifies that the GNU extension to the PE file format that
25466 permits the correct alignment of COMMON variables should be
25467 used when generating code. It is enabled by default if
25468 GCC detects that the target assembler found during configuration
25469 supports the feature.
25470 @end table
25471
25472 See also under @ref{x86 Options} for standard options.
25473
25474 @node Xstormy16 Options
25475 @subsection Xstormy16 Options
25476 @cindex Xstormy16 Options
25477
25478 These options are defined for Xstormy16:
25479
25480 @table @gcctabopt
25481 @item -msim
25482 @opindex msim
25483 Choose startup files and linker script suitable for the simulator.
25484 @end table
25485
25486 @node Xtensa Options
25487 @subsection Xtensa Options
25488 @cindex Xtensa Options
25489
25490 These options are supported for Xtensa targets:
25491
25492 @table @gcctabopt
25493 @item -mconst16
25494 @itemx -mno-const16
25495 @opindex mconst16
25496 @opindex mno-const16
25497 Enable or disable use of @code{CONST16} instructions for loading
25498 constant values. The @code{CONST16} instruction is currently not a
25499 standard option from Tensilica. When enabled, @code{CONST16}
25500 instructions are always used in place of the standard @code{L32R}
25501 instructions. The use of @code{CONST16} is enabled by default only if
25502 the @code{L32R} instruction is not available.
25503
25504 @item -mfused-madd
25505 @itemx -mno-fused-madd
25506 @opindex mfused-madd
25507 @opindex mno-fused-madd
25508 Enable or disable use of fused multiply/add and multiply/subtract
25509 instructions in the floating-point option. This has no effect if the
25510 floating-point option is not also enabled. Disabling fused multiply/add
25511 and multiply/subtract instructions forces the compiler to use separate
25512 instructions for the multiply and add/subtract operations. This may be
25513 desirable in some cases where strict IEEE 754-compliant results are
25514 required: the fused multiply add/subtract instructions do not round the
25515 intermediate result, thereby producing results with @emph{more} bits of
25516 precision than specified by the IEEE standard. Disabling fused multiply
25517 add/subtract instructions also ensures that the program output is not
25518 sensitive to the compiler's ability to combine multiply and add/subtract
25519 operations.
25520
25521 @item -mserialize-volatile
25522 @itemx -mno-serialize-volatile
25523 @opindex mserialize-volatile
25524 @opindex mno-serialize-volatile
25525 When this option is enabled, GCC inserts @code{MEMW} instructions before
25526 @code{volatile} memory references to guarantee sequential consistency.
25527 The default is @option{-mserialize-volatile}. Use
25528 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
25529
25530 @item -mforce-no-pic
25531 @opindex mforce-no-pic
25532 For targets, like GNU/Linux, where all user-mode Xtensa code must be
25533 position-independent code (PIC), this option disables PIC for compiling
25534 kernel code.
25535
25536 @item -mtext-section-literals
25537 @itemx -mno-text-section-literals
25538 @opindex mtext-section-literals
25539 @opindex mno-text-section-literals
25540 These options control the treatment of literal pools. The default is
25541 @option{-mno-text-section-literals}, which places literals in a separate
25542 section in the output file. This allows the literal pool to be placed
25543 in a data RAM/ROM, and it also allows the linker to combine literal
25544 pools from separate object files to remove redundant literals and
25545 improve code size. With @option{-mtext-section-literals}, the literals
25546 are interspersed in the text section in order to keep them as close as
25547 possible to their references. This may be necessary for large assembly
25548 files. Literals for each function are placed right before that function.
25549
25550 @item -mauto-litpools
25551 @itemx -mno-auto-litpools
25552 @opindex mauto-litpools
25553 @opindex mno-auto-litpools
25554 These options control the treatment of literal pools. The default is
25555 @option{-mno-auto-litpools}, which places literals in a separate
25556 section in the output file unless @option{-mtext-section-literals} is
25557 used. With @option{-mauto-litpools} the literals are interspersed in
25558 the text section by the assembler. Compiler does not produce explicit
25559 @code{.literal} directives and loads literals into registers with
25560 @code{MOVI} instructions instead of @code{L32R} to let the assembler
25561 do relaxation and place literals as necessary. This option allows
25562 assembler to create several literal pools per function and assemble
25563 very big functions, which may not be possible with
25564 @option{-mtext-section-literals}.
25565
25566 @item -mtarget-align
25567 @itemx -mno-target-align
25568 @opindex mtarget-align
25569 @opindex mno-target-align
25570 When this option is enabled, GCC instructs the assembler to
25571 automatically align instructions to reduce branch penalties at the
25572 expense of some code density. The assembler attempts to widen density
25573 instructions to align branch targets and the instructions following call
25574 instructions. If there are not enough preceding safe density
25575 instructions to align a target, no widening is performed. The
25576 default is @option{-mtarget-align}. These options do not affect the
25577 treatment of auto-aligned instructions like @code{LOOP}, which the
25578 assembler always aligns, either by widening density instructions or
25579 by inserting NOP instructions.
25580
25581 @item -mlongcalls
25582 @itemx -mno-longcalls
25583 @opindex mlongcalls
25584 @opindex mno-longcalls
25585 When this option is enabled, GCC instructs the assembler to translate
25586 direct calls to indirect calls unless it can determine that the target
25587 of a direct call is in the range allowed by the call instruction. This
25588 translation typically occurs for calls to functions in other source
25589 files. Specifically, the assembler translates a direct @code{CALL}
25590 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
25591 The default is @option{-mno-longcalls}. This option should be used in
25592 programs where the call target can potentially be out of range. This
25593 option is implemented in the assembler, not the compiler, so the
25594 assembly code generated by GCC still shows direct call
25595 instructions---look at the disassembled object code to see the actual
25596 instructions. Note that the assembler uses an indirect call for
25597 every cross-file call, not just those that really are out of range.
25598 @end table
25599
25600 @node zSeries Options
25601 @subsection zSeries Options
25602 @cindex zSeries options
25603
25604 These are listed under @xref{S/390 and zSeries Options}.
25605
25606
25607 @c man end
25608
25609 @node Spec Files
25610 @section Specifying Subprocesses and the Switches to Pass to Them
25611 @cindex Spec Files
25612
25613 @command{gcc} is a driver program. It performs its job by invoking a
25614 sequence of other programs to do the work of compiling, assembling and
25615 linking. GCC interprets its command-line parameters and uses these to
25616 deduce which programs it should invoke, and which command-line options
25617 it ought to place on their command lines. This behavior is controlled
25618 by @dfn{spec strings}. In most cases there is one spec string for each
25619 program that GCC can invoke, but a few programs have multiple spec
25620 strings to control their behavior. The spec strings built into GCC can
25621 be overridden by using the @option{-specs=} command-line switch to specify
25622 a spec file.
25623
25624 @dfn{Spec files} are plain-text files that are used to construct spec
25625 strings. They consist of a sequence of directives separated by blank
25626 lines. The type of directive is determined by the first non-whitespace
25627 character on the line, which can be one of the following:
25628
25629 @table @code
25630 @item %@var{command}
25631 Issues a @var{command} to the spec file processor. The commands that can
25632 appear here are:
25633
25634 @table @code
25635 @item %include <@var{file}>
25636 @cindex @code{%include}
25637 Search for @var{file} and insert its text at the current point in the
25638 specs file.
25639
25640 @item %include_noerr <@var{file}>
25641 @cindex @code{%include_noerr}
25642 Just like @samp{%include}, but do not generate an error message if the include
25643 file cannot be found.
25644
25645 @item %rename @var{old_name} @var{new_name}
25646 @cindex @code{%rename}
25647 Rename the spec string @var{old_name} to @var{new_name}.
25648
25649 @end table
25650
25651 @item *[@var{spec_name}]:
25652 This tells the compiler to create, override or delete the named spec
25653 string. All lines after this directive up to the next directive or
25654 blank line are considered to be the text for the spec string. If this
25655 results in an empty string then the spec is deleted. (Or, if the
25656 spec did not exist, then nothing happens.) Otherwise, if the spec
25657 does not currently exist a new spec is created. If the spec does
25658 exist then its contents are overridden by the text of this
25659 directive, unless the first character of that text is the @samp{+}
25660 character, in which case the text is appended to the spec.
25661
25662 @item [@var{suffix}]:
25663 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
25664 and up to the next directive or blank line are considered to make up the
25665 spec string for the indicated suffix. When the compiler encounters an
25666 input file with the named suffix, it processes the spec string in
25667 order to work out how to compile that file. For example:
25668
25669 @smallexample
25670 .ZZ:
25671 z-compile -input %i
25672 @end smallexample
25673
25674 This says that any input file whose name ends in @samp{.ZZ} should be
25675 passed to the program @samp{z-compile}, which should be invoked with the
25676 command-line switch @option{-input} and with the result of performing the
25677 @samp{%i} substitution. (See below.)
25678
25679 As an alternative to providing a spec string, the text following a
25680 suffix directive can be one of the following:
25681
25682 @table @code
25683 @item @@@var{language}
25684 This says that the suffix is an alias for a known @var{language}. This is
25685 similar to using the @option{-x} command-line switch to GCC to specify a
25686 language explicitly. For example:
25687
25688 @smallexample
25689 .ZZ:
25690 @@c++
25691 @end smallexample
25692
25693 Says that .ZZ files are, in fact, C++ source files.
25694
25695 @item #@var{name}
25696 This causes an error messages saying:
25697
25698 @smallexample
25699 @var{name} compiler not installed on this system.
25700 @end smallexample
25701 @end table
25702
25703 GCC already has an extensive list of suffixes built into it.
25704 This directive adds an entry to the end of the list of suffixes, but
25705 since the list is searched from the end backwards, it is effectively
25706 possible to override earlier entries using this technique.
25707
25708 @end table
25709
25710 GCC has the following spec strings built into it. Spec files can
25711 override these strings or create their own. Note that individual
25712 targets can also add their own spec strings to this list.
25713
25714 @smallexample
25715 asm Options to pass to the assembler
25716 asm_final Options to pass to the assembler post-processor
25717 cpp Options to pass to the C preprocessor
25718 cc1 Options to pass to the C compiler
25719 cc1plus Options to pass to the C++ compiler
25720 endfile Object files to include at the end of the link
25721 link Options to pass to the linker
25722 lib Libraries to include on the command line to the linker
25723 libgcc Decides which GCC support library to pass to the linker
25724 linker Sets the name of the linker
25725 predefines Defines to be passed to the C preprocessor
25726 signed_char Defines to pass to CPP to say whether @code{char} is signed
25727 by default
25728 startfile Object files to include at the start of the link
25729 @end smallexample
25730
25731 Here is a small example of a spec file:
25732
25733 @smallexample
25734 %rename lib old_lib
25735
25736 *lib:
25737 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
25738 @end smallexample
25739
25740 This example renames the spec called @samp{lib} to @samp{old_lib} and
25741 then overrides the previous definition of @samp{lib} with a new one.
25742 The new definition adds in some extra command-line options before
25743 including the text of the old definition.
25744
25745 @dfn{Spec strings} are a list of command-line options to be passed to their
25746 corresponding program. In addition, the spec strings can contain
25747 @samp{%}-prefixed sequences to substitute variable text or to
25748 conditionally insert text into the command line. Using these constructs
25749 it is possible to generate quite complex command lines.
25750
25751 Here is a table of all defined @samp{%}-sequences for spec
25752 strings. Note that spaces are not generated automatically around the
25753 results of expanding these sequences. Therefore you can concatenate them
25754 together or combine them with constant text in a single argument.
25755
25756 @table @code
25757 @item %%
25758 Substitute one @samp{%} into the program name or argument.
25759
25760 @item %i
25761 Substitute the name of the input file being processed.
25762
25763 @item %b
25764 Substitute the basename of the input file being processed.
25765 This is the substring up to (and not including) the last period
25766 and not including the directory.
25767
25768 @item %B
25769 This is the same as @samp{%b}, but include the file suffix (text after
25770 the last period).
25771
25772 @item %d
25773 Marks the argument containing or following the @samp{%d} as a
25774 temporary file name, so that that file is deleted if GCC exits
25775 successfully. Unlike @samp{%g}, this contributes no text to the
25776 argument.
25777
25778 @item %g@var{suffix}
25779 Substitute a file name that has suffix @var{suffix} and is chosen
25780 once per compilation, and mark the argument in the same way as
25781 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
25782 name is now chosen in a way that is hard to predict even when previously
25783 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
25784 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
25785 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
25786 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
25787 was simply substituted with a file name chosen once per compilation,
25788 without regard to any appended suffix (which was therefore treated
25789 just like ordinary text), making such attacks more likely to succeed.
25790
25791 @item %u@var{suffix}
25792 Like @samp{%g}, but generates a new temporary file name
25793 each time it appears instead of once per compilation.
25794
25795 @item %U@var{suffix}
25796 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
25797 new one if there is no such last file name. In the absence of any
25798 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
25799 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
25800 involves the generation of two distinct file names, one
25801 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
25802 simply substituted with a file name chosen for the previous @samp{%u},
25803 without regard to any appended suffix.
25804
25805 @item %j@var{suffix}
25806 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
25807 writable, and if @option{-save-temps} is not used;
25808 otherwise, substitute the name
25809 of a temporary file, just like @samp{%u}. This temporary file is not
25810 meant for communication between processes, but rather as a junk
25811 disposal mechanism.
25812
25813 @item %|@var{suffix}
25814 @itemx %m@var{suffix}
25815 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
25816 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
25817 all. These are the two most common ways to instruct a program that it
25818 should read from standard input or write to standard output. If you
25819 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
25820 construct: see for example @file{f/lang-specs.h}.
25821
25822 @item %.@var{SUFFIX}
25823 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
25824 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
25825 terminated by the next space or %.
25826
25827 @item %w
25828 Marks the argument containing or following the @samp{%w} as the
25829 designated output file of this compilation. This puts the argument
25830 into the sequence of arguments that @samp{%o} substitutes.
25831
25832 @item %o
25833 Substitutes the names of all the output files, with spaces
25834 automatically placed around them. You should write spaces
25835 around the @samp{%o} as well or the results are undefined.
25836 @samp{%o} is for use in the specs for running the linker.
25837 Input files whose names have no recognized suffix are not compiled
25838 at all, but they are included among the output files, so they are
25839 linked.
25840
25841 @item %O
25842 Substitutes the suffix for object files. Note that this is
25843 handled specially when it immediately follows @samp{%g, %u, or %U},
25844 because of the need for those to form complete file names. The
25845 handling is such that @samp{%O} is treated exactly as if it had already
25846 been substituted, except that @samp{%g, %u, and %U} do not currently
25847 support additional @var{suffix} characters following @samp{%O} as they do
25848 following, for example, @samp{.o}.
25849
25850 @item %p
25851 Substitutes the standard macro predefinitions for the
25852 current target machine. Use this when running @command{cpp}.
25853
25854 @item %P
25855 Like @samp{%p}, but puts @samp{__} before and after the name of each
25856 predefined macro, except for macros that start with @samp{__} or with
25857 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
25858 C@.
25859
25860 @item %I
25861 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
25862 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
25863 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
25864 and @option{-imultilib} as necessary.
25865
25866 @item %s
25867 Current argument is the name of a library or startup file of some sort.
25868 Search for that file in a standard list of directories and substitute
25869 the full name found. The current working directory is included in the
25870 list of directories scanned.
25871
25872 @item %T
25873 Current argument is the name of a linker script. Search for that file
25874 in the current list of directories to scan for libraries. If the file
25875 is located insert a @option{--script} option into the command line
25876 followed by the full path name found. If the file is not found then
25877 generate an error message. Note: the current working directory is not
25878 searched.
25879
25880 @item %e@var{str}
25881 Print @var{str} as an error message. @var{str} is terminated by a newline.
25882 Use this when inconsistent options are detected.
25883
25884 @item %(@var{name})
25885 Substitute the contents of spec string @var{name} at this point.
25886
25887 @item %x@{@var{option}@}
25888 Accumulate an option for @samp{%X}.
25889
25890 @item %X
25891 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
25892 spec string.
25893
25894 @item %Y
25895 Output the accumulated assembler options specified by @option{-Wa}.
25896
25897 @item %Z
25898 Output the accumulated preprocessor options specified by @option{-Wp}.
25899
25900 @item %a
25901 Process the @code{asm} spec. This is used to compute the
25902 switches to be passed to the assembler.
25903
25904 @item %A
25905 Process the @code{asm_final} spec. This is a spec string for
25906 passing switches to an assembler post-processor, if such a program is
25907 needed.
25908
25909 @item %l
25910 Process the @code{link} spec. This is the spec for computing the
25911 command line passed to the linker. Typically it makes use of the
25912 @samp{%L %G %S %D and %E} sequences.
25913
25914 @item %D
25915 Dump out a @option{-L} option for each directory that GCC believes might
25916 contain startup files. If the target supports multilibs then the
25917 current multilib directory is prepended to each of these paths.
25918
25919 @item %L
25920 Process the @code{lib} spec. This is a spec string for deciding which
25921 libraries are included on the command line to the linker.
25922
25923 @item %G
25924 Process the @code{libgcc} spec. This is a spec string for deciding
25925 which GCC support library is included on the command line to the linker.
25926
25927 @item %S
25928 Process the @code{startfile} spec. This is a spec for deciding which
25929 object files are the first ones passed to the linker. Typically
25930 this might be a file named @file{crt0.o}.
25931
25932 @item %E
25933 Process the @code{endfile} spec. This is a spec string that specifies
25934 the last object files that are passed to the linker.
25935
25936 @item %C
25937 Process the @code{cpp} spec. This is used to construct the arguments
25938 to be passed to the C preprocessor.
25939
25940 @item %1
25941 Process the @code{cc1} spec. This is used to construct the options to be
25942 passed to the actual C compiler (@command{cc1}).
25943
25944 @item %2
25945 Process the @code{cc1plus} spec. This is used to construct the options to be
25946 passed to the actual C++ compiler (@command{cc1plus}).
25947
25948 @item %*
25949 Substitute the variable part of a matched option. See below.
25950 Note that each comma in the substituted string is replaced by
25951 a single space.
25952
25953 @item %<@code{S}
25954 Remove all occurrences of @code{-S} from the command line. Note---this
25955 command is position dependent. @samp{%} commands in the spec string
25956 before this one see @code{-S}, @samp{%} commands in the spec string
25957 after this one do not.
25958
25959 @item %:@var{function}(@var{args})
25960 Call the named function @var{function}, passing it @var{args}.
25961 @var{args} is first processed as a nested spec string, then split
25962 into an argument vector in the usual fashion. The function returns
25963 a string which is processed as if it had appeared literally as part
25964 of the current spec.
25965
25966 The following built-in spec functions are provided:
25967
25968 @table @code
25969 @item @code{getenv}
25970 The @code{getenv} spec function takes two arguments: an environment
25971 variable name and a string. If the environment variable is not
25972 defined, a fatal error is issued. Otherwise, the return value is the
25973 value of the environment variable concatenated with the string. For
25974 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
25975
25976 @smallexample
25977 %:getenv(TOPDIR /include)
25978 @end smallexample
25979
25980 expands to @file{/path/to/top/include}.
25981
25982 @item @code{if-exists}
25983 The @code{if-exists} spec function takes one argument, an absolute
25984 pathname to a file. If the file exists, @code{if-exists} returns the
25985 pathname. Here is a small example of its usage:
25986
25987 @smallexample
25988 *startfile:
25989 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
25990 @end smallexample
25991
25992 @item @code{if-exists-else}
25993 The @code{if-exists-else} spec function is similar to the @code{if-exists}
25994 spec function, except that it takes two arguments. The first argument is
25995 an absolute pathname to a file. If the file exists, @code{if-exists-else}
25996 returns the pathname. If it does not exist, it returns the second argument.
25997 This way, @code{if-exists-else} can be used to select one file or another,
25998 based on the existence of the first. Here is a small example of its usage:
25999
26000 @smallexample
26001 *startfile:
26002 crt0%O%s %:if-exists(crti%O%s) \
26003 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
26004 @end smallexample
26005
26006 @item @code{replace-outfile}
26007 The @code{replace-outfile} spec function takes two arguments. It looks for the
26008 first argument in the outfiles array and replaces it with the second argument. Here
26009 is a small example of its usage:
26010
26011 @smallexample
26012 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
26013 @end smallexample
26014
26015 @item @code{remove-outfile}
26016 The @code{remove-outfile} spec function takes one argument. It looks for the
26017 first argument in the outfiles array and removes it. Here is a small example
26018 its usage:
26019
26020 @smallexample
26021 %:remove-outfile(-lm)
26022 @end smallexample
26023
26024 @item @code{pass-through-libs}
26025 The @code{pass-through-libs} spec function takes any number of arguments. It
26026 finds any @option{-l} options and any non-options ending in @file{.a} (which it
26027 assumes are the names of linker input library archive files) and returns a
26028 result containing all the found arguments each prepended by
26029 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
26030 intended to be passed to the LTO linker plugin.
26031
26032 @smallexample
26033 %:pass-through-libs(%G %L %G)
26034 @end smallexample
26035
26036 @item @code{print-asm-header}
26037 The @code{print-asm-header} function takes no arguments and simply
26038 prints a banner like:
26039
26040 @smallexample
26041 Assembler options
26042 =================
26043
26044 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
26045 @end smallexample
26046
26047 It is used to separate compiler options from assembler options
26048 in the @option{--target-help} output.
26049 @end table
26050
26051 @item %@{@code{S}@}
26052 Substitutes the @code{-S} switch, if that switch is given to GCC@.
26053 If that switch is not specified, this substitutes nothing. Note that
26054 the leading dash is omitted when specifying this option, and it is
26055 automatically inserted if the substitution is performed. Thus the spec
26056 string @samp{%@{foo@}} matches the command-line option @option{-foo}
26057 and outputs the command-line option @option{-foo}.
26058
26059 @item %W@{@code{S}@}
26060 Like %@{@code{S}@} but mark last argument supplied within as a file to be
26061 deleted on failure.
26062
26063 @item %@{@code{S}*@}
26064 Substitutes all the switches specified to GCC whose names start
26065 with @code{-S}, but which also take an argument. This is used for
26066 switches like @option{-o}, @option{-D}, @option{-I}, etc.
26067 GCC considers @option{-o foo} as being
26068 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
26069 text, including the space. Thus two arguments are generated.
26070
26071 @item %@{@code{S}*&@code{T}*@}
26072 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
26073 (the order of @code{S} and @code{T} in the spec is not significant).
26074 There can be any number of ampersand-separated variables; for each the
26075 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
26076
26077 @item %@{@code{S}:@code{X}@}
26078 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
26079
26080 @item %@{!@code{S}:@code{X}@}
26081 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
26082
26083 @item %@{@code{S}*:@code{X}@}
26084 Substitutes @code{X} if one or more switches whose names start with
26085 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
26086 once, no matter how many such switches appeared. However, if @code{%*}
26087 appears somewhere in @code{X}, then @code{X} is substituted once
26088 for each matching switch, with the @code{%*} replaced by the part of
26089 that switch matching the @code{*}.
26090
26091 If @code{%*} appears as the last part of a spec sequence then a space
26092 is added after the end of the last substitution. If there is more
26093 text in the sequence, however, then a space is not generated. This
26094 allows the @code{%*} substitution to be used as part of a larger
26095 string. For example, a spec string like this:
26096
26097 @smallexample
26098 %@{mcu=*:--script=%*/memory.ld@}
26099 @end smallexample
26100
26101 @noindent
26102 when matching an option like @option{-mcu=newchip} produces:
26103
26104 @smallexample
26105 --script=newchip/memory.ld
26106 @end smallexample
26107
26108 @item %@{.@code{S}:@code{X}@}
26109 Substitutes @code{X}, if processing a file with suffix @code{S}.
26110
26111 @item %@{!.@code{S}:@code{X}@}
26112 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
26113
26114 @item %@{,@code{S}:@code{X}@}
26115 Substitutes @code{X}, if processing a file for language @code{S}.
26116
26117 @item %@{!,@code{S}:@code{X}@}
26118 Substitutes @code{X}, if not processing a file for language @code{S}.
26119
26120 @item %@{@code{S}|@code{P}:@code{X}@}
26121 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
26122 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
26123 @code{*} sequences as well, although they have a stronger binding than
26124 the @samp{|}. If @code{%*} appears in @code{X}, all of the
26125 alternatives must be starred, and only the first matching alternative
26126 is substituted.
26127
26128 For example, a spec string like this:
26129
26130 @smallexample
26131 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
26132 @end smallexample
26133
26134 @noindent
26135 outputs the following command-line options from the following input
26136 command-line options:
26137
26138 @smallexample
26139 fred.c -foo -baz
26140 jim.d -bar -boggle
26141 -d fred.c -foo -baz -boggle
26142 -d jim.d -bar -baz -boggle
26143 @end smallexample
26144
26145 @item %@{S:X; T:Y; :D@}
26146
26147 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
26148 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
26149 be as many clauses as you need. This may be combined with @code{.},
26150 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
26151
26152
26153 @end table
26154
26155 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
26156 construct may contain other nested @samp{%} constructs or spaces, or
26157 even newlines. They are processed as usual, as described above.
26158 Trailing white space in @code{X} is ignored. White space may also
26159 appear anywhere on the left side of the colon in these constructs,
26160 except between @code{.} or @code{*} and the corresponding word.
26161
26162 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
26163 handled specifically in these constructs. If another value of
26164 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
26165 @option{-W} switch is found later in the command line, the earlier
26166 switch value is ignored, except with @{@code{S}*@} where @code{S} is
26167 just one letter, which passes all matching options.
26168
26169 The character @samp{|} at the beginning of the predicate text is used to
26170 indicate that a command should be piped to the following command, but
26171 only if @option{-pipe} is specified.
26172
26173 It is built into GCC which switches take arguments and which do not.
26174 (You might think it would be useful to generalize this to allow each
26175 compiler's spec to say which switches take arguments. But this cannot
26176 be done in a consistent fashion. GCC cannot even decide which input
26177 files have been specified without knowing which switches take arguments,
26178 and it must know which input files to compile in order to tell which
26179 compilers to run).
26180
26181 GCC also knows implicitly that arguments starting in @option{-l} are to be
26182 treated as compiler output files, and passed to the linker in their
26183 proper position among the other output files.
26184
26185 @node Environment Variables
26186 @section Environment Variables Affecting GCC
26187 @cindex environment variables
26188
26189 @c man begin ENVIRONMENT
26190 This section describes several environment variables that affect how GCC
26191 operates. Some of them work by specifying directories or prefixes to use
26192 when searching for various kinds of files. Some are used to specify other
26193 aspects of the compilation environment.
26194
26195 Note that you can also specify places to search using options such as
26196 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
26197 take precedence over places specified using environment variables, which
26198 in turn take precedence over those specified by the configuration of GCC@.
26199 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
26200 GNU Compiler Collection (GCC) Internals}.
26201
26202 @table @env
26203 @item LANG
26204 @itemx LC_CTYPE
26205 @c @itemx LC_COLLATE
26206 @itemx LC_MESSAGES
26207 @c @itemx LC_MONETARY
26208 @c @itemx LC_NUMERIC
26209 @c @itemx LC_TIME
26210 @itemx LC_ALL
26211 @findex LANG
26212 @findex LC_CTYPE
26213 @c @findex LC_COLLATE
26214 @findex LC_MESSAGES
26215 @c @findex LC_MONETARY
26216 @c @findex LC_NUMERIC
26217 @c @findex LC_TIME
26218 @findex LC_ALL
26219 @cindex locale
26220 These environment variables control the way that GCC uses
26221 localization information which allows GCC to work with different
26222 national conventions. GCC inspects the locale categories
26223 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
26224 so. These locale categories can be set to any value supported by your
26225 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
26226 Kingdom encoded in UTF-8.
26227
26228 The @env{LC_CTYPE} environment variable specifies character
26229 classification. GCC uses it to determine the character boundaries in
26230 a string; this is needed for some multibyte encodings that contain quote
26231 and escape characters that are otherwise interpreted as a string
26232 end or escape.
26233
26234 The @env{LC_MESSAGES} environment variable specifies the language to
26235 use in diagnostic messages.
26236
26237 If the @env{LC_ALL} environment variable is set, it overrides the value
26238 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
26239 and @env{LC_MESSAGES} default to the value of the @env{LANG}
26240 environment variable. If none of these variables are set, GCC
26241 defaults to traditional C English behavior.
26242
26243 @item TMPDIR
26244 @findex TMPDIR
26245 If @env{TMPDIR} is set, it specifies the directory to use for temporary
26246 files. GCC uses temporary files to hold the output of one stage of
26247 compilation which is to be used as input to the next stage: for example,
26248 the output of the preprocessor, which is the input to the compiler
26249 proper.
26250
26251 @item GCC_COMPARE_DEBUG
26252 @findex GCC_COMPARE_DEBUG
26253 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
26254 @option{-fcompare-debug} to the compiler driver. See the documentation
26255 of this option for more details.
26256
26257 @item GCC_EXEC_PREFIX
26258 @findex GCC_EXEC_PREFIX
26259 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
26260 names of the subprograms executed by the compiler. No slash is added
26261 when this prefix is combined with the name of a subprogram, but you can
26262 specify a prefix that ends with a slash if you wish.
26263
26264 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
26265 an appropriate prefix to use based on the pathname it is invoked with.
26266
26267 If GCC cannot find the subprogram using the specified prefix, it
26268 tries looking in the usual places for the subprogram.
26269
26270 The default value of @env{GCC_EXEC_PREFIX} is
26271 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
26272 the installed compiler. In many cases @var{prefix} is the value
26273 of @code{prefix} when you ran the @file{configure} script.
26274
26275 Other prefixes specified with @option{-B} take precedence over this prefix.
26276
26277 This prefix is also used for finding files such as @file{crt0.o} that are
26278 used for linking.
26279
26280 In addition, the prefix is used in an unusual way in finding the
26281 directories to search for header files. For each of the standard
26282 directories whose name normally begins with @samp{/usr/local/lib/gcc}
26283 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
26284 replacing that beginning with the specified prefix to produce an
26285 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
26286 @file{foo/bar} just before it searches the standard directory
26287 @file{/usr/local/lib/bar}.
26288 If a standard directory begins with the configured
26289 @var{prefix} then the value of @var{prefix} is replaced by
26290 @env{GCC_EXEC_PREFIX} when looking for header files.
26291
26292 @item COMPILER_PATH
26293 @findex COMPILER_PATH
26294 The value of @env{COMPILER_PATH} is a colon-separated list of
26295 directories, much like @env{PATH}. GCC tries the directories thus
26296 specified when searching for subprograms, if it can't find the
26297 subprograms using @env{GCC_EXEC_PREFIX}.
26298
26299 @item LIBRARY_PATH
26300 @findex LIBRARY_PATH
26301 The value of @env{LIBRARY_PATH} is a colon-separated list of
26302 directories, much like @env{PATH}. When configured as a native compiler,
26303 GCC tries the directories thus specified when searching for special
26304 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
26305 using GCC also uses these directories when searching for ordinary
26306 libraries for the @option{-l} option (but directories specified with
26307 @option{-L} come first).
26308
26309 @item LANG
26310 @findex LANG
26311 @cindex locale definition
26312 This variable is used to pass locale information to the compiler. One way in
26313 which this information is used is to determine the character set to be used
26314 when character literals, string literals and comments are parsed in C and C++.
26315 When the compiler is configured to allow multibyte characters,
26316 the following values for @env{LANG} are recognized:
26317
26318 @table @samp
26319 @item C-JIS
26320 Recognize JIS characters.
26321 @item C-SJIS
26322 Recognize SJIS characters.
26323 @item C-EUCJP
26324 Recognize EUCJP characters.
26325 @end table
26326
26327 If @env{LANG} is not defined, or if it has some other value, then the
26328 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
26329 recognize and translate multibyte characters.
26330 @end table
26331
26332 @noindent
26333 Some additional environment variables affect the behavior of the
26334 preprocessor.
26335
26336 @include cppenv.texi
26337
26338 @c man end
26339
26340 @node Precompiled Headers
26341 @section Using Precompiled Headers
26342 @cindex precompiled headers
26343 @cindex speed of compilation
26344
26345 Often large projects have many header files that are included in every
26346 source file. The time the compiler takes to process these header files
26347 over and over again can account for nearly all of the time required to
26348 build the project. To make builds faster, GCC allows you to
26349 @dfn{precompile} a header file.
26350
26351 To create a precompiled header file, simply compile it as you would any
26352 other file, if necessary using the @option{-x} option to make the driver
26353 treat it as a C or C++ header file. You may want to use a
26354 tool like @command{make} to keep the precompiled header up-to-date when
26355 the headers it contains change.
26356
26357 A precompiled header file is searched for when @code{#include} is
26358 seen in the compilation. As it searches for the included file
26359 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
26360 compiler looks for a precompiled header in each directory just before it
26361 looks for the include file in that directory. The name searched for is
26362 the name specified in the @code{#include} with @samp{.gch} appended. If
26363 the precompiled header file can't be used, it is ignored.
26364
26365 For instance, if you have @code{#include "all.h"}, and you have
26366 @file{all.h.gch} in the same directory as @file{all.h}, then the
26367 precompiled header file is used if possible, and the original
26368 header is used otherwise.
26369
26370 Alternatively, you might decide to put the precompiled header file in a
26371 directory and use @option{-I} to ensure that directory is searched
26372 before (or instead of) the directory containing the original header.
26373 Then, if you want to check that the precompiled header file is always
26374 used, you can put a file of the same name as the original header in this
26375 directory containing an @code{#error} command.
26376
26377 This also works with @option{-include}. So yet another way to use
26378 precompiled headers, good for projects not designed with precompiled
26379 header files in mind, is to simply take most of the header files used by
26380 a project, include them from another header file, precompile that header
26381 file, and @option{-include} the precompiled header. If the header files
26382 have guards against multiple inclusion, they are skipped because
26383 they've already been included (in the precompiled header).
26384
26385 If you need to precompile the same header file for different
26386 languages, targets, or compiler options, you can instead make a
26387 @emph{directory} named like @file{all.h.gch}, and put each precompiled
26388 header in the directory, perhaps using @option{-o}. It doesn't matter
26389 what you call the files in the directory; every precompiled header in
26390 the directory is considered. The first precompiled header
26391 encountered in the directory that is valid for this compilation is
26392 used; they're searched in no particular order.
26393
26394 There are many other possibilities, limited only by your imagination,
26395 good sense, and the constraints of your build system.
26396
26397 A precompiled header file can be used only when these conditions apply:
26398
26399 @itemize
26400 @item
26401 Only one precompiled header can be used in a particular compilation.
26402
26403 @item
26404 A precompiled header can't be used once the first C token is seen. You
26405 can have preprocessor directives before a precompiled header; you cannot
26406 include a precompiled header from inside another header.
26407
26408 @item
26409 The precompiled header file must be produced for the same language as
26410 the current compilation. You can't use a C precompiled header for a C++
26411 compilation.
26412
26413 @item
26414 The precompiled header file must have been produced by the same compiler
26415 binary as the current compilation is using.
26416
26417 @item
26418 Any macros defined before the precompiled header is included must
26419 either be defined in the same way as when the precompiled header was
26420 generated, or must not affect the precompiled header, which usually
26421 means that they don't appear in the precompiled header at all.
26422
26423 The @option{-D} option is one way to define a macro before a
26424 precompiled header is included; using a @code{#define} can also do it.
26425 There are also some options that define macros implicitly, like
26426 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
26427 defined this way.
26428
26429 @item If debugging information is output when using the precompiled
26430 header, using @option{-g} or similar, the same kind of debugging information
26431 must have been output when building the precompiled header. However,
26432 a precompiled header built using @option{-g} can be used in a compilation
26433 when no debugging information is being output.
26434
26435 @item The same @option{-m} options must generally be used when building
26436 and using the precompiled header. @xref{Submodel Options},
26437 for any cases where this rule is relaxed.
26438
26439 @item Each of the following options must be the same when building and using
26440 the precompiled header:
26441
26442 @gccoptlist{-fexceptions}
26443
26444 @item
26445 Some other command-line options starting with @option{-f},
26446 @option{-p}, or @option{-O} must be defined in the same way as when
26447 the precompiled header was generated. At present, it's not clear
26448 which options are safe to change and which are not; the safest choice
26449 is to use exactly the same options when generating and using the
26450 precompiled header. The following are known to be safe:
26451
26452 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
26453 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
26454 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
26455 -pedantic-errors}
26456
26457 @end itemize
26458
26459 For all of these except the last, the compiler automatically
26460 ignores the precompiled header if the conditions aren't met. If you
26461 find an option combination that doesn't work and doesn't cause the
26462 precompiled header to be ignored, please consider filing a bug report,
26463 see @ref{Bugs}.
26464
26465 If you do use differing options when generating and using the
26466 precompiled header, the actual behavior is a mixture of the
26467 behavior for the options. For instance, if you use @option{-g} to
26468 generate the precompiled header but not when using it, you may or may
26469 not get debugging information for routines in the precompiled header.