]> gcc.gnu.org Git - gcc.git/blob - gcc/doc/invoke.texi
Introduce -fsanitize-address-use-after-scope
[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 -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 -Wcast-qual
5578 @opindex Wcast-qual
5579 @opindex Wno-cast-qual
5580 Warn whenever a pointer is cast so as to remove a type qualifier from
5581 the target type. For example, warn if a @code{const char *} is cast
5582 to an ordinary @code{char *}.
5583
5584 Also warn when making a cast that introduces a type qualifier in an
5585 unsafe way. For example, casting @code{char **} to @code{const char **}
5586 is unsafe, as in this example:
5587
5588 @smallexample
5589 /* p is char ** value. */
5590 const char **q = (const char **) p;
5591 /* Assignment of readonly string to const char * is OK. */
5592 *q = "string";
5593 /* Now char** pointer points to read-only memory. */
5594 **p = 'b';
5595 @end smallexample
5596
5597 @item -Wcast-align
5598 @opindex Wcast-align
5599 @opindex Wno-cast-align
5600 Warn whenever a pointer is cast such that the required alignment of the
5601 target is increased. For example, warn if a @code{char *} is cast to
5602 an @code{int *} on machines where integers can only be accessed at
5603 two- or four-byte boundaries.
5604
5605 @item -Wwrite-strings
5606 @opindex Wwrite-strings
5607 @opindex Wno-write-strings
5608 When compiling C, give string constants the type @code{const
5609 char[@var{length}]} so that copying the address of one into a
5610 non-@code{const} @code{char *} pointer produces a warning. These
5611 warnings help you find at compile time code that can try to write
5612 into a string constant, but only if you have been very careful about
5613 using @code{const} in declarations and prototypes. Otherwise, it is
5614 just a nuisance. This is why we did not make @option{-Wall} request
5615 these warnings.
5616
5617 When compiling C++, warn about the deprecated conversion from string
5618 literals to @code{char *}. This warning is enabled by default for C++
5619 programs.
5620
5621 @item -Wclobbered
5622 @opindex Wclobbered
5623 @opindex Wno-clobbered
5624 Warn for variables that might be changed by @code{longjmp} or
5625 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5626
5627 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5628 @opindex Wconditionally-supported
5629 @opindex Wno-conditionally-supported
5630 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5631
5632 @item -Wconversion
5633 @opindex Wconversion
5634 @opindex Wno-conversion
5635 Warn for implicit conversions that may alter a value. This includes
5636 conversions between real and integer, like @code{abs (x)} when
5637 @code{x} is @code{double}; conversions between signed and unsigned,
5638 like @code{unsigned ui = -1}; and conversions to smaller types, like
5639 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5640 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5641 changed by the conversion like in @code{abs (2.0)}. Warnings about
5642 conversions between signed and unsigned integers can be disabled by
5643 using @option{-Wno-sign-conversion}.
5644
5645 For C++, also warn for confusing overload resolution for user-defined
5646 conversions; and conversions that never use a type conversion
5647 operator: conversions to @code{void}, the same type, a base class or a
5648 reference to them. Warnings about conversions between signed and
5649 unsigned integers are disabled by default in C++ unless
5650 @option{-Wsign-conversion} is explicitly enabled.
5651
5652 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5653 @opindex Wconversion-null
5654 @opindex Wno-conversion-null
5655 Do not warn for conversions between @code{NULL} and non-pointer
5656 types. @option{-Wconversion-null} is enabled by default.
5657
5658 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5659 @opindex Wzero-as-null-pointer-constant
5660 @opindex Wno-zero-as-null-pointer-constant
5661 Warn when a literal @samp{0} is used as null pointer constant. This can
5662 be useful to facilitate the conversion to @code{nullptr} in C++11.
5663
5664 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5665 @opindex Wsubobject-linkage
5666 @opindex Wno-subobject-linkage
5667 Warn if a class type has a base or a field whose type uses the anonymous
5668 namespace or depends on a type with no linkage. If a type A depends on
5669 a type B with no or internal linkage, defining it in multiple
5670 translation units would be an ODR violation because the meaning of B
5671 is different in each translation unit. If A only appears in a single
5672 translation unit, the best way to silence the warning is to give it
5673 internal linkage by putting it in an anonymous namespace as well. The
5674 compiler doesn't give this warning for types defined in the main .C
5675 file, as those are unlikely to have multiple definitions.
5676 @option{-Wsubobject-linkage} is enabled by default.
5677
5678 @item -Wdangling-else
5679 @opindex Wdangling-else
5680 @opindex Wno-dangling-else
5681 Warn about constructions where there may be confusion to which
5682 @code{if} statement an @code{else} branch belongs. Here is an example of
5683 such a case:
5684
5685 @smallexample
5686 @group
5687 @{
5688 if (a)
5689 if (b)
5690 foo ();
5691 else
5692 bar ();
5693 @}
5694 @end group
5695 @end smallexample
5696
5697 In C/C++, every @code{else} branch belongs to the innermost possible
5698 @code{if} statement, which in this example is @code{if (b)}. This is
5699 often not what the programmer expected, as illustrated in the above
5700 example by indentation the programmer chose. When there is the
5701 potential for this confusion, GCC issues a warning when this flag
5702 is specified. To eliminate the warning, add explicit braces around
5703 the innermost @code{if} statement so there is no way the @code{else}
5704 can belong to the enclosing @code{if}. The resulting code
5705 looks like this:
5706
5707 @smallexample
5708 @group
5709 @{
5710 if (a)
5711 @{
5712 if (b)
5713 foo ();
5714 else
5715 bar ();
5716 @}
5717 @}
5718 @end group
5719 @end smallexample
5720
5721 This warning is enabled by @option{-Wparentheses}.
5722
5723 @item -Wdate-time
5724 @opindex Wdate-time
5725 @opindex Wno-date-time
5726 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5727 are encountered as they might prevent bit-wise-identical reproducible
5728 compilations.
5729
5730 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5731 @opindex Wdelete-incomplete
5732 @opindex Wno-delete-incomplete
5733 Warn when deleting a pointer to incomplete type, which may cause
5734 undefined behavior at runtime. This warning is enabled by default.
5735
5736 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5737 @opindex Wuseless-cast
5738 @opindex Wno-useless-cast
5739 Warn when an expression is casted to its own type.
5740
5741 @item -Wempty-body
5742 @opindex Wempty-body
5743 @opindex Wno-empty-body
5744 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5745 while} statement. This warning is also enabled by @option{-Wextra}.
5746
5747 @item -Wenum-compare
5748 @opindex Wenum-compare
5749 @opindex Wno-enum-compare
5750 Warn about a comparison between values of different enumerated types.
5751 In C++ enumeral mismatches in conditional expressions are also
5752 diagnosed and the warning is enabled by default. In C this warning is
5753 enabled by @option{-Wall}.
5754
5755 @item -Wjump-misses-init @r{(C, Objective-C only)}
5756 @opindex Wjump-misses-init
5757 @opindex Wno-jump-misses-init
5758 Warn if a @code{goto} statement or a @code{switch} statement jumps
5759 forward across the initialization of a variable, or jumps backward to a
5760 label after the variable has been initialized. This only warns about
5761 variables that are initialized when they are declared. This warning is
5762 only supported for C and Objective-C; in C++ this sort of branch is an
5763 error in any case.
5764
5765 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5766 can be disabled with the @option{-Wno-jump-misses-init} option.
5767
5768 @item -Wsign-compare
5769 @opindex Wsign-compare
5770 @opindex Wno-sign-compare
5771 @cindex warning for comparison of signed and unsigned values
5772 @cindex comparison of signed and unsigned values, warning
5773 @cindex signed and unsigned values, comparison warning
5774 Warn when a comparison between signed and unsigned values could produce
5775 an incorrect result when the signed value is converted to unsigned.
5776 In C++, this warning is also enabled by @option{-Wall}. In C, it is
5777 also enabled by @option{-Wextra}.
5778
5779 @item -Wsign-conversion
5780 @opindex Wsign-conversion
5781 @opindex Wno-sign-conversion
5782 Warn for implicit conversions that may change the sign of an integer
5783 value, like assigning a signed integer expression to an unsigned
5784 integer variable. An explicit cast silences the warning. In C, this
5785 option is enabled also by @option{-Wconversion}.
5786
5787 @item -Wfloat-conversion
5788 @opindex Wfloat-conversion
5789 @opindex Wno-float-conversion
5790 Warn for implicit conversions that reduce the precision of a real value.
5791 This includes conversions from real to integer, and from higher precision
5792 real to lower precision real values. This option is also enabled by
5793 @option{-Wconversion}.
5794
5795 @item -Wno-scalar-storage-order
5796 @opindex -Wno-scalar-storage-order
5797 @opindex -Wscalar-storage-order
5798 Do not warn on suspicious constructs involving reverse scalar storage order.
5799
5800 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
5801 @opindex Wsized-deallocation
5802 @opindex Wno-sized-deallocation
5803 Warn about a definition of an unsized deallocation function
5804 @smallexample
5805 void operator delete (void *) noexcept;
5806 void operator delete[] (void *) noexcept;
5807 @end smallexample
5808 without a definition of the corresponding sized deallocation function
5809 @smallexample
5810 void operator delete (void *, std::size_t) noexcept;
5811 void operator delete[] (void *, std::size_t) noexcept;
5812 @end smallexample
5813 or vice versa. Enabled by @option{-Wextra} along with
5814 @option{-fsized-deallocation}.
5815
5816 @item -Wsizeof-pointer-memaccess
5817 @opindex Wsizeof-pointer-memaccess
5818 @opindex Wno-sizeof-pointer-memaccess
5819 Warn for suspicious length parameters to certain string and memory built-in
5820 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
5821 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
5822 but a pointer, and suggests a possible fix, or about
5823 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
5824 @option{-Wall}.
5825
5826 @item -Wsizeof-array-argument
5827 @opindex Wsizeof-array-argument
5828 @opindex Wno-sizeof-array-argument
5829 Warn when the @code{sizeof} operator is applied to a parameter that is
5830 declared as an array in a function definition. This warning is enabled by
5831 default for C and C++ programs.
5832
5833 @item -Wmemset-elt-size
5834 @opindex Wmemset-elt-size
5835 @opindex Wno-memset-elt-size
5836 Warn for suspicious calls to the @code{memset} built-in function, if the
5837 first argument references an array, and the third argument is a number
5838 equal to the number of elements, but not equal to the size of the array
5839 in memory. This indicates that the user has omitted a multiplication by
5840 the element size. This warning is enabled by @option{-Wall}.
5841
5842 @item -Wmemset-transposed-args
5843 @opindex Wmemset-transposed-args
5844 @opindex Wno-memset-transposed-args
5845 Warn for suspicious calls to the @code{memset} built-in function, if the
5846 second argument is not zero and the third argument is zero. This warns e.g.@
5847 about @code{memset (buf, sizeof buf, 0)} where most probably
5848 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
5849 is only emitted if the third argument is literal zero. If it is some
5850 expression that is folded to zero, a cast of zero to some type, etc.,
5851 it is far less likely that the user has mistakenly exchanged the arguments
5852 and no warning is emitted. This warning is enabled by @option{-Wall}.
5853
5854 @item -Waddress
5855 @opindex Waddress
5856 @opindex Wno-address
5857 Warn about suspicious uses of memory addresses. These include using
5858 the address of a function in a conditional expression, such as
5859 @code{void func(void); if (func)}, and comparisons against the memory
5860 address of a string literal, such as @code{if (x == "abc")}. Such
5861 uses typically indicate a programmer error: the address of a function
5862 always evaluates to true, so their use in a conditional usually
5863 indicate that the programmer forgot the parentheses in a function
5864 call; and comparisons against string literals result in unspecified
5865 behavior and are not portable in C, so they usually indicate that the
5866 programmer intended to use @code{strcmp}. This warning is enabled by
5867 @option{-Wall}.
5868
5869 @item -Wlogical-op
5870 @opindex Wlogical-op
5871 @opindex Wno-logical-op
5872 Warn about suspicious uses of logical operators in expressions.
5873 This includes using logical operators in contexts where a
5874 bit-wise operator is likely to be expected. Also warns when
5875 the operands of a logical operator are the same:
5876 @smallexample
5877 extern int a;
5878 if (a < 0 && a < 0) @{ @dots{} @}
5879 @end smallexample
5880
5881 @item -Wlogical-not-parentheses
5882 @opindex Wlogical-not-parentheses
5883 @opindex Wno-logical-not-parentheses
5884 Warn about logical not used on the left hand side operand of a comparison.
5885 This option does not warn if the right operand is considered to be a boolean
5886 expression. Its purpose is to detect suspicious code like the following:
5887 @smallexample
5888 int a;
5889 @dots{}
5890 if (!a > 1) @{ @dots{} @}
5891 @end smallexample
5892
5893 It is possible to suppress the warning by wrapping the LHS into
5894 parentheses:
5895 @smallexample
5896 if ((!a) > 1) @{ @dots{} @}
5897 @end smallexample
5898
5899 This warning is enabled by @option{-Wall}.
5900
5901 @item -Waggregate-return
5902 @opindex Waggregate-return
5903 @opindex Wno-aggregate-return
5904 Warn if any functions that return structures or unions are defined or
5905 called. (In languages where you can return an array, this also elicits
5906 a warning.)
5907
5908 @item -Wno-aggressive-loop-optimizations
5909 @opindex Wno-aggressive-loop-optimizations
5910 @opindex Waggressive-loop-optimizations
5911 Warn if in a loop with constant number of iterations the compiler detects
5912 undefined behavior in some statement during one or more of the iterations.
5913
5914 @item -Wno-attributes
5915 @opindex Wno-attributes
5916 @opindex Wattributes
5917 Do not warn if an unexpected @code{__attribute__} is used, such as
5918 unrecognized attributes, function attributes applied to variables,
5919 etc. This does not stop errors for incorrect use of supported
5920 attributes.
5921
5922 @item -Wno-builtin-macro-redefined
5923 @opindex Wno-builtin-macro-redefined
5924 @opindex Wbuiltin-macro-redefined
5925 Do not warn if certain built-in macros are redefined. This suppresses
5926 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
5927 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
5928
5929 @item -Wstrict-prototypes @r{(C and Objective-C only)}
5930 @opindex Wstrict-prototypes
5931 @opindex Wno-strict-prototypes
5932 Warn if a function is declared or defined without specifying the
5933 argument types. (An old-style function definition is permitted without
5934 a warning if preceded by a declaration that specifies the argument
5935 types.)
5936
5937 @item -Wold-style-declaration @r{(C and Objective-C only)}
5938 @opindex Wold-style-declaration
5939 @opindex Wno-old-style-declaration
5940 Warn for obsolescent usages, according to the C Standard, in a
5941 declaration. For example, warn if storage-class specifiers like
5942 @code{static} are not the first things in a declaration. This warning
5943 is also enabled by @option{-Wextra}.
5944
5945 @item -Wold-style-definition @r{(C and Objective-C only)}
5946 @opindex Wold-style-definition
5947 @opindex Wno-old-style-definition
5948 Warn if an old-style function definition is used. A warning is given
5949 even if there is a previous prototype.
5950
5951 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5952 @opindex Wmissing-parameter-type
5953 @opindex Wno-missing-parameter-type
5954 A function parameter is declared without a type specifier in K&R-style
5955 functions:
5956
5957 @smallexample
5958 void foo(bar) @{ @}
5959 @end smallexample
5960
5961 This warning is also enabled by @option{-Wextra}.
5962
5963 @item -Wmissing-prototypes @r{(C and Objective-C only)}
5964 @opindex Wmissing-prototypes
5965 @opindex Wno-missing-prototypes
5966 Warn if a global function is defined without a previous prototype
5967 declaration. This warning is issued even if the definition itself
5968 provides a prototype. Use this option to detect global functions
5969 that do not have a matching prototype declaration in a header file.
5970 This option is not valid for C++ because all function declarations
5971 provide prototypes and a non-matching declaration declares an
5972 overload rather than conflict with an earlier declaration.
5973 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
5974
5975 @item -Wmissing-declarations
5976 @opindex Wmissing-declarations
5977 @opindex Wno-missing-declarations
5978 Warn if a global function is defined without a previous declaration.
5979 Do so even if the definition itself provides a prototype.
5980 Use this option to detect global functions that are not declared in
5981 header files. In C, no warnings are issued for functions with previous
5982 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
5983 missing prototypes. In C++, no warnings are issued for function templates,
5984 or for inline functions, or for functions in anonymous namespaces.
5985
5986 @item -Wmissing-field-initializers
5987 @opindex Wmissing-field-initializers
5988 @opindex Wno-missing-field-initializers
5989 @opindex W
5990 @opindex Wextra
5991 @opindex Wno-extra
5992 Warn if a structure's initializer has some fields missing. For
5993 example, the following code causes such a warning, because
5994 @code{x.h} is implicitly zero:
5995
5996 @smallexample
5997 struct s @{ int f, g, h; @};
5998 struct s x = @{ 3, 4 @};
5999 @end smallexample
6000
6001 This option does not warn about designated initializers, so the following
6002 modification does not trigger a warning:
6003
6004 @smallexample
6005 struct s @{ int f, g, h; @};
6006 struct s x = @{ .f = 3, .g = 4 @};
6007 @end smallexample
6008
6009 In C++ this option does not warn either about the empty @{ @}
6010 initializer, for example:
6011
6012 @smallexample
6013 struct s @{ int f, g, h; @};
6014 s x = @{ @};
6015 @end smallexample
6016
6017 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6018 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6019
6020 @item -Wno-multichar
6021 @opindex Wno-multichar
6022 @opindex Wmultichar
6023 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6024 Usually they indicate a typo in the user's code, as they have
6025 implementation-defined values, and should not be used in portable code.
6026
6027 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
6028 @opindex Wnormalized=
6029 @opindex Wnormalized
6030 @opindex Wno-normalized
6031 @cindex NFC
6032 @cindex NFKC
6033 @cindex character set, input normalization
6034 In ISO C and ISO C++, two identifiers are different if they are
6035 different sequences of characters. However, sometimes when characters
6036 outside the basic ASCII character set are used, you can have two
6037 different character sequences that look the same. To avoid confusion,
6038 the ISO 10646 standard sets out some @dfn{normalization rules} which
6039 when applied ensure that two sequences that look the same are turned into
6040 the same sequence. GCC can warn you if you are using identifiers that
6041 have not been normalized; this option controls that warning.
6042
6043 There are four levels of warning supported by GCC@. The default is
6044 @option{-Wnormalized=nfc}, which warns about any identifier that is
6045 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6046 recommended form for most uses. It is equivalent to
6047 @option{-Wnormalized}.
6048
6049 Unfortunately, there are some characters allowed in identifiers by
6050 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6051 identifiers. That is, there's no way to use these symbols in portable
6052 ISO C or C++ and have all your identifiers in NFC@.
6053 @option{-Wnormalized=id} suppresses the warning for these characters.
6054 It is hoped that future versions of the standards involved will correct
6055 this, which is why this option is not the default.
6056
6057 You can switch the warning off for all characters by writing
6058 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6059 only do this if you are using some other normalization scheme (like
6060 ``D''), because otherwise you can easily create bugs that are
6061 literally impossible to see.
6062
6063 Some characters in ISO 10646 have distinct meanings but look identical
6064 in some fonts or display methodologies, especially once formatting has
6065 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6066 LETTER N'', displays just like a regular @code{n} that has been
6067 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6068 normalization scheme to convert all these into a standard form as
6069 well, and GCC warns if your code is not in NFKC if you use
6070 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6071 about every identifier that contains the letter O because it might be
6072 confused with the digit 0, and so is not the default, but may be
6073 useful as a local coding convention if the programming environment
6074 cannot be fixed to display these characters distinctly.
6075
6076 @item -Wno-deprecated
6077 @opindex Wno-deprecated
6078 @opindex Wdeprecated
6079 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6080
6081 @item -Wno-deprecated-declarations
6082 @opindex Wno-deprecated-declarations
6083 @opindex Wdeprecated-declarations
6084 Do not warn about uses of functions (@pxref{Function Attributes}),
6085 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6086 Attributes}) marked as deprecated by using the @code{deprecated}
6087 attribute.
6088
6089 @item -Wno-overflow
6090 @opindex Wno-overflow
6091 @opindex Woverflow
6092 Do not warn about compile-time overflow in constant expressions.
6093
6094 @item -Wno-odr
6095 @opindex Wno-odr
6096 @opindex Wodr
6097 Warn about One Definition Rule violations during link-time optimization.
6098 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6099
6100 @item -Wopenmp-simd
6101 @opindex Wopenm-simd
6102 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
6103 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6104 option can be used to relax the cost model.
6105
6106 @item -Woverride-init @r{(C and Objective-C only)}
6107 @opindex Woverride-init
6108 @opindex Wno-override-init
6109 @opindex W
6110 @opindex Wextra
6111 @opindex Wno-extra
6112 Warn if an initialized field without side effects is overridden when
6113 using designated initializers (@pxref{Designated Inits, , Designated
6114 Initializers}).
6115
6116 This warning is included in @option{-Wextra}. To get other
6117 @option{-Wextra} warnings without this one, use @option{-Wextra
6118 -Wno-override-init}.
6119
6120 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6121 @opindex Woverride-init-side-effects
6122 @opindex Wno-override-init-side-effects
6123 Warn if an initialized field with side effects is overridden when
6124 using designated initializers (@pxref{Designated Inits, , Designated
6125 Initializers}). This warning is enabled by default.
6126
6127 @item -Wpacked
6128 @opindex Wpacked
6129 @opindex Wno-packed
6130 Warn if a structure is given the packed attribute, but the packed
6131 attribute has no effect on the layout or size of the structure.
6132 Such structures may be mis-aligned for little benefit. For
6133 instance, in this code, the variable @code{f.x} in @code{struct bar}
6134 is misaligned even though @code{struct bar} does not itself
6135 have the packed attribute:
6136
6137 @smallexample
6138 @group
6139 struct foo @{
6140 int x;
6141 char a, b, c, d;
6142 @} __attribute__((packed));
6143 struct bar @{
6144 char z;
6145 struct foo f;
6146 @};
6147 @end group
6148 @end smallexample
6149
6150 @item -Wpacked-bitfield-compat
6151 @opindex Wpacked-bitfield-compat
6152 @opindex Wno-packed-bitfield-compat
6153 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
6154 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
6155 the change can lead to differences in the structure layout. GCC
6156 informs you when the offset of such a field has changed in GCC 4.4.
6157 For example there is no longer a 4-bit padding between field @code{a}
6158 and @code{b} in this structure:
6159
6160 @smallexample
6161 struct foo
6162 @{
6163 char a:4;
6164 char b:8;
6165 @} __attribute__ ((packed));
6166 @end smallexample
6167
6168 This warning is enabled by default. Use
6169 @option{-Wno-packed-bitfield-compat} to disable this warning.
6170
6171 @item -Wpadded
6172 @opindex Wpadded
6173 @opindex Wno-padded
6174 Warn if padding is included in a structure, either to align an element
6175 of the structure or to align the whole structure. Sometimes when this
6176 happens it is possible to rearrange the fields of the structure to
6177 reduce the padding and so make the structure smaller.
6178
6179 @item -Wredundant-decls
6180 @opindex Wredundant-decls
6181 @opindex Wno-redundant-decls
6182 Warn if anything is declared more than once in the same scope, even in
6183 cases where multiple declaration is valid and changes nothing.
6184
6185 @item -Wnested-externs @r{(C and Objective-C only)}
6186 @opindex Wnested-externs
6187 @opindex Wno-nested-externs
6188 Warn if an @code{extern} declaration is encountered within a function.
6189
6190 @item -Wno-inherited-variadic-ctor
6191 @opindex Winherited-variadic-ctor
6192 @opindex Wno-inherited-variadic-ctor
6193 Suppress warnings about use of C++11 inheriting constructors when the
6194 base class inherited from has a C variadic constructor; the warning is
6195 on by default because the ellipsis is not inherited.
6196
6197 @item -Winline
6198 @opindex Winline
6199 @opindex Wno-inline
6200 Warn if a function that is declared as inline cannot be inlined.
6201 Even with this option, the compiler does not warn about failures to
6202 inline functions declared in system headers.
6203
6204 The compiler uses a variety of heuristics to determine whether or not
6205 to inline a function. For example, the compiler takes into account
6206 the size of the function being inlined and the amount of inlining
6207 that has already been done in the current function. Therefore,
6208 seemingly insignificant changes in the source program can cause the
6209 warnings produced by @option{-Winline} to appear or disappear.
6210
6211 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6212 @opindex Wno-invalid-offsetof
6213 @opindex Winvalid-offsetof
6214 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6215 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6216 to a non-standard-layout type is undefined. In existing C++ implementations,
6217 however, @code{offsetof} typically gives meaningful results.
6218 This flag is for users who are aware that they are
6219 writing nonportable code and who have deliberately chosen to ignore the
6220 warning about it.
6221
6222 The restrictions on @code{offsetof} may be relaxed in a future version
6223 of the C++ standard.
6224
6225 @item -Wint-in-bool-context
6226 @opindex Wint-in-bool-context
6227 @opindex Wno-int-in-bool-context
6228 Warn for suspicious use of integer values where boolean values are expected,
6229 such as conditional expressions (?:) using non-boolean integer constants in
6230 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
6231 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
6232 for all kinds of multiplications regardless of the data type.
6233 This warning is enabled by @option{-Wall}.
6234
6235 @item -Wno-int-to-pointer-cast
6236 @opindex Wno-int-to-pointer-cast
6237 @opindex Wint-to-pointer-cast
6238 Suppress warnings from casts to pointer type of an integer of a
6239 different size. In C++, casting to a pointer type of smaller size is
6240 an error. @option{Wint-to-pointer-cast} is enabled by default.
6241
6242
6243 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
6244 @opindex Wno-pointer-to-int-cast
6245 @opindex Wpointer-to-int-cast
6246 Suppress warnings from casts from a pointer to an integer type of a
6247 different size.
6248
6249 @item -Winvalid-pch
6250 @opindex Winvalid-pch
6251 @opindex Wno-invalid-pch
6252 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
6253 the search path but can't be used.
6254
6255 @item -Wlong-long
6256 @opindex Wlong-long
6257 @opindex Wno-long-long
6258 Warn if @code{long long} type is used. This is enabled by either
6259 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
6260 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
6261
6262 @item -Wvariadic-macros
6263 @opindex Wvariadic-macros
6264 @opindex Wno-variadic-macros
6265 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6266 alternate syntax is used in ISO C99 mode. This is enabled by either
6267 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
6268 messages, use @option{-Wno-variadic-macros}.
6269
6270 @item -Wvarargs
6271 @opindex Wvarargs
6272 @opindex Wno-varargs
6273 Warn upon questionable usage of the macros used to handle variable
6274 arguments like @code{va_start}. This is default. To inhibit the
6275 warning messages, use @option{-Wno-varargs}.
6276
6277 @item -Wvector-operation-performance
6278 @opindex Wvector-operation-performance
6279 @opindex Wno-vector-operation-performance
6280 Warn if vector operation is not implemented via SIMD capabilities of the
6281 architecture. Mainly useful for the performance tuning.
6282 Vector operation can be implemented @code{piecewise}, which means that the
6283 scalar operation is performed on every vector element;
6284 @code{in parallel}, which means that the vector operation is implemented
6285 using scalars of wider type, which normally is more performance efficient;
6286 and @code{as a single scalar}, which means that vector fits into a
6287 scalar type.
6288
6289 @item -Wno-virtual-move-assign
6290 @opindex Wvirtual-move-assign
6291 @opindex Wno-virtual-move-assign
6292 Suppress warnings about inheriting from a virtual base with a
6293 non-trivial C++11 move assignment operator. This is dangerous because
6294 if the virtual base is reachable along more than one path, it is
6295 moved multiple times, which can mean both objects end up in the
6296 moved-from state. If the move assignment operator is written to avoid
6297 moving from a moved-from object, this warning can be disabled.
6298
6299 @item -Wvla
6300 @opindex Wvla
6301 @opindex Wno-vla
6302 Warn if a variable-length array is used in the code.
6303 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
6304 the variable-length array.
6305
6306 @item -Wvla-larger-than=@var{n}
6307 If this option is used, the compiler will warn on uses of
6308 variable-length arrays where the size is either unbounded, or bounded
6309 by an argument that can be larger than @var{n} bytes. This is similar
6310 to how @option{-Walloca-larger-than=@var{n}} works, but with
6311 variable-length arrays.
6312
6313 Note that GCC may optimize small variable-length arrays of a known
6314 value into plain arrays, so this warning may not get triggered for
6315 such arrays.
6316
6317 This warning is not enabled by @option{-Wall}, and is only active when
6318 @option{-ftree-vrp} is active (default for @option{-O2} and above).
6319
6320 See also @option{-Walloca-larger-than=@var{n}}.
6321
6322 @item -Wvolatile-register-var
6323 @opindex Wvolatile-register-var
6324 @opindex Wno-volatile-register-var
6325 Warn if a register variable is declared volatile. The volatile
6326 modifier does not inhibit all optimizations that may eliminate reads
6327 and/or writes to register variables. This warning is enabled by
6328 @option{-Wall}.
6329
6330 @item -Wdisabled-optimization
6331 @opindex Wdisabled-optimization
6332 @opindex Wno-disabled-optimization
6333 Warn if a requested optimization pass is disabled. This warning does
6334 not generally indicate that there is anything wrong with your code; it
6335 merely indicates that GCC's optimizers are unable to handle the code
6336 effectively. Often, the problem is that your code is too big or too
6337 complex; GCC refuses to optimize programs when the optimization
6338 itself is likely to take inordinate amounts of time.
6339
6340 @item -Wpointer-sign @r{(C and Objective-C only)}
6341 @opindex Wpointer-sign
6342 @opindex Wno-pointer-sign
6343 Warn for pointer argument passing or assignment with different signedness.
6344 This option is only supported for C and Objective-C@. It is implied by
6345 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
6346 @option{-Wno-pointer-sign}.
6347
6348 @item -Wstack-protector
6349 @opindex Wstack-protector
6350 @opindex Wno-stack-protector
6351 This option is only active when @option{-fstack-protector} is active. It
6352 warns about functions that are not protected against stack smashing.
6353
6354 @item -Woverlength-strings
6355 @opindex Woverlength-strings
6356 @opindex Wno-overlength-strings
6357 Warn about string constants that are longer than the ``minimum
6358 maximum'' length specified in the C standard. Modern compilers
6359 generally allow string constants that are much longer than the
6360 standard's minimum limit, but very portable programs should avoid
6361 using longer strings.
6362
6363 The limit applies @emph{after} string constant concatenation, and does
6364 not count the trailing NUL@. In C90, the limit was 509 characters; in
6365 C99, it was raised to 4095. C++98 does not specify a normative
6366 minimum maximum, so we do not diagnose overlength strings in C++@.
6367
6368 This option is implied by @option{-Wpedantic}, and can be disabled with
6369 @option{-Wno-overlength-strings}.
6370
6371 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
6372 @opindex Wunsuffixed-float-constants
6373
6374 Issue a warning for any floating constant that does not have
6375 a suffix. When used together with @option{-Wsystem-headers} it
6376 warns about such constants in system header files. This can be useful
6377 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
6378 from the decimal floating-point extension to C99.
6379
6380 @item -Wno-designated-init @r{(C and Objective-C only)}
6381 Suppress warnings when a positional initializer is used to initialize
6382 a structure that has been marked with the @code{designated_init}
6383 attribute.
6384
6385 @item -Whsa
6386 Issue a warning when HSAIL cannot be emitted for the compiled function or
6387 OpenMP construct.
6388
6389 @end table
6390
6391 @node Debugging Options
6392 @section Options for Debugging Your Program
6393 @cindex options, debugging
6394 @cindex debugging information options
6395
6396 To tell GCC to emit extra information for use by a debugger, in almost
6397 all cases you need only to add @option{-g} to your other options.
6398
6399 GCC allows you to use @option{-g} with
6400 @option{-O}. The shortcuts taken by optimized code may occasionally
6401 be surprising: some variables you declared may not exist
6402 at all; flow of control may briefly move where you did not expect it;
6403 some statements may not be executed because they compute constant
6404 results or their values are already at hand; some statements may
6405 execute in different places because they have been moved out of loops.
6406 Nevertheless it is possible to debug optimized output. This makes
6407 it reasonable to use the optimizer for programs that might have bugs.
6408
6409 If you are not using some other optimization option, consider
6410 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
6411 With no @option{-O} option at all, some compiler passes that collect
6412 information useful for debugging do not run at all, so that
6413 @option{-Og} may result in a better debugging experience.
6414
6415 @table @gcctabopt
6416 @item -g
6417 @opindex g
6418 Produce debugging information in the operating system's native format
6419 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
6420 information.
6421
6422 On most systems that use stabs format, @option{-g} enables use of extra
6423 debugging information that only GDB can use; this extra information
6424 makes debugging work better in GDB but probably makes other debuggers
6425 crash or
6426 refuse to read the program. If you want to control for certain whether
6427 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
6428 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
6429
6430 @item -ggdb
6431 @opindex ggdb
6432 Produce debugging information for use by GDB@. This means to use the
6433 most expressive format available (DWARF, stabs, or the native format
6434 if neither of those are supported), including GDB extensions if at all
6435 possible.
6436
6437 @item -gdwarf
6438 @itemx -gdwarf-@var{version}
6439 @opindex gdwarf
6440 Produce debugging information in DWARF format (if that is supported).
6441 The value of @var{version} may be either 2, 3, 4 or 5; the default version
6442 for most targets is 4. DWARF Version 5 is only experimental.
6443
6444 Note that with DWARF Version 2, some ports require and always
6445 use some non-conflicting DWARF 3 extensions in the unwind tables.
6446
6447 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
6448 for maximum benefit.
6449
6450 GCC no longer supports DWARF Version 1, which is substantially
6451 different than Version 2 and later. For historical reasons, some
6452 other DWARF-related options (including @option{-feliminate-dwarf2-dups}
6453 and @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
6454 in their names, but apply to all currently-supported versions of DWARF.
6455
6456 @item -gstabs
6457 @opindex gstabs
6458 Produce debugging information in stabs format (if that is supported),
6459 without GDB extensions. This is the format used by DBX on most BSD
6460 systems. On MIPS, Alpha and System V Release 4 systems this option
6461 produces stabs debugging output that is not understood by DBX or SDB@.
6462 On System V Release 4 systems this option requires the GNU assembler.
6463
6464 @item -gstabs+
6465 @opindex gstabs+
6466 Produce debugging information in stabs format (if that is supported),
6467 using GNU extensions understood only by the GNU debugger (GDB)@. The
6468 use of these extensions is likely to make other debuggers crash or
6469 refuse to read the program.
6470
6471 @item -gcoff
6472 @opindex gcoff
6473 Produce debugging information in COFF format (if that is supported).
6474 This is the format used by SDB on most System V systems prior to
6475 System V Release 4.
6476
6477 @item -gxcoff
6478 @opindex gxcoff
6479 Produce debugging information in XCOFF format (if that is supported).
6480 This is the format used by the DBX debugger on IBM RS/6000 systems.
6481
6482 @item -gxcoff+
6483 @opindex gxcoff+
6484 Produce debugging information in XCOFF format (if that is supported),
6485 using GNU extensions understood only by the GNU debugger (GDB)@. The
6486 use of these extensions is likely to make other debuggers crash or
6487 refuse to read the program, and may cause assemblers other than the GNU
6488 assembler (GAS) to fail with an error.
6489
6490 @item -gvms
6491 @opindex gvms
6492 Produce debugging information in Alpha/VMS debug format (if that is
6493 supported). This is the format used by DEBUG on Alpha/VMS systems.
6494
6495 @item -g@var{level}
6496 @itemx -ggdb@var{level}
6497 @itemx -gstabs@var{level}
6498 @itemx -gcoff@var{level}
6499 @itemx -gxcoff@var{level}
6500 @itemx -gvms@var{level}
6501 Request debugging information and also use @var{level} to specify how
6502 much information. The default level is 2.
6503
6504 Level 0 produces no debug information at all. Thus, @option{-g0} negates
6505 @option{-g}.
6506
6507 Level 1 produces minimal information, enough for making backtraces in
6508 parts of the program that you don't plan to debug. This includes
6509 descriptions of functions and external variables, and line number
6510 tables, but no information about local variables.
6511
6512 Level 3 includes extra information, such as all the macro definitions
6513 present in the program. Some debuggers support macro expansion when
6514 you use @option{-g3}.
6515
6516 @option{-gdwarf} does not accept a concatenated debug level, to avoid
6517 confusion with @option{-gdwarf-@var{level}}.
6518 Instead use an additional @option{-g@var{level}} option to change the
6519 debug level for DWARF.
6520
6521 @item -feliminate-unused-debug-symbols
6522 @opindex feliminate-unused-debug-symbols
6523 Produce debugging information in stabs format (if that is supported),
6524 for only symbols that are actually used.
6525
6526 @item -femit-class-debug-always
6527 @opindex femit-class-debug-always
6528 Instead of emitting debugging information for a C++ class in only one
6529 object file, emit it in all object files using the class. This option
6530 should be used only with debuggers that are unable to handle the way GCC
6531 normally emits debugging information for classes because using this
6532 option increases the size of debugging information by as much as a
6533 factor of two.
6534
6535 @item -fno-merge-debug-strings
6536 @opindex fmerge-debug-strings
6537 @opindex fno-merge-debug-strings
6538 Direct the linker to not merge together strings in the debugging
6539 information that are identical in different object files. Merging is
6540 not supported by all assemblers or linkers. Merging decreases the size
6541 of the debug information in the output file at the cost of increasing
6542 link processing time. Merging is enabled by default.
6543
6544 @item -fdebug-prefix-map=@var{old}=@var{new}
6545 @opindex fdebug-prefix-map
6546 When compiling files in directory @file{@var{old}}, record debugging
6547 information describing them as in @file{@var{new}} instead.
6548
6549 @item -fvar-tracking
6550 @opindex fvar-tracking
6551 Run variable tracking pass. It computes where variables are stored at each
6552 position in code. Better debugging information is then generated
6553 (if the debugging information format supports this information).
6554
6555 It is enabled by default when compiling with optimization (@option{-Os},
6556 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6557 the debug info format supports it.
6558
6559 @item -fvar-tracking-assignments
6560 @opindex fvar-tracking-assignments
6561 @opindex fno-var-tracking-assignments
6562 Annotate assignments to user variables early in the compilation and
6563 attempt to carry the annotations over throughout the compilation all the
6564 way to the end, in an attempt to improve debug information while
6565 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6566
6567 It can be enabled even if var-tracking is disabled, in which case
6568 annotations are created and maintained, but discarded at the end.
6569 By default, this flag is enabled together with @option{-fvar-tracking},
6570 except when selective scheduling is enabled.
6571
6572 @item -gsplit-dwarf
6573 @opindex gsplit-dwarf
6574 Separate as much DWARF debugging information as possible into a
6575 separate output file with the extension @file{.dwo}. This option allows
6576 the build system to avoid linking files with debug information. To
6577 be useful, this option requires a debugger capable of reading @file{.dwo}
6578 files.
6579
6580 @item -gpubnames
6581 @opindex gpubnames
6582 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
6583
6584 @item -ggnu-pubnames
6585 @opindex ggnu-pubnames
6586 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
6587 suitable for conversion into a GDB@ index. This option is only useful
6588 with a linker that can produce GDB@ index version 7.
6589
6590 @item -fdebug-types-section
6591 @opindex fdebug-types-section
6592 @opindex fno-debug-types-section
6593 When using DWARF Version 4 or higher, type DIEs can be put into
6594 their own @code{.debug_types} section instead of making them part of the
6595 @code{.debug_info} section. It is more efficient to put them in a separate
6596 comdat sections since the linker can then remove duplicates.
6597 But not all DWARF consumers support @code{.debug_types} sections yet
6598 and on some objects @code{.debug_types} produces larger instead of smaller
6599 debugging information.
6600
6601 @item -grecord-gcc-switches
6602 @item -gno-record-gcc-switches
6603 @opindex grecord-gcc-switches
6604 @opindex gno-record-gcc-switches
6605 This switch causes the command-line options used to invoke the
6606 compiler that may affect code generation to be appended to the
6607 DW_AT_producer attribute in DWARF debugging information. The options
6608 are concatenated with spaces separating them from each other and from
6609 the compiler version.
6610 It is enabled by default.
6611 See also @option{-frecord-gcc-switches} for another
6612 way of storing compiler options into the object file.
6613
6614 @item -gstrict-dwarf
6615 @opindex gstrict-dwarf
6616 Disallow using extensions of later DWARF standard version than selected
6617 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
6618 DWARF extensions from later standard versions is allowed.
6619
6620 @item -gno-strict-dwarf
6621 @opindex gno-strict-dwarf
6622 Allow using extensions of later DWARF standard version than selected with
6623 @option{-gdwarf-@var{version}}.
6624
6625 @item -gz@r{[}=@var{type}@r{]}
6626 @opindex gz
6627 Produce compressed debug sections in DWARF format, if that is supported.
6628 If @var{type} is not given, the default type depends on the capabilities
6629 of the assembler and linker used. @var{type} may be one of
6630 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
6631 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
6632 compression in traditional GNU format). If the linker doesn't support
6633 writing compressed debug sections, the option is rejected. Otherwise,
6634 if the assembler does not support them, @option{-gz} is silently ignored
6635 when producing object files.
6636
6637 @item -feliminate-dwarf2-dups
6638 @opindex feliminate-dwarf2-dups
6639 Compress DWARF debugging information by eliminating duplicated
6640 information about each symbol. This option only makes sense when
6641 generating DWARF debugging information.
6642
6643 @item -femit-struct-debug-baseonly
6644 @opindex femit-struct-debug-baseonly
6645 Emit debug information for struct-like types
6646 only when the base name of the compilation source file
6647 matches the base name of file in which the struct is defined.
6648
6649 This option substantially reduces the size of debugging information,
6650 but at significant potential loss in type information to the debugger.
6651 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6652 See @option{-femit-struct-debug-detailed} for more detailed control.
6653
6654 This option works only with DWARF debug output.
6655
6656 @item -femit-struct-debug-reduced
6657 @opindex femit-struct-debug-reduced
6658 Emit debug information for struct-like types
6659 only when the base name of the compilation source file
6660 matches the base name of file in which the type is defined,
6661 unless the struct is a template or defined in a system header.
6662
6663 This option significantly reduces the size of debugging information,
6664 with some potential loss in type information to the debugger.
6665 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6666 See @option{-femit-struct-debug-detailed} for more detailed control.
6667
6668 This option works only with DWARF debug output.
6669
6670 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6671 @opindex femit-struct-debug-detailed
6672 Specify the struct-like types
6673 for which the compiler generates debug information.
6674 The intent is to reduce duplicate struct debug information
6675 between different object files within the same program.
6676
6677 This option is a detailed version of
6678 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6679 which serves for most needs.
6680
6681 A specification has the syntax@*
6682 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6683
6684 The optional first word limits the specification to
6685 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6686 A struct type is used directly when it is the type of a variable, member.
6687 Indirect uses arise through pointers to structs.
6688 That is, when use of an incomplete struct is valid, the use is indirect.
6689 An example is
6690 @samp{struct one direct; struct two * indirect;}.
6691
6692 The optional second word limits the specification to
6693 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6694 Generic structs are a bit complicated to explain.
6695 For C++, these are non-explicit specializations of template classes,
6696 or non-template classes within the above.
6697 Other programming languages have generics,
6698 but @option{-femit-struct-debug-detailed} does not yet implement them.
6699
6700 The third word specifies the source files for those
6701 structs for which the compiler should emit debug information.
6702 The values @samp{none} and @samp{any} have the normal meaning.
6703 The value @samp{base} means that
6704 the base of name of the file in which the type declaration appears
6705 must match the base of the name of the main compilation file.
6706 In practice, this means that when compiling @file{foo.c}, debug information
6707 is generated for types declared in that file and @file{foo.h},
6708 but not other header files.
6709 The value @samp{sys} means those types satisfying @samp{base}
6710 or declared in system or compiler headers.
6711
6712 You may need to experiment to determine the best settings for your application.
6713
6714 The default is @option{-femit-struct-debug-detailed=all}.
6715
6716 This option works only with DWARF debug output.
6717
6718 @item -fno-dwarf2-cfi-asm
6719 @opindex fdwarf2-cfi-asm
6720 @opindex fno-dwarf2-cfi-asm
6721 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
6722 instead of using GAS @code{.cfi_*} directives.
6723
6724 @item -fno-eliminate-unused-debug-types
6725 @opindex feliminate-unused-debug-types
6726 @opindex fno-eliminate-unused-debug-types
6727 Normally, when producing DWARF output, GCC avoids producing debug symbol
6728 output for types that are nowhere used in the source file being compiled.
6729 Sometimes it is useful to have GCC emit debugging
6730 information for all types declared in a compilation
6731 unit, regardless of whether or not they are actually used
6732 in that compilation unit, for example
6733 if, in the debugger, you want to cast a value to a type that is
6734 not actually used in your program (but is declared). More often,
6735 however, this results in a significant amount of wasted space.
6736 @end table
6737
6738 @node Optimize Options
6739 @section Options That Control Optimization
6740 @cindex optimize options
6741 @cindex options, optimization
6742
6743 These options control various sorts of optimizations.
6744
6745 Without any optimization option, the compiler's goal is to reduce the
6746 cost of compilation and to make debugging produce the expected
6747 results. Statements are independent: if you stop the program with a
6748 breakpoint between statements, you can then assign a new value to any
6749 variable or change the program counter to any other statement in the
6750 function and get exactly the results you expect from the source
6751 code.
6752
6753 Turning on optimization flags makes the compiler attempt to improve
6754 the performance and/or code size at the expense of compilation time
6755 and possibly the ability to debug the program.
6756
6757 The compiler performs optimization based on the knowledge it has of the
6758 program. Compiling multiple files at once to a single output file mode allows
6759 the compiler to use information gained from all of the files when compiling
6760 each of them.
6761
6762 Not all optimizations are controlled directly by a flag. Only
6763 optimizations that have a flag are listed in this section.
6764
6765 Most optimizations are only enabled if an @option{-O} level is set on
6766 the command line. Otherwise they are disabled, even if individual
6767 optimization flags are specified.
6768
6769 Depending on the target and how GCC was configured, a slightly different
6770 set of optimizations may be enabled at each @option{-O} level than
6771 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6772 to find out the exact set of optimizations that are enabled at each level.
6773 @xref{Overall Options}, for examples.
6774
6775 @table @gcctabopt
6776 @item -O
6777 @itemx -O1
6778 @opindex O
6779 @opindex O1
6780 Optimize. Optimizing compilation takes somewhat more time, and a lot
6781 more memory for a large function.
6782
6783 With @option{-O}, the compiler tries to reduce code size and execution
6784 time, without performing any optimizations that take a great deal of
6785 compilation time.
6786
6787 @option{-O} turns on the following optimization flags:
6788 @gccoptlist{
6789 -fauto-inc-dec @gol
6790 -fbranch-count-reg @gol
6791 -fcombine-stack-adjustments @gol
6792 -fcompare-elim @gol
6793 -fcprop-registers @gol
6794 -fdce @gol
6795 -fdefer-pop @gol
6796 -fdelayed-branch @gol
6797 -fdse @gol
6798 -fforward-propagate @gol
6799 -fguess-branch-probability @gol
6800 -fif-conversion2 @gol
6801 -fif-conversion @gol
6802 -finline-functions-called-once @gol
6803 -fipa-pure-const @gol
6804 -fipa-profile @gol
6805 -fipa-reference @gol
6806 -fmerge-constants @gol
6807 -fmove-loop-invariants @gol
6808 -freorder-blocks @gol
6809 -fshrink-wrap @gol
6810 -fshrink-wrap-separate @gol
6811 -fsplit-wide-types @gol
6812 -fssa-backprop @gol
6813 -fssa-phiopt @gol
6814 -fstore-merging @gol
6815 -ftree-bit-ccp @gol
6816 -ftree-ccp @gol
6817 -ftree-ch @gol
6818 -ftree-coalesce-vars @gol
6819 -ftree-copy-prop @gol
6820 -ftree-dce @gol
6821 -ftree-dominator-opts @gol
6822 -ftree-dse @gol
6823 -ftree-forwprop @gol
6824 -ftree-fre @gol
6825 -ftree-phiprop @gol
6826 -ftree-sink @gol
6827 -ftree-slsr @gol
6828 -ftree-sra @gol
6829 -ftree-pta @gol
6830 -ftree-ter @gol
6831 -funit-at-a-time}
6832
6833 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6834 where doing so does not interfere with debugging.
6835
6836 @item -O2
6837 @opindex O2
6838 Optimize even more. GCC performs nearly all supported optimizations
6839 that do not involve a space-speed tradeoff.
6840 As compared to @option{-O}, this option increases both compilation time
6841 and the performance of the generated code.
6842
6843 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6844 also turns on the following optimization flags:
6845 @gccoptlist{-fthread-jumps @gol
6846 -falign-functions -falign-jumps @gol
6847 -falign-loops -falign-labels @gol
6848 -fcaller-saves @gol
6849 -fcrossjumping @gol
6850 -fcse-follow-jumps -fcse-skip-blocks @gol
6851 -fdelete-null-pointer-checks @gol
6852 -fdevirtualize -fdevirtualize-speculatively @gol
6853 -fexpensive-optimizations @gol
6854 -fgcse -fgcse-lm @gol
6855 -fhoist-adjacent-loads @gol
6856 -finline-small-functions @gol
6857 -findirect-inlining @gol
6858 -fipa-cp @gol
6859 -fipa-cp-alignment @gol
6860 -fipa-bit-cp @gol
6861 -fipa-sra @gol
6862 -fipa-icf @gol
6863 -fisolate-erroneous-paths-dereference @gol
6864 -flra-remat @gol
6865 -foptimize-sibling-calls @gol
6866 -foptimize-strlen @gol
6867 -fpartial-inlining @gol
6868 -fpeephole2 @gol
6869 -freorder-blocks-algorithm=stc @gol
6870 -freorder-blocks-and-partition -freorder-functions @gol
6871 -frerun-cse-after-loop @gol
6872 -fsched-interblock -fsched-spec @gol
6873 -fschedule-insns -fschedule-insns2 @gol
6874 -fstrict-aliasing -fstrict-overflow @gol
6875 -ftree-builtin-call-dce @gol
6876 -ftree-switch-conversion -ftree-tail-merge @gol
6877 -fcode-hoisting @gol
6878 -ftree-pre @gol
6879 -ftree-vrp @gol
6880 -fipa-ra}
6881
6882 Please note the warning under @option{-fgcse} about
6883 invoking @option{-O2} on programs that use computed gotos.
6884
6885 @item -O3
6886 @opindex O3
6887 Optimize yet more. @option{-O3} turns on all optimizations specified
6888 by @option{-O2} and also turns on the @option{-finline-functions},
6889 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6890 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
6891 @option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
6892 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
6893 @option{-ftree-partial-pre}, @option{-fpeel-loops}
6894 and @option{-fipa-cp-clone} options.
6895
6896 @item -O0
6897 @opindex O0
6898 Reduce compilation time and make debugging produce the expected
6899 results. This is the default.
6900
6901 @item -Os
6902 @opindex Os
6903 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6904 do not typically increase code size. It also performs further
6905 optimizations designed to reduce code size.
6906
6907 @option{-Os} disables the following optimization flags:
6908 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6909 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
6910 -freorder-blocks-and-partition -fprefetch-loop-arrays}
6911
6912 @item -Ofast
6913 @opindex Ofast
6914 Disregard strict standards compliance. @option{-Ofast} enables all
6915 @option{-O3} optimizations. It also enables optimizations that are not
6916 valid for all standard-compliant programs.
6917 It turns on @option{-ffast-math} and the Fortran-specific
6918 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6919
6920 @item -Og
6921 @opindex Og
6922 Optimize debugging experience. @option{-Og} enables optimizations
6923 that do not interfere with debugging. It should be the optimization
6924 level of choice for the standard edit-compile-debug cycle, offering
6925 a reasonable level of optimization while maintaining fast compilation
6926 and a good debugging experience.
6927 @end table
6928
6929 If you use multiple @option{-O} options, with or without level numbers,
6930 the last such option is the one that is effective.
6931
6932 Options of the form @option{-f@var{flag}} specify machine-independent
6933 flags. Most flags have both positive and negative forms; the negative
6934 form of @option{-ffoo} is @option{-fno-foo}. In the table
6935 below, only one of the forms is listed---the one you typically
6936 use. You can figure out the other form by either removing @samp{no-}
6937 or adding it.
6938
6939 The following options control specific optimizations. They are either
6940 activated by @option{-O} options or are related to ones that are. You
6941 can use the following flags in the rare cases when ``fine-tuning'' of
6942 optimizations to be performed is desired.
6943
6944 @table @gcctabopt
6945 @item -fno-defer-pop
6946 @opindex fno-defer-pop
6947 Always pop the arguments to each function call as soon as that function
6948 returns. For machines that must pop arguments after a function call,
6949 the compiler normally lets arguments accumulate on the stack for several
6950 function calls and pops them all at once.
6951
6952 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6953
6954 @item -fforward-propagate
6955 @opindex fforward-propagate
6956 Perform a forward propagation pass on RTL@. The pass tries to combine two
6957 instructions and checks if the result can be simplified. If loop unrolling
6958 is active, two passes are performed and the second is scheduled after
6959 loop unrolling.
6960
6961 This option is enabled by default at optimization levels @option{-O},
6962 @option{-O2}, @option{-O3}, @option{-Os}.
6963
6964 @item -ffp-contract=@var{style}
6965 @opindex ffp-contract
6966 @option{-ffp-contract=off} disables floating-point expression contraction.
6967 @option{-ffp-contract=fast} enables floating-point expression contraction
6968 such as forming of fused multiply-add operations if the target has
6969 native support for them.
6970 @option{-ffp-contract=on} enables floating-point expression contraction
6971 if allowed by the language standard. This is currently not implemented
6972 and treated equal to @option{-ffp-contract=off}.
6973
6974 The default is @option{-ffp-contract=fast}.
6975
6976 @item -fomit-frame-pointer
6977 @opindex fomit-frame-pointer
6978 Don't keep the frame pointer in a register for functions that
6979 don't need one. This avoids the instructions to save, set up and
6980 restore frame pointers; it also makes an extra register available
6981 in many functions. @strong{It also makes debugging impossible on
6982 some machines.}
6983
6984 On some machines, such as the VAX, this flag has no effect, because
6985 the standard calling sequence automatically handles the frame pointer
6986 and nothing is saved by pretending it doesn't exist. The
6987 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6988 whether a target machine supports this flag. @xref{Registers,,Register
6989 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6990
6991 The default setting (when not optimizing for
6992 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
6993 @option{-fomit-frame-pointer}. You can configure GCC with the
6994 @option{--enable-frame-pointer} configure option to change the default.
6995
6996 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6997
6998 @item -foptimize-sibling-calls
6999 @opindex foptimize-sibling-calls
7000 Optimize sibling and tail recursive calls.
7001
7002 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7003
7004 @item -foptimize-strlen
7005 @opindex foptimize-strlen
7006 Optimize various standard C string functions (e.g. @code{strlen},
7007 @code{strchr} or @code{strcpy}) and
7008 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7009
7010 Enabled at levels @option{-O2}, @option{-O3}.
7011
7012 @item -fno-inline
7013 @opindex fno-inline
7014 Do not expand any functions inline apart from those marked with
7015 the @code{always_inline} attribute. This is the default when not
7016 optimizing.
7017
7018 Single functions can be exempted from inlining by marking them
7019 with the @code{noinline} attribute.
7020
7021 @item -finline-small-functions
7022 @opindex finline-small-functions
7023 Integrate functions into their callers when their body is smaller than expected
7024 function call code (so overall size of program gets smaller). The compiler
7025 heuristically decides which functions are simple enough to be worth integrating
7026 in this way. This inlining applies to all functions, even those not declared
7027 inline.
7028
7029 Enabled at level @option{-O2}.
7030
7031 @item -findirect-inlining
7032 @opindex findirect-inlining
7033 Inline also indirect calls that are discovered to be known at compile
7034 time thanks to previous inlining. This option has any effect only
7035 when inlining itself is turned on by the @option{-finline-functions}
7036 or @option{-finline-small-functions} options.
7037
7038 Enabled at level @option{-O2}.
7039
7040 @item -finline-functions
7041 @opindex finline-functions
7042 Consider all functions for inlining, even if they are not declared inline.
7043 The compiler heuristically decides which functions are worth integrating
7044 in this way.
7045
7046 If all calls to a given function are integrated, and the function is
7047 declared @code{static}, then the function is normally not output as
7048 assembler code in its own right.
7049
7050 Enabled at level @option{-O3}.
7051
7052 @item -finline-functions-called-once
7053 @opindex finline-functions-called-once
7054 Consider all @code{static} functions called once for inlining into their
7055 caller even if they are not marked @code{inline}. If a call to a given
7056 function is integrated, then the function is not output as assembler code
7057 in its own right.
7058
7059 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7060
7061 @item -fearly-inlining
7062 @opindex fearly-inlining
7063 Inline functions marked by @code{always_inline} and functions whose body seems
7064 smaller than the function call overhead early before doing
7065 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7066 makes profiling significantly cheaper and usually inlining faster on programs
7067 having large chains of nested wrapper functions.
7068
7069 Enabled by default.
7070
7071 @item -fipa-sra
7072 @opindex fipa-sra
7073 Perform interprocedural scalar replacement of aggregates, removal of
7074 unused parameters and replacement of parameters passed by reference
7075 by parameters passed by value.
7076
7077 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7078
7079 @item -finline-limit=@var{n}
7080 @opindex finline-limit
7081 By default, GCC limits the size of functions that can be inlined. This flag
7082 allows coarse control of this limit. @var{n} is the size of functions that
7083 can be inlined in number of pseudo instructions.
7084
7085 Inlining is actually controlled by a number of parameters, which may be
7086 specified individually by using @option{--param @var{name}=@var{value}}.
7087 The @option{-finline-limit=@var{n}} option sets some of these parameters
7088 as follows:
7089
7090 @table @gcctabopt
7091 @item max-inline-insns-single
7092 is set to @var{n}/2.
7093 @item max-inline-insns-auto
7094 is set to @var{n}/2.
7095 @end table
7096
7097 See below for a documentation of the individual
7098 parameters controlling inlining and for the defaults of these parameters.
7099
7100 @emph{Note:} there may be no value to @option{-finline-limit} that results
7101 in default behavior.
7102
7103 @emph{Note:} pseudo instruction represents, in this particular context, an
7104 abstract measurement of function's size. In no way does it represent a count
7105 of assembly instructions and as such its exact meaning might change from one
7106 release to an another.
7107
7108 @item -fno-keep-inline-dllexport
7109 @opindex fno-keep-inline-dllexport
7110 This is a more fine-grained version of @option{-fkeep-inline-functions},
7111 which applies only to functions that are declared using the @code{dllexport}
7112 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
7113 Functions}.)
7114
7115 @item -fkeep-inline-functions
7116 @opindex fkeep-inline-functions
7117 In C, emit @code{static} functions that are declared @code{inline}
7118 into the object file, even if the function has been inlined into all
7119 of its callers. This switch does not affect functions using the
7120 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7121 inline functions into the object file.
7122
7123 @item -fkeep-static-functions
7124 @opindex fkeep-static-functions
7125 Emit @code{static} functions into the object file, even if the function
7126 is never used.
7127
7128 @item -fkeep-static-consts
7129 @opindex fkeep-static-consts
7130 Emit variables declared @code{static const} when optimization isn't turned
7131 on, even if the variables aren't referenced.
7132
7133 GCC enables this option by default. If you want to force the compiler to
7134 check if a variable is referenced, regardless of whether or not
7135 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7136
7137 @item -fmerge-constants
7138 @opindex fmerge-constants
7139 Attempt to merge identical constants (string constants and floating-point
7140 constants) across compilation units.
7141
7142 This option is the default for optimized compilation if the assembler and
7143 linker support it. Use @option{-fno-merge-constants} to inhibit this
7144 behavior.
7145
7146 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7147
7148 @item -fmerge-all-constants
7149 @opindex fmerge-all-constants
7150 Attempt to merge identical constants and identical variables.
7151
7152 This option implies @option{-fmerge-constants}. In addition to
7153 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7154 arrays or initialized constant variables with integral or floating-point
7155 types. Languages like C or C++ require each variable, including multiple
7156 instances of the same variable in recursive calls, to have distinct locations,
7157 so using this option results in non-conforming
7158 behavior.
7159
7160 @item -fmodulo-sched
7161 @opindex fmodulo-sched
7162 Perform swing modulo scheduling immediately before the first scheduling
7163 pass. This pass looks at innermost loops and reorders their
7164 instructions by overlapping different iterations.
7165
7166 @item -fmodulo-sched-allow-regmoves
7167 @opindex fmodulo-sched-allow-regmoves
7168 Perform more aggressive SMS-based modulo scheduling with register moves
7169 allowed. By setting this flag certain anti-dependences edges are
7170 deleted, which triggers the generation of reg-moves based on the
7171 life-range analysis. This option is effective only with
7172 @option{-fmodulo-sched} enabled.
7173
7174 @item -fno-branch-count-reg
7175 @opindex fno-branch-count-reg
7176 Avoid running a pass scanning for opportunities to use ``decrement and
7177 branch'' instructions on a count register instead of generating sequences
7178 of instructions that decrement a register, compare it against zero, and
7179 then branch based upon the result. This option is only meaningful on
7180 architectures that support such instructions, which include x86, PowerPC,
7181 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
7182 doesn't remove the decrement and branch instructions from the generated
7183 instruction stream introduced by other optimization passes.
7184
7185 Enabled by default at @option{-O1} and higher.
7186
7187 The default is @option{-fbranch-count-reg}.
7188
7189 @item -fno-function-cse
7190 @opindex fno-function-cse
7191 Do not put function addresses in registers; make each instruction that
7192 calls a constant function contain the function's address explicitly.
7193
7194 This option results in less efficient code, but some strange hacks
7195 that alter the assembler output may be confused by the optimizations
7196 performed when this option is not used.
7197
7198 The default is @option{-ffunction-cse}
7199
7200 @item -fno-zero-initialized-in-bss
7201 @opindex fno-zero-initialized-in-bss
7202 If the target supports a BSS section, GCC by default puts variables that
7203 are initialized to zero into BSS@. This can save space in the resulting
7204 code.
7205
7206 This option turns off this behavior because some programs explicitly
7207 rely on variables going to the data section---e.g., so that the
7208 resulting executable can find the beginning of that section and/or make
7209 assumptions based on that.
7210
7211 The default is @option{-fzero-initialized-in-bss}.
7212
7213 @item -fthread-jumps
7214 @opindex fthread-jumps
7215 Perform optimizations that check to see if a jump branches to a
7216 location where another comparison subsumed by the first is found. If
7217 so, the first branch is redirected to either the destination of the
7218 second branch or a point immediately following it, depending on whether
7219 the condition is known to be true or false.
7220
7221 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7222
7223 @item -fsplit-wide-types
7224 @opindex fsplit-wide-types
7225 When using a type that occupies multiple registers, such as @code{long
7226 long} on a 32-bit system, split the registers apart and allocate them
7227 independently. This normally generates better code for those types,
7228 but may make debugging more difficult.
7229
7230 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7231 @option{-Os}.
7232
7233 @item -fcse-follow-jumps
7234 @opindex fcse-follow-jumps
7235 In common subexpression elimination (CSE), scan through jump instructions
7236 when the target of the jump is not reached by any other path. For
7237 example, when CSE encounters an @code{if} statement with an
7238 @code{else} clause, CSE follows the jump when the condition
7239 tested is false.
7240
7241 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7242
7243 @item -fcse-skip-blocks
7244 @opindex fcse-skip-blocks
7245 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7246 follow jumps that conditionally skip over blocks. When CSE
7247 encounters a simple @code{if} statement with no else clause,
7248 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7249 body of the @code{if}.
7250
7251 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7252
7253 @item -frerun-cse-after-loop
7254 @opindex frerun-cse-after-loop
7255 Re-run common subexpression elimination after loop optimizations are
7256 performed.
7257
7258 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7259
7260 @item -fgcse
7261 @opindex fgcse
7262 Perform a global common subexpression elimination pass.
7263 This pass also performs global constant and copy propagation.
7264
7265 @emph{Note:} When compiling a program using computed gotos, a GCC
7266 extension, you may get better run-time performance if you disable
7267 the global common subexpression elimination pass by adding
7268 @option{-fno-gcse} to the command line.
7269
7270 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7271
7272 @item -fgcse-lm
7273 @opindex fgcse-lm
7274 When @option{-fgcse-lm} is enabled, global common subexpression elimination
7275 attempts to move loads that are only killed by stores into themselves. This
7276 allows a loop containing a load/store sequence to be changed to a load outside
7277 the loop, and a copy/store within the loop.
7278
7279 Enabled by default when @option{-fgcse} is enabled.
7280
7281 @item -fgcse-sm
7282 @opindex fgcse-sm
7283 When @option{-fgcse-sm} is enabled, a store motion pass is run after
7284 global common subexpression elimination. This pass attempts to move
7285 stores out of loops. When used in conjunction with @option{-fgcse-lm},
7286 loops containing a load/store sequence can be changed to a load before
7287 the loop and a store after the loop.
7288
7289 Not enabled at any optimization level.
7290
7291 @item -fgcse-las
7292 @opindex fgcse-las
7293 When @option{-fgcse-las} is enabled, the global common subexpression
7294 elimination pass eliminates redundant loads that come after stores to the
7295 same memory location (both partial and full redundancies).
7296
7297 Not enabled at any optimization level.
7298
7299 @item -fgcse-after-reload
7300 @opindex fgcse-after-reload
7301 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7302 pass is performed after reload. The purpose of this pass is to clean up
7303 redundant spilling.
7304
7305 @item -faggressive-loop-optimizations
7306 @opindex faggressive-loop-optimizations
7307 This option tells the loop optimizer to use language constraints to
7308 derive bounds for the number of iterations of a loop. This assumes that
7309 loop code does not invoke undefined behavior by for example causing signed
7310 integer overflows or out-of-bound array accesses. The bounds for the
7311 number of iterations of a loop are used to guide loop unrolling and peeling
7312 and loop exit test optimizations.
7313 This option is enabled by default.
7314
7315 @item -funconstrained-commons
7316 @opindex funconstrained-commons
7317 This option tells the compiler that variables declared in common blocks
7318 (e.g. Fortran) may later be overridden with longer trailing arrays. This
7319 prevents certain optimizations that depend on knowing the array bounds.
7320
7321 @item -fcrossjumping
7322 @opindex fcrossjumping
7323 Perform cross-jumping transformation.
7324 This transformation unifies equivalent code and saves code size. The
7325 resulting code may or may not perform better than without cross-jumping.
7326
7327 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7328
7329 @item -fauto-inc-dec
7330 @opindex fauto-inc-dec
7331 Combine increments or decrements of addresses with memory accesses.
7332 This pass is always skipped on architectures that do not have
7333 instructions to support this. Enabled by default at @option{-O} and
7334 higher on architectures that support this.
7335
7336 @item -fdce
7337 @opindex fdce
7338 Perform dead code elimination (DCE) on RTL@.
7339 Enabled by default at @option{-O} and higher.
7340
7341 @item -fdse
7342 @opindex fdse
7343 Perform dead store elimination (DSE) on RTL@.
7344 Enabled by default at @option{-O} and higher.
7345
7346 @item -fif-conversion
7347 @opindex fif-conversion
7348 Attempt to transform conditional jumps into branch-less equivalents. This
7349 includes use of conditional moves, min, max, set flags and abs instructions, and
7350 some tricks doable by standard arithmetics. The use of conditional execution
7351 on chips where it is available is controlled by @option{-fif-conversion2}.
7352
7353 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7354
7355 @item -fif-conversion2
7356 @opindex fif-conversion2
7357 Use conditional execution (where available) to transform conditional jumps into
7358 branch-less equivalents.
7359
7360 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7361
7362 @item -fdeclone-ctor-dtor
7363 @opindex fdeclone-ctor-dtor
7364 The C++ ABI requires multiple entry points for constructors and
7365 destructors: one for a base subobject, one for a complete object, and
7366 one for a virtual destructor that calls operator delete afterwards.
7367 For a hierarchy with virtual bases, the base and complete variants are
7368 clones, which means two copies of the function. With this option, the
7369 base and complete variants are changed to be thunks that call a common
7370 implementation.
7371
7372 Enabled by @option{-Os}.
7373
7374 @item -fdelete-null-pointer-checks
7375 @opindex fdelete-null-pointer-checks
7376 Assume that programs cannot safely dereference null pointers, and that
7377 no code or data element resides at address zero.
7378 This option enables simple constant
7379 folding optimizations at all optimization levels. In addition, other
7380 optimization passes in GCC use this flag to control global dataflow
7381 analyses that eliminate useless checks for null pointers; these assume
7382 that a memory access to address zero always results in a trap, so
7383 that if a pointer is checked after it has already been dereferenced,
7384 it cannot be null.
7385
7386 Note however that in some environments this assumption is not true.
7387 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
7388 for programs that depend on that behavior.
7389
7390 This option is enabled by default on most targets. On Nios II ELF, it
7391 defaults to off. On AVR and CR16, this option is completely disabled.
7392
7393 Passes that use the dataflow information
7394 are enabled independently at different optimization levels.
7395
7396 @item -fdevirtualize
7397 @opindex fdevirtualize
7398 Attempt to convert calls to virtual functions to direct calls. This
7399 is done both within a procedure and interprocedurally as part of
7400 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
7401 propagation (@option{-fipa-cp}).
7402 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7403
7404 @item -fdevirtualize-speculatively
7405 @opindex fdevirtualize-speculatively
7406 Attempt to convert calls to virtual functions to speculative direct calls.
7407 Based on the analysis of the type inheritance graph, determine for a given call
7408 the set of likely targets. If the set is small, preferably of size 1, change
7409 the call into a conditional deciding between direct and indirect calls. The
7410 speculative calls enable more optimizations, such as inlining. When they seem
7411 useless after further optimization, they are converted back into original form.
7412
7413 @item -fdevirtualize-at-ltrans
7414 @opindex fdevirtualize-at-ltrans
7415 Stream extra information needed for aggressive devirtualization when running
7416 the link-time optimizer in local transformation mode.
7417 This option enables more devirtualization but
7418 significantly increases the size of streamed data. For this reason it is
7419 disabled by default.
7420
7421 @item -fexpensive-optimizations
7422 @opindex fexpensive-optimizations
7423 Perform a number of minor optimizations that are relatively expensive.
7424
7425 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7426
7427 @item -free
7428 @opindex free
7429 Attempt to remove redundant extension instructions. This is especially
7430 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
7431 registers after writing to their lower 32-bit half.
7432
7433 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
7434 @option{-O3}, @option{-Os}.
7435
7436 @item -fno-lifetime-dse
7437 @opindex fno-lifetime-dse
7438 In C++ the value of an object is only affected by changes within its
7439 lifetime: when the constructor begins, the object has an indeterminate
7440 value, and any changes during the lifetime of the object are dead when
7441 the object is destroyed. Normally dead store elimination will take
7442 advantage of this; if your code relies on the value of the object
7443 storage persisting beyond the lifetime of the object, you can use this
7444 flag to disable this optimization. To preserve stores before the
7445 constructor starts (e.g. because your operator new clears the object
7446 storage) but still treat the object as dead after the destructor you,
7447 can use @option{-flifetime-dse=1}. The default behavior can be
7448 explicitly selected with @option{-flifetime-dse=2}.
7449 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
7450
7451 @item -flive-range-shrinkage
7452 @opindex flive-range-shrinkage
7453 Attempt to decrease register pressure through register live range
7454 shrinkage. This is helpful for fast processors with small or moderate
7455 size register sets.
7456
7457 @item -fira-algorithm=@var{algorithm}
7458 @opindex fira-algorithm
7459 Use the specified coloring algorithm for the integrated register
7460 allocator. The @var{algorithm} argument can be @samp{priority}, which
7461 specifies Chow's priority coloring, or @samp{CB}, which specifies
7462 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
7463 for all architectures, but for those targets that do support it, it is
7464 the default because it generates better code.
7465
7466 @item -fira-region=@var{region}
7467 @opindex fira-region
7468 Use specified regions for the integrated register allocator. The
7469 @var{region} argument should be one of the following:
7470
7471 @table @samp
7472
7473 @item all
7474 Use all loops as register allocation regions.
7475 This can give the best results for machines with a small and/or
7476 irregular register set.
7477
7478 @item mixed
7479 Use all loops except for loops with small register pressure
7480 as the regions. This value usually gives
7481 the best results in most cases and for most architectures,
7482 and is enabled by default when compiling with optimization for speed
7483 (@option{-O}, @option{-O2}, @dots{}).
7484
7485 @item one
7486 Use all functions as a single region.
7487 This typically results in the smallest code size, and is enabled by default for
7488 @option{-Os} or @option{-O0}.
7489
7490 @end table
7491
7492 @item -fira-hoist-pressure
7493 @opindex fira-hoist-pressure
7494 Use IRA to evaluate register pressure in the code hoisting pass for
7495 decisions to hoist expressions. This option usually results in smaller
7496 code, but it can slow the compiler down.
7497
7498 This option is enabled at level @option{-Os} for all targets.
7499
7500 @item -fira-loop-pressure
7501 @opindex fira-loop-pressure
7502 Use IRA to evaluate register pressure in loops for decisions to move
7503 loop invariants. This option usually results in generation
7504 of faster and smaller code on machines with large register files (>= 32
7505 registers), but it can slow the compiler down.
7506
7507 This option is enabled at level @option{-O3} for some targets.
7508
7509 @item -fno-ira-share-save-slots
7510 @opindex fno-ira-share-save-slots
7511 Disable sharing of stack slots used for saving call-used hard
7512 registers living through a call. Each hard register gets a
7513 separate stack slot, and as a result function stack frames are
7514 larger.
7515
7516 @item -fno-ira-share-spill-slots
7517 @opindex fno-ira-share-spill-slots
7518 Disable sharing of stack slots allocated for pseudo-registers. Each
7519 pseudo-register that does not get a hard register gets a separate
7520 stack slot, and as a result function stack frames are larger.
7521
7522 @item -flra-remat
7523 @opindex flra-remat
7524 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7525 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7526 values if it is profitable.
7527
7528 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7529
7530 @item -fdelayed-branch
7531 @opindex fdelayed-branch
7532 If supported for the target machine, attempt to reorder instructions
7533 to exploit instruction slots available after delayed branch
7534 instructions.
7535
7536 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7537
7538 @item -fschedule-insns
7539 @opindex fschedule-insns
7540 If supported for the target machine, attempt to reorder instructions to
7541 eliminate execution stalls due to required data being unavailable. This
7542 helps machines that have slow floating point or memory load instructions
7543 by allowing other instructions to be issued until the result of the load
7544 or floating-point instruction is required.
7545
7546 Enabled at levels @option{-O2}, @option{-O3}.
7547
7548 @item -fschedule-insns2
7549 @opindex fschedule-insns2
7550 Similar to @option{-fschedule-insns}, but requests an additional pass of
7551 instruction scheduling after register allocation has been done. This is
7552 especially useful on machines with a relatively small number of
7553 registers and where memory load instructions take more than one cycle.
7554
7555 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7556
7557 @item -fno-sched-interblock
7558 @opindex fno-sched-interblock
7559 Don't schedule instructions across basic blocks. This is normally
7560 enabled by default when scheduling before register allocation, i.e.@:
7561 with @option{-fschedule-insns} or at @option{-O2} or higher.
7562
7563 @item -fno-sched-spec
7564 @opindex fno-sched-spec
7565 Don't allow speculative motion of non-load instructions. This is normally
7566 enabled by default when scheduling before register allocation, i.e.@:
7567 with @option{-fschedule-insns} or at @option{-O2} or higher.
7568
7569 @item -fsched-pressure
7570 @opindex fsched-pressure
7571 Enable register pressure sensitive insn scheduling before register
7572 allocation. This only makes sense when scheduling before register
7573 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7574 @option{-O2} or higher. Usage of this option can improve the
7575 generated code and decrease its size by preventing register pressure
7576 increase above the number of available hard registers and subsequent
7577 spills in register allocation.
7578
7579 @item -fsched-spec-load
7580 @opindex fsched-spec-load
7581 Allow speculative motion of some load instructions. This only makes
7582 sense when scheduling before register allocation, i.e.@: with
7583 @option{-fschedule-insns} or at @option{-O2} or higher.
7584
7585 @item -fsched-spec-load-dangerous
7586 @opindex fsched-spec-load-dangerous
7587 Allow speculative motion of more load instructions. This only makes
7588 sense when scheduling before register allocation, i.e.@: with
7589 @option{-fschedule-insns} or at @option{-O2} or higher.
7590
7591 @item -fsched-stalled-insns
7592 @itemx -fsched-stalled-insns=@var{n}
7593 @opindex fsched-stalled-insns
7594 Define how many insns (if any) can be moved prematurely from the queue
7595 of stalled insns into the ready list during the second scheduling pass.
7596 @option{-fno-sched-stalled-insns} means that no insns are moved
7597 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7598 on how many queued insns can be moved prematurely.
7599 @option{-fsched-stalled-insns} without a value is equivalent to
7600 @option{-fsched-stalled-insns=1}.
7601
7602 @item -fsched-stalled-insns-dep
7603 @itemx -fsched-stalled-insns-dep=@var{n}
7604 @opindex fsched-stalled-insns-dep
7605 Define how many insn groups (cycles) are examined for a dependency
7606 on a stalled insn that is a candidate for premature removal from the queue
7607 of stalled insns. This has an effect only during the second scheduling pass,
7608 and only if @option{-fsched-stalled-insns} is used.
7609 @option{-fno-sched-stalled-insns-dep} is equivalent to
7610 @option{-fsched-stalled-insns-dep=0}.
7611 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7612 @option{-fsched-stalled-insns-dep=1}.
7613
7614 @item -fsched2-use-superblocks
7615 @opindex fsched2-use-superblocks
7616 When scheduling after register allocation, use superblock scheduling.
7617 This allows motion across basic block boundaries,
7618 resulting in faster schedules. This option is experimental, as not all machine
7619 descriptions used by GCC model the CPU closely enough to avoid unreliable
7620 results from the algorithm.
7621
7622 This only makes sense when scheduling after register allocation, i.e.@: with
7623 @option{-fschedule-insns2} or at @option{-O2} or higher.
7624
7625 @item -fsched-group-heuristic
7626 @opindex fsched-group-heuristic
7627 Enable the group heuristic in the scheduler. This heuristic favors
7628 the instruction that belongs to a schedule group. This is enabled
7629 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7630 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7631
7632 @item -fsched-critical-path-heuristic
7633 @opindex fsched-critical-path-heuristic
7634 Enable the critical-path heuristic in the scheduler. This heuristic favors
7635 instructions on the critical path. This is enabled by default when
7636 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7637 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7638
7639 @item -fsched-spec-insn-heuristic
7640 @opindex fsched-spec-insn-heuristic
7641 Enable the speculative instruction heuristic in the scheduler. This
7642 heuristic favors speculative instructions with greater dependency weakness.
7643 This is enabled by default when scheduling is enabled, i.e.@:
7644 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7645 or at @option{-O2} or higher.
7646
7647 @item -fsched-rank-heuristic
7648 @opindex fsched-rank-heuristic
7649 Enable the rank heuristic in the scheduler. This heuristic favors
7650 the instruction belonging to a basic block with greater size or frequency.
7651 This is enabled by default when scheduling is enabled, i.e.@:
7652 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7653 at @option{-O2} or higher.
7654
7655 @item -fsched-last-insn-heuristic
7656 @opindex fsched-last-insn-heuristic
7657 Enable the last-instruction heuristic in the scheduler. This heuristic
7658 favors the instruction that is less dependent on the last instruction
7659 scheduled. This is enabled by default when scheduling is enabled,
7660 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7661 at @option{-O2} or higher.
7662
7663 @item -fsched-dep-count-heuristic
7664 @opindex fsched-dep-count-heuristic
7665 Enable the dependent-count heuristic in the scheduler. This heuristic
7666 favors the instruction that has more instructions depending on it.
7667 This is enabled by default when scheduling is enabled, i.e.@:
7668 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7669 at @option{-O2} or higher.
7670
7671 @item -freschedule-modulo-scheduled-loops
7672 @opindex freschedule-modulo-scheduled-loops
7673 Modulo scheduling is performed before traditional scheduling. If a loop
7674 is modulo scheduled, later scheduling passes may change its schedule.
7675 Use this option to control that behavior.
7676
7677 @item -fselective-scheduling
7678 @opindex fselective-scheduling
7679 Schedule instructions using selective scheduling algorithm. Selective
7680 scheduling runs instead of the first scheduler pass.
7681
7682 @item -fselective-scheduling2
7683 @opindex fselective-scheduling2
7684 Schedule instructions using selective scheduling algorithm. Selective
7685 scheduling runs instead of the second scheduler pass.
7686
7687 @item -fsel-sched-pipelining
7688 @opindex fsel-sched-pipelining
7689 Enable software pipelining of innermost loops during selective scheduling.
7690 This option has no effect unless one of @option{-fselective-scheduling} or
7691 @option{-fselective-scheduling2} is turned on.
7692
7693 @item -fsel-sched-pipelining-outer-loops
7694 @opindex fsel-sched-pipelining-outer-loops
7695 When pipelining loops during selective scheduling, also pipeline outer loops.
7696 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7697
7698 @item -fsemantic-interposition
7699 @opindex fsemantic-interposition
7700 Some object formats, like ELF, allow interposing of symbols by the
7701 dynamic linker.
7702 This means that for symbols exported from the DSO, the compiler cannot perform
7703 interprocedural propagation, inlining and other optimizations in anticipation
7704 that the function or variable in question may change. While this feature is
7705 useful, for example, to rewrite memory allocation functions by a debugging
7706 implementation, it is expensive in the terms of code quality.
7707 With @option{-fno-semantic-interposition} the compiler assumes that
7708 if interposition happens for functions the overwriting function will have
7709 precisely the same semantics (and side effects).
7710 Similarly if interposition happens
7711 for variables, the constructor of the variable will be the same. The flag
7712 has no effect for functions explicitly declared inline
7713 (where it is never allowed for interposition to change semantics)
7714 and for symbols explicitly declared weak.
7715
7716 @item -fshrink-wrap
7717 @opindex fshrink-wrap
7718 Emit function prologues only before parts of the function that need it,
7719 rather than at the top of the function. This flag is enabled by default at
7720 @option{-O} and higher.
7721
7722 @item -fshrink-wrap-separate
7723 @opindex fshrink-wrap-separate
7724 Shrink-wrap separate parts of the prologue and epilogue separately, so that
7725 those parts are only executed when needed.
7726 This option is on by default, but has no effect unless @option{-fshrink-wrap}
7727 is also turned on and the target supports this.
7728
7729 @item -fcaller-saves
7730 @opindex fcaller-saves
7731 Enable allocation of values to registers that are clobbered by
7732 function calls, by emitting extra instructions to save and restore the
7733 registers around such calls. Such allocation is done only when it
7734 seems to result in better code.
7735
7736 This option is always enabled by default on certain machines, usually
7737 those which have no call-preserved registers to use instead.
7738
7739 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7740
7741 @item -fcombine-stack-adjustments
7742 @opindex fcombine-stack-adjustments
7743 Tracks stack adjustments (pushes and pops) and stack memory references
7744 and then tries to find ways to combine them.
7745
7746 Enabled by default at @option{-O1} and higher.
7747
7748 @item -fipa-ra
7749 @opindex fipa-ra
7750 Use caller save registers for allocation if those registers are not used by
7751 any called function. In that case it is not necessary to save and restore
7752 them around calls. This is only possible if called functions are part of
7753 same compilation unit as current function and they are compiled before it.
7754
7755 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
7756 is disabled if generated code will be instrumented for profiling
7757 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
7758 exactly (this happens on targets that do not expose prologues
7759 and epilogues in RTL).
7760
7761 @item -fconserve-stack
7762 @opindex fconserve-stack
7763 Attempt to minimize stack usage. The compiler attempts to use less
7764 stack space, even if that makes the program slower. This option
7765 implies setting the @option{large-stack-frame} parameter to 100
7766 and the @option{large-stack-frame-growth} parameter to 400.
7767
7768 @item -ftree-reassoc
7769 @opindex ftree-reassoc
7770 Perform reassociation on trees. This flag is enabled by default
7771 at @option{-O} and higher.
7772
7773 @item -fcode-hoisting
7774 @opindex fcode-hoisting
7775 Perform code hoisting. Code hoisting tries to move the
7776 evaluation of expressions executed on all paths to the function exit
7777 as early as possible. This is especially useful as a code size
7778 optimization, but it often helps for code speed as well.
7779 This flag is enabled by default at @option{-O2} and higher.
7780
7781 @item -ftree-pre
7782 @opindex ftree-pre
7783 Perform partial redundancy elimination (PRE) on trees. This flag is
7784 enabled by default at @option{-O2} and @option{-O3}.
7785
7786 @item -ftree-partial-pre
7787 @opindex ftree-partial-pre
7788 Make partial redundancy elimination (PRE) more aggressive. This flag is
7789 enabled by default at @option{-O3}.
7790
7791 @item -ftree-forwprop
7792 @opindex ftree-forwprop
7793 Perform forward propagation on trees. This flag is enabled by default
7794 at @option{-O} and higher.
7795
7796 @item -ftree-fre
7797 @opindex ftree-fre
7798 Perform full redundancy elimination (FRE) on trees. The difference
7799 between FRE and PRE is that FRE only considers expressions
7800 that are computed on all paths leading to the redundant computation.
7801 This analysis is faster than PRE, though it exposes fewer redundancies.
7802 This flag is enabled by default at @option{-O} and higher.
7803
7804 @item -ftree-phiprop
7805 @opindex ftree-phiprop
7806 Perform hoisting of loads from conditional pointers on trees. This
7807 pass is enabled by default at @option{-O} and higher.
7808
7809 @item -fhoist-adjacent-loads
7810 @opindex fhoist-adjacent-loads
7811 Speculatively hoist loads from both branches of an if-then-else if the
7812 loads are from adjacent locations in the same structure and the target
7813 architecture has a conditional move instruction. This flag is enabled
7814 by default at @option{-O2} and higher.
7815
7816 @item -ftree-copy-prop
7817 @opindex ftree-copy-prop
7818 Perform copy propagation on trees. This pass eliminates unnecessary
7819 copy operations. This flag is enabled by default at @option{-O} and
7820 higher.
7821
7822 @item -fipa-pure-const
7823 @opindex fipa-pure-const
7824 Discover which functions are pure or constant.
7825 Enabled by default at @option{-O} and higher.
7826
7827 @item -fipa-reference
7828 @opindex fipa-reference
7829 Discover which static variables do not escape the
7830 compilation unit.
7831 Enabled by default at @option{-O} and higher.
7832
7833 @item -fipa-pta
7834 @opindex fipa-pta
7835 Perform interprocedural pointer analysis and interprocedural modification
7836 and reference analysis. This option can cause excessive memory and
7837 compile-time usage on large compilation units. It is not enabled by
7838 default at any optimization level.
7839
7840 @item -fipa-profile
7841 @opindex fipa-profile
7842 Perform interprocedural profile propagation. The functions called only from
7843 cold functions are marked as cold. Also functions executed once (such as
7844 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7845 functions and loop less parts of functions executed once are then optimized for
7846 size.
7847 Enabled by default at @option{-O} and higher.
7848
7849 @item -fipa-cp
7850 @opindex fipa-cp
7851 Perform interprocedural constant propagation.
7852 This optimization analyzes the program to determine when values passed
7853 to functions are constants and then optimizes accordingly.
7854 This optimization can substantially increase performance
7855 if the application has constants passed to functions.
7856 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7857
7858 @item -fipa-cp-clone
7859 @opindex fipa-cp-clone
7860 Perform function cloning to make interprocedural constant propagation stronger.
7861 When enabled, interprocedural constant propagation performs function cloning
7862 when externally visible function can be called with constant arguments.
7863 Because this optimization can create multiple copies of functions,
7864 it may significantly increase code size
7865 (see @option{--param ipcp-unit-growth=@var{value}}).
7866 This flag is enabled by default at @option{-O3}.
7867
7868 @item -fipa-cp-alignment
7869 @opindex -fipa-cp-alignment
7870 When enabled, this optimization propagates alignment of function
7871 parameters to support better vectorization and string operations.
7872
7873 This flag is enabled by default at @option{-O2} and @option{-Os}. It
7874 requires that @option{-fipa-cp} is enabled.
7875 @option{-fipa-cp-alignment} is obsolete, use @option{-fipa-bit-cp} instead.
7876
7877 @item -fipa-bit-cp
7878 @opindex -fipa-bit-cp
7879 When enabled, perform ipa bitwise constant propagation. This flag is
7880 enabled by default at @option{-O2}. It requires that @option{-fipa-cp}
7881 is enabled.
7882
7883 @item -fipa-icf
7884 @opindex fipa-icf
7885 Perform Identical Code Folding for functions and read-only variables.
7886 The optimization reduces code size and may disturb unwind stacks by replacing
7887 a function by equivalent one with a different name. The optimization works
7888 more effectively with link time optimization enabled.
7889
7890 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
7891 works on different levels and thus the optimizations are not same - there are
7892 equivalences that are found only by GCC and equivalences found only by Gold.
7893
7894 This flag is enabled by default at @option{-O2} and @option{-Os}.
7895
7896 @item -fisolate-erroneous-paths-dereference
7897 @opindex fisolate-erroneous-paths-dereference
7898 Detect paths that trigger erroneous or undefined behavior due to
7899 dereferencing a null pointer. Isolate those paths from the main control
7900 flow and turn the statement with erroneous or undefined behavior into a trap.
7901 This flag is enabled by default at @option{-O2} and higher and depends on
7902 @option{-fdelete-null-pointer-checks} also being enabled.
7903
7904 @item -fisolate-erroneous-paths-attribute
7905 @opindex fisolate-erroneous-paths-attribute
7906 Detect paths that trigger erroneous or undefined behavior due a null value
7907 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
7908 attribute. Isolate those paths from the main control flow and turn the
7909 statement with erroneous or undefined behavior into a trap. This is not
7910 currently enabled, but may be enabled by @option{-O2} in the future.
7911
7912 @item -ftree-sink
7913 @opindex ftree-sink
7914 Perform forward store motion on trees. This flag is
7915 enabled by default at @option{-O} and higher.
7916
7917 @item -ftree-bit-ccp
7918 @opindex ftree-bit-ccp
7919 Perform sparse conditional bit constant propagation on trees and propagate
7920 pointer alignment information.
7921 This pass only operates on local scalar variables and is enabled by default
7922 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7923
7924 @item -ftree-ccp
7925 @opindex ftree-ccp
7926 Perform sparse conditional constant propagation (CCP) on trees. This
7927 pass only operates on local scalar variables and is enabled by default
7928 at @option{-O} and higher.
7929
7930 @item -fssa-backprop
7931 @opindex fssa-backprop
7932 Propagate information about uses of a value up the definition chain
7933 in order to simplify the definitions. For example, this pass strips
7934 sign operations if the sign of a value never matters. The flag is
7935 enabled by default at @option{-O} and higher.
7936
7937 @item -fssa-phiopt
7938 @opindex fssa-phiopt
7939 Perform pattern matching on SSA PHI nodes to optimize conditional
7940 code. This pass is enabled by default at @option{-O} and higher.
7941
7942 @item -ftree-switch-conversion
7943 @opindex ftree-switch-conversion
7944 Perform conversion of simple initializations in a switch to
7945 initializations from a scalar array. This flag is enabled by default
7946 at @option{-O2} and higher.
7947
7948 @item -ftree-tail-merge
7949 @opindex ftree-tail-merge
7950 Look for identical code sequences. When found, replace one with a jump to the
7951 other. This optimization is known as tail merging or cross jumping. This flag
7952 is enabled by default at @option{-O2} and higher. The compilation time
7953 in this pass can
7954 be limited using @option{max-tail-merge-comparisons} parameter and
7955 @option{max-tail-merge-iterations} parameter.
7956
7957 @item -ftree-dce
7958 @opindex ftree-dce
7959 Perform dead code elimination (DCE) on trees. This flag is enabled by
7960 default at @option{-O} and higher.
7961
7962 @item -ftree-builtin-call-dce
7963 @opindex ftree-builtin-call-dce
7964 Perform conditional dead code elimination (DCE) for calls to built-in functions
7965 that may set @code{errno} but are otherwise side-effect free. This flag is
7966 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7967 specified.
7968
7969 @item -ftree-dominator-opts
7970 @opindex ftree-dominator-opts
7971 Perform a variety of simple scalar cleanups (constant/copy
7972 propagation, redundancy elimination, range propagation and expression
7973 simplification) based on a dominator tree traversal. This also
7974 performs jump threading (to reduce jumps to jumps). This flag is
7975 enabled by default at @option{-O} and higher.
7976
7977 @item -ftree-dse
7978 @opindex ftree-dse
7979 Perform dead store elimination (DSE) on trees. A dead store is a store into
7980 a memory location that is later overwritten by another store without
7981 any intervening loads. In this case the earlier store can be deleted. This
7982 flag is enabled by default at @option{-O} and higher.
7983
7984 @item -ftree-ch
7985 @opindex ftree-ch
7986 Perform loop header copying on trees. This is beneficial since it increases
7987 effectiveness of code motion optimizations. It also saves one jump. This flag
7988 is enabled by default at @option{-O} and higher. It is not enabled
7989 for @option{-Os}, since it usually increases code size.
7990
7991 @item -ftree-loop-optimize
7992 @opindex ftree-loop-optimize
7993 Perform loop optimizations on trees. This flag is enabled by default
7994 at @option{-O} and higher.
7995
7996 @item -ftree-loop-linear
7997 @itemx -floop-interchange
7998 @itemx -floop-strip-mine
7999 @itemx -floop-block
8000 @itemx -floop-unroll-and-jam
8001 @opindex ftree-loop-linear
8002 @opindex floop-interchange
8003 @opindex floop-strip-mine
8004 @opindex floop-block
8005 @opindex floop-unroll-and-jam
8006 Perform loop nest optimizations. Same as
8007 @option{-floop-nest-optimize}. To use this code transformation, GCC has
8008 to be configured with @option{--with-isl} to enable the Graphite loop
8009 transformation infrastructure.
8010
8011 @item -fgraphite-identity
8012 @opindex fgraphite-identity
8013 Enable the identity transformation for graphite. For every SCoP we generate
8014 the polyhedral representation and transform it back to gimple. Using
8015 @option{-fgraphite-identity} we can check the costs or benefits of the
8016 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8017 are also performed by the code generator isl, like index splitting and
8018 dead code elimination in loops.
8019
8020 @item -floop-nest-optimize
8021 @opindex floop-nest-optimize
8022 Enable the isl based loop nest optimizer. This is a generic loop nest
8023 optimizer based on the Pluto optimization algorithms. It calculates a loop
8024 structure optimized for data-locality and parallelism. This option
8025 is experimental.
8026
8027 @item -floop-parallelize-all
8028 @opindex floop-parallelize-all
8029 Use the Graphite data dependence analysis to identify loops that can
8030 be parallelized. Parallelize all the loops that can be analyzed to
8031 not contain loop carried dependences without checking that it is
8032 profitable to parallelize the loops.
8033
8034 @item -ftree-coalesce-vars
8035 @opindex ftree-coalesce-vars
8036 While transforming the program out of the SSA representation, attempt to
8037 reduce copying by coalescing versions of different user-defined
8038 variables, instead of just compiler temporaries. This may severely
8039 limit the ability to debug an optimized program compiled with
8040 @option{-fno-var-tracking-assignments}. In the negated form, this flag
8041 prevents SSA coalescing of user variables. This option is enabled by
8042 default if optimization is enabled, and it does very little otherwise.
8043
8044 @item -ftree-loop-if-convert
8045 @opindex ftree-loop-if-convert
8046 Attempt to transform conditional jumps in the innermost loops to
8047 branch-less equivalents. The intent is to remove control-flow from
8048 the innermost loops in order to improve the ability of the
8049 vectorization pass to handle these loops. This is enabled by default
8050 if vectorization is enabled.
8051
8052 @item -ftree-loop-if-convert-stores
8053 @opindex ftree-loop-if-convert-stores
8054 Attempt to also if-convert conditional jumps containing memory writes.
8055 This transformation can be unsafe for multi-threaded programs as it
8056 transforms conditional memory writes into unconditional memory writes.
8057 For example,
8058 @smallexample
8059 for (i = 0; i < N; i++)
8060 if (cond)
8061 A[i] = expr;
8062 @end smallexample
8063 is transformed to
8064 @smallexample
8065 for (i = 0; i < N; i++)
8066 A[i] = cond ? expr : A[i];
8067 @end smallexample
8068 potentially producing data races.
8069
8070 @item -ftree-loop-distribution
8071 @opindex ftree-loop-distribution
8072 Perform loop distribution. This flag can improve cache performance on
8073 big loop bodies and allow further loop optimizations, like
8074 parallelization or vectorization, to take place. For example, the loop
8075 @smallexample
8076 DO I = 1, N
8077 A(I) = B(I) + C
8078 D(I) = E(I) * F
8079 ENDDO
8080 @end smallexample
8081 is transformed to
8082 @smallexample
8083 DO I = 1, N
8084 A(I) = B(I) + C
8085 ENDDO
8086 DO I = 1, N
8087 D(I) = E(I) * F
8088 ENDDO
8089 @end smallexample
8090
8091 @item -ftree-loop-distribute-patterns
8092 @opindex ftree-loop-distribute-patterns
8093 Perform loop distribution of patterns that can be code generated with
8094 calls to a library. This flag is enabled by default at @option{-O3}.
8095
8096 This pass distributes the initialization loops and generates a call to
8097 memset zero. For example, the loop
8098 @smallexample
8099 DO I = 1, N
8100 A(I) = 0
8101 B(I) = A(I) + I
8102 ENDDO
8103 @end smallexample
8104 is transformed to
8105 @smallexample
8106 DO I = 1, N
8107 A(I) = 0
8108 ENDDO
8109 DO I = 1, N
8110 B(I) = A(I) + I
8111 ENDDO
8112 @end smallexample
8113 and the initialization loop is transformed into a call to memset zero.
8114
8115 @item -ftree-loop-im
8116 @opindex ftree-loop-im
8117 Perform loop invariant motion on trees. This pass moves only invariants that
8118 are hard to handle at RTL level (function calls, operations that expand to
8119 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8120 operands of conditions that are invariant out of the loop, so that we can use
8121 just trivial invariantness analysis in loop unswitching. The pass also includes
8122 store motion.
8123
8124 @item -ftree-loop-ivcanon
8125 @opindex ftree-loop-ivcanon
8126 Create a canonical counter for number of iterations in loops for which
8127 determining number of iterations requires complicated analysis. Later
8128 optimizations then may determine the number easily. Useful especially
8129 in connection with unrolling.
8130
8131 @item -fivopts
8132 @opindex fivopts
8133 Perform induction variable optimizations (strength reduction, induction
8134 variable merging and induction variable elimination) on trees.
8135
8136 @item -ftree-parallelize-loops=n
8137 @opindex ftree-parallelize-loops
8138 Parallelize loops, i.e., split their iteration space to run in n threads.
8139 This is only possible for loops whose iterations are independent
8140 and can be arbitrarily reordered. The optimization is only
8141 profitable on multiprocessor machines, for loops that are CPU-intensive,
8142 rather than constrained e.g.@: by memory bandwidth. This option
8143 implies @option{-pthread}, and thus is only supported on targets
8144 that have support for @option{-pthread}.
8145
8146 @item -ftree-pta
8147 @opindex ftree-pta
8148 Perform function-local points-to analysis on trees. This flag is
8149 enabled by default at @option{-O} and higher.
8150
8151 @item -ftree-sra
8152 @opindex ftree-sra
8153 Perform scalar replacement of aggregates. This pass replaces structure
8154 references with scalars to prevent committing structures to memory too
8155 early. This flag is enabled by default at @option{-O} and higher.
8156
8157 @item -fstore-merging
8158 @opindex fstore-merging
8159 Perform merging of narrow stores to consecutive memory addresses. This pass
8160 merges contiguous stores of immediate values narrower than a word into fewer
8161 wider stores to reduce the number of instructions. This is enabled by default
8162 at @option{-O} and higher.
8163
8164 @item -ftree-ter
8165 @opindex ftree-ter
8166 Perform temporary expression replacement during the SSA->normal phase. Single
8167 use/single def temporaries are replaced at their use location with their
8168 defining expression. This results in non-GIMPLE code, but gives the expanders
8169 much more complex trees to work on resulting in better RTL generation. This is
8170 enabled by default at @option{-O} and higher.
8171
8172 @item -ftree-slsr
8173 @opindex ftree-slsr
8174 Perform straight-line strength reduction on trees. This recognizes related
8175 expressions involving multiplications and replaces them by less expensive
8176 calculations when possible. This is enabled by default at @option{-O} and
8177 higher.
8178
8179 @item -ftree-vectorize
8180 @opindex ftree-vectorize
8181 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8182 and @option{-ftree-slp-vectorize} if not explicitly specified.
8183
8184 @item -ftree-loop-vectorize
8185 @opindex ftree-loop-vectorize
8186 Perform loop vectorization on trees. This flag is enabled by default at
8187 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8188
8189 @item -ftree-slp-vectorize
8190 @opindex ftree-slp-vectorize
8191 Perform basic block vectorization on trees. This flag is enabled by default at
8192 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8193
8194 @item -fvect-cost-model=@var{model}
8195 @opindex fvect-cost-model
8196 Alter the cost model used for vectorization. The @var{model} argument
8197 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
8198 With the @samp{unlimited} model the vectorized code-path is assumed
8199 to be profitable while with the @samp{dynamic} model a runtime check
8200 guards the vectorized code-path to enable it only for iteration
8201 counts that will likely execute faster than when executing the original
8202 scalar loop. The @samp{cheap} model disables vectorization of
8203 loops where doing so would be cost prohibitive for example due to
8204 required runtime checks for data dependence or alignment but otherwise
8205 is equal to the @samp{dynamic} model.
8206 The default cost model depends on other optimization flags and is
8207 either @samp{dynamic} or @samp{cheap}.
8208
8209 @item -fsimd-cost-model=@var{model}
8210 @opindex fsimd-cost-model
8211 Alter the cost model used for vectorization of loops marked with the OpenMP
8212 or Cilk Plus simd directive. The @var{model} argument should be one of
8213 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
8214 have the same meaning as described in @option{-fvect-cost-model} and by
8215 default a cost model defined with @option{-fvect-cost-model} is used.
8216
8217 @item -ftree-vrp
8218 @opindex ftree-vrp
8219 Perform Value Range Propagation on trees. This is similar to the
8220 constant propagation pass, but instead of values, ranges of values are
8221 propagated. This allows the optimizers to remove unnecessary range
8222 checks like array bound checks and null pointer checks. This is
8223 enabled by default at @option{-O2} and higher. Null pointer check
8224 elimination is only done if @option{-fdelete-null-pointer-checks} is
8225 enabled.
8226
8227 @item -fsplit-paths
8228 @opindex fsplit-paths
8229 Split paths leading to loop backedges. This can improve dead code
8230 elimination and common subexpression elimination. This is enabled by
8231 default at @option{-O2} and above.
8232
8233 @item -fsplit-ivs-in-unroller
8234 @opindex fsplit-ivs-in-unroller
8235 Enables expression of values of induction variables in later iterations
8236 of the unrolled loop using the value in the first iteration. This breaks
8237 long dependency chains, thus improving efficiency of the scheduling passes.
8238
8239 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8240 same effect. However, that is not reliable in cases where the loop body
8241 is more complicated than a single basic block. It also does not work at all
8242 on some architectures due to restrictions in the CSE pass.
8243
8244 This optimization is enabled by default.
8245
8246 @item -fvariable-expansion-in-unroller
8247 @opindex fvariable-expansion-in-unroller
8248 With this option, the compiler creates multiple copies of some
8249 local variables when unrolling a loop, which can result in superior code.
8250
8251 @item -fpartial-inlining
8252 @opindex fpartial-inlining
8253 Inline parts of functions. This option has any effect only
8254 when inlining itself is turned on by the @option{-finline-functions}
8255 or @option{-finline-small-functions} options.
8256
8257 Enabled at level @option{-O2}.
8258
8259 @item -fpredictive-commoning
8260 @opindex fpredictive-commoning
8261 Perform predictive commoning optimization, i.e., reusing computations
8262 (especially memory loads and stores) performed in previous
8263 iterations of loops.
8264
8265 This option is enabled at level @option{-O3}.
8266
8267 @item -fprefetch-loop-arrays
8268 @opindex fprefetch-loop-arrays
8269 If supported by the target machine, generate instructions to prefetch
8270 memory to improve the performance of loops that access large arrays.
8271
8272 This option may generate better or worse code; results are highly
8273 dependent on the structure of loops within the source code.
8274
8275 Disabled at level @option{-Os}.
8276
8277 @item -fprintf-return-value
8278 @opindex fprintf-return-value
8279 Substitute constants for known return value of formatted output functions
8280 such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and @code{vsnprintf}
8281 (but not @code{printf} of @code{fprintf}). This transformation allows GCC
8282 to optimize or even eliminate branches based on the known return value of
8283 these functions called with arguments that are either constant, or whose
8284 values are known to be in a range that makes determining the exact return
8285 value possible. For example, both the branch and the body of the @code{if}
8286 statement (but not the call to @code{snprint}) can be optimized away when
8287 @code{i} is a 32-bit or smaller integer because the return value is guaranteed
8288 to be at most 8.
8289
8290 @smallexample
8291 char buf[9];
8292 if (snprintf (buf, "%08x", i) >= sizeof buf)
8293 @dots{}
8294 @end smallexample
8295
8296 The @option{-fprintf-return-value} option relies on other optimizations
8297 and yields best results with @option{-O2}. It works in tandem with the
8298 @option{-Wformat-length} option. The @option{-fprintf-return-value}
8299 option is disabled by default.
8300
8301 @item -fno-peephole
8302 @itemx -fno-peephole2
8303 @opindex fno-peephole
8304 @opindex fno-peephole2
8305 Disable any machine-specific peephole optimizations. The difference
8306 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
8307 are implemented in the compiler; some targets use one, some use the
8308 other, a few use both.
8309
8310 @option{-fpeephole} is enabled by default.
8311 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8312
8313 @item -fno-guess-branch-probability
8314 @opindex fno-guess-branch-probability
8315 Do not guess branch probabilities using heuristics.
8316
8317 GCC uses heuristics to guess branch probabilities if they are
8318 not provided by profiling feedback (@option{-fprofile-arcs}). These
8319 heuristics are based on the control flow graph. If some branch probabilities
8320 are specified by @code{__builtin_expect}, then the heuristics are
8321 used to guess branch probabilities for the rest of the control flow graph,
8322 taking the @code{__builtin_expect} info into account. The interactions
8323 between the heuristics and @code{__builtin_expect} can be complex, and in
8324 some cases, it may be useful to disable the heuristics so that the effects
8325 of @code{__builtin_expect} are easier to understand.
8326
8327 The default is @option{-fguess-branch-probability} at levels
8328 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8329
8330 @item -freorder-blocks
8331 @opindex freorder-blocks
8332 Reorder basic blocks in the compiled function in order to reduce number of
8333 taken branches and improve code locality.
8334
8335 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8336
8337 @item -freorder-blocks-algorithm=@var{algorithm}
8338 @opindex freorder-blocks-algorithm
8339 Use the specified algorithm for basic block reordering. The
8340 @var{algorithm} argument can be @samp{simple}, which does not increase
8341 code size (except sometimes due to secondary effects like alignment),
8342 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
8343 put all often executed code together, minimizing the number of branches
8344 executed by making extra copies of code.
8345
8346 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
8347 @samp{stc} at levels @option{-O2}, @option{-O3}.
8348
8349 @item -freorder-blocks-and-partition
8350 @opindex freorder-blocks-and-partition
8351 In addition to reordering basic blocks in the compiled function, in order
8352 to reduce number of taken branches, partitions hot and cold basic blocks
8353 into separate sections of the assembly and @file{.o} files, to improve
8354 paging and cache locality performance.
8355
8356 This optimization is automatically turned off in the presence of
8357 exception handling, for linkonce sections, for functions with a user-defined
8358 section attribute and on any architecture that does not support named
8359 sections.
8360
8361 Enabled for x86 at levels @option{-O2}, @option{-O3}.
8362
8363 @item -freorder-functions
8364 @opindex freorder-functions
8365 Reorder functions in the object file in order to
8366 improve code locality. This is implemented by using special
8367 subsections @code{.text.hot} for most frequently executed functions and
8368 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
8369 the linker so object file format must support named sections and linker must
8370 place them in a reasonable way.
8371
8372 Also profile feedback must be available to make this option effective. See
8373 @option{-fprofile-arcs} for details.
8374
8375 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8376
8377 @item -fstrict-aliasing
8378 @opindex fstrict-aliasing
8379 Allow the compiler to assume the strictest aliasing rules applicable to
8380 the language being compiled. For C (and C++), this activates
8381 optimizations based on the type of expressions. In particular, an
8382 object of one type is assumed never to reside at the same address as an
8383 object of a different type, unless the types are almost the same. For
8384 example, an @code{unsigned int} can alias an @code{int}, but not a
8385 @code{void*} or a @code{double}. A character type may alias any other
8386 type.
8387
8388 @anchor{Type-punning}Pay special attention to code like this:
8389 @smallexample
8390 union a_union @{
8391 int i;
8392 double d;
8393 @};
8394
8395 int f() @{
8396 union a_union t;
8397 t.d = 3.0;
8398 return t.i;
8399 @}
8400 @end smallexample
8401 The practice of reading from a different union member than the one most
8402 recently written to (called ``type-punning'') is common. Even with
8403 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
8404 is accessed through the union type. So, the code above works as
8405 expected. @xref{Structures unions enumerations and bit-fields
8406 implementation}. However, this code might not:
8407 @smallexample
8408 int f() @{
8409 union a_union t;
8410 int* ip;
8411 t.d = 3.0;
8412 ip = &t.i;
8413 return *ip;
8414 @}
8415 @end smallexample
8416
8417 Similarly, access by taking the address, casting the resulting pointer
8418 and dereferencing the result has undefined behavior, even if the cast
8419 uses a union type, e.g.:
8420 @smallexample
8421 int f() @{
8422 double d = 3.0;
8423 return ((union a_union *) &d)->i;
8424 @}
8425 @end smallexample
8426
8427 The @option{-fstrict-aliasing} option is enabled at levels
8428 @option{-O2}, @option{-O3}, @option{-Os}.
8429
8430 @item -fstrict-overflow
8431 @opindex fstrict-overflow
8432 Allow the compiler to assume strict signed overflow rules, depending
8433 on the language being compiled. For C (and C++) this means that
8434 overflow when doing arithmetic with signed numbers is undefined, which
8435 means that the compiler may assume that it does not happen. This
8436 permits various optimizations. For example, the compiler assumes
8437 that an expression like @code{i + 10 > i} is always true for
8438 signed @code{i}. This assumption is only valid if signed overflow is
8439 undefined, as the expression is false if @code{i + 10} overflows when
8440 using twos complement arithmetic. When this option is in effect any
8441 attempt to determine whether an operation on signed numbers
8442 overflows must be written carefully to not actually involve overflow.
8443
8444 This option also allows the compiler to assume strict pointer
8445 semantics: given a pointer to an object, if adding an offset to that
8446 pointer does not produce a pointer to the same object, the addition is
8447 undefined. This permits the compiler to conclude that @code{p + u >
8448 p} is always true for a pointer @code{p} and unsigned integer
8449 @code{u}. This assumption is only valid because pointer wraparound is
8450 undefined, as the expression is false if @code{p + u} overflows using
8451 twos complement arithmetic.
8452
8453 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
8454 that integer signed overflow is fully defined: it wraps. When
8455 @option{-fwrapv} is used, there is no difference between
8456 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
8457 integers. With @option{-fwrapv} certain types of overflow are
8458 permitted. For example, if the compiler gets an overflow when doing
8459 arithmetic on constants, the overflowed value can still be used with
8460 @option{-fwrapv}, but not otherwise.
8461
8462 The @option{-fstrict-overflow} option is enabled at levels
8463 @option{-O2}, @option{-O3}, @option{-Os}.
8464
8465 @item -falign-functions
8466 @itemx -falign-functions=@var{n}
8467 @opindex falign-functions
8468 Align the start of functions to the next power-of-two greater than
8469 @var{n}, skipping up to @var{n} bytes. For instance,
8470 @option{-falign-functions=32} aligns functions to the next 32-byte
8471 boundary, but @option{-falign-functions=24} aligns to the next
8472 32-byte boundary only if this can be done by skipping 23 bytes or less.
8473
8474 @option{-fno-align-functions} and @option{-falign-functions=1} are
8475 equivalent and mean that functions are not aligned.
8476
8477 Some assemblers only support this flag when @var{n} is a power of two;
8478 in that case, it is rounded up.
8479
8480 If @var{n} is not specified or is zero, use a machine-dependent default.
8481
8482 Enabled at levels @option{-O2}, @option{-O3}.
8483
8484 @item -falign-labels
8485 @itemx -falign-labels=@var{n}
8486 @opindex falign-labels
8487 Align all branch targets to a power-of-two boundary, skipping up to
8488 @var{n} bytes like @option{-falign-functions}. This option can easily
8489 make code slower, because it must insert dummy operations for when the
8490 branch target is reached in the usual flow of the code.
8491
8492 @option{-fno-align-labels} and @option{-falign-labels=1} are
8493 equivalent and mean that labels are not aligned.
8494
8495 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8496 are greater than this value, then their values are used instead.
8497
8498 If @var{n} is not specified or is zero, use a machine-dependent default
8499 which is very likely to be @samp{1}, meaning no alignment.
8500
8501 Enabled at levels @option{-O2}, @option{-O3}.
8502
8503 @item -falign-loops
8504 @itemx -falign-loops=@var{n}
8505 @opindex falign-loops
8506 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8507 like @option{-falign-functions}. If the loops are
8508 executed many times, this makes up for any execution of the dummy
8509 operations.
8510
8511 @option{-fno-align-loops} and @option{-falign-loops=1} are
8512 equivalent and mean that loops are not aligned.
8513
8514 If @var{n} is not specified or is zero, use a machine-dependent default.
8515
8516 Enabled at levels @option{-O2}, @option{-O3}.
8517
8518 @item -falign-jumps
8519 @itemx -falign-jumps=@var{n}
8520 @opindex falign-jumps
8521 Align branch targets to a power-of-two boundary, for branch targets
8522 where the targets can only be reached by jumping, skipping up to @var{n}
8523 bytes like @option{-falign-functions}. In this case, no dummy operations
8524 need be executed.
8525
8526 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
8527 equivalent and mean that loops are not aligned.
8528
8529 If @var{n} is not specified or is zero, use a machine-dependent default.
8530
8531 Enabled at levels @option{-O2}, @option{-O3}.
8532
8533 @item -funit-at-a-time
8534 @opindex funit-at-a-time
8535 This option is left for compatibility reasons. @option{-funit-at-a-time}
8536 has no effect, while @option{-fno-unit-at-a-time} implies
8537 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8538
8539 Enabled by default.
8540
8541 @item -fno-toplevel-reorder
8542 @opindex fno-toplevel-reorder
8543 Do not reorder top-level functions, variables, and @code{asm}
8544 statements. Output them in the same order that they appear in the
8545 input file. When this option is used, unreferenced static variables
8546 are not removed. This option is intended to support existing code
8547 that relies on a particular ordering. For new code, it is better to
8548 use attributes when possible.
8549
8550 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8551 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8552 targets.
8553
8554 @item -fweb
8555 @opindex fweb
8556 Constructs webs as commonly used for register allocation purposes and assign
8557 each web individual pseudo register. This allows the register allocation pass
8558 to operate on pseudos directly, but also strengthens several other optimization
8559 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8560 however, make debugging impossible, since variables no longer stay in a
8561 ``home register''.
8562
8563 Enabled by default with @option{-funroll-loops}.
8564
8565 @item -fwhole-program
8566 @opindex fwhole-program
8567 Assume that the current compilation unit represents the whole program being
8568 compiled. All public functions and variables with the exception of @code{main}
8569 and those merged by attribute @code{externally_visible} become static functions
8570 and in effect are optimized more aggressively by interprocedural optimizers.
8571
8572 This option should not be used in combination with @option{-flto}.
8573 Instead relying on a linker plugin should provide safer and more precise
8574 information.
8575
8576 @item -flto[=@var{n}]
8577 @opindex flto
8578 This option runs the standard link-time optimizer. When invoked
8579 with source code, it generates GIMPLE (one of GCC's internal
8580 representations) and writes it to special ELF sections in the object
8581 file. When the object files are linked together, all the function
8582 bodies are read from these ELF sections and instantiated as if they
8583 had been part of the same translation unit.
8584
8585 To use the link-time optimizer, @option{-flto} and optimization
8586 options should be specified at compile time and during the final link.
8587 It is recommended that you compile all the files participating in the
8588 same link with the same options and also specify those options at
8589 link time.
8590 For example:
8591
8592 @smallexample
8593 gcc -c -O2 -flto foo.c
8594 gcc -c -O2 -flto bar.c
8595 gcc -o myprog -flto -O2 foo.o bar.o
8596 @end smallexample
8597
8598 The first two invocations to GCC save a bytecode representation
8599 of GIMPLE into special ELF sections inside @file{foo.o} and
8600 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8601 @file{foo.o} and @file{bar.o}, merges the two files into a single
8602 internal image, and compiles the result as usual. Since both
8603 @file{foo.o} and @file{bar.o} are merged into a single image, this
8604 causes all the interprocedural analyses and optimizations in GCC to
8605 work across the two files as if they were a single one. This means,
8606 for example, that the inliner is able to inline functions in
8607 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8608
8609 Another (simpler) way to enable link-time optimization is:
8610
8611 @smallexample
8612 gcc -o myprog -flto -O2 foo.c bar.c
8613 @end smallexample
8614
8615 The above generates bytecode for @file{foo.c} and @file{bar.c},
8616 merges them together into a single GIMPLE representation and optimizes
8617 them as usual to produce @file{myprog}.
8618
8619 The only important thing to keep in mind is that to enable link-time
8620 optimizations you need to use the GCC driver to perform the link step.
8621 GCC then automatically performs link-time optimization if any of the
8622 objects involved were compiled with the @option{-flto} command-line option.
8623 You generally
8624 should specify the optimization options to be used for link-time
8625 optimization though GCC tries to be clever at guessing an
8626 optimization level to use from the options used at compile time
8627 if you fail to specify one at link time. You can always override
8628 the automatic decision to do link-time optimization at link time
8629 by passing @option{-fno-lto} to the link command.
8630
8631 To make whole program optimization effective, it is necessary to make
8632 certain whole program assumptions. The compiler needs to know
8633 what functions and variables can be accessed by libraries and runtime
8634 outside of the link-time optimized unit. When supported by the linker,
8635 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8636 to the compiler about used and externally visible symbols. When
8637 the linker plugin is not available, @option{-fwhole-program} should be
8638 used to allow the compiler to make these assumptions, which leads
8639 to more aggressive optimization decisions.
8640
8641 When @option{-fuse-linker-plugin} is not enabled, when a file is
8642 compiled with @option{-flto}, the generated object file is larger than
8643 a regular object file because it contains GIMPLE bytecodes and the usual
8644 final code (see @option{-ffat-lto-objects}. This means that
8645 object files with LTO information can be linked as normal object
8646 files; if @option{-fno-lto} is passed to the linker, no
8647 interprocedural optimizations are applied. Note that when
8648 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
8649 but you cannot perform a regular, non-LTO link on them.
8650
8651 Additionally, the optimization flags used to compile individual files
8652 are not necessarily related to those used at link time. For instance,
8653
8654 @smallexample
8655 gcc -c -O0 -ffat-lto-objects -flto foo.c
8656 gcc -c -O0 -ffat-lto-objects -flto bar.c
8657 gcc -o myprog -O3 foo.o bar.o
8658 @end smallexample
8659
8660 This produces individual object files with unoptimized assembler
8661 code, but the resulting binary @file{myprog} is optimized at
8662 @option{-O3}. If, instead, the final binary is generated with
8663 @option{-fno-lto}, then @file{myprog} is not optimized.
8664
8665 When producing the final binary, GCC only
8666 applies link-time optimizations to those files that contain bytecode.
8667 Therefore, you can mix and match object files and libraries with
8668 GIMPLE bytecodes and final object code. GCC automatically selects
8669 which files to optimize in LTO mode and which files to link without
8670 further processing.
8671
8672 There are some code generation flags preserved by GCC when
8673 generating bytecodes, as they need to be used during the final link
8674 stage. Generally options specified at link time override those
8675 specified at compile time.
8676
8677 If you do not specify an optimization level option @option{-O} at
8678 link time, then GCC uses the highest optimization level
8679 used when compiling the object files.
8680
8681 Currently, the following options and their settings are taken from
8682 the first object file that explicitly specifies them:
8683 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8684 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8685 and all the @option{-m} target flags.
8686
8687 Certain ABI-changing flags are required to match in all compilation units,
8688 and trying to override this at link time with a conflicting value
8689 is ignored. This includes options such as @option{-freg-struct-return}
8690 and @option{-fpcc-struct-return}.
8691
8692 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8693 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8694 are passed through to the link stage and merged conservatively for
8695 conflicting translation units. Specifically
8696 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8697 precedence; and for example @option{-ffp-contract=off} takes precedence
8698 over @option{-ffp-contract=fast}. You can override them at link time.
8699
8700 If LTO encounters objects with C linkage declared with incompatible
8701 types in separate translation units to be linked together (undefined
8702 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8703 issued. The behavior is still undefined at run time. Similar
8704 diagnostics may be raised for other languages.
8705
8706 Another feature of LTO is that it is possible to apply interprocedural
8707 optimizations on files written in different languages:
8708
8709 @smallexample
8710 gcc -c -flto foo.c
8711 g++ -c -flto bar.cc
8712 gfortran -c -flto baz.f90
8713 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8714 @end smallexample
8715
8716 Notice that the final link is done with @command{g++} to get the C++
8717 runtime libraries and @option{-lgfortran} is added to get the Fortran
8718 runtime libraries. In general, when mixing languages in LTO mode, you
8719 should use the same link command options as when mixing languages in a
8720 regular (non-LTO) compilation.
8721
8722 If object files containing GIMPLE bytecode are stored in a library archive, say
8723 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8724 are using a linker with plugin support. To create static libraries suitable
8725 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8726 and @command{ranlib};
8727 to show the symbols of object files with GIMPLE bytecode, use
8728 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8729 and @command{nm} have been compiled with plugin support. At link time, use the the
8730 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8731 the LTO optimization process:
8732
8733 @smallexample
8734 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8735 @end smallexample
8736
8737 With the linker plugin enabled, the linker extracts the needed
8738 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8739 to make them part of the aggregated GIMPLE image to be optimized.
8740
8741 If you are not using a linker with plugin support and/or do not
8742 enable the linker plugin, then the objects inside @file{libfoo.a}
8743 are extracted and linked as usual, but they do not participate
8744 in the LTO optimization process. In order to make a static library suitable
8745 for both LTO optimization and usual linkage, compile its object files with
8746 @option{-flto} @option{-ffat-lto-objects}.
8747
8748 Link-time optimizations do not require the presence of the whole program to
8749 operate. If the program does not require any symbols to be exported, it is
8750 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8751 the interprocedural optimizers to use more aggressive assumptions which may
8752 lead to improved optimization opportunities.
8753 Use of @option{-fwhole-program} is not needed when linker plugin is
8754 active (see @option{-fuse-linker-plugin}).
8755
8756 The current implementation of LTO makes no
8757 attempt to generate bytecode that is portable between different
8758 types of hosts. The bytecode files are versioned and there is a
8759 strict version check, so bytecode files generated in one version of
8760 GCC do not work with an older or newer version of GCC.
8761
8762 Link-time optimization does not work well with generation of debugging
8763 information. Combining @option{-flto} with
8764 @option{-g} is currently experimental and expected to produce unexpected
8765 results.
8766
8767 If you specify the optional @var{n}, the optimization and code
8768 generation done at link time is executed in parallel using @var{n}
8769 parallel jobs by utilizing an installed @command{make} program. The
8770 environment variable @env{MAKE} may be used to override the program
8771 used. The default value for @var{n} is 1.
8772
8773 You can also specify @option{-flto=jobserver} to use GNU make's
8774 job server mode to determine the number of parallel jobs. This
8775 is useful when the Makefile calling GCC is already executing in parallel.
8776 You must prepend a @samp{+} to the command recipe in the parent Makefile
8777 for this to work. This option likely only works if @env{MAKE} is
8778 GNU make.
8779
8780 @item -flto-partition=@var{alg}
8781 @opindex flto-partition
8782 Specify the partitioning algorithm used by the link-time optimizer.
8783 The value is either @samp{1to1} to specify a partitioning mirroring
8784 the original source files or @samp{balanced} to specify partitioning
8785 into equally sized chunks (whenever possible) or @samp{max} to create
8786 new partition for every symbol where possible. Specifying @samp{none}
8787 as an algorithm disables partitioning and streaming completely.
8788 The default value is @samp{balanced}. While @samp{1to1} can be used
8789 as an workaround for various code ordering issues, the @samp{max}
8790 partitioning is intended for internal testing only.
8791 The value @samp{one} specifies that exactly one partition should be
8792 used while the value @samp{none} bypasses partitioning and executes
8793 the link-time optimization step directly from the WPA phase.
8794
8795 @item -flto-odr-type-merging
8796 @opindex flto-odr-type-merging
8797 Enable streaming of mangled types names of C++ types and their unification
8798 at link time. This increases size of LTO object files, but enables
8799 diagnostics about One Definition Rule violations.
8800
8801 @item -flto-compression-level=@var{n}
8802 @opindex flto-compression-level
8803 This option specifies the level of compression used for intermediate
8804 language written to LTO object files, and is only meaningful in
8805 conjunction with LTO mode (@option{-flto}). Valid
8806 values are 0 (no compression) to 9 (maximum compression). Values
8807 outside this range are clamped to either 0 or 9. If the option is not
8808 given, a default balanced compression setting is used.
8809
8810 @item -fuse-linker-plugin
8811 @opindex fuse-linker-plugin
8812 Enables the use of a linker plugin during link-time optimization. This
8813 option relies on plugin support in the linker, which is available in gold
8814 or in GNU ld 2.21 or newer.
8815
8816 This option enables the extraction of object files with GIMPLE bytecode out
8817 of library archives. This improves the quality of optimization by exposing
8818 more code to the link-time optimizer. This information specifies what
8819 symbols can be accessed externally (by non-LTO object or during dynamic
8820 linking). Resulting code quality improvements on binaries (and shared
8821 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
8822 See @option{-flto} for a description of the effect of this flag and how to
8823 use it.
8824
8825 This option is enabled by default when LTO support in GCC is enabled
8826 and GCC was configured for use with
8827 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8828
8829 @item -ffat-lto-objects
8830 @opindex ffat-lto-objects
8831 Fat LTO objects are object files that contain both the intermediate language
8832 and the object code. This makes them usable for both LTO linking and normal
8833 linking. This option is effective only when compiling with @option{-flto}
8834 and is ignored at link time.
8835
8836 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8837 requires the complete toolchain to be aware of LTO. It requires a linker with
8838 linker plugin support for basic functionality. Additionally,
8839 @command{nm}, @command{ar} and @command{ranlib}
8840 need to support linker plugins to allow a full-featured build environment
8841 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
8842 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8843 to these tools. With non fat LTO makefiles need to be modified to use them.
8844
8845 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
8846 support.
8847
8848 @item -fcompare-elim
8849 @opindex fcompare-elim
8850 After register allocation and post-register allocation instruction splitting,
8851 identify arithmetic instructions that compute processor flags similar to a
8852 comparison operation based on that arithmetic. If possible, eliminate the
8853 explicit comparison operation.
8854
8855 This pass only applies to certain targets that cannot explicitly represent
8856 the comparison operation before register allocation is complete.
8857
8858 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8859
8860 @item -fcprop-registers
8861 @opindex fcprop-registers
8862 After register allocation and post-register allocation instruction splitting,
8863 perform a copy-propagation pass to try to reduce scheduling dependencies
8864 and occasionally eliminate the copy.
8865
8866 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8867
8868 @item -fprofile-correction
8869 @opindex fprofile-correction
8870 Profiles collected using an instrumented binary for multi-threaded programs may
8871 be inconsistent due to missed counter updates. When this option is specified,
8872 GCC uses heuristics to correct or smooth out such inconsistencies. By
8873 default, GCC emits an error message when an inconsistent profile is detected.
8874
8875 @item -fprofile-use
8876 @itemx -fprofile-use=@var{path}
8877 @opindex fprofile-use
8878 Enable profile feedback-directed optimizations,
8879 and the following optimizations
8880 which are generally profitable only with profile feedback available:
8881 @option{-fbranch-probabilities}, @option{-fvpt},
8882 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8883 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
8884
8885 Before you can use this option, you must first generate profiling information.
8886 @xref{Optimize Options}, for information about the @option{-fprofile-generate}
8887 option.
8888
8889 By default, GCC emits an error message if the feedback profiles do not
8890 match the source code. This error can be turned into a warning by using
8891 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8892 code.
8893
8894 If @var{path} is specified, GCC looks at the @var{path} to find
8895 the profile feedback data files. See @option{-fprofile-dir}.
8896
8897 @item -fauto-profile
8898 @itemx -fauto-profile=@var{path}
8899 @opindex fauto-profile
8900 Enable sampling-based feedback-directed optimizations,
8901 and the following optimizations
8902 which are generally profitable only with profile feedback available:
8903 @option{-fbranch-probabilities}, @option{-fvpt},
8904 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8905 @option{-ftree-vectorize},
8906 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
8907 @option{-fpredictive-commoning}, @option{-funswitch-loops},
8908 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
8909
8910 @var{path} is the name of a file containing AutoFDO profile information.
8911 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
8912
8913 Producing an AutoFDO profile data file requires running your program
8914 with the @command{perf} utility on a supported GNU/Linux target system.
8915 For more information, see @uref{https://perf.wiki.kernel.org/}.
8916
8917 E.g.
8918 @smallexample
8919 perf record -e br_inst_retired:near_taken -b -o perf.data \
8920 -- your_program
8921 @end smallexample
8922
8923 Then use the @command{create_gcov} tool to convert the raw profile data
8924 to a format that can be used by GCC.@ You must also supply the
8925 unstripped binary for your program to this tool.
8926 See @uref{https://github.com/google/autofdo}.
8927
8928 E.g.
8929 @smallexample
8930 create_gcov --binary=your_program.unstripped --profile=perf.data \
8931 --gcov=profile.afdo
8932 @end smallexample
8933 @end table
8934
8935 The following options control compiler behavior regarding floating-point
8936 arithmetic. These options trade off between speed and
8937 correctness. All must be specifically enabled.
8938
8939 @table @gcctabopt
8940 @item -ffloat-store
8941 @opindex ffloat-store
8942 Do not store floating-point variables in registers, and inhibit other
8943 options that might change whether a floating-point value is taken from a
8944 register or memory.
8945
8946 @cindex floating-point precision
8947 This option prevents undesirable excess precision on machines such as
8948 the 68000 where the floating registers (of the 68881) keep more
8949 precision than a @code{double} is supposed to have. Similarly for the
8950 x86 architecture. For most programs, the excess precision does only
8951 good, but a few programs rely on the precise definition of IEEE floating
8952 point. Use @option{-ffloat-store} for such programs, after modifying
8953 them to store all pertinent intermediate computations into variables.
8954
8955 @item -fexcess-precision=@var{style}
8956 @opindex fexcess-precision
8957 This option allows further control over excess precision on machines
8958 where floating-point registers have more precision than the IEEE
8959 @code{float} and @code{double} types and the processor does not
8960 support operations rounding to those types. By default,
8961 @option{-fexcess-precision=fast} is in effect; this means that
8962 operations are carried out in the precision of the registers and that
8963 it is unpredictable when rounding to the types specified in the source
8964 code takes place. When compiling C, if
8965 @option{-fexcess-precision=standard} is specified then excess
8966 precision follows the rules specified in ISO C99; in particular,
8967 both casts and assignments cause values to be rounded to their
8968 semantic types (whereas @option{-ffloat-store} only affects
8969 assignments). This option is enabled by default for C if a strict
8970 conformance option such as @option{-std=c99} is used.
8971
8972 @opindex mfpmath
8973 @option{-fexcess-precision=standard} is not implemented for languages
8974 other than C, and has no effect if
8975 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8976 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8977 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8978 semantics apply without excess precision, and in the latter, rounding
8979 is unpredictable.
8980
8981 @item -ffast-math
8982 @opindex ffast-math
8983 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8984 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8985 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8986
8987 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8988
8989 This option is not turned on by any @option{-O} option besides
8990 @option{-Ofast} since it can result in incorrect output for programs
8991 that depend on an exact implementation of IEEE or ISO rules/specifications
8992 for math functions. It may, however, yield faster code for programs
8993 that do not require the guarantees of these specifications.
8994
8995 @item -fno-math-errno
8996 @opindex fno-math-errno
8997 Do not set @code{errno} after calling math functions that are executed
8998 with a single instruction, e.g., @code{sqrt}. A program that relies on
8999 IEEE exceptions for math error handling may want to use this flag
9000 for speed while maintaining IEEE arithmetic compatibility.
9001
9002 This option is not turned on by any @option{-O} option since
9003 it can result in incorrect output for programs that depend on
9004 an exact implementation of IEEE or ISO rules/specifications for
9005 math functions. It may, however, yield faster code for programs
9006 that do not require the guarantees of these specifications.
9007
9008 The default is @option{-fmath-errno}.
9009
9010 On Darwin systems, the math library never sets @code{errno}. There is
9011 therefore no reason for the compiler to consider the possibility that
9012 it might, and @option{-fno-math-errno} is the default.
9013
9014 @item -funsafe-math-optimizations
9015 @opindex funsafe-math-optimizations
9016
9017 Allow optimizations for floating-point arithmetic that (a) assume
9018 that arguments and results are valid and (b) may violate IEEE or
9019 ANSI standards. When used at link time, it may include libraries
9020 or startup files that change the default FPU control word or other
9021 similar optimizations.
9022
9023 This option is not turned on by any @option{-O} option since
9024 it can result in incorrect output for programs that depend on
9025 an exact implementation of IEEE or ISO rules/specifications for
9026 math functions. It may, however, yield faster code for programs
9027 that do not require the guarantees of these specifications.
9028 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9029 @option{-fassociative-math} and @option{-freciprocal-math}.
9030
9031 The default is @option{-fno-unsafe-math-optimizations}.
9032
9033 @item -fassociative-math
9034 @opindex fassociative-math
9035
9036 Allow re-association of operands in series of floating-point operations.
9037 This violates the ISO C and C++ language standard by possibly changing
9038 computation result. NOTE: re-ordering may change the sign of zero as
9039 well as ignore NaNs and inhibit or create underflow or overflow (and
9040 thus cannot be used on code that relies on rounding behavior like
9041 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9042 and thus may not be used when ordered comparisons are required.
9043 This option requires that both @option{-fno-signed-zeros} and
9044 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9045 much sense with @option{-frounding-math}. For Fortran the option
9046 is automatically enabled when both @option{-fno-signed-zeros} and
9047 @option{-fno-trapping-math} are in effect.
9048
9049 The default is @option{-fno-associative-math}.
9050
9051 @item -freciprocal-math
9052 @opindex freciprocal-math
9053
9054 Allow the reciprocal of a value to be used instead of dividing by
9055 the value if this enables optimizations. For example @code{x / y}
9056 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9057 is subject to common subexpression elimination. Note that this loses
9058 precision and increases the number of flops operating on the value.
9059
9060 The default is @option{-fno-reciprocal-math}.
9061
9062 @item -ffinite-math-only
9063 @opindex ffinite-math-only
9064 Allow optimizations for floating-point arithmetic that assume
9065 that arguments and results are not NaNs or +-Infs.
9066
9067 This option is not turned on by any @option{-O} option since
9068 it can result in incorrect output for programs that depend on
9069 an exact implementation of IEEE or ISO rules/specifications for
9070 math functions. It may, however, yield faster code for programs
9071 that do not require the guarantees of these specifications.
9072
9073 The default is @option{-fno-finite-math-only}.
9074
9075 @item -fno-signed-zeros
9076 @opindex fno-signed-zeros
9077 Allow optimizations for floating-point arithmetic that ignore the
9078 signedness of zero. IEEE arithmetic specifies the behavior of
9079 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9080 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9081 This option implies that the sign of a zero result isn't significant.
9082
9083 The default is @option{-fsigned-zeros}.
9084
9085 @item -fno-trapping-math
9086 @opindex fno-trapping-math
9087 Compile code assuming that floating-point operations cannot generate
9088 user-visible traps. These traps include division by zero, overflow,
9089 underflow, inexact result and invalid operation. This option requires
9090 that @option{-fno-signaling-nans} be in effect. Setting this option may
9091 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9092
9093 This option should never be turned on by any @option{-O} option since
9094 it can result in incorrect output for programs that depend on
9095 an exact implementation of IEEE or ISO rules/specifications for
9096 math functions.
9097
9098 The default is @option{-ftrapping-math}.
9099
9100 @item -frounding-math
9101 @opindex frounding-math
9102 Disable transformations and optimizations that assume default floating-point
9103 rounding behavior. This is round-to-zero for all floating point
9104 to integer conversions, and round-to-nearest for all other arithmetic
9105 truncations. This option should be specified for programs that change
9106 the FP rounding mode dynamically, or that may be executed with a
9107 non-default rounding mode. This option disables constant folding of
9108 floating-point expressions at compile time (which may be affected by
9109 rounding mode) and arithmetic transformations that are unsafe in the
9110 presence of sign-dependent rounding modes.
9111
9112 The default is @option{-fno-rounding-math}.
9113
9114 This option is experimental and does not currently guarantee to
9115 disable all GCC optimizations that are affected by rounding mode.
9116 Future versions of GCC may provide finer control of this setting
9117 using C99's @code{FENV_ACCESS} pragma. This command-line option
9118 will be used to specify the default state for @code{FENV_ACCESS}.
9119
9120 @item -fsignaling-nans
9121 @opindex fsignaling-nans
9122 Compile code assuming that IEEE signaling NaNs may generate user-visible
9123 traps during floating-point operations. Setting this option disables
9124 optimizations that may change the number of exceptions visible with
9125 signaling NaNs. This option implies @option{-ftrapping-math}.
9126
9127 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9128 be defined.
9129
9130 The default is @option{-fno-signaling-nans}.
9131
9132 This option is experimental and does not currently guarantee to
9133 disable all GCC optimizations that affect signaling NaN behavior.
9134
9135 @item -fno-fp-int-builtin-inexact
9136 @opindex fno-fp-int-builtin-inexact
9137 Do not allow the built-in functions @code{ceil}, @code{floor},
9138 @code{round} and @code{trunc}, and their @code{float} and @code{long
9139 double} variants, to generate code that raises the ``inexact''
9140 floating-point exception for noninteger arguments. ISO C99 and C11
9141 allow these functions to raise the ``inexact'' exception, but ISO/IEC
9142 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
9143 functions to do so.
9144
9145 The default is @option{-ffp-int-builtin-inexact}, allowing the
9146 exception to be raised. This option does nothing unless
9147 @option{-ftrapping-math} is in effect.
9148
9149 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
9150 generate a call to a library function then the ``inexact'' exception
9151 may be raised if the library implementation does not follow TS 18661.
9152
9153 @item -fsingle-precision-constant
9154 @opindex fsingle-precision-constant
9155 Treat floating-point constants as single precision instead of
9156 implicitly converting them to double-precision constants.
9157
9158 @item -fcx-limited-range
9159 @opindex fcx-limited-range
9160 When enabled, this option states that a range reduction step is not
9161 needed when performing complex division. Also, there is no checking
9162 whether the result of a complex multiplication or division is @code{NaN
9163 + I*NaN}, with an attempt to rescue the situation in that case. The
9164 default is @option{-fno-cx-limited-range}, but is enabled by
9165 @option{-ffast-math}.
9166
9167 This option controls the default setting of the ISO C99
9168 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9169 all languages.
9170
9171 @item -fcx-fortran-rules
9172 @opindex fcx-fortran-rules
9173 Complex multiplication and division follow Fortran rules. Range
9174 reduction is done as part of complex division, but there is no checking
9175 whether the result of a complex multiplication or division is @code{NaN
9176 + I*NaN}, with an attempt to rescue the situation in that case.
9177
9178 The default is @option{-fno-cx-fortran-rules}.
9179
9180 @end table
9181
9182 The following options control optimizations that may improve
9183 performance, but are not enabled by any @option{-O} options. This
9184 section includes experimental options that may produce broken code.
9185
9186 @table @gcctabopt
9187 @item -fbranch-probabilities
9188 @opindex fbranch-probabilities
9189 After running a program compiled with @option{-fprofile-arcs}
9190 (@pxref{Instrumentation Options}),
9191 you can compile it a second time using
9192 @option{-fbranch-probabilities}, to improve optimizations based on
9193 the number of times each branch was taken. When a program
9194 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9195 counts to a file called @file{@var{sourcename}.gcda} for each source
9196 file. The information in this data file is very dependent on the
9197 structure of the generated code, so you must use the same source code
9198 and the same optimization options for both compilations.
9199
9200 With @option{-fbranch-probabilities}, GCC puts a
9201 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9202 These can be used to improve optimization. Currently, they are only
9203 used in one place: in @file{reorg.c}, instead of guessing which path a
9204 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9205 exactly determine which path is taken more often.
9206
9207 @item -fprofile-values
9208 @opindex fprofile-values
9209 If combined with @option{-fprofile-arcs}, it adds code so that some
9210 data about values of expressions in the program is gathered.
9211
9212 With @option{-fbranch-probabilities}, it reads back the data gathered
9213 from profiling values of expressions for usage in optimizations.
9214
9215 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9216
9217 @item -fprofile-reorder-functions
9218 @opindex fprofile-reorder-functions
9219 Function reordering based on profile instrumentation collects
9220 first time of execution of a function and orders these functions
9221 in ascending order.
9222
9223 Enabled with @option{-fprofile-use}.
9224
9225 @item -fvpt
9226 @opindex fvpt
9227 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9228 to add code to gather information about values of expressions.
9229
9230 With @option{-fbranch-probabilities}, it reads back the data gathered
9231 and actually performs the optimizations based on them.
9232 Currently the optimizations include specialization of division operations
9233 using the knowledge about the value of the denominator.
9234
9235 @item -frename-registers
9236 @opindex frename-registers
9237 Attempt to avoid false dependencies in scheduled code by making use
9238 of registers left over after register allocation. This optimization
9239 most benefits processors with lots of registers. Depending on the
9240 debug information format adopted by the target, however, it can
9241 make debugging impossible, since variables no longer stay in
9242 a ``home register''.
9243
9244 Enabled by default with @option{-funroll-loops}.
9245
9246 @item -fschedule-fusion
9247 @opindex fschedule-fusion
9248 Performs a target dependent pass over the instruction stream to schedule
9249 instructions of same type together because target machine can execute them
9250 more efficiently if they are adjacent to each other in the instruction flow.
9251
9252 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9253
9254 @item -ftracer
9255 @opindex ftracer
9256 Perform tail duplication to enlarge superblock size. This transformation
9257 simplifies the control flow of the function allowing other optimizations to do
9258 a better job.
9259
9260 Enabled with @option{-fprofile-use}.
9261
9262 @item -funroll-loops
9263 @opindex funroll-loops
9264 Unroll loops whose number of iterations can be determined at compile time or
9265 upon entry to the loop. @option{-funroll-loops} implies
9266 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9267 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9268 a small constant number of iterations). This option makes code larger, and may
9269 or may not make it run faster.
9270
9271 Enabled with @option{-fprofile-use}.
9272
9273 @item -funroll-all-loops
9274 @opindex funroll-all-loops
9275 Unroll all loops, even if their number of iterations is uncertain when
9276 the loop is entered. This usually makes programs run more slowly.
9277 @option{-funroll-all-loops} implies the same options as
9278 @option{-funroll-loops}.
9279
9280 @item -fpeel-loops
9281 @opindex fpeel-loops
9282 Peels loops for which there is enough information that they do not
9283 roll much (from profile feedback or static analysis). It also turns on
9284 complete loop peeling (i.e.@: complete removal of loops with small constant
9285 number of iterations).
9286
9287 Enabled with @option{-O3} and/or @option{-fprofile-use}.
9288
9289 @item -fmove-loop-invariants
9290 @opindex fmove-loop-invariants
9291 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
9292 at level @option{-O1}
9293
9294 @item -fsplit-loops
9295 @opindex fsplit-loops
9296 Split a loop into two if it contains a condition that's always true
9297 for one side of the iteration space and false for the other.
9298
9299 @item -funswitch-loops
9300 @opindex funswitch-loops
9301 Move branches with loop invariant conditions out of the loop, with duplicates
9302 of the loop on both branches (modified according to result of the condition).
9303
9304 @item -ffunction-sections
9305 @itemx -fdata-sections
9306 @opindex ffunction-sections
9307 @opindex fdata-sections
9308 Place each function or data item into its own section in the output
9309 file if the target supports arbitrary sections. The name of the
9310 function or the name of the data item determines the section's name
9311 in the output file.
9312
9313 Use these options on systems where the linker can perform optimizations
9314 to improve locality of reference in the instruction space. Most systems
9315 using the ELF object format and SPARC processors running Solaris 2 have
9316 linkers with such optimizations. AIX may have these optimizations in
9317 the future.
9318
9319 Only use these options when there are significant benefits from doing
9320 so. When you specify these options, the assembler and linker
9321 create larger object and executable files and are also slower.
9322 You cannot use @command{gprof} on all systems if you
9323 specify this option, and you may have problems with debugging if
9324 you specify both this option and @option{-g}.
9325
9326 @item -fbranch-target-load-optimize
9327 @opindex fbranch-target-load-optimize
9328 Perform branch target register load optimization before prologue / epilogue
9329 threading.
9330 The use of target registers can typically be exposed only during reload,
9331 thus hoisting loads out of loops and doing inter-block scheduling needs
9332 a separate optimization pass.
9333
9334 @item -fbranch-target-load-optimize2
9335 @opindex fbranch-target-load-optimize2
9336 Perform branch target register load optimization after prologue / epilogue
9337 threading.
9338
9339 @item -fbtr-bb-exclusive
9340 @opindex fbtr-bb-exclusive
9341 When performing branch target register load optimization, don't reuse
9342 branch target registers within any basic block.
9343
9344 @item -fstdarg-opt
9345 @opindex fstdarg-opt
9346 Optimize the prologue of variadic argument functions with respect to usage of
9347 those arguments.
9348
9349 @item -fsection-anchors
9350 @opindex fsection-anchors
9351 Try to reduce the number of symbolic address calculations by using
9352 shared ``anchor'' symbols to address nearby objects. This transformation
9353 can help to reduce the number of GOT entries and GOT accesses on some
9354 targets.
9355
9356 For example, the implementation of the following function @code{foo}:
9357
9358 @smallexample
9359 static int a, b, c;
9360 int foo (void) @{ return a + b + c; @}
9361 @end smallexample
9362
9363 @noindent
9364 usually calculates the addresses of all three variables, but if you
9365 compile it with @option{-fsection-anchors}, it accesses the variables
9366 from a common anchor point instead. The effect is similar to the
9367 following pseudocode (which isn't valid C):
9368
9369 @smallexample
9370 int foo (void)
9371 @{
9372 register int *xr = &x;
9373 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9374 @}
9375 @end smallexample
9376
9377 Not all targets support this option.
9378
9379 @item --param @var{name}=@var{value}
9380 @opindex param
9381 In some places, GCC uses various constants to control the amount of
9382 optimization that is done. For example, GCC does not inline functions
9383 that contain more than a certain number of instructions. You can
9384 control some of these constants on the command line using the
9385 @option{--param} option.
9386
9387 The names of specific parameters, and the meaning of the values, are
9388 tied to the internals of the compiler, and are subject to change
9389 without notice in future releases.
9390
9391 In each case, the @var{value} is an integer. The allowable choices for
9392 @var{name} are:
9393
9394 @table @gcctabopt
9395 @item predictable-branch-outcome
9396 When branch is predicted to be taken with probability lower than this threshold
9397 (in percent), then it is considered well predictable. The default is 10.
9398
9399 @item max-rtl-if-conversion-insns
9400 RTL if-conversion tries to remove conditional branches around a block and
9401 replace them with conditionally executed instructions. This parameter
9402 gives the maximum number of instructions in a block which should be
9403 considered for if-conversion. The default is 10, though the compiler will
9404 also use other heuristics to decide whether if-conversion is likely to be
9405 profitable.
9406
9407 @item max-rtl-if-conversion-predictable-cost
9408 @item max-rtl-if-conversion-unpredictable-cost
9409 RTL if-conversion will try to remove conditional branches around a block
9410 and replace them with conditionally executed instructions. These parameters
9411 give the maximum permissible cost for the sequence that would be generated
9412 by if-conversion depending on whether the branch is statically determined
9413 to be predictable or not. The units for this parameter are the same as
9414 those for the GCC internal seq_cost metric. The compiler will try to
9415 provide a reasonable default for this parameter using the BRANCH_COST
9416 target macro.
9417
9418 @item max-crossjump-edges
9419 The maximum number of incoming edges to consider for cross-jumping.
9420 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
9421 the number of edges incoming to each block. Increasing values mean
9422 more aggressive optimization, making the compilation time increase with
9423 probably small improvement in executable size.
9424
9425 @item min-crossjump-insns
9426 The minimum number of instructions that must be matched at the end
9427 of two blocks before cross-jumping is performed on them. This
9428 value is ignored in the case where all instructions in the block being
9429 cross-jumped from are matched. The default value is 5.
9430
9431 @item max-grow-copy-bb-insns
9432 The maximum code size expansion factor when copying basic blocks
9433 instead of jumping. The expansion is relative to a jump instruction.
9434 The default value is 8.
9435
9436 @item max-goto-duplication-insns
9437 The maximum number of instructions to duplicate to a block that jumps
9438 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
9439 passes, GCC factors computed gotos early in the compilation process,
9440 and unfactors them as late as possible. Only computed jumps at the
9441 end of a basic blocks with no more than max-goto-duplication-insns are
9442 unfactored. The default value is 8.
9443
9444 @item max-delay-slot-insn-search
9445 The maximum number of instructions to consider when looking for an
9446 instruction to fill a delay slot. If more than this arbitrary number of
9447 instructions are searched, the time savings from filling the delay slot
9448 are minimal, so stop searching. Increasing values mean more
9449 aggressive optimization, making the compilation time increase with probably
9450 small improvement in execution time.
9451
9452 @item max-delay-slot-live-search
9453 When trying to fill delay slots, the maximum number of instructions to
9454 consider when searching for a block with valid live register
9455 information. Increasing this arbitrarily chosen value means more
9456 aggressive optimization, increasing the compilation time. This parameter
9457 should be removed when the delay slot code is rewritten to maintain the
9458 control-flow graph.
9459
9460 @item max-gcse-memory
9461 The approximate maximum amount of memory that can be allocated in
9462 order to perform the global common subexpression elimination
9463 optimization. If more memory than specified is required, the
9464 optimization is not done.
9465
9466 @item max-gcse-insertion-ratio
9467 If the ratio of expression insertions to deletions is larger than this value
9468 for any expression, then RTL PRE inserts or removes the expression and thus
9469 leaves partially redundant computations in the instruction stream. The default value is 20.
9470
9471 @item max-pending-list-length
9472 The maximum number of pending dependencies scheduling allows
9473 before flushing the current state and starting over. Large functions
9474 with few branches or calls can create excessively large lists which
9475 needlessly consume memory and resources.
9476
9477 @item max-modulo-backtrack-attempts
9478 The maximum number of backtrack attempts the scheduler should make
9479 when modulo scheduling a loop. Larger values can exponentially increase
9480 compilation time.
9481
9482 @item max-inline-insns-single
9483 Several parameters control the tree inliner used in GCC@.
9484 This number sets the maximum number of instructions (counted in GCC's
9485 internal representation) in a single function that the tree inliner
9486 considers for inlining. This only affects functions declared
9487 inline and methods implemented in a class declaration (C++).
9488 The default value is 400.
9489
9490 @item max-inline-insns-auto
9491 When you use @option{-finline-functions} (included in @option{-O3}),
9492 a lot of functions that would otherwise not be considered for inlining
9493 by the compiler are investigated. To those functions, a different
9494 (more restrictive) limit compared to functions declared inline can
9495 be applied.
9496 The default value is 40.
9497
9498 @item inline-min-speedup
9499 When estimated performance improvement of caller + callee runtime exceeds this
9500 threshold (in precent), the function can be inlined regardless the limit on
9501 @option{--param max-inline-insns-single} and @option{--param
9502 max-inline-insns-auto}.
9503
9504 @item large-function-insns
9505 The limit specifying really large functions. For functions larger than this
9506 limit after inlining, inlining is constrained by
9507 @option{--param large-function-growth}. This parameter is useful primarily
9508 to avoid extreme compilation time caused by non-linear algorithms used by the
9509 back end.
9510 The default value is 2700.
9511
9512 @item large-function-growth
9513 Specifies maximal growth of large function caused by inlining in percents.
9514 The default value is 100 which limits large function growth to 2.0 times
9515 the original size.
9516
9517 @item large-unit-insns
9518 The limit specifying large translation unit. Growth caused by inlining of
9519 units larger than this limit is limited by @option{--param inline-unit-growth}.
9520 For small units this might be too tight.
9521 For example, consider a unit consisting of function A
9522 that is inline and B that just calls A three times. If B is small relative to
9523 A, the growth of unit is 300\% and yet such inlining is very sane. For very
9524 large units consisting of small inlineable functions, however, the overall unit
9525 growth limit is needed to avoid exponential explosion of code size. Thus for
9526 smaller units, the size is increased to @option{--param large-unit-insns}
9527 before applying @option{--param inline-unit-growth}. The default is 10000.
9528
9529 @item inline-unit-growth
9530 Specifies maximal overall growth of the compilation unit caused by inlining.
9531 The default value is 20 which limits unit growth to 1.2 times the original
9532 size. Cold functions (either marked cold via an attribute or by profile
9533 feedback) are not accounted into the unit size.
9534
9535 @item ipcp-unit-growth
9536 Specifies maximal overall growth of the compilation unit caused by
9537 interprocedural constant propagation. The default value is 10 which limits
9538 unit growth to 1.1 times the original size.
9539
9540 @item large-stack-frame
9541 The limit specifying large stack frames. While inlining the algorithm is trying
9542 to not grow past this limit too much. The default value is 256 bytes.
9543
9544 @item large-stack-frame-growth
9545 Specifies maximal growth of large stack frames caused by inlining in percents.
9546 The default value is 1000 which limits large stack frame growth to 11 times
9547 the original size.
9548
9549 @item max-inline-insns-recursive
9550 @itemx max-inline-insns-recursive-auto
9551 Specifies the maximum number of instructions an out-of-line copy of a
9552 self-recursive inline
9553 function can grow into by performing recursive inlining.
9554
9555 @option{--param max-inline-insns-recursive} applies to functions
9556 declared inline.
9557 For functions not declared inline, recursive inlining
9558 happens only when @option{-finline-functions} (included in @option{-O3}) is
9559 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
9560 default value is 450.
9561
9562 @item max-inline-recursive-depth
9563 @itemx max-inline-recursive-depth-auto
9564 Specifies the maximum recursion depth used for recursive inlining.
9565
9566 @option{--param max-inline-recursive-depth} applies to functions
9567 declared inline. For functions not declared inline, recursive inlining
9568 happens only when @option{-finline-functions} (included in @option{-O3}) is
9569 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
9570 default value is 8.
9571
9572 @item min-inline-recursive-probability
9573 Recursive inlining is profitable only for function having deep recursion
9574 in average and can hurt for function having little recursion depth by
9575 increasing the prologue size or complexity of function body to other
9576 optimizers.
9577
9578 When profile feedback is available (see @option{-fprofile-generate}) the actual
9579 recursion depth can be guessed from the probability that function recurses
9580 via a given call expression. This parameter limits inlining only to call
9581 expressions whose probability exceeds the given threshold (in percents).
9582 The default value is 10.
9583
9584 @item early-inlining-insns
9585 Specify growth that the early inliner can make. In effect it increases
9586 the amount of inlining for code having a large abstraction penalty.
9587 The default value is 14.
9588
9589 @item max-early-inliner-iterations
9590 Limit of iterations of the early inliner. This basically bounds
9591 the number of nested indirect calls the early inliner can resolve.
9592 Deeper chains are still handled by late inlining.
9593
9594 @item comdat-sharing-probability
9595 Probability (in percent) that C++ inline function with comdat visibility
9596 are shared across multiple compilation units. The default value is 20.
9597
9598 @item profile-func-internal-id
9599 A parameter to control whether to use function internal id in profile
9600 database lookup. If the value is 0, the compiler uses an id that
9601 is based on function assembler name and filename, which makes old profile
9602 data more tolerant to source changes such as function reordering etc.
9603 The default value is 0.
9604
9605 @item min-vect-loop-bound
9606 The minimum number of iterations under which loops are not vectorized
9607 when @option{-ftree-vectorize} is used. The number of iterations after
9608 vectorization needs to be greater than the value specified by this option
9609 to allow vectorization. The default value is 0.
9610
9611 @item gcse-cost-distance-ratio
9612 Scaling factor in calculation of maximum distance an expression
9613 can be moved by GCSE optimizations. This is currently supported only in the
9614 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9615 is with simple expressions, i.e., the expressions that have cost
9616 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9617 hoisting of simple expressions. The default value is 10.
9618
9619 @item gcse-unrestricted-cost
9620 Cost, roughly measured as the cost of a single typical machine
9621 instruction, at which GCSE optimizations do not constrain
9622 the distance an expression can travel. This is currently
9623 supported only in the code hoisting pass. The lesser the cost,
9624 the more aggressive code hoisting is. Specifying 0
9625 allows all expressions to travel unrestricted distances.
9626 The default value is 3.
9627
9628 @item max-hoist-depth
9629 The depth of search in the dominator tree for expressions to hoist.
9630 This is used to avoid quadratic behavior in hoisting algorithm.
9631 The value of 0 does not limit on the search, but may slow down compilation
9632 of huge functions. The default value is 30.
9633
9634 @item max-tail-merge-comparisons
9635 The maximum amount of similar bbs to compare a bb with. This is used to
9636 avoid quadratic behavior in tree tail merging. The default value is 10.
9637
9638 @item max-tail-merge-iterations
9639 The maximum amount of iterations of the pass over the function. This is used to
9640 limit compilation time in tree tail merging. The default value is 2.
9641
9642 @item store-merging-allow-unaligned
9643 Allow the store merging pass to introduce unaligned stores if it is legal to
9644 do so. The default value is 1.
9645
9646 @item max-stores-to-merge
9647 The maximum number of stores to attempt to merge into wider stores in the store
9648 merging pass. The minimum value is 2 and the default is 64.
9649
9650 @item max-unrolled-insns
9651 The maximum number of instructions that a loop may have to be unrolled.
9652 If a loop is unrolled, this parameter also determines how many times
9653 the loop code is unrolled.
9654
9655 @item max-average-unrolled-insns
9656 The maximum number of instructions biased by probabilities of their execution
9657 that a loop may have to be unrolled. If a loop is unrolled,
9658 this parameter also determines how many times the loop code is unrolled.
9659
9660 @item max-unroll-times
9661 The maximum number of unrollings of a single loop.
9662
9663 @item max-peeled-insns
9664 The maximum number of instructions that a loop may have to be peeled.
9665 If a loop is peeled, this parameter also determines how many times
9666 the loop code is peeled.
9667
9668 @item max-peel-times
9669 The maximum number of peelings of a single loop.
9670
9671 @item max-peel-branches
9672 The maximum number of branches on the hot path through the peeled sequence.
9673
9674 @item max-completely-peeled-insns
9675 The maximum number of insns of a completely peeled loop.
9676
9677 @item max-completely-peel-times
9678 The maximum number of iterations of a loop to be suitable for complete peeling.
9679
9680 @item max-completely-peel-loop-nest-depth
9681 The maximum depth of a loop nest suitable for complete peeling.
9682
9683 @item max-unswitch-insns
9684 The maximum number of insns of an unswitched loop.
9685
9686 @item max-unswitch-level
9687 The maximum number of branches unswitched in a single loop.
9688
9689 @item max-loop-headers-insns
9690 The maximum number of insns in loop header duplicated by he copy loop headers
9691 pass.
9692
9693 @item lim-expensive
9694 The minimum cost of an expensive expression in the loop invariant motion.
9695
9696 @item iv-consider-all-candidates-bound
9697 Bound on number of candidates for induction variables, below which
9698 all candidates are considered for each use in induction variable
9699 optimizations. If there are more candidates than this,
9700 only the most relevant ones are considered to avoid quadratic time complexity.
9701
9702 @item iv-max-considered-uses
9703 The induction variable optimizations give up on loops that contain more
9704 induction variable uses.
9705
9706 @item iv-always-prune-cand-set-bound
9707 If the number of candidates in the set is smaller than this value,
9708 always try to remove unnecessary ivs from the set
9709 when adding a new one.
9710
9711 @item avg-loop-niter
9712 Average number of iterations of a loop.
9713
9714 @item scev-max-expr-size
9715 Bound on size of expressions used in the scalar evolutions analyzer.
9716 Large expressions slow the analyzer.
9717
9718 @item scev-max-expr-complexity
9719 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9720 Complex expressions slow the analyzer.
9721
9722 @item max-tree-if-conversion-phi-args
9723 Maximum number of arguments in a PHI supported by TREE if conversion
9724 unless the loop is marked with simd pragma.
9725
9726 @item vect-max-version-for-alignment-checks
9727 The maximum number of run-time checks that can be performed when
9728 doing loop versioning for alignment in the vectorizer.
9729
9730 @item vect-max-version-for-alias-checks
9731 The maximum number of run-time checks that can be performed when
9732 doing loop versioning for alias in the vectorizer.
9733
9734 @item vect-max-peeling-for-alignment
9735 The maximum number of loop peels to enhance access alignment
9736 for vectorizer. Value -1 means no limit.
9737
9738 @item max-iterations-to-track
9739 The maximum number of iterations of a loop the brute-force algorithm
9740 for analysis of the number of iterations of the loop tries to evaluate.
9741
9742 @item hot-bb-count-ws-permille
9743 A basic block profile count is considered hot if it contributes to
9744 the given permillage (i.e. 0...1000) of the entire profiled execution.
9745
9746 @item hot-bb-frequency-fraction
9747 Select fraction of the entry block frequency of executions of basic block in
9748 function given basic block needs to have to be considered hot.
9749
9750 @item max-predicted-iterations
9751 The maximum number of loop iterations we predict statically. This is useful
9752 in cases where a function contains a single loop with known bound and
9753 another loop with unknown bound.
9754 The known number of iterations is predicted correctly, while
9755 the unknown number of iterations average to roughly 10. This means that the
9756 loop without bounds appears artificially cold relative to the other one.
9757
9758 @item builtin-expect-probability
9759 Control the probability of the expression having the specified value. This
9760 parameter takes a percentage (i.e. 0 ... 100) as input.
9761 The default probability of 90 is obtained empirically.
9762
9763 @item align-threshold
9764
9765 Select fraction of the maximal frequency of executions of a basic block in
9766 a function to align the basic block.
9767
9768 @item align-loop-iterations
9769
9770 A loop expected to iterate at least the selected number of iterations is
9771 aligned.
9772
9773 @item tracer-dynamic-coverage
9774 @itemx tracer-dynamic-coverage-feedback
9775
9776 This value is used to limit superblock formation once the given percentage of
9777 executed instructions is covered. This limits unnecessary code size
9778 expansion.
9779
9780 The @option{tracer-dynamic-coverage-feedback} parameter
9781 is used only when profile
9782 feedback is available. The real profiles (as opposed to statically estimated
9783 ones) are much less balanced allowing the threshold to be larger value.
9784
9785 @item tracer-max-code-growth
9786 Stop tail duplication once code growth has reached given percentage. This is
9787 a rather artificial limit, as most of the duplicates are eliminated later in
9788 cross jumping, so it may be set to much higher values than is the desired code
9789 growth.
9790
9791 @item tracer-min-branch-ratio
9792
9793 Stop reverse growth when the reverse probability of best edge is less than this
9794 threshold (in percent).
9795
9796 @item tracer-min-branch-probability
9797 @itemx tracer-min-branch-probability-feedback
9798
9799 Stop forward growth if the best edge has probability lower than this
9800 threshold.
9801
9802 Similarly to @option{tracer-dynamic-coverage} two parameters are
9803 provided. @option{tracer-min-branch-probability-feedback} is used for
9804 compilation with profile feedback and @option{tracer-min-branch-probability}
9805 compilation without. The value for compilation with profile feedback
9806 needs to be more conservative (higher) in order to make tracer
9807 effective.
9808
9809 @item max-cse-path-length
9810
9811 The maximum number of basic blocks on path that CSE considers.
9812 The default is 10.
9813
9814 @item max-cse-insns
9815 The maximum number of instructions CSE processes before flushing.
9816 The default is 1000.
9817
9818 @item ggc-min-expand
9819
9820 GCC uses a garbage collector to manage its own memory allocation. This
9821 parameter specifies the minimum percentage by which the garbage
9822 collector's heap should be allowed to expand between collections.
9823 Tuning this may improve compilation speed; it has no effect on code
9824 generation.
9825
9826 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9827 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9828 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9829 GCC is not able to calculate RAM on a particular platform, the lower
9830 bound of 30% is used. Setting this parameter and
9831 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9832 every opportunity. This is extremely slow, but can be useful for
9833 debugging.
9834
9835 @item ggc-min-heapsize
9836
9837 Minimum size of the garbage collector's heap before it begins bothering
9838 to collect garbage. The first collection occurs after the heap expands
9839 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9840 tuning this may improve compilation speed, and has no effect on code
9841 generation.
9842
9843 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9844 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9845 with a lower bound of 4096 (four megabytes) and an upper bound of
9846 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9847 particular platform, the lower bound is used. Setting this parameter
9848 very large effectively disables garbage collection. Setting this
9849 parameter and @option{ggc-min-expand} to zero causes a full collection
9850 to occur at every opportunity.
9851
9852 @item max-reload-search-insns
9853 The maximum number of instruction reload should look backward for equivalent
9854 register. Increasing values mean more aggressive optimization, making the
9855 compilation time increase with probably slightly better performance.
9856 The default value is 100.
9857
9858 @item max-cselib-memory-locations
9859 The maximum number of memory locations cselib should take into account.
9860 Increasing values mean more aggressive optimization, making the compilation time
9861 increase with probably slightly better performance. The default value is 500.
9862
9863 @item max-sched-ready-insns
9864 The maximum number of instructions ready to be issued the scheduler should
9865 consider at any given time during the first scheduling pass. Increasing
9866 values mean more thorough searches, making the compilation time increase
9867 with probably little benefit. The default value is 100.
9868
9869 @item max-sched-region-blocks
9870 The maximum number of blocks in a region to be considered for
9871 interblock scheduling. The default value is 10.
9872
9873 @item max-pipeline-region-blocks
9874 The maximum number of blocks in a region to be considered for
9875 pipelining in the selective scheduler. The default value is 15.
9876
9877 @item max-sched-region-insns
9878 The maximum number of insns in a region to be considered for
9879 interblock scheduling. The default value is 100.
9880
9881 @item max-pipeline-region-insns
9882 The maximum number of insns in a region to be considered for
9883 pipelining in the selective scheduler. The default value is 200.
9884
9885 @item min-spec-prob
9886 The minimum probability (in percents) of reaching a source block
9887 for interblock speculative scheduling. The default value is 40.
9888
9889 @item max-sched-extend-regions-iters
9890 The maximum number of iterations through CFG to extend regions.
9891 A value of 0 (the default) disables region extensions.
9892
9893 @item max-sched-insn-conflict-delay
9894 The maximum conflict delay for an insn to be considered for speculative motion.
9895 The default value is 3.
9896
9897 @item sched-spec-prob-cutoff
9898 The minimal probability of speculation success (in percents), so that
9899 speculative insns are scheduled.
9900 The default value is 40.
9901
9902 @item sched-state-edge-prob-cutoff
9903 The minimum probability an edge must have for the scheduler to save its
9904 state across it.
9905 The default value is 10.
9906
9907 @item sched-mem-true-dep-cost
9908 Minimal distance (in CPU cycles) between store and load targeting same
9909 memory locations. The default value is 1.
9910
9911 @item selsched-max-lookahead
9912 The maximum size of the lookahead window of selective scheduling. It is a
9913 depth of search for available instructions.
9914 The default value is 50.
9915
9916 @item selsched-max-sched-times
9917 The maximum number of times that an instruction is scheduled during
9918 selective scheduling. This is the limit on the number of iterations
9919 through which the instruction may be pipelined. The default value is 2.
9920
9921 @item selsched-insns-to-rename
9922 The maximum number of best instructions in the ready list that are considered
9923 for renaming in the selective scheduler. The default value is 2.
9924
9925 @item sms-min-sc
9926 The minimum value of stage count that swing modulo scheduler
9927 generates. The default value is 2.
9928
9929 @item max-last-value-rtl
9930 The maximum size measured as number of RTLs that can be recorded in an expression
9931 in combiner for a pseudo register as last known value of that register. The default
9932 is 10000.
9933
9934 @item max-combine-insns
9935 The maximum number of instructions the RTL combiner tries to combine.
9936 The default value is 2 at @option{-Og} and 4 otherwise.
9937
9938 @item integer-share-limit
9939 Small integer constants can use a shared data structure, reducing the
9940 compiler's memory usage and increasing its speed. This sets the maximum
9941 value of a shared integer constant. The default value is 256.
9942
9943 @item ssp-buffer-size
9944 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9945 protection when @option{-fstack-protection} is used.
9946
9947 @item min-size-for-stack-sharing
9948 The minimum size of variables taking part in stack slot sharing when not
9949 optimizing. The default value is 32.
9950
9951 @item max-jump-thread-duplication-stmts
9952 Maximum number of statements allowed in a block that needs to be
9953 duplicated when threading jumps.
9954
9955 @item max-fields-for-field-sensitive
9956 Maximum number of fields in a structure treated in
9957 a field sensitive manner during pointer analysis. The default is zero
9958 for @option{-O0} and @option{-O1},
9959 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9960
9961 @item prefetch-latency
9962 Estimate on average number of instructions that are executed before
9963 prefetch finishes. The distance prefetched ahead is proportional
9964 to this constant. Increasing this number may also lead to less
9965 streams being prefetched (see @option{simultaneous-prefetches}).
9966
9967 @item simultaneous-prefetches
9968 Maximum number of prefetches that can run at the same time.
9969
9970 @item l1-cache-line-size
9971 The size of cache line in L1 cache, in bytes.
9972
9973 @item l1-cache-size
9974 The size of L1 cache, in kilobytes.
9975
9976 @item l2-cache-size
9977 The size of L2 cache, in kilobytes.
9978
9979 @item min-insn-to-prefetch-ratio
9980 The minimum ratio between the number of instructions and the
9981 number of prefetches to enable prefetching in a loop.
9982
9983 @item prefetch-min-insn-to-mem-ratio
9984 The minimum ratio between the number of instructions and the
9985 number of memory references to enable prefetching in a loop.
9986
9987 @item use-canonical-types
9988 Whether the compiler should use the ``canonical'' type system. By
9989 default, this should always be 1, which uses a more efficient internal
9990 mechanism for comparing types in C++ and Objective-C++. However, if
9991 bugs in the canonical type system are causing compilation failures,
9992 set this value to 0 to disable canonical types.
9993
9994 @item switch-conversion-max-branch-ratio
9995 Switch initialization conversion refuses to create arrays that are
9996 bigger than @option{switch-conversion-max-branch-ratio} times the number of
9997 branches in the switch.
9998
9999 @item max-partial-antic-length
10000 Maximum length of the partial antic set computed during the tree
10001 partial redundancy elimination optimization (@option{-ftree-pre}) when
10002 optimizing at @option{-O3} and above. For some sorts of source code
10003 the enhanced partial redundancy elimination optimization can run away,
10004 consuming all of the memory available on the host machine. This
10005 parameter sets a limit on the length of the sets that are computed,
10006 which prevents the runaway behavior. Setting a value of 0 for
10007 this parameter allows an unlimited set length.
10008
10009 @item sccvn-max-scc-size
10010 Maximum size of a strongly connected component (SCC) during SCCVN
10011 processing. If this limit is hit, SCCVN processing for the whole
10012 function is not done and optimizations depending on it are
10013 disabled. The default maximum SCC size is 10000.
10014
10015 @item sccvn-max-alias-queries-per-access
10016 Maximum number of alias-oracle queries we perform when looking for
10017 redundancies for loads and stores. If this limit is hit the search
10018 is aborted and the load or store is not considered redundant. The
10019 number of queries is algorithmically limited to the number of
10020 stores on all paths from the load to the function entry.
10021 The default maximum number of queries is 1000.
10022
10023 @item ira-max-loops-num
10024 IRA uses regional register allocation by default. If a function
10025 contains more loops than the number given by this parameter, only at most
10026 the given number of the most frequently-executed loops form regions
10027 for regional register allocation. The default value of the
10028 parameter is 100.
10029
10030 @item ira-max-conflict-table-size
10031 Although IRA uses a sophisticated algorithm to compress the conflict
10032 table, the table can still require excessive amounts of memory for
10033 huge functions. If the conflict table for a function could be more
10034 than the size in MB given by this parameter, the register allocator
10035 instead uses a faster, simpler, and lower-quality
10036 algorithm that does not require building a pseudo-register conflict table.
10037 The default value of the parameter is 2000.
10038
10039 @item ira-loop-reserved-regs
10040 IRA can be used to evaluate more accurate register pressure in loops
10041 for decisions to move loop invariants (see @option{-O3}). The number
10042 of available registers reserved for some other purposes is given
10043 by this parameter. The default value of the parameter is 2, which is
10044 the minimal number of registers needed by typical instructions.
10045 This value is the best found from numerous experiments.
10046
10047 @item lra-inheritance-ebb-probability-cutoff
10048 LRA tries to reuse values reloaded in registers in subsequent insns.
10049 This optimization is called inheritance. EBB is used as a region to
10050 do this optimization. The parameter defines a minimal fall-through
10051 edge probability in percentage used to add BB to inheritance EBB in
10052 LRA. The default value of the parameter is 40. The value was chosen
10053 from numerous runs of SPEC2000 on x86-64.
10054
10055 @item loop-invariant-max-bbs-in-loop
10056 Loop invariant motion can be very expensive, both in compilation time and
10057 in amount of needed compile-time memory, with very large loops. Loops
10058 with more basic blocks than this parameter won't have loop invariant
10059 motion optimization performed on them. The default value of the
10060 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10061
10062 @item loop-max-datarefs-for-datadeps
10063 Building data dependencies is expensive for very large loops. This
10064 parameter limits the number of data references in loops that are
10065 considered for data dependence analysis. These large loops are no
10066 handled by the optimizations using loop data dependencies.
10067 The default value is 1000.
10068
10069 @item max-vartrack-size
10070 Sets a maximum number of hash table slots to use during variable
10071 tracking dataflow analysis of any function. If this limit is exceeded
10072 with variable tracking at assignments enabled, analysis for that
10073 function is retried without it, after removing all debug insns from
10074 the function. If the limit is exceeded even without debug insns, var
10075 tracking analysis is completely disabled for the function. Setting
10076 the parameter to zero makes it unlimited.
10077
10078 @item max-vartrack-expr-depth
10079 Sets a maximum number of recursion levels when attempting to map
10080 variable names or debug temporaries to value expressions. This trades
10081 compilation time for more complete debug information. If this is set too
10082 low, value expressions that are available and could be represented in
10083 debug information may end up not being used; setting this higher may
10084 enable the compiler to find more complex debug expressions, but compile
10085 time and memory use may grow. The default is 12.
10086
10087 @item min-nondebug-insn-uid
10088 Use uids starting at this parameter for nondebug insns. The range below
10089 the parameter is reserved exclusively for debug insns created by
10090 @option{-fvar-tracking-assignments}, but debug insns may get
10091 (non-overlapping) uids above it if the reserved range is exhausted.
10092
10093 @item ipa-sra-ptr-growth-factor
10094 IPA-SRA replaces a pointer to an aggregate with one or more new
10095 parameters only when their cumulative size is less or equal to
10096 @option{ipa-sra-ptr-growth-factor} times the size of the original
10097 pointer parameter.
10098
10099 @item sra-max-scalarization-size-Ospeed
10100 @item sra-max-scalarization-size-Osize
10101 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
10102 replace scalar parts of aggregates with uses of independent scalar
10103 variables. These parameters control the maximum size, in storage units,
10104 of aggregate which is considered for replacement when compiling for
10105 speed
10106 (@option{sra-max-scalarization-size-Ospeed}) or size
10107 (@option{sra-max-scalarization-size-Osize}) respectively.
10108
10109 @item tm-max-aggregate-size
10110 When making copies of thread-local variables in a transaction, this
10111 parameter specifies the size in bytes after which variables are
10112 saved with the logging functions as opposed to save/restore code
10113 sequence pairs. This option only applies when using
10114 @option{-fgnu-tm}.
10115
10116 @item graphite-max-nb-scop-params
10117 To avoid exponential effects in the Graphite loop transforms, the
10118 number of parameters in a Static Control Part (SCoP) is bounded. The
10119 default value is 10 parameters. A variable whose value is unknown at
10120 compilation time and defined outside a SCoP is a parameter of the SCoP.
10121
10122 @item graphite-max-bbs-per-function
10123 To avoid exponential effects in the detection of SCoPs, the size of
10124 the functions analyzed by Graphite is bounded. The default value is
10125 100 basic blocks.
10126
10127 @item loop-block-tile-size
10128 Loop blocking or strip mining transforms, enabled with
10129 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10130 loop in the loop nest by a given number of iterations. The strip
10131 length can be changed using the @option{loop-block-tile-size}
10132 parameter. The default value is 51 iterations.
10133
10134 @item loop-unroll-jam-size
10135 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
10136 default value is 4.
10137
10138 @item loop-unroll-jam-depth
10139 Specify the dimension to be unrolled (counting from the most inner loop)
10140 for the @option{-floop-unroll-and-jam}. The default value is 2.
10141
10142 @item ipa-cp-value-list-size
10143 IPA-CP attempts to track all possible values and types passed to a function's
10144 parameter in order to propagate them and perform devirtualization.
10145 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10146 stores per one formal parameter of a function.
10147
10148 @item ipa-cp-eval-threshold
10149 IPA-CP calculates its own score of cloning profitability heuristics
10150 and performs those cloning opportunities with scores that exceed
10151 @option{ipa-cp-eval-threshold}.
10152
10153 @item ipa-cp-recursion-penalty
10154 Percentage penalty the recursive functions will receive when they
10155 are evaluated for cloning.
10156
10157 @item ipa-cp-single-call-penalty
10158 Percentage penalty functions containg a single call to another
10159 function will receive when they are evaluated for cloning.
10160
10161
10162 @item ipa-max-agg-items
10163 IPA-CP is also capable to propagate a number of scalar values passed
10164 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10165 number of such values per one parameter.
10166
10167 @item ipa-cp-loop-hint-bonus
10168 When IPA-CP determines that a cloning candidate would make the number
10169 of iterations of a loop known, it adds a bonus of
10170 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10171 the candidate.
10172
10173 @item ipa-cp-array-index-hint-bonus
10174 When IPA-CP determines that a cloning candidate would make the index of
10175 an array access known, it adds a bonus of
10176 @option{ipa-cp-array-index-hint-bonus} to the profitability
10177 score of the candidate.
10178
10179 @item ipa-max-aa-steps
10180 During its analysis of function bodies, IPA-CP employs alias analysis
10181 in order to track values pointed to by function parameters. In order
10182 not spend too much time analyzing huge functions, it gives up and
10183 consider all memory clobbered after examining
10184 @option{ipa-max-aa-steps} statements modifying memory.
10185
10186 @item lto-partitions
10187 Specify desired number of partitions produced during WHOPR compilation.
10188 The number of partitions should exceed the number of CPUs used for compilation.
10189 The default value is 32.
10190
10191 @item lto-min-partition
10192 Size of minimal partition for WHOPR (in estimated instructions).
10193 This prevents expenses of splitting very small programs into too many
10194 partitions.
10195
10196 @item lto-max-partition
10197 Size of max partition for WHOPR (in estimated instructions).
10198 to provide an upper bound for individual size of partition.
10199 Meant to be used only with balanced partitioning.
10200
10201 @item cxx-max-namespaces-for-diagnostic-help
10202 The maximum number of namespaces to consult for suggestions when C++
10203 name lookup fails for an identifier. The default is 1000.
10204
10205 @item sink-frequency-threshold
10206 The maximum relative execution frequency (in percents) of the target block
10207 relative to a statement's original block to allow statement sinking of a
10208 statement. Larger numbers result in more aggressive statement sinking.
10209 The default value is 75. A small positive adjustment is applied for
10210 statements with memory operands as those are even more profitable so sink.
10211
10212 @item max-stores-to-sink
10213 The maximum number of conditional store pairs that can be sunk. Set to 0
10214 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10215 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10216
10217 @item allow-store-data-races
10218 Allow optimizers to introduce new data races on stores.
10219 Set to 1 to allow, otherwise to 0. This option is enabled by default
10220 at optimization level @option{-Ofast}.
10221
10222 @item case-values-threshold
10223 The smallest number of different values for which it is best to use a
10224 jump-table instead of a tree of conditional branches. If the value is
10225 0, use the default for the machine. The default is 0.
10226
10227 @item tree-reassoc-width
10228 Set the maximum number of instructions executed in parallel in
10229 reassociated tree. This parameter overrides target dependent
10230 heuristics used by default if has non zero value.
10231
10232 @item sched-pressure-algorithm
10233 Choose between the two available implementations of
10234 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10235 and is the more likely to prevent instructions from being reordered.
10236 Algorithm 2 was designed to be a compromise between the relatively
10237 conservative approach taken by algorithm 1 and the rather aggressive
10238 approach taken by the default scheduler. It relies more heavily on
10239 having a regular register file and accurate register pressure classes.
10240 See @file{haifa-sched.c} in the GCC sources for more details.
10241
10242 The default choice depends on the target.
10243
10244 @item max-slsr-cand-scan
10245 Set the maximum number of existing candidates that are considered when
10246 seeking a basis for a new straight-line strength reduction candidate.
10247
10248 @item asan-globals
10249 Enable buffer overflow detection for global objects. This kind
10250 of protection is enabled by default if you are using
10251 @option{-fsanitize=address} option.
10252 To disable global objects protection use @option{--param asan-globals=0}.
10253
10254 @item asan-stack
10255 Enable buffer overflow detection for stack objects. This kind of
10256 protection is enabled by default when using @option{-fsanitize=address}.
10257 To disable stack protection use @option{--param asan-stack=0} option.
10258
10259 @item asan-instrument-reads
10260 Enable buffer overflow detection for memory reads. This kind of
10261 protection is enabled by default when using @option{-fsanitize=address}.
10262 To disable memory reads protection use
10263 @option{--param asan-instrument-reads=0}.
10264
10265 @item asan-instrument-writes
10266 Enable buffer overflow detection for memory writes. This kind of
10267 protection is enabled by default when using @option{-fsanitize=address}.
10268 To disable memory writes protection use
10269 @option{--param asan-instrument-writes=0} option.
10270
10271 @item asan-memintrin
10272 Enable detection for built-in functions. This kind of protection
10273 is enabled by default when using @option{-fsanitize=address}.
10274 To disable built-in functions protection use
10275 @option{--param asan-memintrin=0}.
10276
10277 @item asan-use-after-return
10278 Enable detection of use-after-return. This kind of protection
10279 is enabled by default when using @option{-fsanitize=address} option.
10280 To disable use-after-return detection use
10281 @option{--param asan-use-after-return=0}.
10282
10283 Note: The check is disabled by default at runtime. To enable the check,
10284 you should set environment variable @env{ASAN_OPTIONS} to
10285 @code{detect_stack_use_after_return=1}.
10286
10287 @item asan-instrumentation-with-call-threshold
10288 If number of memory accesses in function being instrumented
10289 is greater or equal to this number, use callbacks instead of inline checks.
10290 E.g. to disable inline code use
10291 @option{--param asan-instrumentation-with-call-threshold=0}.
10292
10293 @item use-after-scope-direct-emission-threshold
10294 If size of a local variables in bytes is smaller of equal to this number,
10295 direct instruction emission is utilized to poison and unpoison local variables.
10296
10297 @item chkp-max-ctor-size
10298 Static constructors generated by Pointer Bounds Checker may become very
10299 large and significantly increase compile time at optimization level
10300 @option{-O1} and higher. This parameter is a maximum nubmer of statements
10301 in a single generated constructor. Default value is 5000.
10302
10303 @item max-fsm-thread-path-insns
10304 Maximum number of instructions to copy when duplicating blocks on a
10305 finite state automaton jump thread path. The default is 100.
10306
10307 @item max-fsm-thread-length
10308 Maximum number of basic blocks on a finite state automaton jump thread
10309 path. The default is 10.
10310
10311 @item max-fsm-thread-paths
10312 Maximum number of new jump thread paths to create for a finite state
10313 automaton. The default is 50.
10314
10315 @item parloops-chunk-size
10316 Chunk size of omp schedule for loops parallelized by parloops. The default
10317 is 0.
10318
10319 @item parloops-schedule
10320 Schedule type of omp schedule for loops parallelized by parloops (static,
10321 dynamic, guided, auto, runtime). The default is static.
10322
10323 @item max-ssa-name-query-depth
10324 Maximum depth of recursion when querying properties of SSA names in things
10325 like fold routines. One level of recursion corresponds to following a
10326 use-def chain.
10327
10328 @item hsa-gen-debug-stores
10329 Enable emission of special debug stores within HSA kernels which are
10330 then read and reported by libgomp plugin. Generation of these stores
10331 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
10332 enable it.
10333
10334 @item max-speculative-devirt-maydefs
10335 The maximum number of may-defs we analyze when looking for a must-def
10336 specifying the dynamic type of an object that invokes a virtual call
10337 we may be able to devirtualize speculatively.
10338
10339 @item max-vrp-switch-assertions
10340 The maximum number of assertions to add along the default edge of a switch
10341 statement during VRP. The default is 10.
10342 @end table
10343 @end table
10344
10345 @node Instrumentation Options
10346 @section Program Instrumentation Options
10347 @cindex instrumentation options
10348 @cindex program instrumentation options
10349 @cindex run-time error checking options
10350 @cindex profiling options
10351 @cindex options, program instrumentation
10352 @cindex options, run-time error checking
10353 @cindex options, profiling
10354
10355 GCC supports a number of command-line options that control adding
10356 run-time instrumentation to the code it normally generates.
10357 For example, one purpose of instrumentation is collect profiling
10358 statistics for use in finding program hot spots, code coverage
10359 analysis, or profile-guided optimizations.
10360 Another class of program instrumentation is adding run-time checking
10361 to detect programming errors like invalid pointer
10362 dereferences or out-of-bounds array accesses, as well as deliberately
10363 hostile attacks such as stack smashing or C++ vtable hijacking.
10364 There is also a general hook which can be used to implement other
10365 forms of tracing or function-level instrumentation for debug or
10366 program analysis purposes.
10367
10368 @table @gcctabopt
10369 @cindex @command{prof}
10370 @item -p
10371 @opindex p
10372 Generate extra code to write profile information suitable for the
10373 analysis program @command{prof}. You must use this option when compiling
10374 the source files you want data about, and you must also use it when
10375 linking.
10376
10377 @cindex @command{gprof}
10378 @item -pg
10379 @opindex pg
10380 Generate extra code to write profile information suitable for the
10381 analysis program @command{gprof}. You must use this option when compiling
10382 the source files you want data about, and you must also use it when
10383 linking.
10384
10385 @item -fprofile-arcs
10386 @opindex fprofile-arcs
10387 Add code so that program flow @dfn{arcs} are instrumented. During
10388 execution the program records how many times each branch and call is
10389 executed and how many times it is taken or returns. When the compiled
10390 program exits it saves this data to a file called
10391 @file{@var{auxname}.gcda} for each source file. The data may be used for
10392 profile-directed optimizations (@option{-fbranch-probabilities}), or for
10393 test coverage analysis (@option{-ftest-coverage}). Each object file's
10394 @var{auxname} is generated from the name of the output file, if
10395 explicitly specified and it is not the final executable, otherwise it is
10396 the basename of the source file. In both cases any suffix is removed
10397 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
10398 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
10399 @xref{Cross-profiling}.
10400
10401 @cindex @command{gcov}
10402 @item --coverage
10403 @opindex coverage
10404
10405 This option is used to compile and link code instrumented for coverage
10406 analysis. The option is a synonym for @option{-fprofile-arcs}
10407 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
10408 linking). See the documentation for those options for more details.
10409
10410 @itemize
10411
10412 @item
10413 Compile the source files with @option{-fprofile-arcs} plus optimization
10414 and code generation options. For test coverage analysis, use the
10415 additional @option{-ftest-coverage} option. You do not need to profile
10416 every source file in a program.
10417
10418 @item
10419 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
10420 (the latter implies the former).
10421
10422 @item
10423 Run the program on a representative workload to generate the arc profile
10424 information. This may be repeated any number of times. You can run
10425 concurrent instances of your program, and provided that the file system
10426 supports locking, the data files will be correctly updated. Also
10427 @code{fork} calls are detected and correctly handled (double counting
10428 will not happen).
10429
10430 @item
10431 For profile-directed optimizations, compile the source files again with
10432 the same optimization and code generation options plus
10433 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
10434 Control Optimization}).
10435
10436 @item
10437 For test coverage analysis, use @command{gcov} to produce human readable
10438 information from the @file{.gcno} and @file{.gcda} files. Refer to the
10439 @command{gcov} documentation for further information.
10440
10441 @end itemize
10442
10443 With @option{-fprofile-arcs}, for each function of your program GCC
10444 creates a program flow graph, then finds a spanning tree for the graph.
10445 Only arcs that are not on the spanning tree have to be instrumented: the
10446 compiler adds code to count the number of times that these arcs are
10447 executed. When an arc is the only exit or only entrance to a block, the
10448 instrumentation code can be added to the block; otherwise, a new basic
10449 block must be created to hold the instrumentation code.
10450
10451 @need 2000
10452 @item -ftest-coverage
10453 @opindex ftest-coverage
10454 Produce a notes file that the @command{gcov} code-coverage utility
10455 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
10456 show program coverage. Each source file's note file is called
10457 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
10458 above for a description of @var{auxname} and instructions on how to
10459 generate test coverage data. Coverage data matches the source files
10460 more closely if you do not optimize.
10461
10462 @item -fprofile-dir=@var{path}
10463 @opindex fprofile-dir
10464
10465 Set the directory to search for the profile data files in to @var{path}.
10466 This option affects only the profile data generated by
10467 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
10468 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
10469 and its related options. Both absolute and relative paths can be used.
10470 By default, GCC uses the current directory as @var{path}, thus the
10471 profile data file appears in the same directory as the object file.
10472
10473 @item -fprofile-generate
10474 @itemx -fprofile-generate=@var{path}
10475 @opindex fprofile-generate
10476
10477 Enable options usually used for instrumenting application to produce
10478 profile useful for later recompilation with profile feedback based
10479 optimization. You must use @option{-fprofile-generate} both when
10480 compiling and when linking your program.
10481
10482 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
10483
10484 If @var{path} is specified, GCC looks at the @var{path} to find
10485 the profile feedback data files. See @option{-fprofile-dir}.
10486
10487 To optimize the program based on the collected profile information, use
10488 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
10489
10490 @item -fprofile-update=@var{method}
10491 @opindex fprofile-update
10492
10493 Alter the update method for an application instrumented for profile
10494 feedback based optimization. The @var{method} argument should be one of
10495 @samp{single} or @samp{atomic}. The first one is useful for single-threaded
10496 applications, while the second one prevents profile corruption by emitting
10497 thread-safe code.
10498
10499 @strong{Warning:} When an application does not properly join all threads
10500 (or creates an detached thread), a profile file can be still corrupted.
10501
10502 @item -fsanitize=address
10503 @opindex fsanitize=address
10504 Enable AddressSanitizer, a fast memory error detector.
10505 Memory access instructions are instrumented to detect
10506 out-of-bounds and use-after-free bugs.
10507 The option enables @option{-fsanitize-address-use-after-scope}.
10508 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
10509 more details. The run-time behavior can be influenced using the
10510 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
10511 the available options are shown at startup of the instrumented program. See
10512 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
10513 for a list of supported options.
10514 The option can't be combined with @option{-fsanitize=thread}.
10515
10516 @item -fsanitize=kernel-address
10517 @opindex fsanitize=kernel-address
10518 Enable AddressSanitizer for Linux kernel.
10519 The option enables @option{-fsanitize-address-use-after-scope}.
10520 See @uref{https://github.com/google/kasan/wiki} for more details.
10521
10522 @item -fsanitize=thread
10523 @opindex fsanitize=thread
10524 Enable ThreadSanitizer, a fast data race detector.
10525 Memory access instructions are instrumented to detect
10526 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
10527 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
10528 environment variable; see
10529 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
10530 supported options.
10531 The option can't be combined with @option{-fsanitize=address}
10532 and/or @option{-fsanitize=leak}.
10533
10534 @item -fsanitize=leak
10535 @opindex fsanitize=leak
10536 Enable LeakSanitizer, a memory leak detector.
10537 This option only matters for linking of executables and
10538 the executable is linked against a library that overrides @code{malloc}
10539 and other allocator functions. See
10540 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
10541 details. The run-time behavior can be influenced using the
10542 @env{LSAN_OPTIONS} environment variable.
10543 The option can't be combined with @option{-fsanitize=thread}.
10544
10545 @item -fsanitize=undefined
10546 @opindex fsanitize=undefined
10547 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
10548 Various computations are instrumented to detect undefined behavior
10549 at runtime. Current suboptions are:
10550
10551 @table @gcctabopt
10552
10553 @item -fsanitize=shift
10554 @opindex fsanitize=shift
10555 This option enables checking that the result of a shift operation is
10556 not undefined. Note that what exactly is considered undefined differs
10557 slightly between C and C++, as well as between ISO C90 and C99, etc.
10558
10559 @item -fsanitize=integer-divide-by-zero
10560 @opindex fsanitize=integer-divide-by-zero
10561 Detect integer division by zero as well as @code{INT_MIN / -1} division.
10562
10563 @item -fsanitize=unreachable
10564 @opindex fsanitize=unreachable
10565 With this option, the compiler turns the @code{__builtin_unreachable}
10566 call into a diagnostics message call instead. When reaching the
10567 @code{__builtin_unreachable} call, the behavior is undefined.
10568
10569 @item -fsanitize=vla-bound
10570 @opindex fsanitize=vla-bound
10571 This option instructs the compiler to check that the size of a variable
10572 length array is positive.
10573
10574 @item -fsanitize=null
10575 @opindex fsanitize=null
10576 This option enables pointer checking. Particularly, the application
10577 built with this option turned on will issue an error message when it
10578 tries to dereference a NULL pointer, or if a reference (possibly an
10579 rvalue reference) is bound to a NULL pointer, or if a method is invoked
10580 on an object pointed by a NULL pointer.
10581
10582 @item -fsanitize=return
10583 @opindex fsanitize=return
10584 This option enables return statement checking. Programs
10585 built with this option turned on will issue an error message
10586 when the end of a non-void function is reached without actually
10587 returning a value. This option works in C++ only.
10588
10589 @item -fsanitize=signed-integer-overflow
10590 @opindex fsanitize=signed-integer-overflow
10591 This option enables signed integer overflow checking. We check that
10592 the result of @code{+}, @code{*}, and both unary and binary @code{-}
10593 does not overflow in the signed arithmetics. Note, integer promotion
10594 rules must be taken into account. That is, the following is not an
10595 overflow:
10596 @smallexample
10597 signed char a = SCHAR_MAX;
10598 a++;
10599 @end smallexample
10600
10601 @item -fsanitize=bounds
10602 @opindex fsanitize=bounds
10603 This option enables instrumentation of array bounds. Various out of bounds
10604 accesses are detected. Flexible array members, flexible array member-like
10605 arrays, and initializers of variables with static storage are not instrumented.
10606
10607 @item -fsanitize=bounds-strict
10608 @opindex fsanitize=bounds-strict
10609 This option enables strict instrumentation of array bounds. Most out of bounds
10610 accesses are detected, including flexible array members and flexible array
10611 member-like arrays. Initializers of variables with static storage are not
10612 instrumented.
10613
10614 @item -fsanitize=alignment
10615 @opindex fsanitize=alignment
10616
10617 This option enables checking of alignment of pointers when they are
10618 dereferenced, or when a reference is bound to insufficiently aligned target,
10619 or when a method or constructor is invoked on insufficiently aligned object.
10620
10621 @item -fsanitize=object-size
10622 @opindex fsanitize=object-size
10623 This option enables instrumentation of memory references using the
10624 @code{__builtin_object_size} function. Various out of bounds pointer
10625 accesses are detected.
10626
10627 @item -fsanitize=float-divide-by-zero
10628 @opindex fsanitize=float-divide-by-zero
10629 Detect floating-point division by zero. Unlike other similar options,
10630 @option{-fsanitize=float-divide-by-zero} is not enabled by
10631 @option{-fsanitize=undefined}, since floating-point division by zero can
10632 be a legitimate way of obtaining infinities and NaNs.
10633
10634 @item -fsanitize=float-cast-overflow
10635 @opindex fsanitize=float-cast-overflow
10636 This option enables floating-point type to integer conversion checking.
10637 We check that the result of the conversion does not overflow.
10638 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
10639 not enabled by @option{-fsanitize=undefined}.
10640 This option does not work well with @code{FE_INVALID} exceptions enabled.
10641
10642 @item -fsanitize=nonnull-attribute
10643 @opindex fsanitize=nonnull-attribute
10644
10645 This option enables instrumentation of calls, checking whether null values
10646 are not passed to arguments marked as requiring a non-null value by the
10647 @code{nonnull} function attribute.
10648
10649 @item -fsanitize=returns-nonnull-attribute
10650 @opindex fsanitize=returns-nonnull-attribute
10651
10652 This option enables instrumentation of return statements in functions
10653 marked with @code{returns_nonnull} function attribute, to detect returning
10654 of null values from such functions.
10655
10656 @item -fsanitize=bool
10657 @opindex fsanitize=bool
10658
10659 This option enables instrumentation of loads from bool. If a value other
10660 than 0/1 is loaded, a run-time error is issued.
10661
10662 @item -fsanitize=enum
10663 @opindex fsanitize=enum
10664
10665 This option enables instrumentation of loads from an enum type. If
10666 a value outside the range of values for the enum type is loaded,
10667 a run-time error is issued.
10668
10669 @item -fsanitize=vptr
10670 @opindex fsanitize=vptr
10671
10672 This option enables instrumentation of C++ member function calls, member
10673 accesses and some conversions between pointers to base and derived classes,
10674 to verify the referenced object has the correct dynamic type.
10675
10676 @end table
10677
10678 While @option{-ftrapv} causes traps for signed overflows to be emitted,
10679 @option{-fsanitize=undefined} gives a diagnostic message.
10680 This currently works only for the C family of languages.
10681
10682 @item -fno-sanitize=all
10683 @opindex fno-sanitize=all
10684
10685 This option disables all previously enabled sanitizers.
10686 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
10687 together.
10688
10689 @item -fasan-shadow-offset=@var{number}
10690 @opindex fasan-shadow-offset
10691 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
10692 It is useful for experimenting with different shadow memory layouts in
10693 Kernel AddressSanitizer.
10694
10695 @item -fsanitize-sections=@var{s1},@var{s2},...
10696 @opindex fsanitize-sections
10697 Sanitize global variables in selected user-defined sections. @var{si} may
10698 contain wildcards.
10699
10700 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
10701 @opindex fsanitize-recover
10702 @opindex fno-sanitize-recover
10703 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
10704 mentioned in comma-separated list of @var{opts}. Enabling this option
10705 for a sanitizer component causes it to attempt to continue
10706 running the program as if no error happened. This means multiple
10707 runtime errors can be reported in a single program run, and the exit
10708 code of the program may indicate success even when errors
10709 have been reported. The @option{-fno-sanitize-recover=} option
10710 can be used to alter
10711 this behavior: only the first detected error is reported
10712 and program then exits with a non-zero exit code.
10713
10714 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
10715 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
10716 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
10717 @option{-fsanitize=bounds-strict},
10718 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
10719 For these sanitizers error recovery is turned on by default,
10720 except @option{-fsanitize=address}, for which this feature is experimental.
10721 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
10722 accepted, the former enables recovery for all sanitizers that support it,
10723 the latter disables recovery for all sanitizers that support it.
10724
10725 Even if a recovery mode is turned on the compiler side, it needs to be also
10726 enabled on the runtime library side, otherwise the failures are still fatal.
10727 The runtime library defaults to @code{halt_on_error=0} for
10728 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
10729 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
10730 setting the @code{halt_on_error} flag in the corresponding environment variable.
10731
10732 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
10733 @smallexample
10734 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
10735 @end smallexample
10736 @noindent
10737 Similarly @option{-fno-sanitize-recover} is equivalent to
10738 @smallexample
10739 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
10740 @end smallexample
10741
10742 @item -fsanitize-address-use-after-scope
10743 @opindex fsanitize-address-use-after-scope
10744 Enable sanitization of local variables to detect use-after-scope bugs.
10745 The option sets @option{-fstack-reuse} to @samp{none}.
10746
10747 @item -fsanitize-undefined-trap-on-error
10748 @opindex fsanitize-undefined-trap-on-error
10749 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
10750 report undefined behavior using @code{__builtin_trap} rather than
10751 a @code{libubsan} library routine. The advantage of this is that the
10752 @code{libubsan} library is not needed and is not linked in, so this
10753 is usable even in freestanding environments.
10754
10755 @item -fsanitize-coverage=trace-pc
10756 @opindex fsanitize-coverage=trace-pc
10757 Enable coverage-guided fuzzing code instrumentation.
10758 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
10759
10760 @item -fbounds-check
10761 @opindex fbounds-check
10762 For front ends that support it, generate additional code to check that
10763 indices used to access arrays are within the declared range. This is
10764 currently only supported by the Java and Fortran front ends, where
10765 this option defaults to true and false respectively.
10766
10767 @item -fcheck-pointer-bounds
10768 @opindex fcheck-pointer-bounds
10769 @opindex fno-check-pointer-bounds
10770 @cindex Pointer Bounds Checker options
10771 Enable Pointer Bounds Checker instrumentation. Each memory reference
10772 is instrumented with checks of the pointer used for memory access against
10773 bounds associated with that pointer.
10774
10775 Currently there
10776 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
10777 and @option{-mmpx} are required to enable this feature.
10778 MPX-based instrumentation requires
10779 a runtime library to enable MPX in hardware and handle bounds
10780 violation signals. By default when @option{-fcheck-pointer-bounds}
10781 and @option{-mmpx} options are used to link a program, the GCC driver
10782 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
10783 Bounds checking on calls to dynamic libraries requires a linker
10784 with @option{-z bndplt} support; if GCC was configured with a linker
10785 without support for this option (including the Gold linker and older
10786 versions of ld), a warning is given if you link with @option{-mmpx}
10787 without also specifying @option{-static}, since the overall effectiveness
10788 of the bounds checking protection is reduced.
10789 See also @option{-static-libmpxwrappers}.
10790
10791 MPX-based instrumentation
10792 may be used for debugging and also may be included in production code
10793 to increase program security. Depending on usage, you may
10794 have different requirements for the runtime library. The current version
10795 of the MPX runtime library is more oriented for use as a debugging
10796 tool. MPX runtime library usage implies @option{-lpthread}. See
10797 also @option{-static-libmpx}. The runtime library behavior can be
10798 influenced using various @env{CHKP_RT_*} environment variables. See
10799 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
10800 for more details.
10801
10802 Generated instrumentation may be controlled by various
10803 @option{-fchkp-*} options and by the @code{bnd_variable_size}
10804 structure field attribute (@pxref{Type Attributes}) and
10805 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
10806 (@pxref{Function Attributes}). GCC also provides a number of built-in
10807 functions for controlling the Pointer Bounds Checker. @xref{Pointer
10808 Bounds Checker builtins}, for more information.
10809
10810 @item -fchkp-check-incomplete-type
10811 @opindex fchkp-check-incomplete-type
10812 @opindex fno-chkp-check-incomplete-type
10813 Generate pointer bounds checks for variables with incomplete type.
10814 Enabled by default.
10815
10816 @item -fchkp-narrow-bounds
10817 @opindex fchkp-narrow-bounds
10818 @opindex fno-chkp-narrow-bounds
10819 Controls bounds used by Pointer Bounds Checker for pointers to object
10820 fields. If narrowing is enabled then field bounds are used. Otherwise
10821 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
10822 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
10823
10824 @item -fchkp-first-field-has-own-bounds
10825 @opindex fchkp-first-field-has-own-bounds
10826 @opindex fno-chkp-first-field-has-own-bounds
10827 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
10828 first field in the structure. By default a pointer to the first field has
10829 the same bounds as a pointer to the whole structure.
10830
10831 @item -fchkp-narrow-to-innermost-array
10832 @opindex fchkp-narrow-to-innermost-array
10833 @opindex fno-chkp-narrow-to-innermost-array
10834 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
10835 case of nested static array access. By default this option is disabled and
10836 bounds of the outermost array are used.
10837
10838 @item -fchkp-optimize
10839 @opindex fchkp-optimize
10840 @opindex fno-chkp-optimize
10841 Enables Pointer Bounds Checker optimizations. Enabled by default at
10842 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
10843
10844 @item -fchkp-use-fast-string-functions
10845 @opindex fchkp-use-fast-string-functions
10846 @opindex fno-chkp-use-fast-string-functions
10847 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
10848 by Pointer Bounds Checker. Disabled by default.
10849
10850 @item -fchkp-use-nochk-string-functions
10851 @opindex fchkp-use-nochk-string-functions
10852 @opindex fno-chkp-use-nochk-string-functions
10853 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
10854 by Pointer Bounds Checker. Disabled by default.
10855
10856 @item -fchkp-use-static-bounds
10857 @opindex fchkp-use-static-bounds
10858 @opindex fno-chkp-use-static-bounds
10859 Allow Pointer Bounds Checker to generate static bounds holding
10860 bounds of static variables. Enabled by default.
10861
10862 @item -fchkp-use-static-const-bounds
10863 @opindex fchkp-use-static-const-bounds
10864 @opindex fno-chkp-use-static-const-bounds
10865 Use statically-initialized bounds for constant bounds instead of
10866 generating them each time they are required. By default enabled when
10867 @option{-fchkp-use-static-bounds} is enabled.
10868
10869 @item -fchkp-treat-zero-dynamic-size-as-infinite
10870 @opindex fchkp-treat-zero-dynamic-size-as-infinite
10871 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
10872 With this option, objects with incomplete type whose
10873 dynamically-obtained size is zero are treated as having infinite size
10874 instead by Pointer Bounds
10875 Checker. This option may be helpful if a program is linked with a library
10876 missing size information for some symbols. Disabled by default.
10877
10878 @item -fchkp-check-read
10879 @opindex fchkp-check-read
10880 @opindex fno-chkp-check-read
10881 Instructs Pointer Bounds Checker to generate checks for all read
10882 accesses to memory. Enabled by default.
10883
10884 @item -fchkp-check-write
10885 @opindex fchkp-check-write
10886 @opindex fno-chkp-check-write
10887 Instructs Pointer Bounds Checker to generate checks for all write
10888 accesses to memory. Enabled by default.
10889
10890 @item -fchkp-store-bounds
10891 @opindex fchkp-store-bounds
10892 @opindex fno-chkp-store-bounds
10893 Instructs Pointer Bounds Checker to generate bounds stores for
10894 pointer writes. Enabled by default.
10895
10896 @item -fchkp-instrument-calls
10897 @opindex fchkp-instrument-calls
10898 @opindex fno-chkp-instrument-calls
10899 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
10900 Enabled by default.
10901
10902 @item -fchkp-instrument-marked-only
10903 @opindex fchkp-instrument-marked-only
10904 @opindex fno-chkp-instrument-marked-only
10905 Instructs Pointer Bounds Checker to instrument only functions
10906 marked with the @code{bnd_instrument} attribute
10907 (@pxref{Function Attributes}). Disabled by default.
10908
10909 @item -fchkp-use-wrappers
10910 @opindex fchkp-use-wrappers
10911 @opindex fno-chkp-use-wrappers
10912 Allows Pointer Bounds Checker to replace calls to built-in functions
10913 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
10914 is used to link a program, the GCC driver automatically links
10915 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
10916 Enabled by default.
10917
10918 @item -fstack-protector
10919 @opindex fstack-protector
10920 Emit extra code to check for buffer overflows, such as stack smashing
10921 attacks. This is done by adding a guard variable to functions with
10922 vulnerable objects. This includes functions that call @code{alloca}, and
10923 functions with buffers larger than 8 bytes. The guards are initialized
10924 when a function is entered and then checked when the function exits.
10925 If a guard check fails, an error message is printed and the program exits.
10926
10927 @item -fstack-protector-all
10928 @opindex fstack-protector-all
10929 Like @option{-fstack-protector} except that all functions are protected.
10930
10931 @item -fstack-protector-strong
10932 @opindex fstack-protector-strong
10933 Like @option{-fstack-protector} but includes additional functions to
10934 be protected --- those that have local array definitions, or have
10935 references to local frame addresses.
10936
10937 @item -fstack-protector-explicit
10938 @opindex fstack-protector-explicit
10939 Like @option{-fstack-protector} but only protects those functions which
10940 have the @code{stack_protect} attribute.
10941
10942 @item -fstack-check
10943 @opindex fstack-check
10944 Generate code to verify that you do not go beyond the boundary of the
10945 stack. You should specify this flag if you are running in an
10946 environment with multiple threads, but you only rarely need to specify it in
10947 a single-threaded environment since stack overflow is automatically
10948 detected on nearly all systems if there is only one stack.
10949
10950 Note that this switch does not actually cause checking to be done; the
10951 operating system or the language runtime must do that. The switch causes
10952 generation of code to ensure that they see the stack being extended.
10953
10954 You can additionally specify a string parameter: @samp{no} means no
10955 checking, @samp{generic} means force the use of old-style checking,
10956 @samp{specific} means use the best checking method and is equivalent
10957 to bare @option{-fstack-check}.
10958
10959 Old-style checking is a generic mechanism that requires no specific
10960 target support in the compiler but comes with the following drawbacks:
10961
10962 @enumerate
10963 @item
10964 Modified allocation strategy for large objects: they are always
10965 allocated dynamically if their size exceeds a fixed threshold.
10966
10967 @item
10968 Fixed limit on the size of the static frame of functions: when it is
10969 topped by a particular function, stack checking is not reliable and
10970 a warning is issued by the compiler.
10971
10972 @item
10973 Inefficiency: because of both the modified allocation strategy and the
10974 generic implementation, code performance is hampered.
10975 @end enumerate
10976
10977 Note that old-style stack checking is also the fallback method for
10978 @samp{specific} if no target support has been added in the compiler.
10979
10980 @item -fstack-limit-register=@var{reg}
10981 @itemx -fstack-limit-symbol=@var{sym}
10982 @itemx -fno-stack-limit
10983 @opindex fstack-limit-register
10984 @opindex fstack-limit-symbol
10985 @opindex fno-stack-limit
10986 Generate code to ensure that the stack does not grow beyond a certain value,
10987 either the value of a register or the address of a symbol. If a larger
10988 stack is required, a signal is raised at run time. For most targets,
10989 the signal is raised before the stack overruns the boundary, so
10990 it is possible to catch the signal without taking special precautions.
10991
10992 For instance, if the stack starts at absolute address @samp{0x80000000}
10993 and grows downwards, you can use the flags
10994 @option{-fstack-limit-symbol=__stack_limit} and
10995 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10996 of 128KB@. Note that this may only work with the GNU linker.
10997
10998 You can locally override stack limit checking by using the
10999 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
11000
11001 @item -fsplit-stack
11002 @opindex fsplit-stack
11003 Generate code to automatically split the stack before it overflows.
11004 The resulting program has a discontiguous stack which can only
11005 overflow if the program is unable to allocate any more memory. This
11006 is most useful when running threaded programs, as it is no longer
11007 necessary to calculate a good stack size to use for each thread. This
11008 is currently only implemented for the x86 targets running
11009 GNU/Linux.
11010
11011 When code compiled with @option{-fsplit-stack} calls code compiled
11012 without @option{-fsplit-stack}, there may not be much stack space
11013 available for the latter code to run. If compiling all code,
11014 including library code, with @option{-fsplit-stack} is not an option,
11015 then the linker can fix up these calls so that the code compiled
11016 without @option{-fsplit-stack} always has a large stack. Support for
11017 this is implemented in the gold linker in GNU binutils release 2.21
11018 and later.
11019
11020 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
11021 @opindex fvtable-verify
11022 This option is only available when compiling C++ code.
11023 It turns on (or off, if using @option{-fvtable-verify=none}) the security
11024 feature that verifies at run time, for every virtual call, that
11025 the vtable pointer through which the call is made is valid for the type of
11026 the object, and has not been corrupted or overwritten. If an invalid vtable
11027 pointer is detected at run time, an error is reported and execution of the
11028 program is immediately halted.
11029
11030 This option causes run-time data structures to be built at program startup,
11031 which are used for verifying the vtable pointers.
11032 The options @samp{std} and @samp{preinit}
11033 control the timing of when these data structures are built. In both cases the
11034 data structures are built before execution reaches @code{main}. Using
11035 @option{-fvtable-verify=std} causes the data structures to be built after
11036 shared libraries have been loaded and initialized.
11037 @option{-fvtable-verify=preinit} causes them to be built before shared
11038 libraries have been loaded and initialized.
11039
11040 If this option appears multiple times in the command line with different
11041 values specified, @samp{none} takes highest priority over both @samp{std} and
11042 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
11043
11044 @item -fvtv-debug
11045 @opindex fvtv-debug
11046 When used in conjunction with @option{-fvtable-verify=std} or
11047 @option{-fvtable-verify=preinit}, causes debug versions of the
11048 runtime functions for the vtable verification feature to be called.
11049 This flag also causes the compiler to log information about which
11050 vtable pointers it finds for each class.
11051 This information is written to a file named @file{vtv_set_ptr_data.log}
11052 in the directory named by the environment variable @env{VTV_LOGS_DIR}
11053 if that is defined or the current working directory otherwise.
11054
11055 Note: This feature @emph{appends} data to the log file. If you want a fresh log
11056 file, be sure to delete any existing one.
11057
11058 @item -fvtv-counts
11059 @opindex fvtv-counts
11060 This is a debugging flag. When used in conjunction with
11061 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
11062 causes the compiler to keep track of the total number of virtual calls
11063 it encounters and the number of verifications it inserts. It also
11064 counts the number of calls to certain run-time library functions
11065 that it inserts and logs this information for each compilation unit.
11066 The compiler writes this information to a file named
11067 @file{vtv_count_data.log} in the directory named by the environment
11068 variable @env{VTV_LOGS_DIR} if that is defined or the current working
11069 directory otherwise. It also counts the size of the vtable pointer sets
11070 for each class, and writes this information to @file{vtv_class_set_sizes.log}
11071 in the same directory.
11072
11073 Note: This feature @emph{appends} data to the log files. To get fresh log
11074 files, be sure to delete any existing ones.
11075
11076 @item -finstrument-functions
11077 @opindex finstrument-functions
11078 Generate instrumentation calls for entry and exit to functions. Just
11079 after function entry and just before function exit, the following
11080 profiling functions are called with the address of the current
11081 function and its call site. (On some platforms,
11082 @code{__builtin_return_address} does not work beyond the current
11083 function, so the call site information may not be available to the
11084 profiling functions otherwise.)
11085
11086 @smallexample
11087 void __cyg_profile_func_enter (void *this_fn,
11088 void *call_site);
11089 void __cyg_profile_func_exit (void *this_fn,
11090 void *call_site);
11091 @end smallexample
11092
11093 The first argument is the address of the start of the current function,
11094 which may be looked up exactly in the symbol table.
11095
11096 This instrumentation is also done for functions expanded inline in other
11097 functions. The profiling calls indicate where, conceptually, the
11098 inline function is entered and exited. This means that addressable
11099 versions of such functions must be available. If all your uses of a
11100 function are expanded inline, this may mean an additional expansion of
11101 code size. If you use @code{extern inline} in your C code, an
11102 addressable version of such functions must be provided. (This is
11103 normally the case anyway, but if you get lucky and the optimizer always
11104 expands the functions inline, you might have gotten away without
11105 providing static copies.)
11106
11107 A function may be given the attribute @code{no_instrument_function}, in
11108 which case this instrumentation is not done. This can be used, for
11109 example, for the profiling functions listed above, high-priority
11110 interrupt routines, and any functions from which the profiling functions
11111 cannot safely be called (perhaps signal handlers, if the profiling
11112 routines generate output or allocate memory).
11113
11114 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
11115 @opindex finstrument-functions-exclude-file-list
11116
11117 Set the list of functions that are excluded from instrumentation (see
11118 the description of @option{-finstrument-functions}). If the file that
11119 contains a function definition matches with one of @var{file}, then
11120 that function is not instrumented. The match is done on substrings:
11121 if the @var{file} parameter is a substring of the file name, it is
11122 considered to be a match.
11123
11124 For example:
11125
11126 @smallexample
11127 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
11128 @end smallexample
11129
11130 @noindent
11131 excludes any inline function defined in files whose pathnames
11132 contain @file{/bits/stl} or @file{include/sys}.
11133
11134 If, for some reason, you want to include letter @samp{,} in one of
11135 @var{sym}, write @samp{\,}. For example,
11136 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
11137 (note the single quote surrounding the option).
11138
11139 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
11140 @opindex finstrument-functions-exclude-function-list
11141
11142 This is similar to @option{-finstrument-functions-exclude-file-list},
11143 but this option sets the list of function names to be excluded from
11144 instrumentation. The function name to be matched is its user-visible
11145 name, such as @code{vector<int> blah(const vector<int> &)}, not the
11146 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
11147 match is done on substrings: if the @var{sym} parameter is a substring
11148 of the function name, it is considered to be a match. For C99 and C++
11149 extended identifiers, the function name must be given in UTF-8, not
11150 using universal character names.
11151
11152 @end table
11153
11154
11155 @node Preprocessor Options
11156 @section Options Controlling the Preprocessor
11157 @cindex preprocessor options
11158 @cindex options, preprocessor
11159
11160 These options control the C preprocessor, which is run on each C source
11161 file before actual compilation.
11162
11163 If you use the @option{-E} option, nothing is done except preprocessing.
11164 Some of these options make sense only together with @option{-E} because
11165 they cause the preprocessor output to be unsuitable for actual
11166 compilation.
11167
11168 @table @gcctabopt
11169 @item -Wp,@var{option}
11170 @opindex Wp
11171 You can use @option{-Wp,@var{option}} to bypass the compiler driver
11172 and pass @var{option} directly through to the preprocessor. If
11173 @var{option} contains commas, it is split into multiple options at the
11174 commas. However, many options are modified, translated or interpreted
11175 by the compiler driver before being passed to the preprocessor, and
11176 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
11177 interface is undocumented and subject to change, so whenever possible
11178 you should avoid using @option{-Wp} and let the driver handle the
11179 options instead.
11180
11181 @item -Xpreprocessor @var{option}
11182 @opindex Xpreprocessor
11183 Pass @var{option} as an option to the preprocessor. You can use this to
11184 supply system-specific preprocessor options that GCC does not
11185 recognize.
11186
11187 If you want to pass an option that takes an argument, you must use
11188 @option{-Xpreprocessor} twice, once for the option and once for the argument.
11189
11190 @item -no-integrated-cpp
11191 @opindex no-integrated-cpp
11192 Perform preprocessing as a separate pass before compilation.
11193 By default, GCC performs preprocessing as an integrated part of
11194 input tokenization and parsing.
11195 If this option is provided, the appropriate language front end
11196 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
11197 and Objective-C, respectively) is instead invoked twice,
11198 once for preprocessing only and once for actual compilation
11199 of the preprocessed input.
11200 This option may be useful in conjunction with the @option{-B} or
11201 @option{-wrapper} options to specify an alternate preprocessor or
11202 perform additional processing of the program source between
11203 normal preprocessing and compilation.
11204 @end table
11205
11206 @include cppopts.texi
11207
11208 @node Assembler Options
11209 @section Passing Options to the Assembler
11210
11211 @c prevent bad page break with this line
11212 You can pass options to the assembler.
11213
11214 @table @gcctabopt
11215 @item -Wa,@var{option}
11216 @opindex Wa
11217 Pass @var{option} as an option to the assembler. If @var{option}
11218 contains commas, it is split into multiple options at the commas.
11219
11220 @item -Xassembler @var{option}
11221 @opindex Xassembler
11222 Pass @var{option} as an option to the assembler. You can use this to
11223 supply system-specific assembler options that GCC does not
11224 recognize.
11225
11226 If you want to pass an option that takes an argument, you must use
11227 @option{-Xassembler} twice, once for the option and once for the argument.
11228
11229 @end table
11230
11231 @node Link Options
11232 @section Options for Linking
11233 @cindex link options
11234 @cindex options, linking
11235
11236 These options come into play when the compiler links object files into
11237 an executable output file. They are meaningless if the compiler is
11238 not doing a link step.
11239
11240 @table @gcctabopt
11241 @cindex file names
11242 @item @var{object-file-name}
11243 A file name that does not end in a special recognized suffix is
11244 considered to name an object file or library. (Object files are
11245 distinguished from libraries by the linker according to the file
11246 contents.) If linking is done, these object files are used as input
11247 to the linker.
11248
11249 @item -c
11250 @itemx -S
11251 @itemx -E
11252 @opindex c
11253 @opindex S
11254 @opindex E
11255 If any of these options is used, then the linker is not run, and
11256 object file names should not be used as arguments. @xref{Overall
11257 Options}.
11258
11259 @item -fuse-ld=bfd
11260 @opindex fuse-ld=bfd
11261 Use the @command{bfd} linker instead of the default linker.
11262
11263 @item -fuse-ld=gold
11264 @opindex fuse-ld=gold
11265 Use the @command{gold} linker instead of the default linker.
11266
11267 @cindex Libraries
11268 @item -l@var{library}
11269 @itemx -l @var{library}
11270 @opindex l
11271 Search the library named @var{library} when linking. (The second
11272 alternative with the library as a separate argument is only for
11273 POSIX compliance and is not recommended.)
11274
11275 It makes a difference where in the command you write this option; the
11276 linker searches and processes libraries and object files in the order they
11277 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
11278 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
11279 to functions in @samp{z}, those functions may not be loaded.
11280
11281 The linker searches a standard list of directories for the library,
11282 which is actually a file named @file{lib@var{library}.a}. The linker
11283 then uses this file as if it had been specified precisely by name.
11284
11285 The directories searched include several standard system directories
11286 plus any that you specify with @option{-L}.
11287
11288 Normally the files found this way are library files---archive files
11289 whose members are object files. The linker handles an archive file by
11290 scanning through it for members which define symbols that have so far
11291 been referenced but not defined. But if the file that is found is an
11292 ordinary object file, it is linked in the usual fashion. The only
11293 difference between using an @option{-l} option and specifying a file name
11294 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
11295 and searches several directories.
11296
11297 @item -lobjc
11298 @opindex lobjc
11299 You need this special case of the @option{-l} option in order to
11300 link an Objective-C or Objective-C++ program.
11301
11302 @item -nostartfiles
11303 @opindex nostartfiles
11304 Do not use the standard system startup files when linking.
11305 The standard system libraries are used normally, unless @option{-nostdlib}
11306 or @option{-nodefaultlibs} is used.
11307
11308 @item -nodefaultlibs
11309 @opindex nodefaultlibs
11310 Do not use the standard system libraries when linking.
11311 Only the libraries you specify are passed to the linker, and options
11312 specifying linkage of the system libraries, such as @option{-static-libgcc}
11313 or @option{-shared-libgcc}, are ignored.
11314 The standard startup files are used normally, unless @option{-nostartfiles}
11315 is used.
11316
11317 The compiler may generate calls to @code{memcmp},
11318 @code{memset}, @code{memcpy} and @code{memmove}.
11319 These entries are usually resolved by entries in
11320 libc. These entry points should be supplied through some other
11321 mechanism when this option is specified.
11322
11323 @item -nostdlib
11324 @opindex nostdlib
11325 Do not use the standard system startup files or libraries when linking.
11326 No startup files and only the libraries you specify are passed to
11327 the linker, and options specifying linkage of the system libraries, such as
11328 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
11329
11330 The compiler may generate calls to @code{memcmp}, @code{memset},
11331 @code{memcpy} and @code{memmove}.
11332 These entries are usually resolved by entries in
11333 libc. These entry points should be supplied through some other
11334 mechanism when this option is specified.
11335
11336 @cindex @option{-lgcc}, use with @option{-nostdlib}
11337 @cindex @option{-nostdlib} and unresolved references
11338 @cindex unresolved references and @option{-nostdlib}
11339 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
11340 @cindex @option{-nodefaultlibs} and unresolved references
11341 @cindex unresolved references and @option{-nodefaultlibs}
11342 One of the standard libraries bypassed by @option{-nostdlib} and
11343 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
11344 which GCC uses to overcome shortcomings of particular machines, or special
11345 needs for some languages.
11346 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
11347 Collection (GCC) Internals},
11348 for more discussion of @file{libgcc.a}.)
11349 In most cases, you need @file{libgcc.a} even when you want to avoid
11350 other standard libraries. In other words, when you specify @option{-nostdlib}
11351 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
11352 This ensures that you have no unresolved references to internal GCC
11353 library subroutines.
11354 (An example of such an internal subroutine is @code{__main}, used to ensure C++
11355 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
11356 GNU Compiler Collection (GCC) Internals}.)
11357
11358 @item -pie
11359 @opindex pie
11360 Produce a position independent executable on targets that support it.
11361 For predictable results, you must also specify the same set of options
11362 used for compilation (@option{-fpie}, @option{-fPIE},
11363 or model suboptions) when you specify this linker option.
11364
11365 @item -no-pie
11366 @opindex no-pie
11367 Don't produce a position independent executable.
11368
11369 @item -rdynamic
11370 @opindex rdynamic
11371 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
11372 that support it. This instructs the linker to add all symbols, not
11373 only used ones, to the dynamic symbol table. This option is needed
11374 for some uses of @code{dlopen} or to allow obtaining backtraces
11375 from within a program.
11376
11377 @item -s
11378 @opindex s
11379 Remove all symbol table and relocation information from the executable.
11380
11381 @item -static
11382 @opindex static
11383 On systems that support dynamic linking, this prevents linking with the shared
11384 libraries. On other systems, this option has no effect.
11385
11386 @item -shared
11387 @opindex shared
11388 Produce a shared object which can then be linked with other objects to
11389 form an executable. Not all systems support this option. For predictable
11390 results, you must also specify the same set of options used for compilation
11391 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
11392 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
11393 needs to build supplementary stub code for constructors to work. On
11394 multi-libbed systems, @samp{gcc -shared} must select the correct support
11395 libraries to link against. Failing to supply the correct flags may lead
11396 to subtle defects. Supplying them in cases where they are not necessary
11397 is innocuous.}
11398
11399 @item -shared-libgcc
11400 @itemx -static-libgcc
11401 @opindex shared-libgcc
11402 @opindex static-libgcc
11403 On systems that provide @file{libgcc} as a shared library, these options
11404 force the use of either the shared or static version, respectively.
11405 If no shared version of @file{libgcc} was built when the compiler was
11406 configured, these options have no effect.
11407
11408 There are several situations in which an application should use the
11409 shared @file{libgcc} instead of the static version. The most common
11410 of these is when the application wishes to throw and catch exceptions
11411 across different shared libraries. In that case, each of the libraries
11412 as well as the application itself should use the shared @file{libgcc}.
11413
11414 Therefore, the G++ and GCJ drivers automatically add
11415 @option{-shared-libgcc} whenever you build a shared library or a main
11416 executable, because C++ and Java programs typically use exceptions, so
11417 this is the right thing to do.
11418
11419 If, instead, you use the GCC driver to create shared libraries, you may
11420 find that they are not always linked with the shared @file{libgcc}.
11421 If GCC finds, at its configuration time, that you have a non-GNU linker
11422 or a GNU linker that does not support option @option{--eh-frame-hdr},
11423 it links the shared version of @file{libgcc} into shared libraries
11424 by default. Otherwise, it takes advantage of the linker and optimizes
11425 away the linking with the shared version of @file{libgcc}, linking with
11426 the static version of libgcc by default. This allows exceptions to
11427 propagate through such shared libraries, without incurring relocation
11428 costs at library load time.
11429
11430 However, if a library or main executable is supposed to throw or catch
11431 exceptions, you must link it using the G++ or GCJ driver, as appropriate
11432 for the languages used in the program, or using the option
11433 @option{-shared-libgcc}, such that it is linked with the shared
11434 @file{libgcc}.
11435
11436 @item -static-libasan
11437 @opindex static-libasan
11438 When the @option{-fsanitize=address} option is used to link a program,
11439 the GCC driver automatically links against @option{libasan}. If
11440 @file{libasan} is available as a shared library, and the @option{-static}
11441 option is not used, then this links against the shared version of
11442 @file{libasan}. The @option{-static-libasan} option directs the GCC
11443 driver to link @file{libasan} statically, without necessarily linking
11444 other libraries statically.
11445
11446 @item -static-libtsan
11447 @opindex static-libtsan
11448 When the @option{-fsanitize=thread} option is used to link a program,
11449 the GCC driver automatically links against @option{libtsan}. If
11450 @file{libtsan} is available as a shared library, and the @option{-static}
11451 option is not used, then this links against the shared version of
11452 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
11453 driver to link @file{libtsan} statically, without necessarily linking
11454 other libraries statically.
11455
11456 @item -static-liblsan
11457 @opindex static-liblsan
11458 When the @option{-fsanitize=leak} option is used to link a program,
11459 the GCC driver automatically links against @option{liblsan}. If
11460 @file{liblsan} is available as a shared library, and the @option{-static}
11461 option is not used, then this links against the shared version of
11462 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
11463 driver to link @file{liblsan} statically, without necessarily linking
11464 other libraries statically.
11465
11466 @item -static-libubsan
11467 @opindex static-libubsan
11468 When the @option{-fsanitize=undefined} option is used to link a program,
11469 the GCC driver automatically links against @option{libubsan}. If
11470 @file{libubsan} is available as a shared library, and the @option{-static}
11471 option is not used, then this links against the shared version of
11472 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
11473 driver to link @file{libubsan} statically, without necessarily linking
11474 other libraries statically.
11475
11476 @item -static-libmpx
11477 @opindex static-libmpx
11478 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
11479 used to link a program, the GCC driver automatically links against
11480 @file{libmpx}. If @file{libmpx} is available as a shared library,
11481 and the @option{-static} option is not used, then this links against
11482 the shared version of @file{libmpx}. The @option{-static-libmpx}
11483 option directs the GCC driver to link @file{libmpx} statically,
11484 without necessarily linking other libraries statically.
11485
11486 @item -static-libmpxwrappers
11487 @opindex static-libmpxwrappers
11488 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
11489 to link a program without also using @option{-fno-chkp-use-wrappers}, the
11490 GCC driver automatically links against @file{libmpxwrappers}. If
11491 @file{libmpxwrappers} is available as a shared library, and the
11492 @option{-static} option is not used, then this links against the shared
11493 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
11494 option directs the GCC driver to link @file{libmpxwrappers} statically,
11495 without necessarily linking other libraries statically.
11496
11497 @item -static-libstdc++
11498 @opindex static-libstdc++
11499 When the @command{g++} program is used to link a C++ program, it
11500 normally automatically links against @option{libstdc++}. If
11501 @file{libstdc++} is available as a shared library, and the
11502 @option{-static} option is not used, then this links against the
11503 shared version of @file{libstdc++}. That is normally fine. However, it
11504 is sometimes useful to freeze the version of @file{libstdc++} used by
11505 the program without going all the way to a fully static link. The
11506 @option{-static-libstdc++} option directs the @command{g++} driver to
11507 link @file{libstdc++} statically, without necessarily linking other
11508 libraries statically.
11509
11510 @item -symbolic
11511 @opindex symbolic
11512 Bind references to global symbols when building a shared object. Warn
11513 about any unresolved references (unless overridden by the link editor
11514 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
11515 this option.
11516
11517 @item -T @var{script}
11518 @opindex T
11519 @cindex linker script
11520 Use @var{script} as the linker script. This option is supported by most
11521 systems using the GNU linker. On some targets, such as bare-board
11522 targets without an operating system, the @option{-T} option may be required
11523 when linking to avoid references to undefined symbols.
11524
11525 @item -Xlinker @var{option}
11526 @opindex Xlinker
11527 Pass @var{option} as an option to the linker. You can use this to
11528 supply system-specific linker options that GCC does not recognize.
11529
11530 If you want to pass an option that takes a separate argument, you must use
11531 @option{-Xlinker} twice, once for the option and once for the argument.
11532 For example, to pass @option{-assert definitions}, you must write
11533 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
11534 @option{-Xlinker "-assert definitions"}, because this passes the entire
11535 string as a single argument, which is not what the linker expects.
11536
11537 When using the GNU linker, it is usually more convenient to pass
11538 arguments to linker options using the @option{@var{option}=@var{value}}
11539 syntax than as separate arguments. For example, you can specify
11540 @option{-Xlinker -Map=output.map} rather than
11541 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
11542 this syntax for command-line options.
11543
11544 @item -Wl,@var{option}
11545 @opindex Wl
11546 Pass @var{option} as an option to the linker. If @var{option} contains
11547 commas, it is split into multiple options at the commas. You can use this
11548 syntax to pass an argument to the option.
11549 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
11550 linker. When using the GNU linker, you can also get the same effect with
11551 @option{-Wl,-Map=output.map}.
11552
11553 @item -u @var{symbol}
11554 @opindex u
11555 Pretend the symbol @var{symbol} is undefined, to force linking of
11556 library modules to define it. You can use @option{-u} multiple times with
11557 different symbols to force loading of additional library modules.
11558
11559 @item -z @var{keyword}
11560 @opindex z
11561 @option{-z} is passed directly on to the linker along with the keyword
11562 @var{keyword}. See the section in the documentation of your linker for
11563 permitted values and their meanings.
11564 @end table
11565
11566 @node Directory Options
11567 @section Options for Directory Search
11568 @cindex directory options
11569 @cindex options, directory search
11570 @cindex search path
11571
11572 These options specify directories to search for header files, for
11573 libraries and for parts of the compiler:
11574
11575 @table @gcctabopt
11576 @item -I@var{dir}
11577 @opindex I
11578 Add the directory @var{dir} to the head of the list of directories to be
11579 searched for header files. This can be used to override a system header
11580 file, substituting your own version, since these directories are
11581 searched before the system header file directories. However, you should
11582 not use this option to add directories that contain vendor-supplied
11583 system header files (use @option{-isystem} for that). If you use more than
11584 one @option{-I} option, the directories are scanned in left-to-right
11585 order; the standard system directories come after.
11586
11587 If a standard system include directory, or a directory specified with
11588 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
11589 option is ignored. The directory is still searched but as a
11590 system directory at its normal position in the system include chain.
11591 This is to ensure that GCC's procedure to fix buggy system headers and
11592 the ordering for the @code{include_next} directive are not inadvertently changed.
11593 If you really need to change the search order for system directories,
11594 use the @option{-nostdinc} and/or @option{-isystem} options.
11595
11596 @item -iplugindir=@var{dir}
11597 @opindex iplugindir=
11598 Set the directory to search for plugins that are passed
11599 by @option{-fplugin=@var{name}} instead of
11600 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
11601 to be used by the user, but only passed by the driver.
11602
11603 @item -iquote@var{dir}
11604 @opindex iquote
11605 Add the directory @var{dir} to the head of the list of directories to
11606 be searched for header files only for the case of @code{#include
11607 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
11608 otherwise just like @option{-I}.
11609
11610 @item -L@var{dir}
11611 @opindex L
11612 Add directory @var{dir} to the list of directories to be searched
11613 for @option{-l}.
11614
11615 @item -B@var{prefix}
11616 @opindex B
11617 This option specifies where to find the executables, libraries,
11618 include files, and data files of the compiler itself.
11619
11620 The compiler driver program runs one or more of the subprograms
11621 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
11622 @var{prefix} as a prefix for each program it tries to run, both with and
11623 without @samp{@var{machine}/@var{version}/} for the corresponding target
11624 machine and compiler version.
11625
11626 For each subprogram to be run, the compiler driver first tries the
11627 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
11628 is not specified, the driver tries two standard prefixes,
11629 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
11630 those results in a file name that is found, the unmodified program
11631 name is searched for using the directories specified in your
11632 @env{PATH} environment variable.
11633
11634 The compiler checks to see if the path provided by @option{-B}
11635 refers to a directory, and if necessary it adds a directory
11636 separator character at the end of the path.
11637
11638 @option{-B} prefixes that effectively specify directory names also apply
11639 to libraries in the linker, because the compiler translates these
11640 options into @option{-L} options for the linker. They also apply to
11641 include files in the preprocessor, because the compiler translates these
11642 options into @option{-isystem} options for the preprocessor. In this case,
11643 the compiler appends @samp{include} to the prefix.
11644
11645 The runtime support file @file{libgcc.a} can also be searched for using
11646 the @option{-B} prefix, if needed. If it is not found there, the two
11647 standard prefixes above are tried, and that is all. The file is left
11648 out of the link if it is not found by those means.
11649
11650 Another way to specify a prefix much like the @option{-B} prefix is to use
11651 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
11652 Variables}.
11653
11654 As a special kludge, if the path provided by @option{-B} is
11655 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
11656 9, then it is replaced by @file{[dir/]include}. This is to help
11657 with boot-strapping the compiler.
11658
11659 @item -no-canonical-prefixes
11660 @opindex no-canonical-prefixes
11661 Do not expand any symbolic links, resolve references to @samp{/../}
11662 or @samp{/./}, or make the path absolute when generating a relative
11663 prefix.
11664
11665 @item --sysroot=@var{dir}
11666 @opindex sysroot
11667 Use @var{dir} as the logical root directory for headers and libraries.
11668 For example, if the compiler normally searches for headers in
11669 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
11670 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
11671
11672 If you use both this option and the @option{-isysroot} option, then
11673 the @option{--sysroot} option applies to libraries, but the
11674 @option{-isysroot} option applies to header files.
11675
11676 The GNU linker (beginning with version 2.16) has the necessary support
11677 for this option. If your linker does not support this option, the
11678 header file aspect of @option{--sysroot} still works, but the
11679 library aspect does not.
11680
11681 @item --no-sysroot-suffix
11682 @opindex no-sysroot-suffix
11683 For some targets, a suffix is added to the root directory specified
11684 with @option{--sysroot}, depending on the other options used, so that
11685 headers may for example be found in
11686 @file{@var{dir}/@var{suffix}/usr/include} instead of
11687 @file{@var{dir}/usr/include}. This option disables the addition of
11688 such a suffix.
11689
11690 @item -I-
11691 @opindex I-
11692 This option has been deprecated. Please use @option{-iquote} instead for
11693 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
11694 option.
11695 Any directories you specify with @option{-I} options before the @option{-I-}
11696 option are searched only for the case of @code{#include "@var{file}"};
11697 they are not searched for @code{#include <@var{file}>}.
11698
11699 If additional directories are specified with @option{-I} options after
11700 the @option{-I-} option, these directories are searched for all @code{#include}
11701 directives. (Ordinarily @emph{all} @option{-I} directories are used
11702 this way.)
11703
11704 In addition, the @option{-I-} option inhibits the use of the current
11705 directory (where the current input file came from) as the first search
11706 directory for @code{#include "@var{file}"}. There is no way to
11707 override this effect of @option{-I-}. With @option{-I.} you can specify
11708 searching the directory that is current when the compiler is
11709 invoked. That is not exactly the same as what the preprocessor does
11710 by default, but it is often satisfactory.
11711
11712 @option{-I-} does not inhibit the use of the standard system directories
11713 for header files. Thus, @option{-I-} and @option{-nostdinc} are
11714 independent.
11715 @end table
11716
11717 @node Code Gen Options
11718 @section Options for Code Generation Conventions
11719 @cindex code generation conventions
11720 @cindex options, code generation
11721 @cindex run-time options
11722
11723 These machine-independent options control the interface conventions
11724 used in code generation.
11725
11726 Most of them have both positive and negative forms; the negative form
11727 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
11728 one of the forms is listed---the one that is not the default. You
11729 can figure out the other form by either removing @samp{no-} or adding
11730 it.
11731
11732 @table @gcctabopt
11733 @item -fstack-reuse=@var{reuse-level}
11734 @opindex fstack_reuse
11735 This option controls stack space reuse for user declared local/auto variables
11736 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
11737 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
11738 local variables and temporaries, @samp{named_vars} enables the reuse only for
11739 user defined local variables with names, and @samp{none} disables stack reuse
11740 completely. The default value is @samp{all}. The option is needed when the
11741 program extends the lifetime of a scoped local variable or a compiler generated
11742 temporary beyond the end point defined by the language. When a lifetime of
11743 a variable ends, and if the variable lives in memory, the optimizing compiler
11744 has the freedom to reuse its stack space with other temporaries or scoped
11745 local variables whose live range does not overlap with it. Legacy code extending
11746 local lifetime is likely to break with the stack reuse optimization.
11747
11748 For example,
11749
11750 @smallexample
11751 int *p;
11752 @{
11753 int local1;
11754
11755 p = &local1;
11756 local1 = 10;
11757 ....
11758 @}
11759 @{
11760 int local2;
11761 local2 = 20;
11762 ...
11763 @}
11764
11765 if (*p == 10) // out of scope use of local1
11766 @{
11767
11768 @}
11769 @end smallexample
11770
11771 Another example:
11772 @smallexample
11773
11774 struct A
11775 @{
11776 A(int k) : i(k), j(k) @{ @}
11777 int i;
11778 int j;
11779 @};
11780
11781 A *ap;
11782
11783 void foo(const A& ar)
11784 @{
11785 ap = &ar;
11786 @}
11787
11788 void bar()
11789 @{
11790 foo(A(10)); // temp object's lifetime ends when foo returns
11791
11792 @{
11793 A a(20);
11794 ....
11795 @}
11796 ap->i+= 10; // ap references out of scope temp whose space
11797 // is reused with a. What is the value of ap->i?
11798 @}
11799
11800 @end smallexample
11801
11802 The lifetime of a compiler generated temporary is well defined by the C++
11803 standard. When a lifetime of a temporary ends, and if the temporary lives
11804 in memory, the optimizing compiler has the freedom to reuse its stack
11805 space with other temporaries or scoped local variables whose live range
11806 does not overlap with it. However some of the legacy code relies on
11807 the behavior of older compilers in which temporaries' stack space is
11808 not reused, the aggressive stack reuse can lead to runtime errors. This
11809 option is used to control the temporary stack reuse optimization.
11810
11811 @item -ftrapv
11812 @opindex ftrapv
11813 This option generates traps for signed overflow on addition, subtraction,
11814 multiplication operations.
11815 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11816 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11817 @option{-fwrapv} being effective. Note that only active options override, so
11818 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11819 results in @option{-ftrapv} being effective.
11820
11821 @item -fwrapv
11822 @opindex fwrapv
11823 This option instructs the compiler to assume that signed arithmetic
11824 overflow of addition, subtraction and multiplication wraps around
11825 using twos-complement representation. This flag enables some optimizations
11826 and disables others. This option is enabled by default for the Java
11827 front end, as required by the Java language specification.
11828 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11829 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11830 @option{-fwrapv} being effective. Note that only active options override, so
11831 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11832 results in @option{-ftrapv} being effective.
11833
11834 @item -fexceptions
11835 @opindex fexceptions
11836 Enable exception handling. Generates extra code needed to propagate
11837 exceptions. For some targets, this implies GCC generates frame
11838 unwind information for all functions, which can produce significant data
11839 size overhead, although it does not affect execution. If you do not
11840 specify this option, GCC enables it by default for languages like
11841 C++ that normally require exception handling, and disables it for
11842 languages like C that do not normally require it. However, you may need
11843 to enable this option when compiling C code that needs to interoperate
11844 properly with exception handlers written in C++. You may also wish to
11845 disable this option if you are compiling older C++ programs that don't
11846 use exception handling.
11847
11848 @item -fnon-call-exceptions
11849 @opindex fnon-call-exceptions
11850 Generate code that allows trapping instructions to throw exceptions.
11851 Note that this requires platform-specific runtime support that does
11852 not exist everywhere. Moreover, it only allows @emph{trapping}
11853 instructions to throw exceptions, i.e.@: memory references or floating-point
11854 instructions. It does not allow exceptions to be thrown from
11855 arbitrary signal handlers such as @code{SIGALRM}.
11856
11857 @item -fdelete-dead-exceptions
11858 @opindex fdelete-dead-exceptions
11859 Consider that instructions that may throw exceptions but don't otherwise
11860 contribute to the execution of the program can be optimized away.
11861 This option is enabled by default for the Ada front end, as permitted by
11862 the Ada language specification.
11863 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
11864
11865 @item -funwind-tables
11866 @opindex funwind-tables
11867 Similar to @option{-fexceptions}, except that it just generates any needed
11868 static data, but does not affect the generated code in any other way.
11869 You normally do not need to enable this option; instead, a language processor
11870 that needs this handling enables it on your behalf.
11871
11872 @item -fasynchronous-unwind-tables
11873 @opindex fasynchronous-unwind-tables
11874 Generate unwind table in DWARF format, if supported by target machine. The
11875 table is exact at each instruction boundary, so it can be used for stack
11876 unwinding from asynchronous events (such as debugger or garbage collector).
11877
11878 @item -fno-gnu-unique
11879 @opindex fno-gnu-unique
11880 On systems with recent GNU assembler and C library, the C++ compiler
11881 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
11882 of template static data members and static local variables in inline
11883 functions are unique even in the presence of @code{RTLD_LOCAL}; this
11884 is necessary to avoid problems with a library used by two different
11885 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
11886 therefore disagreeing with the other one about the binding of the
11887 symbol. But this causes @code{dlclose} to be ignored for affected
11888 DSOs; if your program relies on reinitialization of a DSO via
11889 @code{dlclose} and @code{dlopen}, you can use
11890 @option{-fno-gnu-unique}.
11891
11892 @item -fpcc-struct-return
11893 @opindex fpcc-struct-return
11894 Return ``short'' @code{struct} and @code{union} values in memory like
11895 longer ones, rather than in registers. This convention is less
11896 efficient, but it has the advantage of allowing intercallability between
11897 GCC-compiled files and files compiled with other compilers, particularly
11898 the Portable C Compiler (pcc).
11899
11900 The precise convention for returning structures in memory depends
11901 on the target configuration macros.
11902
11903 Short structures and unions are those whose size and alignment match
11904 that of some integer type.
11905
11906 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11907 switch is not binary compatible with code compiled with the
11908 @option{-freg-struct-return} switch.
11909 Use it to conform to a non-default application binary interface.
11910
11911 @item -freg-struct-return
11912 @opindex freg-struct-return
11913 Return @code{struct} and @code{union} values in registers when possible.
11914 This is more efficient for small structures than
11915 @option{-fpcc-struct-return}.
11916
11917 If you specify neither @option{-fpcc-struct-return} nor
11918 @option{-freg-struct-return}, GCC defaults to whichever convention is
11919 standard for the target. If there is no standard convention, GCC
11920 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11921 the principal compiler. In those cases, we can choose the standard, and
11922 we chose the more efficient register return alternative.
11923
11924 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11925 switch is not binary compatible with code compiled with the
11926 @option{-fpcc-struct-return} switch.
11927 Use it to conform to a non-default application binary interface.
11928
11929 @item -fshort-enums
11930 @opindex fshort-enums
11931 Allocate to an @code{enum} type only as many bytes as it needs for the
11932 declared range of possible values. Specifically, the @code{enum} type
11933 is equivalent to the smallest integer type that has enough room.
11934
11935 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11936 code that is not binary compatible with code generated without that switch.
11937 Use it to conform to a non-default application binary interface.
11938
11939 @item -fshort-wchar
11940 @opindex fshort-wchar
11941 Override the underlying type for @code{wchar_t} to be @code{short
11942 unsigned int} instead of the default for the target. This option is
11943 useful for building programs to run under WINE@.
11944
11945 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11946 code that is not binary compatible with code generated without that switch.
11947 Use it to conform to a non-default application binary interface.
11948
11949 @item -fno-common
11950 @opindex fno-common
11951 In C code, controls the placement of uninitialized global variables.
11952 Unix C compilers have traditionally permitted multiple definitions of
11953 such variables in different compilation units by placing the variables
11954 in a common block.
11955 This is the behavior specified by @option{-fcommon}, and is the default
11956 for GCC on most targets.
11957 On the other hand, this behavior is not required by ISO C, and on some
11958 targets may carry a speed or code size penalty on variable references.
11959 The @option{-fno-common} option specifies that the compiler should place
11960 uninitialized global variables in the data section of the object file,
11961 rather than generating them as common blocks.
11962 This has the effect that if the same variable is declared
11963 (without @code{extern}) in two different compilations,
11964 you get a multiple-definition error when you link them.
11965 In this case, you must compile with @option{-fcommon} instead.
11966 Compiling with @option{-fno-common} is useful on targets for which
11967 it provides better performance, or if you wish to verify that the
11968 program will work on other systems that always treat uninitialized
11969 variable declarations this way.
11970
11971 @item -fno-ident
11972 @opindex fno-ident
11973 Ignore the @code{#ident} directive.
11974
11975 @item -finhibit-size-directive
11976 @opindex finhibit-size-directive
11977 Don't output a @code{.size} assembler directive, or anything else that
11978 would cause trouble if the function is split in the middle, and the
11979 two halves are placed at locations far apart in memory. This option is
11980 used when compiling @file{crtstuff.c}; you should not need to use it
11981 for anything else.
11982
11983 @item -fverbose-asm
11984 @opindex fverbose-asm
11985 Put extra commentary information in the generated assembly code to
11986 make it more readable. This option is generally only of use to those
11987 who actually need to read the generated assembly code (perhaps while
11988 debugging the compiler itself).
11989
11990 @option{-fno-verbose-asm}, the default, causes the
11991 extra information to be omitted and is useful when comparing two assembler
11992 files.
11993
11994 The added comments include:
11995
11996 @itemize @bullet
11997
11998 @item
11999 information on the compiler version and command-line options,
12000
12001 @item
12002 the source code lines associated with the assembly instructions,
12003 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12004
12005 @item
12006 hints on which high-level expressions correspond to
12007 the various assembly instruction operands.
12008
12009 @end itemize
12010
12011 For example, given this C source file:
12012
12013 @smallexample
12014 int test (int n)
12015 @{
12016 int i;
12017 int total = 0;
12018
12019 for (i = 0; i < n; i++)
12020 total += i * i;
12021
12022 return total;
12023 @}
12024 @end smallexample
12025
12026 compiling to (x86_64) assembly via @option{-S} and emitting the result
12027 direct to stdout via @option{-o} @option{-}
12028
12029 @smallexample
12030 gcc -S test.c -fverbose-asm -Os -o -
12031 @end smallexample
12032
12033 gives output similar to this:
12034
12035 @smallexample
12036 .file "test.c"
12037 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12038 [...snip...]
12039 # options passed:
12040 [...snip...]
12041
12042 .text
12043 .globl test
12044 .type test, @@function
12045 test:
12046 .LFB0:
12047 .cfi_startproc
12048 # test.c:4: int total = 0;
12049 xorl %eax, %eax # <retval>
12050 # test.c:6: for (i = 0; i < n; i++)
12051 xorl %edx, %edx # i
12052 .L2:
12053 # test.c:6: for (i = 0; i < n; i++)
12054 cmpl %edi, %edx # n, i
12055 jge .L5 #,
12056 # test.c:7: total += i * i;
12057 movl %edx, %ecx # i, tmp92
12058 imull %edx, %ecx # i, tmp92
12059 # test.c:6: for (i = 0; i < n; i++)
12060 incl %edx # i
12061 # test.c:7: total += i * i;
12062 addl %ecx, %eax # tmp92, <retval>
12063 jmp .L2 #
12064 .L5:
12065 # test.c:10: @}
12066 ret
12067 .cfi_endproc
12068 .LFE0:
12069 .size test, .-test
12070 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
12071 .section .note.GNU-stack,"",@@progbits
12072 @end smallexample
12073
12074 The comments are intended for humans rather than machines and hence the
12075 precise format of the comments is subject to change.
12076
12077 @item -frecord-gcc-switches
12078 @opindex frecord-gcc-switches
12079 This switch causes the command line used to invoke the
12080 compiler to be recorded into the object file that is being created.
12081 This switch is only implemented on some targets and the exact format
12082 of the recording is target and binary file format dependent, but it
12083 usually takes the form of a section containing ASCII text. This
12084 switch is related to the @option{-fverbose-asm} switch, but that
12085 switch only records information in the assembler output file as
12086 comments, so it never reaches the object file.
12087 See also @option{-grecord-gcc-switches} for another
12088 way of storing compiler options into the object file.
12089
12090 @item -fpic
12091 @opindex fpic
12092 @cindex global offset table
12093 @cindex PIC
12094 Generate position-independent code (PIC) suitable for use in a shared
12095 library, if supported for the target machine. Such code accesses all
12096 constant addresses through a global offset table (GOT)@. The dynamic
12097 loader resolves the GOT entries when the program starts (the dynamic
12098 loader is not part of GCC; it is part of the operating system). If
12099 the GOT size for the linked executable exceeds a machine-specific
12100 maximum size, you get an error message from the linker indicating that
12101 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
12102 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
12103 on the m68k and RS/6000. The x86 has no such limit.)
12104
12105 Position-independent code requires special support, and therefore works
12106 only on certain machines. For the x86, GCC supports PIC for System V
12107 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
12108 position-independent.
12109
12110 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12111 are defined to 1.
12112
12113 @item -fPIC
12114 @opindex fPIC
12115 If supported for the target machine, emit position-independent code,
12116 suitable for dynamic linking and avoiding any limit on the size of the
12117 global offset table. This option makes a difference on AArch64, m68k,
12118 PowerPC and SPARC@.
12119
12120 Position-independent code requires special support, and therefore works
12121 only on certain machines.
12122
12123 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
12124 are defined to 2.
12125
12126 @item -fpie
12127 @itemx -fPIE
12128 @opindex fpie
12129 @opindex fPIE
12130 These options are similar to @option{-fpic} and @option{-fPIC}, but
12131 generated position independent code can be only linked into executables.
12132 Usually these options are used when @option{-pie} GCC option is
12133 used during linking.
12134
12135 @option{-fpie} and @option{-fPIE} both define the macros
12136 @code{__pie__} and @code{__PIE__}. The macros have the value 1
12137 for @option{-fpie} and 2 for @option{-fPIE}.
12138
12139 @item -fno-plt
12140 @opindex fno-plt
12141 Do not use the PLT for external function calls in position-independent code.
12142 Instead, load the callee address at call sites from the GOT and branch to it.
12143 This leads to more efficient code by eliminating PLT stubs and exposing
12144 GOT loads to optimizations. On architectures such as 32-bit x86 where
12145 PLT stubs expect the GOT pointer in a specific register, this gives more
12146 register allocation freedom to the compiler.
12147 Lazy binding requires use of the PLT;
12148 with @option{-fno-plt} all external symbols are resolved at load time.
12149
12150 Alternatively, the function attribute @code{noplt} can be used to avoid calls
12151 through the PLT for specific external functions.
12152
12153 In position-dependent code, a few targets also convert calls to
12154 functions that are marked to not use the PLT to use the GOT instead.
12155
12156 @item -fno-jump-tables
12157 @opindex fno-jump-tables
12158 Do not use jump tables for switch statements even where it would be
12159 more efficient than other code generation strategies. This option is
12160 of use in conjunction with @option{-fpic} or @option{-fPIC} for
12161 building code that forms part of a dynamic linker and cannot
12162 reference the address of a jump table. On some targets, jump tables
12163 do not require a GOT and this option is not needed.
12164
12165 @item -ffixed-@var{reg}
12166 @opindex ffixed
12167 Treat the register named @var{reg} as a fixed register; generated code
12168 should never refer to it (except perhaps as a stack pointer, frame
12169 pointer or in some other fixed role).
12170
12171 @var{reg} must be the name of a register. The register names accepted
12172 are machine-specific and are defined in the @code{REGISTER_NAMES}
12173 macro in the machine description macro file.
12174
12175 This flag does not have a negative form, because it specifies a
12176 three-way choice.
12177
12178 @item -fcall-used-@var{reg}
12179 @opindex fcall-used
12180 Treat the register named @var{reg} as an allocable register that is
12181 clobbered by function calls. It may be allocated for temporaries or
12182 variables that do not live across a call. Functions compiled this way
12183 do not save and restore the register @var{reg}.
12184
12185 It is an error to use this flag with the frame pointer or stack pointer.
12186 Use of this flag for other registers that have fixed pervasive roles in
12187 the machine's execution model produces disastrous results.
12188
12189 This flag does not have a negative form, because it specifies a
12190 three-way choice.
12191
12192 @item -fcall-saved-@var{reg}
12193 @opindex fcall-saved
12194 Treat the register named @var{reg} as an allocable register saved by
12195 functions. It may be allocated even for temporaries or variables that
12196 live across a call. Functions compiled this way save and restore
12197 the register @var{reg} if they use it.
12198
12199 It is an error to use this flag with the frame pointer or stack pointer.
12200 Use of this flag for other registers that have fixed pervasive roles in
12201 the machine's execution model produces disastrous results.
12202
12203 A different sort of disaster results from the use of this flag for
12204 a register in which function values may be returned.
12205
12206 This flag does not have a negative form, because it specifies a
12207 three-way choice.
12208
12209 @item -fpack-struct[=@var{n}]
12210 @opindex fpack-struct
12211 Without a value specified, pack all structure members together without
12212 holes. When a value is specified (which must be a small power of two), pack
12213 structure members according to this value, representing the maximum
12214 alignment (that is, objects with default alignment requirements larger than
12215 this are output potentially unaligned at the next fitting location.
12216
12217 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
12218 code that is not binary compatible with code generated without that switch.
12219 Additionally, it makes the code suboptimal.
12220 Use it to conform to a non-default application binary interface.
12221
12222 @item -fleading-underscore
12223 @opindex fleading-underscore
12224 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
12225 change the way C symbols are represented in the object file. One use
12226 is to help link with legacy assembly code.
12227
12228 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
12229 generate code that is not binary compatible with code generated without that
12230 switch. Use it to conform to a non-default application binary interface.
12231 Not all targets provide complete support for this switch.
12232
12233 @item -ftls-model=@var{model}
12234 @opindex ftls-model
12235 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
12236 The @var{model} argument should be one of @samp{global-dynamic},
12237 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
12238 Note that the choice is subject to optimization: the compiler may use
12239 a more efficient model for symbols not visible outside of the translation
12240 unit, or if @option{-fpic} is not given on the command line.
12241
12242 The default without @option{-fpic} is @samp{initial-exec}; with
12243 @option{-fpic} the default is @samp{global-dynamic}.
12244
12245 @item -ftrampolines
12246 @opindex ftrampolines
12247 For targets that normally need trampolines for nested functions, always
12248 generate them instead of using descriptors. Otherwise, for targets that
12249 do not need them, like for example HP-PA or IA-64, do nothing.
12250
12251 A trampoline is a small piece of code that is created at run time on the
12252 stack when the address of a nested function is taken, and is used to call
12253 the nested function indirectly. Therefore, it requires the stack to be
12254 made executable in order for the program to work properly.
12255
12256 @option{-fno-trampolines} is enabled by default on a language by language
12257 basis to let the compiler avoid generating them, if it computes that this
12258 is safe, and replace them with descriptors. Descriptors are made up of data
12259 only, but the generated code must be prepared to deal with them. As of this
12260 writing, @option{-fno-trampolines} is enabled by default only for Ada.
12261
12262 Moreover, code compiled with @option{-ftrampolines} and code compiled with
12263 @option{-fno-trampolines} are not binary compatible if nested functions are
12264 present. This option must therefore be used on a program-wide basis and be
12265 manipulated with extreme care.
12266
12267 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
12268 @opindex fvisibility
12269 Set the default ELF image symbol visibility to the specified option---all
12270 symbols are marked with this unless overridden within the code.
12271 Using this feature can very substantially improve linking and
12272 load times of shared object libraries, produce more optimized
12273 code, provide near-perfect API export and prevent symbol clashes.
12274 It is @strong{strongly} recommended that you use this in any shared objects
12275 you distribute.
12276
12277 Despite the nomenclature, @samp{default} always means public; i.e.,
12278 available to be linked against from outside the shared object.
12279 @samp{protected} and @samp{internal} are pretty useless in real-world
12280 usage so the only other commonly used option is @samp{hidden}.
12281 The default if @option{-fvisibility} isn't specified is
12282 @samp{default}, i.e., make every symbol public.
12283
12284 A good explanation of the benefits offered by ensuring ELF
12285 symbols have the correct visibility is given by ``How To Write
12286 Shared Libraries'' by Ulrich Drepper (which can be found at
12287 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
12288 solution made possible by this option to marking things hidden when
12289 the default is public is to make the default hidden and mark things
12290 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
12291 and @code{__attribute__ ((visibility("default")))} instead of
12292 @code{__declspec(dllexport)} you get almost identical semantics with
12293 identical syntax. This is a great boon to those working with
12294 cross-platform projects.
12295
12296 For those adding visibility support to existing code, you may find
12297 @code{#pragma GCC visibility} of use. This works by you enclosing
12298 the declarations you wish to set visibility for with (for example)
12299 @code{#pragma GCC visibility push(hidden)} and
12300 @code{#pragma GCC visibility pop}.
12301 Bear in mind that symbol visibility should be viewed @strong{as
12302 part of the API interface contract} and thus all new code should
12303 always specify visibility when it is not the default; i.e., declarations
12304 only for use within the local DSO should @strong{always} be marked explicitly
12305 as hidden as so to avoid PLT indirection overheads---making this
12306 abundantly clear also aids readability and self-documentation of the code.
12307 Note that due to ISO C++ specification requirements, @code{operator new} and
12308 @code{operator delete} must always be of default visibility.
12309
12310 Be aware that headers from outside your project, in particular system
12311 headers and headers from any other library you use, may not be
12312 expecting to be compiled with visibility other than the default. You
12313 may need to explicitly say @code{#pragma GCC visibility push(default)}
12314 before including any such headers.
12315
12316 @code{extern} declarations are not affected by @option{-fvisibility}, so
12317 a lot of code can be recompiled with @option{-fvisibility=hidden} with
12318 no modifications. However, this means that calls to @code{extern}
12319 functions with no explicit visibility use the PLT, so it is more
12320 effective to use @code{__attribute ((visibility))} and/or
12321 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
12322 declarations should be treated as hidden.
12323
12324 Note that @option{-fvisibility} does affect C++ vague linkage
12325 entities. This means that, for instance, an exception class that is
12326 be thrown between DSOs must be explicitly marked with default
12327 visibility so that the @samp{type_info} nodes are unified between
12328 the DSOs.
12329
12330 An overview of these techniques, their benefits and how to use them
12331 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
12332
12333 @item -fstrict-volatile-bitfields
12334 @opindex fstrict-volatile-bitfields
12335 This option should be used if accesses to volatile bit-fields (or other
12336 structure fields, although the compiler usually honors those types
12337 anyway) should use a single access of the width of the
12338 field's type, aligned to a natural alignment if possible. For
12339 example, targets with memory-mapped peripheral registers might require
12340 all such accesses to be 16 bits wide; with this flag you can
12341 declare all peripheral bit-fields as @code{unsigned short} (assuming short
12342 is 16 bits on these targets) to force GCC to use 16-bit accesses
12343 instead of, perhaps, a more efficient 32-bit access.
12344
12345 If this option is disabled, the compiler uses the most efficient
12346 instruction. In the previous example, that might be a 32-bit load
12347 instruction, even though that accesses bytes that do not contain
12348 any portion of the bit-field, or memory-mapped registers unrelated to
12349 the one being updated.
12350
12351 In some cases, such as when the @code{packed} attribute is applied to a
12352 structure field, it may not be possible to access the field with a single
12353 read or write that is correctly aligned for the target machine. In this
12354 case GCC falls back to generating multiple accesses rather than code that
12355 will fault or truncate the result at run time.
12356
12357 Note: Due to restrictions of the C/C++11 memory model, write accesses are
12358 not allowed to touch non bit-field members. It is therefore recommended
12359 to define all bits of the field's type as bit-field members.
12360
12361 The default value of this option is determined by the application binary
12362 interface for the target processor.
12363
12364 @item -fsync-libcalls
12365 @opindex fsync-libcalls
12366 This option controls whether any out-of-line instance of the @code{__sync}
12367 family of functions may be used to implement the C++11 @code{__atomic}
12368 family of functions.
12369
12370 The default value of this option is enabled, thus the only useful form
12371 of the option is @option{-fno-sync-libcalls}. This option is used in
12372 the implementation of the @file{libatomic} runtime library.
12373
12374 @end table
12375
12376 @node Developer Options
12377 @section GCC Developer Options
12378 @cindex developer options
12379 @cindex debugging GCC
12380 @cindex debug dump options
12381 @cindex dump options
12382 @cindex compilation statistics
12383
12384 This section describes command-line options that are primarily of
12385 interest to GCC developers, including options to support compiler
12386 testing and investigation of compiler bugs and compile-time
12387 performance problems. This includes options that produce debug dumps
12388 at various points in the compilation; that print statistics such as
12389 memory use and execution time; and that print information about GCC's
12390 configuration, such as where it searches for libraries. You should
12391 rarely need to use any of these options for ordinary compilation and
12392 linking tasks.
12393
12394 @table @gcctabopt
12395
12396 @item -d@var{letters}
12397 @itemx -fdump-rtl-@var{pass}
12398 @itemx -fdump-rtl-@var{pass}=@var{filename}
12399 @opindex d
12400 @opindex fdump-rtl-@var{pass}
12401 Says to make debugging dumps during compilation at times specified by
12402 @var{letters}. This is used for debugging the RTL-based passes of the
12403 compiler. The file names for most of the dumps are made by appending
12404 a pass number and a word to the @var{dumpname}, and the files are
12405 created in the directory of the output file. In case of
12406 @option{=@var{filename}} option, the dump is output on the given file
12407 instead of the pass numbered dump files. Note that the pass number is
12408 assigned as passes are registered into the pass manager. Most passes
12409 are registered in the order that they will execute and for these passes
12410 the number corresponds to the pass execution order. However, passes
12411 registered by plugins, passes specific to compilation targets, or
12412 passes that are otherwise registered after all the other passes are
12413 numbered higher than a pass named "final", even if they are executed
12414 earlier. @var{dumpname} is generated from the name of the output
12415 file if explicitly specified and not an executable, otherwise it is
12416 the basename of the source file. These switches may have different
12417 effects when @option{-E} is used for preprocessing.
12418
12419 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
12420 @option{-d} option @var{letters}. Here are the possible
12421 letters for use in @var{pass} and @var{letters}, and their meanings:
12422
12423 @table @gcctabopt
12424
12425 @item -fdump-rtl-alignments
12426 @opindex fdump-rtl-alignments
12427 Dump after branch alignments have been computed.
12428
12429 @item -fdump-rtl-asmcons
12430 @opindex fdump-rtl-asmcons
12431 Dump after fixing rtl statements that have unsatisfied in/out constraints.
12432
12433 @item -fdump-rtl-auto_inc_dec
12434 @opindex fdump-rtl-auto_inc_dec
12435 Dump after auto-inc-dec discovery. This pass is only run on
12436 architectures that have auto inc or auto dec instructions.
12437
12438 @item -fdump-rtl-barriers
12439 @opindex fdump-rtl-barriers
12440 Dump after cleaning up the barrier instructions.
12441
12442 @item -fdump-rtl-bbpart
12443 @opindex fdump-rtl-bbpart
12444 Dump after partitioning hot and cold basic blocks.
12445
12446 @item -fdump-rtl-bbro
12447 @opindex fdump-rtl-bbro
12448 Dump after block reordering.
12449
12450 @item -fdump-rtl-btl1
12451 @itemx -fdump-rtl-btl2
12452 @opindex fdump-rtl-btl2
12453 @opindex fdump-rtl-btl2
12454 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
12455 after the two branch
12456 target load optimization passes.
12457
12458 @item -fdump-rtl-bypass
12459 @opindex fdump-rtl-bypass
12460 Dump after jump bypassing and control flow optimizations.
12461
12462 @item -fdump-rtl-combine
12463 @opindex fdump-rtl-combine
12464 Dump after the RTL instruction combination pass.
12465
12466 @item -fdump-rtl-compgotos
12467 @opindex fdump-rtl-compgotos
12468 Dump after duplicating the computed gotos.
12469
12470 @item -fdump-rtl-ce1
12471 @itemx -fdump-rtl-ce2
12472 @itemx -fdump-rtl-ce3
12473 @opindex fdump-rtl-ce1
12474 @opindex fdump-rtl-ce2
12475 @opindex fdump-rtl-ce3
12476 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
12477 @option{-fdump-rtl-ce3} enable dumping after the three
12478 if conversion passes.
12479
12480 @item -fdump-rtl-cprop_hardreg
12481 @opindex fdump-rtl-cprop_hardreg
12482 Dump after hard register copy propagation.
12483
12484 @item -fdump-rtl-csa
12485 @opindex fdump-rtl-csa
12486 Dump after combining stack adjustments.
12487
12488 @item -fdump-rtl-cse1
12489 @itemx -fdump-rtl-cse2
12490 @opindex fdump-rtl-cse1
12491 @opindex fdump-rtl-cse2
12492 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
12493 the two common subexpression elimination passes.
12494
12495 @item -fdump-rtl-dce
12496 @opindex fdump-rtl-dce
12497 Dump after the standalone dead code elimination passes.
12498
12499 @item -fdump-rtl-dbr
12500 @opindex fdump-rtl-dbr
12501 Dump after delayed branch scheduling.
12502
12503 @item -fdump-rtl-dce1
12504 @itemx -fdump-rtl-dce2
12505 @opindex fdump-rtl-dce1
12506 @opindex fdump-rtl-dce2
12507 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
12508 the two dead store elimination passes.
12509
12510 @item -fdump-rtl-eh
12511 @opindex fdump-rtl-eh
12512 Dump after finalization of EH handling code.
12513
12514 @item -fdump-rtl-eh_ranges
12515 @opindex fdump-rtl-eh_ranges
12516 Dump after conversion of EH handling range regions.
12517
12518 @item -fdump-rtl-expand
12519 @opindex fdump-rtl-expand
12520 Dump after RTL generation.
12521
12522 @item -fdump-rtl-fwprop1
12523 @itemx -fdump-rtl-fwprop2
12524 @opindex fdump-rtl-fwprop1
12525 @opindex fdump-rtl-fwprop2
12526 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
12527 dumping after the two forward propagation passes.
12528
12529 @item -fdump-rtl-gcse1
12530 @itemx -fdump-rtl-gcse2
12531 @opindex fdump-rtl-gcse1
12532 @opindex fdump-rtl-gcse2
12533 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
12534 after global common subexpression elimination.
12535
12536 @item -fdump-rtl-init-regs
12537 @opindex fdump-rtl-init-regs
12538 Dump after the initialization of the registers.
12539
12540 @item -fdump-rtl-initvals
12541 @opindex fdump-rtl-initvals
12542 Dump after the computation of the initial value sets.
12543
12544 @item -fdump-rtl-into_cfglayout
12545 @opindex fdump-rtl-into_cfglayout
12546 Dump after converting to cfglayout mode.
12547
12548 @item -fdump-rtl-ira
12549 @opindex fdump-rtl-ira
12550 Dump after iterated register allocation.
12551
12552 @item -fdump-rtl-jump
12553 @opindex fdump-rtl-jump
12554 Dump after the second jump optimization.
12555
12556 @item -fdump-rtl-loop2
12557 @opindex fdump-rtl-loop2
12558 @option{-fdump-rtl-loop2} enables dumping after the rtl
12559 loop optimization passes.
12560
12561 @item -fdump-rtl-mach
12562 @opindex fdump-rtl-mach
12563 Dump after performing the machine dependent reorganization pass, if that
12564 pass exists.
12565
12566 @item -fdump-rtl-mode_sw
12567 @opindex fdump-rtl-mode_sw
12568 Dump after removing redundant mode switches.
12569
12570 @item -fdump-rtl-rnreg
12571 @opindex fdump-rtl-rnreg
12572 Dump after register renumbering.
12573
12574 @item -fdump-rtl-outof_cfglayout
12575 @opindex fdump-rtl-outof_cfglayout
12576 Dump after converting from cfglayout mode.
12577
12578 @item -fdump-rtl-peephole2
12579 @opindex fdump-rtl-peephole2
12580 Dump after the peephole pass.
12581
12582 @item -fdump-rtl-postreload
12583 @opindex fdump-rtl-postreload
12584 Dump after post-reload optimizations.
12585
12586 @item -fdump-rtl-pro_and_epilogue
12587 @opindex fdump-rtl-pro_and_epilogue
12588 Dump after generating the function prologues and epilogues.
12589
12590 @item -fdump-rtl-sched1
12591 @itemx -fdump-rtl-sched2
12592 @opindex fdump-rtl-sched1
12593 @opindex fdump-rtl-sched2
12594 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
12595 after the basic block scheduling passes.
12596
12597 @item -fdump-rtl-ree
12598 @opindex fdump-rtl-ree
12599 Dump after sign/zero extension elimination.
12600
12601 @item -fdump-rtl-seqabstr
12602 @opindex fdump-rtl-seqabstr
12603 Dump after common sequence discovery.
12604
12605 @item -fdump-rtl-shorten
12606 @opindex fdump-rtl-shorten
12607 Dump after shortening branches.
12608
12609 @item -fdump-rtl-sibling
12610 @opindex fdump-rtl-sibling
12611 Dump after sibling call optimizations.
12612
12613 @item -fdump-rtl-split1
12614 @itemx -fdump-rtl-split2
12615 @itemx -fdump-rtl-split3
12616 @itemx -fdump-rtl-split4
12617 @itemx -fdump-rtl-split5
12618 @opindex fdump-rtl-split1
12619 @opindex fdump-rtl-split2
12620 @opindex fdump-rtl-split3
12621 @opindex fdump-rtl-split4
12622 @opindex fdump-rtl-split5
12623 These options enable dumping after five rounds of
12624 instruction splitting.
12625
12626 @item -fdump-rtl-sms
12627 @opindex fdump-rtl-sms
12628 Dump after modulo scheduling. This pass is only run on some
12629 architectures.
12630
12631 @item -fdump-rtl-stack
12632 @opindex fdump-rtl-stack
12633 Dump after conversion from GCC's ``flat register file'' registers to the
12634 x87's stack-like registers. This pass is only run on x86 variants.
12635
12636 @item -fdump-rtl-subreg1
12637 @itemx -fdump-rtl-subreg2
12638 @opindex fdump-rtl-subreg1
12639 @opindex fdump-rtl-subreg2
12640 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
12641 the two subreg expansion passes.
12642
12643 @item -fdump-rtl-unshare
12644 @opindex fdump-rtl-unshare
12645 Dump after all rtl has been unshared.
12646
12647 @item -fdump-rtl-vartrack
12648 @opindex fdump-rtl-vartrack
12649 Dump after variable tracking.
12650
12651 @item -fdump-rtl-vregs
12652 @opindex fdump-rtl-vregs
12653 Dump after converting virtual registers to hard registers.
12654
12655 @item -fdump-rtl-web
12656 @opindex fdump-rtl-web
12657 Dump after live range splitting.
12658
12659 @item -fdump-rtl-regclass
12660 @itemx -fdump-rtl-subregs_of_mode_init
12661 @itemx -fdump-rtl-subregs_of_mode_finish
12662 @itemx -fdump-rtl-dfinit
12663 @itemx -fdump-rtl-dfinish
12664 @opindex fdump-rtl-regclass
12665 @opindex fdump-rtl-subregs_of_mode_init
12666 @opindex fdump-rtl-subregs_of_mode_finish
12667 @opindex fdump-rtl-dfinit
12668 @opindex fdump-rtl-dfinish
12669 These dumps are defined but always produce empty files.
12670
12671 @item -da
12672 @itemx -fdump-rtl-all
12673 @opindex da
12674 @opindex fdump-rtl-all
12675 Produce all the dumps listed above.
12676
12677 @item -dA
12678 @opindex dA
12679 Annotate the assembler output with miscellaneous debugging information.
12680
12681 @item -dD
12682 @opindex dD
12683 Dump all macro definitions, at the end of preprocessing, in addition to
12684 normal output.
12685
12686 @item -dH
12687 @opindex dH
12688 Produce a core dump whenever an error occurs.
12689
12690 @item -dp
12691 @opindex dp
12692 Annotate the assembler output with a comment indicating which
12693 pattern and alternative is used. The length of each instruction is
12694 also printed.
12695
12696 @item -dP
12697 @opindex dP
12698 Dump the RTL in the assembler output as a comment before each instruction.
12699 Also turns on @option{-dp} annotation.
12700
12701 @item -dx
12702 @opindex dx
12703 Just generate RTL for a function instead of compiling it. Usually used
12704 with @option{-fdump-rtl-expand}.
12705 @end table
12706
12707 @item -fdump-noaddr
12708 @opindex fdump-noaddr
12709 When doing debugging dumps, suppress address output. This makes it more
12710 feasible to use diff on debugging dumps for compiler invocations with
12711 different compiler binaries and/or different
12712 text / bss / data / heap / stack / dso start locations.
12713
12714 @item -freport-bug
12715 @opindex freport-bug
12716 Collect and dump debug information into a temporary file if an
12717 internal compiler error (ICE) occurs.
12718
12719 @item -fdump-unnumbered
12720 @opindex fdump-unnumbered
12721 When doing debugging dumps, suppress instruction numbers and address output.
12722 This makes it more feasible to use diff on debugging dumps for compiler
12723 invocations with different options, in particular with and without
12724 @option{-g}.
12725
12726 @item -fdump-unnumbered-links
12727 @opindex fdump-unnumbered-links
12728 When doing debugging dumps (see @option{-d} option above), suppress
12729 instruction numbers for the links to the previous and next instructions
12730 in a sequence.
12731
12732 @item -fdump-translation-unit @r{(C++ only)}
12733 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
12734 @opindex fdump-translation-unit
12735 Dump a representation of the tree structure for the entire translation
12736 unit to a file. The file name is made by appending @file{.tu} to the
12737 source file name, and the file is created in the same directory as the
12738 output file. If the @samp{-@var{options}} form is used, @var{options}
12739 controls the details of the dump as described for the
12740 @option{-fdump-tree} options.
12741
12742 @item -fdump-class-hierarchy @r{(C++ only)}
12743 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
12744 @opindex fdump-class-hierarchy
12745 Dump a representation of each class's hierarchy and virtual function
12746 table layout to a file. The file name is made by appending
12747 @file{.class} to the source file name, and the file is created in the
12748 same directory as the output file. If the @samp{-@var{options}} form
12749 is used, @var{options} controls the details of the dump as described
12750 for the @option{-fdump-tree} options.
12751
12752 @item -fdump-ipa-@var{switch}
12753 @opindex fdump-ipa
12754 Control the dumping at various stages of inter-procedural analysis
12755 language tree to a file. The file name is generated by appending a
12756 switch specific suffix to the source file name, and the file is created
12757 in the same directory as the output file. The following dumps are
12758 possible:
12759
12760 @table @samp
12761 @item all
12762 Enables all inter-procedural analysis dumps.
12763
12764 @item cgraph
12765 Dumps information about call-graph optimization, unused function removal,
12766 and inlining decisions.
12767
12768 @item inline
12769 Dump after function inlining.
12770
12771 @end table
12772
12773 @item -fdump-passes
12774 @opindex fdump-passes
12775 Dump the list of optimization passes that are turned on and off by
12776 the current command-line options.
12777
12778 @item -fdump-statistics-@var{option}
12779 @opindex fdump-statistics
12780 Enable and control dumping of pass statistics in a separate file. The
12781 file name is generated by appending a suffix ending in
12782 @samp{.statistics} to the source file name, and the file is created in
12783 the same directory as the output file. If the @samp{-@var{option}}
12784 form is used, @samp{-stats} causes counters to be summed over the
12785 whole compilation unit while @samp{-details} dumps every event as
12786 the passes generate them. The default with no option is to sum
12787 counters for each function compiled.
12788
12789 @item -fdump-tree-@var{switch}
12790 @itemx -fdump-tree-@var{switch}-@var{options}
12791 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
12792 @opindex fdump-tree
12793 Control the dumping at various stages of processing the intermediate
12794 language tree to a file. The file name is generated by appending a
12795 switch-specific suffix to the source file name, and the file is
12796 created in the same directory as the output file. In case of
12797 @option{=@var{filename}} option, the dump is output on the given file
12798 instead of the auto named dump files. If the @samp{-@var{options}}
12799 form is used, @var{options} is a list of @samp{-} separated options
12800 which control the details of the dump. Not all options are applicable
12801 to all dumps; those that are not meaningful are ignored. The
12802 following options are available
12803
12804 @table @samp
12805 @item address
12806 Print the address of each node. Usually this is not meaningful as it
12807 changes according to the environment and source file. Its primary use
12808 is for tying up a dump file with a debug environment.
12809 @item asmname
12810 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
12811 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
12812 use working backward from mangled names in the assembly file.
12813 @item slim
12814 When dumping front-end intermediate representations, inhibit dumping
12815 of members of a scope or body of a function merely because that scope
12816 has been reached. Only dump such items when they are directly reachable
12817 by some other path.
12818
12819 When dumping pretty-printed trees, this option inhibits dumping the
12820 bodies of control structures.
12821
12822 When dumping RTL, print the RTL in slim (condensed) form instead of
12823 the default LISP-like representation.
12824 @item raw
12825 Print a raw representation of the tree. By default, trees are
12826 pretty-printed into a C-like representation.
12827 @item details
12828 Enable more detailed dumps (not honored by every dump option). Also
12829 include information from the optimization passes.
12830 @item stats
12831 Enable dumping various statistics about the pass (not honored by every dump
12832 option).
12833 @item blocks
12834 Enable showing basic block boundaries (disabled in raw dumps).
12835 @item graph
12836 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
12837 dump a representation of the control flow graph suitable for viewing with
12838 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
12839 the file is pretty-printed as a subgraph, so that GraphViz can render them
12840 all in a single plot.
12841
12842 This option currently only works for RTL dumps, and the RTL is always
12843 dumped in slim form.
12844 @item vops
12845 Enable showing virtual operands for every statement.
12846 @item lineno
12847 Enable showing line numbers for statements.
12848 @item uid
12849 Enable showing the unique ID (@code{DECL_UID}) for each variable.
12850 @item verbose
12851 Enable showing the tree dump for each statement.
12852 @item eh
12853 Enable showing the EH region number holding each statement.
12854 @item scev
12855 Enable showing scalar evolution analysis details.
12856 @item optimized
12857 Enable showing optimization information (only available in certain
12858 passes).
12859 @item missed
12860 Enable showing missed optimization information (only available in certain
12861 passes).
12862 @item note
12863 Enable other detailed optimization information (only available in
12864 certain passes).
12865 @item =@var{filename}
12866 Instead of an auto named dump file, output into the given file
12867 name. The file names @file{stdout} and @file{stderr} are treated
12868 specially and are considered already open standard streams. For
12869 example,
12870
12871 @smallexample
12872 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
12873 -fdump-tree-pre=stderr file.c
12874 @end smallexample
12875
12876 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
12877 output on to @file{stderr}. If two conflicting dump filenames are
12878 given for the same pass, then the latter option overrides the earlier
12879 one.
12880
12881 @item split-paths
12882 @opindex fdump-tree-split-paths
12883 Dump each function after splitting paths to loop backedges. The file
12884 name is made by appending @file{.split-paths} to the source file name.
12885
12886 @item all
12887 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
12888 and @option{lineno}.
12889
12890 @item optall
12891 Turn on all optimization options, i.e., @option{optimized},
12892 @option{missed}, and @option{note}.
12893 @end table
12894
12895 The following tree dumps are possible:
12896 @table @samp
12897
12898 @item original
12899 @opindex fdump-tree-original
12900 Dump before any tree based optimization, to @file{@var{file}.original}.
12901
12902 @item optimized
12903 @opindex fdump-tree-optimized
12904 Dump after all tree based optimization, to @file{@var{file}.optimized}.
12905
12906 @item gimple
12907 @opindex fdump-tree-gimple
12908 Dump each function before and after the gimplification pass to a file. The
12909 file name is made by appending @file{.gimple} to the source file name.
12910
12911 @item cfg
12912 @opindex fdump-tree-cfg
12913 Dump the control flow graph of each function to a file. The file name is
12914 made by appending @file{.cfg} to the source file name.
12915
12916 @item ch
12917 @opindex fdump-tree-ch
12918 Dump each function after copying loop headers. The file name is made by
12919 appending @file{.ch} to the source file name.
12920
12921 @item ssa
12922 @opindex fdump-tree-ssa
12923 Dump SSA related information to a file. The file name is made by appending
12924 @file{.ssa} to the source file name.
12925
12926 @item alias
12927 @opindex fdump-tree-alias
12928 Dump aliasing information for each function. The file name is made by
12929 appending @file{.alias} to the source file name.
12930
12931 @item ccp
12932 @opindex fdump-tree-ccp
12933 Dump each function after CCP@. The file name is made by appending
12934 @file{.ccp} to the source file name.
12935
12936 @item storeccp
12937 @opindex fdump-tree-storeccp
12938 Dump each function after STORE-CCP@. The file name is made by appending
12939 @file{.storeccp} to the source file name.
12940
12941 @item pre
12942 @opindex fdump-tree-pre
12943 Dump trees after partial redundancy elimination and/or code hoisting.
12944 The file name is made by appending @file{.pre} to the source file name.
12945
12946 @item fre
12947 @opindex fdump-tree-fre
12948 Dump trees after full redundancy elimination. The file name is made
12949 by appending @file{.fre} to the source file name.
12950
12951 @item copyprop
12952 @opindex fdump-tree-copyprop
12953 Dump trees after copy propagation. The file name is made
12954 by appending @file{.copyprop} to the source file name.
12955
12956 @item store_copyprop
12957 @opindex fdump-tree-store_copyprop
12958 Dump trees after store copy-propagation. The file name is made
12959 by appending @file{.store_copyprop} to the source file name.
12960
12961 @item dce
12962 @opindex fdump-tree-dce
12963 Dump each function after dead code elimination. The file name is made by
12964 appending @file{.dce} to the source file name.
12965
12966 @item sra
12967 @opindex fdump-tree-sra
12968 Dump each function after performing scalar replacement of aggregates. The
12969 file name is made by appending @file{.sra} to the source file name.
12970
12971 @item sink
12972 @opindex fdump-tree-sink
12973 Dump each function after performing code sinking. The file name is made
12974 by appending @file{.sink} to the source file name.
12975
12976 @item dom
12977 @opindex fdump-tree-dom
12978 Dump each function after applying dominator tree optimizations. The file
12979 name is made by appending @file{.dom} to the source file name.
12980
12981 @item dse
12982 @opindex fdump-tree-dse
12983 Dump each function after applying dead store elimination. The file
12984 name is made by appending @file{.dse} to the source file name.
12985
12986 @item phiopt
12987 @opindex fdump-tree-phiopt
12988 Dump each function after optimizing PHI nodes into straightline code. The file
12989 name is made by appending @file{.phiopt} to the source file name.
12990
12991 @item backprop
12992 @opindex fdump-tree-backprop
12993 Dump each function after back-propagating use information up the definition
12994 chain. The file name is made by appending @file{.backprop} to the
12995 source file name.
12996
12997 @item forwprop
12998 @opindex fdump-tree-forwprop
12999 Dump each function after forward propagating single use variables. The file
13000 name is made by appending @file{.forwprop} to the source file name.
13001
13002 @item nrv
13003 @opindex fdump-tree-nrv
13004 Dump each function after applying the named return value optimization on
13005 generic trees. The file name is made by appending @file{.nrv} to the source
13006 file name.
13007
13008 @item vect
13009 @opindex fdump-tree-vect
13010 Dump each function after applying vectorization of loops. The file name is
13011 made by appending @file{.vect} to the source file name.
13012
13013 @item slp
13014 @opindex fdump-tree-slp
13015 Dump each function after applying vectorization of basic blocks. The file name
13016 is made by appending @file{.slp} to the source file name.
13017
13018 @item vrp
13019 @opindex fdump-tree-vrp
13020 Dump each function after Value Range Propagation (VRP). The file name
13021 is made by appending @file{.vrp} to the source file name.
13022
13023 @item early vrp
13024 @opindex fdump-tree-evrp
13025 Dump each function after Early Value Range Propagation (EVRP). The file name
13026 is made by appending @file{.evrp} to the source file name.
13027
13028 @item oaccdevlow
13029 @opindex fdump-tree-oaccdevlow
13030 Dump each function after applying device-specific OpenACC transformations.
13031 The file name is made by appending @file{.oaccdevlow} to the source file name.
13032
13033 @item all
13034 @opindex fdump-tree-all
13035 Enable all the available tree dumps with the flags provided in this option.
13036 @end table
13037
13038 @item -fopt-info
13039 @itemx -fopt-info-@var{options}
13040 @itemx -fopt-info-@var{options}=@var{filename}
13041 @opindex fopt-info
13042 Controls optimization dumps from various optimization passes. If the
13043 @samp{-@var{options}} form is used, @var{options} is a list of
13044 @samp{-} separated option keywords to select the dump details and
13045 optimizations.
13046
13047 The @var{options} can be divided into two groups: options describing the
13048 verbosity of the dump, and options describing which optimizations
13049 should be included. The options from both the groups can be freely
13050 mixed as they are non-overlapping. However, in case of any conflicts,
13051 the later options override the earlier options on the command
13052 line.
13053
13054 The following options control the dump verbosity:
13055
13056 @table @samp
13057 @item optimized
13058 Print information when an optimization is successfully applied. It is
13059 up to a pass to decide which information is relevant. For example, the
13060 vectorizer passes print the source location of loops which are
13061 successfully vectorized.
13062 @item missed
13063 Print information about missed optimizations. Individual passes
13064 control which information to include in the output.
13065 @item note
13066 Print verbose information about optimizations, such as certain
13067 transformations, more detailed messages about decisions etc.
13068 @item all
13069 Print detailed optimization information. This includes
13070 @samp{optimized}, @samp{missed}, and @samp{note}.
13071 @end table
13072
13073 One or more of the following option keywords can be used to describe a
13074 group of optimizations:
13075
13076 @table @samp
13077 @item ipa
13078 Enable dumps from all interprocedural optimizations.
13079 @item loop
13080 Enable dumps from all loop optimizations.
13081 @item inline
13082 Enable dumps from all inlining optimizations.
13083 @item vec
13084 Enable dumps from all vectorization optimizations.
13085 @item optall
13086 Enable dumps from all optimizations. This is a superset of
13087 the optimization groups listed above.
13088 @end table
13089
13090 If @var{options} is
13091 omitted, it defaults to @samp{optimized-optall}, which means to dump all
13092 info about successful optimizations from all the passes.
13093
13094 If the @var{filename} is provided, then the dumps from all the
13095 applicable optimizations are concatenated into the @var{filename}.
13096 Otherwise the dump is output onto @file{stderr}. Though multiple
13097 @option{-fopt-info} options are accepted, only one of them can include
13098 a @var{filename}. If other filenames are provided then all but the
13099 first such option are ignored.
13100
13101 Note that the output @var{filename} is overwritten
13102 in case of multiple translation units. If a combined output from
13103 multiple translation units is desired, @file{stderr} should be used
13104 instead.
13105
13106 In the following example, the optimization info is output to
13107 @file{stderr}:
13108
13109 @smallexample
13110 gcc -O3 -fopt-info
13111 @end smallexample
13112
13113 This example:
13114 @smallexample
13115 gcc -O3 -fopt-info-missed=missed.all
13116 @end smallexample
13117
13118 @noindent
13119 outputs missed optimization report from all the passes into
13120 @file{missed.all}, and this one:
13121
13122 @smallexample
13123 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13124 @end smallexample
13125
13126 @noindent
13127 prints information about missed optimization opportunities from
13128 vectorization passes on @file{stderr}.
13129 Note that @option{-fopt-info-vec-missed} is equivalent to
13130 @option{-fopt-info-missed-vec}.
13131
13132 As another example,
13133 @smallexample
13134 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13135 @end smallexample
13136
13137 @noindent
13138 outputs information about missed optimizations as well as
13139 optimized locations from all the inlining passes into
13140 @file{inline.txt}.
13141
13142 Finally, consider:
13143
13144 @smallexample
13145 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13146 @end smallexample
13147
13148 @noindent
13149 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
13150 in conflict since only one output file is allowed. In this case, only
13151 the first option takes effect and the subsequent options are
13152 ignored. Thus only @file{vec.miss} is produced which contains
13153 dumps from the vectorizer about missed opportunities.
13154
13155 @item -fsched-verbose=@var{n}
13156 @opindex fsched-verbose
13157 On targets that use instruction scheduling, this option controls the
13158 amount of debugging output the scheduler prints to the dump files.
13159
13160 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
13161 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
13162 For @var{n} greater than one, it also output basic block probabilities,
13163 detailed ready list information and unit/insn info. For @var{n} greater
13164 than two, it includes RTL at abort point, control-flow and regions info.
13165 And for @var{n} over four, @option{-fsched-verbose} also includes
13166 dependence info.
13167
13168
13169
13170 @item -fenable-@var{kind}-@var{pass}
13171 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
13172 @opindex fdisable-
13173 @opindex fenable-
13174
13175 This is a set of options that are used to explicitly disable/enable
13176 optimization passes. These options are intended for use for debugging GCC.
13177 Compiler users should use regular options for enabling/disabling
13178 passes instead.
13179
13180 @table @gcctabopt
13181
13182 @item -fdisable-ipa-@var{pass}
13183 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13184 statically invoked in the compiler multiple times, the pass name should be
13185 appended with a sequential number starting from 1.
13186
13187 @item -fdisable-rtl-@var{pass}
13188 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
13189 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
13190 statically invoked in the compiler multiple times, the pass name should be
13191 appended with a sequential number starting from 1. @var{range-list} is a
13192 comma-separated list of function ranges or assembler names. Each range is a number
13193 pair separated by a colon. The range is inclusive in both ends. If the range
13194 is trivial, the number pair can be simplified as a single number. If the
13195 function's call graph node's @var{uid} falls within one of the specified ranges,
13196 the @var{pass} is disabled for that function. The @var{uid} is shown in the
13197 function header of a dump file, and the pass names can be dumped by using
13198 option @option{-fdump-passes}.
13199
13200 @item -fdisable-tree-@var{pass}
13201 @itemx -fdisable-tree-@var{pass}=@var{range-list}
13202 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
13203 option arguments.
13204
13205 @item -fenable-ipa-@var{pass}
13206 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
13207 statically invoked in the compiler multiple times, the pass name should be
13208 appended with a sequential number starting from 1.
13209
13210 @item -fenable-rtl-@var{pass}
13211 @itemx -fenable-rtl-@var{pass}=@var{range-list}
13212 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
13213 description and examples.
13214
13215 @item -fenable-tree-@var{pass}
13216 @itemx -fenable-tree-@var{pass}=@var{range-list}
13217 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
13218 of option arguments.
13219
13220 @end table
13221
13222 Here are some examples showing uses of these options.
13223
13224 @smallexample
13225
13226 # disable ccp1 for all functions
13227 -fdisable-tree-ccp1
13228 # disable complete unroll for function whose cgraph node uid is 1
13229 -fenable-tree-cunroll=1
13230 # disable gcse2 for functions at the following ranges [1,1],
13231 # [300,400], and [400,1000]
13232 # disable gcse2 for functions foo and foo2
13233 -fdisable-rtl-gcse2=foo,foo2
13234 # disable early inlining
13235 -fdisable-tree-einline
13236 # disable ipa inlining
13237 -fdisable-ipa-inline
13238 # enable tree full unroll
13239 -fenable-tree-unroll
13240
13241 @end smallexample
13242
13243 @item -fchecking
13244 @itemx -fchecking=@var{n}
13245 @opindex fchecking
13246 @opindex fno-checking
13247 Enable internal consistency checking. The default depends on
13248 the compiler configuration. @option{-fchecking=2} enables further
13249 internal consistency checking that might affect code generation.
13250
13251 @item -frandom-seed=@var{string}
13252 @opindex frandom-seed
13253 This option provides a seed that GCC uses in place of
13254 random numbers in generating certain symbol names
13255 that have to be different in every compiled file. It is also used to
13256 place unique stamps in coverage data files and the object files that
13257 produce them. You can use the @option{-frandom-seed} option to produce
13258 reproducibly identical object files.
13259
13260 The @var{string} can either be a number (decimal, octal or hex) or an
13261 arbitrary string (in which case it's converted to a number by
13262 computing CRC32).
13263
13264 The @var{string} should be different for every file you compile.
13265
13266 @item -save-temps
13267 @itemx -save-temps=cwd
13268 @opindex save-temps
13269 Store the usual ``temporary'' intermediate files permanently; place them
13270 in the current directory and name them based on the source file. Thus,
13271 compiling @file{foo.c} with @option{-c -save-temps} produces files
13272 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
13273 preprocessed @file{foo.i} output file even though the compiler now
13274 normally uses an integrated preprocessor.
13275
13276 When used in combination with the @option{-x} command-line option,
13277 @option{-save-temps} is sensible enough to avoid over writing an
13278 input source file with the same extension as an intermediate file.
13279 The corresponding intermediate file may be obtained by renaming the
13280 source file before using @option{-save-temps}.
13281
13282 If you invoke GCC in parallel, compiling several different source
13283 files that share a common base name in different subdirectories or the
13284 same source file compiled for multiple output destinations, it is
13285 likely that the different parallel compilers will interfere with each
13286 other, and overwrite the temporary files. For instance:
13287
13288 @smallexample
13289 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
13290 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
13291 @end smallexample
13292
13293 may result in @file{foo.i} and @file{foo.o} being written to
13294 simultaneously by both compilers.
13295
13296 @item -save-temps=obj
13297 @opindex save-temps=obj
13298 Store the usual ``temporary'' intermediate files permanently. If the
13299 @option{-o} option is used, the temporary files are based on the
13300 object file. If the @option{-o} option is not used, the
13301 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
13302
13303 For example:
13304
13305 @smallexample
13306 gcc -save-temps=obj -c foo.c
13307 gcc -save-temps=obj -c bar.c -o dir/xbar.o
13308 gcc -save-temps=obj foobar.c -o dir2/yfoobar
13309 @end smallexample
13310
13311 @noindent
13312 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
13313 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
13314 @file{dir2/yfoobar.o}.
13315
13316 @item -time@r{[}=@var{file}@r{]}
13317 @opindex time
13318 Report the CPU time taken by each subprocess in the compilation
13319 sequence. For C source files, this is the compiler proper and assembler
13320 (plus the linker if linking is done).
13321
13322 Without the specification of an output file, the output looks like this:
13323
13324 @smallexample
13325 # cc1 0.12 0.01
13326 # as 0.00 0.01
13327 @end smallexample
13328
13329 The first number on each line is the ``user time'', that is time spent
13330 executing the program itself. The second number is ``system time'',
13331 time spent executing operating system routines on behalf of the program.
13332 Both numbers are in seconds.
13333
13334 With the specification of an output file, the output is appended to the
13335 named file, and it looks like this:
13336
13337 @smallexample
13338 0.12 0.01 cc1 @var{options}
13339 0.00 0.01 as @var{options}
13340 @end smallexample
13341
13342 The ``user time'' and the ``system time'' are moved before the program
13343 name, and the options passed to the program are displayed, so that one
13344 can later tell what file was being compiled, and with which options.
13345
13346 @item -fdump-final-insns@r{[}=@var{file}@r{]}
13347 @opindex fdump-final-insns
13348 Dump the final internal representation (RTL) to @var{file}. If the
13349 optional argument is omitted (or if @var{file} is @code{.}), the name
13350 of the dump file is determined by appending @code{.gkd} to the
13351 compilation output file name.
13352
13353 @item -fcompare-debug@r{[}=@var{opts}@r{]}
13354 @opindex fcompare-debug
13355 @opindex fno-compare-debug
13356 If no error occurs during compilation, run the compiler a second time,
13357 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
13358 passed to the second compilation. Dump the final internal
13359 representation in both compilations, and print an error if they differ.
13360
13361 If the equal sign is omitted, the default @option{-gtoggle} is used.
13362
13363 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
13364 and nonzero, implicitly enables @option{-fcompare-debug}. If
13365 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
13366 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
13367 is used.
13368
13369 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
13370 is equivalent to @option{-fno-compare-debug}, which disables the dumping
13371 of the final representation and the second compilation, preventing even
13372 @env{GCC_COMPARE_DEBUG} from taking effect.
13373
13374 To verify full coverage during @option{-fcompare-debug} testing, set
13375 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
13376 which GCC rejects as an invalid option in any actual compilation
13377 (rather than preprocessing, assembly or linking). To get just a
13378 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
13379 not overridden} will do.
13380
13381 @item -fcompare-debug-second
13382 @opindex fcompare-debug-second
13383 This option is implicitly passed to the compiler for the second
13384 compilation requested by @option{-fcompare-debug}, along with options to
13385 silence warnings, and omitting other options that would cause
13386 side-effect compiler outputs to files or to the standard output. Dump
13387 files and preserved temporary files are renamed so as to contain the
13388 @code{.gk} additional extension during the second compilation, to avoid
13389 overwriting those generated by the first.
13390
13391 When this option is passed to the compiler driver, it causes the
13392 @emph{first} compilation to be skipped, which makes it useful for little
13393 other than debugging the compiler proper.
13394
13395 @item -gtoggle
13396 @opindex gtoggle
13397 Turn off generation of debug info, if leaving out this option
13398 generates it, or turn it on at level 2 otherwise. The position of this
13399 argument in the command line does not matter; it takes effect after all
13400 other options are processed, and it does so only once, no matter how
13401 many times it is given. This is mainly intended to be used with
13402 @option{-fcompare-debug}.
13403
13404 @item -fvar-tracking-assignments-toggle
13405 @opindex fvar-tracking-assignments-toggle
13406 @opindex fno-var-tracking-assignments-toggle
13407 Toggle @option{-fvar-tracking-assignments}, in the same way that
13408 @option{-gtoggle} toggles @option{-g}.
13409
13410 @item -Q
13411 @opindex Q
13412 Makes the compiler print out each function name as it is compiled, and
13413 print some statistics about each pass when it finishes.
13414
13415 @item -ftime-report
13416 @opindex ftime-report
13417 Makes the compiler print some statistics about the time consumed by each
13418 pass when it finishes.
13419
13420 @item -ftime-report-details
13421 @opindex ftime-report-details
13422 Record the time consumed by infrastructure parts separately for each pass.
13423
13424 @item -fira-verbose=@var{n}
13425 @opindex fira-verbose
13426 Control the verbosity of the dump file for the integrated register allocator.
13427 The default value is 5. If the value @var{n} is greater or equal to 10,
13428 the dump output is sent to stderr using the same format as @var{n} minus 10.
13429
13430 @item -flto-report
13431 @opindex flto-report
13432 Prints a report with internal details on the workings of the link-time
13433 optimizer. The contents of this report vary from version to version.
13434 It is meant to be useful to GCC developers when processing object
13435 files in LTO mode (via @option{-flto}).
13436
13437 Disabled by default.
13438
13439 @item -flto-report-wpa
13440 @opindex flto-report-wpa
13441 Like @option{-flto-report}, but only print for the WPA phase of Link
13442 Time Optimization.
13443
13444 @item -fmem-report
13445 @opindex fmem-report
13446 Makes the compiler print some statistics about permanent memory
13447 allocation when it finishes.
13448
13449 @item -fmem-report-wpa
13450 @opindex fmem-report-wpa
13451 Makes the compiler print some statistics about permanent memory
13452 allocation for the WPA phase only.
13453
13454 @item -fpre-ipa-mem-report
13455 @opindex fpre-ipa-mem-report
13456 @item -fpost-ipa-mem-report
13457 @opindex fpost-ipa-mem-report
13458 Makes the compiler print some statistics about permanent memory
13459 allocation before or after interprocedural optimization.
13460
13461 @item -fprofile-report
13462 @opindex fprofile-report
13463 Makes the compiler print some statistics about consistency of the
13464 (estimated) profile and effect of individual passes.
13465
13466 @item -fstack-usage
13467 @opindex fstack-usage
13468 Makes the compiler output stack usage information for the program, on a
13469 per-function basis. The filename for the dump is made by appending
13470 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
13471 the output file, if explicitly specified and it is not an executable,
13472 otherwise it is the basename of the source file. An entry is made up
13473 of three fields:
13474
13475 @itemize
13476 @item
13477 The name of the function.
13478 @item
13479 A number of bytes.
13480 @item
13481 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
13482 @end itemize
13483
13484 The qualifier @code{static} means that the function manipulates the stack
13485 statically: a fixed number of bytes are allocated for the frame on function
13486 entry and released on function exit; no stack adjustments are otherwise made
13487 in the function. The second field is this fixed number of bytes.
13488
13489 The qualifier @code{dynamic} means that the function manipulates the stack
13490 dynamically: in addition to the static allocation described above, stack
13491 adjustments are made in the body of the function, for example to push/pop
13492 arguments around function calls. If the qualifier @code{bounded} is also
13493 present, the amount of these adjustments is bounded at compile time and
13494 the second field is an upper bound of the total amount of stack used by
13495 the function. If it is not present, the amount of these adjustments is
13496 not bounded at compile time and the second field only represents the
13497 bounded part.
13498
13499 @item -fstats
13500 @opindex fstats
13501 Emit statistics about front-end processing at the end of the compilation.
13502 This option is supported only by the C++ front end, and
13503 the information is generally only useful to the G++ development team.
13504
13505 @item -fdbg-cnt-list
13506 @opindex fdbg-cnt-list
13507 Print the name and the counter upper bound for all debug counters.
13508
13509
13510 @item -fdbg-cnt=@var{counter-value-list}
13511 @opindex fdbg-cnt
13512 Set the internal debug counter upper bound. @var{counter-value-list}
13513 is a comma-separated list of @var{name}:@var{value} pairs
13514 which sets the upper bound of each debug counter @var{name} to @var{value}.
13515 All debug counters have the initial upper bound of @code{UINT_MAX};
13516 thus @code{dbg_cnt} returns true always unless the upper bound
13517 is set by this option.
13518 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
13519 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
13520
13521 @item -print-file-name=@var{library}
13522 @opindex print-file-name
13523 Print the full absolute name of the library file @var{library} that
13524 would be used when linking---and don't do anything else. With this
13525 option, GCC does not compile or link anything; it just prints the
13526 file name.
13527
13528 @item -print-multi-directory
13529 @opindex print-multi-directory
13530 Print the directory name corresponding to the multilib selected by any
13531 other switches present in the command line. This directory is supposed
13532 to exist in @env{GCC_EXEC_PREFIX}.
13533
13534 @item -print-multi-lib
13535 @opindex print-multi-lib
13536 Print the mapping from multilib directory names to compiler switches
13537 that enable them. The directory name is separated from the switches by
13538 @samp{;}, and each switch starts with an @samp{@@} instead of the
13539 @samp{-}, without spaces between multiple switches. This is supposed to
13540 ease shell processing.
13541
13542 @item -print-multi-os-directory
13543 @opindex print-multi-os-directory
13544 Print the path to OS libraries for the selected
13545 multilib, relative to some @file{lib} subdirectory. If OS libraries are
13546 present in the @file{lib} subdirectory and no multilibs are used, this is
13547 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
13548 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
13549 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
13550 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
13551
13552 @item -print-multiarch
13553 @opindex print-multiarch
13554 Print the path to OS libraries for the selected multiarch,
13555 relative to some @file{lib} subdirectory.
13556
13557 @item -print-prog-name=@var{program}
13558 @opindex print-prog-name
13559 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
13560
13561 @item -print-libgcc-file-name
13562 @opindex print-libgcc-file-name
13563 Same as @option{-print-file-name=libgcc.a}.
13564
13565 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
13566 but you do want to link with @file{libgcc.a}. You can do:
13567
13568 @smallexample
13569 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
13570 @end smallexample
13571
13572 @item -print-search-dirs
13573 @opindex print-search-dirs
13574 Print the name of the configured installation directory and a list of
13575 program and library directories @command{gcc} searches---and don't do anything else.
13576
13577 This is useful when @command{gcc} prints the error message
13578 @samp{installation problem, cannot exec cpp0: No such file or directory}.
13579 To resolve this you either need to put @file{cpp0} and the other compiler
13580 components where @command{gcc} expects to find them, or you can set the environment
13581 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
13582 Don't forget the trailing @samp{/}.
13583 @xref{Environment Variables}.
13584
13585 @item -print-sysroot
13586 @opindex print-sysroot
13587 Print the target sysroot directory that is used during
13588 compilation. This is the target sysroot specified either at configure
13589 time or using the @option{--sysroot} option, possibly with an extra
13590 suffix that depends on compilation options. If no target sysroot is
13591 specified, the option prints nothing.
13592
13593 @item -print-sysroot-headers-suffix
13594 @opindex print-sysroot-headers-suffix
13595 Print the suffix added to the target sysroot when searching for
13596 headers, or give an error if the compiler is not configured with such
13597 a suffix---and don't do anything else.
13598
13599 @item -dumpmachine
13600 @opindex dumpmachine
13601 Print the compiler's target machine (for example,
13602 @samp{i686-pc-linux-gnu})---and don't do anything else.
13603
13604 @item -dumpversion
13605 @opindex dumpversion
13606 Print the compiler version (for example, @code{3.0})---and don't do
13607 anything else.
13608
13609 @item -dumpspecs
13610 @opindex dumpspecs
13611 Print the compiler's built-in specs---and don't do anything else. (This
13612 is used when GCC itself is being built.) @xref{Spec Files}.
13613 @end table
13614
13615 @node Submodel Options
13616 @section Machine-Dependent Options
13617 @cindex submodel options
13618 @cindex specifying hardware config
13619 @cindex hardware models and configurations, specifying
13620 @cindex target-dependent options
13621 @cindex machine-dependent options
13622
13623 Each target machine supported by GCC can have its own options---for
13624 example, to allow you to compile for a particular processor variant or
13625 ABI, or to control optimizations specific to that machine. By
13626 convention, the names of machine-specific options start with
13627 @samp{-m}.
13628
13629 Some configurations of the compiler also support additional target-specific
13630 options, usually for compatibility with other compilers on the same
13631 platform.
13632
13633 @c This list is ordered alphanumerically by subsection name.
13634 @c It should be the same order and spelling as these options are listed
13635 @c in Machine Dependent Options
13636
13637 @menu
13638 * AArch64 Options::
13639 * Adapteva Epiphany Options::
13640 * ARC Options::
13641 * ARM Options::
13642 * AVR Options::
13643 * Blackfin Options::
13644 * C6X Options::
13645 * CRIS Options::
13646 * CR16 Options::
13647 * Darwin Options::
13648 * DEC Alpha Options::
13649 * FR30 Options::
13650 * FT32 Options::
13651 * FRV Options::
13652 * GNU/Linux Options::
13653 * H8/300 Options::
13654 * HPPA Options::
13655 * IA-64 Options::
13656 * LM32 Options::
13657 * M32C Options::
13658 * M32R/D Options::
13659 * M680x0 Options::
13660 * MCore Options::
13661 * MeP Options::
13662 * MicroBlaze Options::
13663 * MIPS Options::
13664 * MMIX Options::
13665 * MN10300 Options::
13666 * Moxie Options::
13667 * MSP430 Options::
13668 * NDS32 Options::
13669 * Nios II Options::
13670 * Nvidia PTX Options::
13671 * PDP-11 Options::
13672 * picoChip Options::
13673 * PowerPC Options::
13674 * RL78 Options::
13675 * RS/6000 and PowerPC Options::
13676 * RX Options::
13677 * S/390 and zSeries Options::
13678 * Score Options::
13679 * SH Options::
13680 * Solaris 2 Options::
13681 * SPARC Options::
13682 * SPU Options::
13683 * System V Options::
13684 * TILE-Gx Options::
13685 * TILEPro Options::
13686 * V850 Options::
13687 * VAX Options::
13688 * Visium Options::
13689 * VMS Options::
13690 * VxWorks Options::
13691 * x86 Options::
13692 * x86 Windows Options::
13693 * Xstormy16 Options::
13694 * Xtensa Options::
13695 * zSeries Options::
13696 @end menu
13697
13698 @node AArch64 Options
13699 @subsection AArch64 Options
13700 @cindex AArch64 Options
13701
13702 These options are defined for AArch64 implementations:
13703
13704 @table @gcctabopt
13705
13706 @item -mabi=@var{name}
13707 @opindex mabi
13708 Generate code for the specified data model. Permissible values
13709 are @samp{ilp32} for SysV-like data model where int, long int and pointers
13710 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
13711 but long int and pointers are 64 bits.
13712
13713 The default depends on the specific target configuration. Note that
13714 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
13715 entire program with the same ABI, and link with a compatible set of libraries.
13716
13717 @item -mbig-endian
13718 @opindex mbig-endian
13719 Generate big-endian code. This is the default when GCC is configured for an
13720 @samp{aarch64_be-*-*} target.
13721
13722 @item -mgeneral-regs-only
13723 @opindex mgeneral-regs-only
13724 Generate code which uses only the general-purpose registers. This will prevent
13725 the compiler from using floating-point and Advanced SIMD registers but will not
13726 impose any restrictions on the assembler.
13727
13728 @item -mlittle-endian
13729 @opindex mlittle-endian
13730 Generate little-endian code. This is the default when GCC is configured for an
13731 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
13732
13733 @item -mcmodel=tiny
13734 @opindex mcmodel=tiny
13735 Generate code for the tiny code model. The program and its statically defined
13736 symbols must be within 1MB of each other. Programs can be statically or
13737 dynamically linked.
13738
13739 @item -mcmodel=small
13740 @opindex mcmodel=small
13741 Generate code for the small code model. The program and its statically defined
13742 symbols must be within 4GB of each other. Programs can be statically or
13743 dynamically linked. This is the default code model.
13744
13745 @item -mcmodel=large
13746 @opindex mcmodel=large
13747 Generate code for the large code model. This makes no assumptions about
13748 addresses and sizes of sections. Programs can be statically linked only.
13749
13750 @item -mstrict-align
13751 @opindex mstrict-align
13752 Avoid generating memory accesses that may not be aligned on a natural object
13753 boundary as described in the architecture specification.
13754
13755 @item -momit-leaf-frame-pointer
13756 @itemx -mno-omit-leaf-frame-pointer
13757 @opindex momit-leaf-frame-pointer
13758 @opindex mno-omit-leaf-frame-pointer
13759 Omit or keep the frame pointer in leaf functions. The former behavior is the
13760 default.
13761
13762 @item -mtls-dialect=desc
13763 @opindex mtls-dialect=desc
13764 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
13765 of TLS variables. This is the default.
13766
13767 @item -mtls-dialect=traditional
13768 @opindex mtls-dialect=traditional
13769 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
13770 of TLS variables.
13771
13772 @item -mtls-size=@var{size}
13773 @opindex mtls-size
13774 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
13775 This option requires binutils 2.26 or newer.
13776
13777 @item -mfix-cortex-a53-835769
13778 @itemx -mno-fix-cortex-a53-835769
13779 @opindex mfix-cortex-a53-835769
13780 @opindex mno-fix-cortex-a53-835769
13781 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
13782 This involves inserting a NOP instruction between memory instructions and
13783 64-bit integer multiply-accumulate instructions.
13784
13785 @item -mfix-cortex-a53-843419
13786 @itemx -mno-fix-cortex-a53-843419
13787 @opindex mfix-cortex-a53-843419
13788 @opindex mno-fix-cortex-a53-843419
13789 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
13790 This erratum workaround is made at link time and this will only pass the
13791 corresponding flag to the linker.
13792
13793 @item -mlow-precision-recip-sqrt
13794 @item -mno-low-precision-recip-sqrt
13795 @opindex mlow-precision-recip-sqrt
13796 @opindex mno-low-precision-recip-sqrt
13797 Enable or disable the reciprocal square root approximation.
13798 This option only has an effect if @option{-ffast-math} or
13799 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13800 precision of reciprocal square root results to about 16 bits for
13801 single precision and to 32 bits for double precision.
13802
13803 @item -mlow-precision-sqrt
13804 @item -mno-low-precision-sqrt
13805 @opindex -mlow-precision-sqrt
13806 @opindex -mno-low-precision-sqrt
13807 Enable or disable the square root approximation.
13808 This option only has an effect if @option{-ffast-math} or
13809 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13810 precision of square root results to about 16 bits for
13811 single precision and to 32 bits for double precision.
13812 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
13813
13814 @item -mlow-precision-div
13815 @item -mno-low-precision-div
13816 @opindex -mlow-precision-div
13817 @opindex -mno-low-precision-div
13818 Enable or disable the division approximation.
13819 This option only has an effect if @option{-ffast-math} or
13820 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13821 precision of division results to about 16 bits for
13822 single precision and to 32 bits for double precision.
13823
13824 @item -march=@var{name}
13825 @opindex march
13826 Specify the name of the target architecture and, optionally, one or
13827 more feature modifiers. This option has the form
13828 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
13829
13830 The permissible values for @var{arch} are @samp{armv8-a},
13831 @samp{armv8.1-a}, @samp{armv8.2-a} or @var{native}.
13832
13833 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
13834 support for the ARMv8.2-A architecture extensions.
13835
13836 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
13837 support for the ARMv8.1-A architecture extension. In particular, it
13838 enables the @samp{+crc} and @samp{+lse} features.
13839
13840 The value @samp{native} is available on native AArch64 GNU/Linux and
13841 causes the compiler to pick the architecture of the host system. This
13842 option has no effect if the compiler is unable to recognize the
13843 architecture of the host system,
13844
13845 The permissible values for @var{feature} are listed in the sub-section
13846 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13847 Feature Modifiers}. Where conflicting feature modifiers are
13848 specified, the right-most feature is used.
13849
13850 GCC uses @var{name} to determine what kind of instructions it can emit
13851 when generating assembly code. If @option{-march} is specified
13852 without either of @option{-mtune} or @option{-mcpu} also being
13853 specified, the code is tuned to perform well across a range of target
13854 processors implementing the target architecture.
13855
13856 @item -mtune=@var{name}
13857 @opindex mtune
13858 Specify the name of the target processor for which GCC should tune the
13859 performance of the code. Permissible values for this option are:
13860 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
13861 @samp{cortex-a72}, @samp{cortex-a73}, @samp{exynos-m1}, @samp{qdf24xx},
13862 @samp{thunderx}, @samp{xgene1}, @samp{vulcan}, @samp{cortex-a57.cortex-a53},
13863 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
13864 @samp{cortex-a73.cortex-a53}, @samp{native}.
13865
13866 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
13867 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}
13868 specify that GCC should tune for a big.LITTLE system.
13869
13870 Additionally on native AArch64 GNU/Linux systems the value
13871 @samp{native} tunes performance to the host system. This option has no effect
13872 if the compiler is unable to recognize the processor of the host system.
13873
13874 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
13875 are specified, the code is tuned to perform well across a range
13876 of target processors.
13877
13878 This option cannot be suffixed by feature modifiers.
13879
13880 @item -mcpu=@var{name}
13881 @opindex mcpu
13882 Specify the name of the target processor, optionally suffixed by one
13883 or more feature modifiers. This option has the form
13884 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
13885 the permissible values for @var{cpu} are the same as those available
13886 for @option{-mtune}. The permissible values for @var{feature} are
13887 documented in the sub-section on
13888 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13889 Feature Modifiers}. Where conflicting feature modifiers are
13890 specified, the right-most feature is used.
13891
13892 GCC uses @var{name} to determine what kind of instructions it can emit when
13893 generating assembly code (as if by @option{-march}) and to determine
13894 the target processor for which to tune for performance (as if
13895 by @option{-mtune}). Where this option is used in conjunction
13896 with @option{-march} or @option{-mtune}, those options take precedence
13897 over the appropriate part of this option.
13898
13899 @item -moverride=@var{string}
13900 @opindex moverride
13901 Override tuning decisions made by the back-end in response to a
13902 @option{-mtune=} switch. The syntax, semantics, and accepted values
13903 for @var{string} in this option are not guaranteed to be consistent
13904 across releases.
13905
13906 This option is only intended to be useful when developing GCC.
13907
13908 @item -mpc-relative-literal-loads
13909 @opindex mpc-relative-literal-loads
13910 Enable PC-relative literal loads. With this option literal pools are
13911 accessed using a single instruction and emitted after each function. This
13912 limits the maximum size of functions to 1MB. This is enabled by default for
13913 @option{-mcmodel=tiny}.
13914
13915 @end table
13916
13917 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
13918 @anchor{aarch64-feature-modifiers}
13919 @cindex @option{-march} feature modifiers
13920 @cindex @option{-mcpu} feature modifiers
13921 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
13922 the following and their inverses @option{no@var{feature}}:
13923
13924 @table @samp
13925 @item crc
13926 Enable CRC extension. This is on by default for
13927 @option{-march=armv8.1-a}.
13928 @item crypto
13929 Enable Crypto extension. This also enables Advanced SIMD and floating-point
13930 instructions.
13931 @item fp
13932 Enable floating-point instructions. This is on by default for all possible
13933 values for options @option{-march} and @option{-mcpu}.
13934 @item simd
13935 Enable Advanced SIMD instructions. This also enables floating-point
13936 instructions. This is on by default for all possible values for options
13937 @option{-march} and @option{-mcpu}.
13938 @item lse
13939 Enable Large System Extension instructions. This is on by default for
13940 @option{-march=armv8.1-a}.
13941 @item fp16
13942 Enable FP16 extension. This also enables floating-point instructions.
13943
13944 @end table
13945
13946 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
13947 Conversely, @option{nofp} implies @option{nosimd}, which implies
13948 @option{nocrypto}.
13949
13950 @node Adapteva Epiphany Options
13951 @subsection Adapteva Epiphany Options
13952
13953 These @samp{-m} options are defined for Adapteva Epiphany:
13954
13955 @table @gcctabopt
13956 @item -mhalf-reg-file
13957 @opindex mhalf-reg-file
13958 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
13959 That allows code to run on hardware variants that lack these registers.
13960
13961 @item -mprefer-short-insn-regs
13962 @opindex mprefer-short-insn-regs
13963 Preferentially allocate registers that allow short instruction generation.
13964 This can result in increased instruction count, so this may either reduce or
13965 increase overall code size.
13966
13967 @item -mbranch-cost=@var{num}
13968 @opindex mbranch-cost
13969 Set the cost of branches to roughly @var{num} ``simple'' instructions.
13970 This cost is only a heuristic and is not guaranteed to produce
13971 consistent results across releases.
13972
13973 @item -mcmove
13974 @opindex mcmove
13975 Enable the generation of conditional moves.
13976
13977 @item -mnops=@var{num}
13978 @opindex mnops
13979 Emit @var{num} NOPs before every other generated instruction.
13980
13981 @item -mno-soft-cmpsf
13982 @opindex mno-soft-cmpsf
13983 For single-precision floating-point comparisons, emit an @code{fsub} instruction
13984 and test the flags. This is faster than a software comparison, but can
13985 get incorrect results in the presence of NaNs, or when two different small
13986 numbers are compared such that their difference is calculated as zero.
13987 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
13988 software comparisons.
13989
13990 @item -mstack-offset=@var{num}
13991 @opindex mstack-offset
13992 Set the offset between the top of the stack and the stack pointer.
13993 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
13994 can be used by leaf functions without stack allocation.
13995 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
13996 Note also that this option changes the ABI; compiling a program with a
13997 different stack offset than the libraries have been compiled with
13998 generally does not work.
13999 This option can be useful if you want to evaluate if a different stack
14000 offset would give you better code, but to actually use a different stack
14001 offset to build working programs, it is recommended to configure the
14002 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
14003
14004 @item -mno-round-nearest
14005 @opindex mno-round-nearest
14006 Make the scheduler assume that the rounding mode has been set to
14007 truncating. The default is @option{-mround-nearest}.
14008
14009 @item -mlong-calls
14010 @opindex mlong-calls
14011 If not otherwise specified by an attribute, assume all calls might be beyond
14012 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
14013 function address into a register before performing a (otherwise direct) call.
14014 This is the default.
14015
14016 @item -mshort-calls
14017 @opindex short-calls
14018 If not otherwise specified by an attribute, assume all direct calls are
14019 in the range of the @code{b} / @code{bl} instructions, so use these instructions
14020 for direct calls. The default is @option{-mlong-calls}.
14021
14022 @item -msmall16
14023 @opindex msmall16
14024 Assume addresses can be loaded as 16-bit unsigned values. This does not
14025 apply to function addresses for which @option{-mlong-calls} semantics
14026 are in effect.
14027
14028 @item -mfp-mode=@var{mode}
14029 @opindex mfp-mode
14030 Set the prevailing mode of the floating-point unit.
14031 This determines the floating-point mode that is provided and expected
14032 at function call and return time. Making this mode match the mode you
14033 predominantly need at function start can make your programs smaller and
14034 faster by avoiding unnecessary mode switches.
14035
14036 @var{mode} can be set to one the following values:
14037
14038 @table @samp
14039 @item caller
14040 Any mode at function entry is valid, and retained or restored when
14041 the function returns, and when it calls other functions.
14042 This mode is useful for compiling libraries or other compilation units
14043 you might want to incorporate into different programs with different
14044 prevailing FPU modes, and the convenience of being able to use a single
14045 object file outweighs the size and speed overhead for any extra
14046 mode switching that might be needed, compared with what would be needed
14047 with a more specific choice of prevailing FPU mode.
14048
14049 @item truncate
14050 This is the mode used for floating-point calculations with
14051 truncating (i.e.@: round towards zero) rounding mode. That includes
14052 conversion from floating point to integer.
14053
14054 @item round-nearest
14055 This is the mode used for floating-point calculations with
14056 round-to-nearest-or-even rounding mode.
14057
14058 @item int
14059 This is the mode used to perform integer calculations in the FPU, e.g.@:
14060 integer multiply, or integer multiply-and-accumulate.
14061 @end table
14062
14063 The default is @option{-mfp-mode=caller}
14064
14065 @item -mnosplit-lohi
14066 @itemx -mno-postinc
14067 @itemx -mno-postmodify
14068 @opindex mnosplit-lohi
14069 @opindex mno-postinc
14070 @opindex mno-postmodify
14071 Code generation tweaks that disable, respectively, splitting of 32-bit
14072 loads, generation of post-increment addresses, and generation of
14073 post-modify addresses. The defaults are @option{msplit-lohi},
14074 @option{-mpost-inc}, and @option{-mpost-modify}.
14075
14076 @item -mnovect-double
14077 @opindex mno-vect-double
14078 Change the preferred SIMD mode to SImode. The default is
14079 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
14080
14081 @item -max-vect-align=@var{num}
14082 @opindex max-vect-align
14083 The maximum alignment for SIMD vector mode types.
14084 @var{num} may be 4 or 8. The default is 8.
14085 Note that this is an ABI change, even though many library function
14086 interfaces are unaffected if they don't use SIMD vector modes
14087 in places that affect size and/or alignment of relevant types.
14088
14089 @item -msplit-vecmove-early
14090 @opindex msplit-vecmove-early
14091 Split vector moves into single word moves before reload. In theory this
14092 can give better register allocation, but so far the reverse seems to be
14093 generally the case.
14094
14095 @item -m1reg-@var{reg}
14096 @opindex m1reg-
14097 Specify a register to hold the constant @minus{}1, which makes loading small negative
14098 constants and certain bitmasks faster.
14099 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
14100 which specify use of that register as a fixed register,
14101 and @samp{none}, which means that no register is used for this
14102 purpose. The default is @option{-m1reg-none}.
14103
14104 @end table
14105
14106 @node ARC Options
14107 @subsection ARC Options
14108 @cindex ARC options
14109
14110 The following options control the architecture variant for which code
14111 is being compiled:
14112
14113 @c architecture variants
14114 @table @gcctabopt
14115
14116 @item -mbarrel-shifter
14117 @opindex mbarrel-shifter
14118 Generate instructions supported by barrel shifter. This is the default
14119 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
14120
14121 @item -mcpu=@var{cpu}
14122 @opindex mcpu
14123 Set architecture type, register usage, and instruction scheduling
14124 parameters for @var{cpu}. There are also shortcut alias options
14125 available for backward compatibility and convenience. Supported
14126 values for @var{cpu} are
14127
14128 @table @samp
14129 @opindex mA6
14130 @opindex mARC600
14131 @item ARC600
14132 @item arc600
14133 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
14134
14135 @item ARC601
14136 @item arc601
14137 @opindex mARC601
14138 Compile for ARC601. Alias: @option{-mARC601}.
14139
14140 @item ARC700
14141 @item arc700
14142 @opindex mA7
14143 @opindex mARC700
14144 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
14145 This is the default when configured with @option{--with-cpu=arc700}@.
14146
14147 @item ARCEM
14148 @item arcem
14149 Compile for ARC EM.
14150
14151 @item ARCHS
14152 @item archs
14153 Compile for ARC HS.
14154 @end table
14155
14156 @item -mdpfp
14157 @opindex mdpfp
14158 @itemx -mdpfp-compact
14159 @opindex mdpfp-compact
14160 FPX: Generate Double Precision FPX instructions, tuned for the compact
14161 implementation.
14162
14163 @item -mdpfp-fast
14164 @opindex mdpfp-fast
14165 FPX: Generate Double Precision FPX instructions, tuned for the fast
14166 implementation.
14167
14168 @item -mno-dpfp-lrsr
14169 @opindex mno-dpfp-lrsr
14170 Disable LR and SR instructions from using FPX extension aux registers.
14171
14172 @item -mea
14173 @opindex mea
14174 Generate Extended arithmetic instructions. Currently only
14175 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
14176 supported. This is always enabled for @option{-mcpu=ARC700}.
14177
14178 @item -mno-mpy
14179 @opindex mno-mpy
14180 Do not generate mpy instructions for ARC700.
14181
14182 @item -mmul32x16
14183 @opindex mmul32x16
14184 Generate 32x16 bit multiply and mac instructions.
14185
14186 @item -mmul64
14187 @opindex mmul64
14188 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
14189
14190 @item -mnorm
14191 @opindex mnorm
14192 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
14193 is in effect.
14194
14195 @item -mspfp
14196 @opindex mspfp
14197 @itemx -mspfp-compact
14198 @opindex mspfp-compact
14199 FPX: Generate Single Precision FPX instructions, tuned for the compact
14200 implementation.
14201
14202 @item -mspfp-fast
14203 @opindex mspfp-fast
14204 FPX: Generate Single Precision FPX instructions, tuned for the fast
14205 implementation.
14206
14207 @item -msimd
14208 @opindex msimd
14209 Enable generation of ARC SIMD instructions via target-specific
14210 builtins. Only valid for @option{-mcpu=ARC700}.
14211
14212 @item -msoft-float
14213 @opindex msoft-float
14214 This option ignored; it is provided for compatibility purposes only.
14215 Software floating point code is emitted by default, and this default
14216 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
14217 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
14218 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
14219
14220 @item -mswap
14221 @opindex mswap
14222 Generate swap instructions.
14223
14224 @item -matomic
14225 @opindex matomic
14226 This enables Locked Load/Store Conditional extension to implement
14227 atomic memopry built-in functions. Not available for ARC 6xx or ARC
14228 EM cores.
14229
14230 @item -mdiv-rem
14231 @opindex mdiv-rem
14232 Enable DIV/REM instructions for ARCv2 cores.
14233
14234 @item -mcode-density
14235 @opindex mcode-density
14236 Enable code density instructions for ARC EM, default on for ARC HS.
14237
14238 @item -mll64
14239 @opindex mll64
14240 Enable double load/store operations for ARC HS cores.
14241
14242 @item -mtp-regno=@var{regno}
14243 @opindex mtp-regno
14244 Specify thread pointer register number.
14245
14246 @item -mmpy-option=@var{multo}
14247 @opindex mmpy-option
14248 Compile ARCv2 code with a multiplier design option. @samp{wlh1} is
14249 the default value. The recognized values for @var{multo} are:
14250
14251 @table @samp
14252 @item 0
14253 No multiplier available.
14254
14255 @item 1
14256 @opindex w
14257 The multiply option is set to w: 16x16 multiplier, fully pipelined.
14258 The following instructions are enabled: MPYW, and MPYUW.
14259
14260 @item 2
14261 @opindex wlh1
14262 The multiply option is set to wlh1: 32x32 multiplier, fully
14263 pipelined (1 stage). The following instructions are additionally
14264 enabled: MPY, MPYU, MPYM, MPYMU, and MPY_S.
14265
14266 @item 3
14267 @opindex wlh2
14268 The multiply option is set to wlh2: 32x32 multiplier, fully pipelined
14269 (2 stages). The following instructions are additionally enabled: MPY,
14270 MPYU, MPYM, MPYMU, and MPY_S.
14271
14272 @item 4
14273 @opindex wlh3
14274 The multiply option is set to wlh3: Two 16x16 multiplier, blocking,
14275 sequential. The following instructions are additionally enabled: MPY,
14276 MPYU, MPYM, MPYMU, and MPY_S.
14277
14278 @item 5
14279 @opindex wlh4
14280 The multiply option is set to wlh4: One 16x16 multiplier, blocking,
14281 sequential. The following instructions are additionally enabled: MPY,
14282 MPYU, MPYM, MPYMU, and MPY_S.
14283
14284 @item 6
14285 @opindex wlh5
14286 The multiply option is set to wlh5: One 32x4 multiplier, blocking,
14287 sequential. The following instructions are additionally enabled: MPY,
14288 MPYU, MPYM, MPYMU, and MPY_S.
14289
14290 @end table
14291
14292 This option is only available for ARCv2 cores@.
14293
14294 @item -mfpu=@var{fpu}
14295 @opindex mfpu
14296 Enables specific floating-point hardware extension for ARCv2
14297 core. Supported values for @var{fpu} are:
14298
14299 @table @samp
14300
14301 @item fpus
14302 @opindex fpus
14303 Enables support for single precision floating point hardware
14304 extensions@.
14305
14306 @item fpud
14307 @opindex fpud
14308 Enables support for double precision floating point hardware
14309 extensions. The single precision floating point extension is also
14310 enabled. Not available for ARC EM@.
14311
14312 @item fpuda
14313 @opindex fpuda
14314 Enables support for double precision floating point hardware
14315 extensions using double precision assist instructions. The single
14316 precision floating point extension is also enabled. This option is
14317 only available for ARC EM@.
14318
14319 @item fpuda_div
14320 @opindex fpuda_div
14321 Enables support for double precision floating point hardware
14322 extensions using double precision assist instructions, and simple
14323 precision square-root and divide hardware extensions. The single
14324 precision floating point extension is also enabled. This option is
14325 only available for ARC EM@.
14326
14327 @item fpuda_fma
14328 @opindex fpuda_fma
14329 Enables support for double precision floating point hardware
14330 extensions using double precision assist instructions, and simple
14331 precision fused multiple and add hardware extension. The single
14332 precision floating point extension is also enabled. This option is
14333 only available for ARC EM@.
14334
14335 @item fpuda_all
14336 @opindex fpuda_all
14337 Enables support for double precision floating point hardware
14338 extensions using double precision assist instructions, and all simple
14339 precision hardware extensions. The single precision floating point
14340 extension is also enabled. This option is only available for ARC EM@.
14341
14342 @item fpus_div
14343 @opindex fpus_div
14344 Enables support for single precision floating point, and single
14345 precision square-root and divide hardware extensions@.
14346
14347 @item fpud_div
14348 @opindex fpud_div
14349 Enables support for double precision floating point, and double
14350 precision square-root and divide hardware extensions. This option
14351 includes option @samp{fpus_div}. Not available for ARC EM@.
14352
14353 @item fpus_fma
14354 @opindex fpus_fma
14355 Enables support for single precision floating point, and single
14356 precision fused multiple and add hardware extensions@.
14357
14358 @item fpud_fma
14359 @opindex fpud_fma
14360 Enables support for double precision floating point, and double
14361 precision fused multiple and add hardware extensions. This option
14362 includes option @samp{fpus_fma}. Not available for ARC EM@.
14363
14364 @item fpus_all
14365 @opindex fpus_all
14366 Enables support for all single precision floating point hardware
14367 extensions@.
14368
14369 @item fpud_all
14370 @opindex fpud_all
14371 Enables support for all single and double precision floating point
14372 hardware extensions. Not available for ARC EM@.
14373
14374 @end table
14375
14376 @end table
14377
14378 The following options are passed through to the assembler, and also
14379 define preprocessor macro symbols.
14380
14381 @c Flags used by the assembler, but for which we define preprocessor
14382 @c macro symbols as well.
14383 @table @gcctabopt
14384 @item -mdsp-packa
14385 @opindex mdsp-packa
14386 Passed down to the assembler to enable the DSP Pack A extensions.
14387 Also sets the preprocessor symbol @code{__Xdsp_packa}.
14388
14389 @item -mdvbf
14390 @opindex mdvbf
14391 Passed down to the assembler to enable the dual viterbi butterfly
14392 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
14393
14394 @c ARC700 4.10 extension instruction
14395 @item -mlock
14396 @opindex mlock
14397 Passed down to the assembler to enable the Locked Load/Store
14398 Conditional extension. Also sets the preprocessor symbol
14399 @code{__Xlock}.
14400
14401 @item -mmac-d16
14402 @opindex mmac-d16
14403 Passed down to the assembler. Also sets the preprocessor symbol
14404 @code{__Xxmac_d16}.
14405
14406 @item -mmac-24
14407 @opindex mmac-24
14408 Passed down to the assembler. Also sets the preprocessor symbol
14409 @code{__Xxmac_24}.
14410
14411 @c ARC700 4.10 extension instruction
14412 @item -mrtsc
14413 @opindex mrtsc
14414 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
14415 extension instruction. Also sets the preprocessor symbol
14416 @code{__Xrtsc}.
14417
14418 @c ARC700 4.10 extension instruction
14419 @item -mswape
14420 @opindex mswape
14421 Passed down to the assembler to enable the swap byte ordering
14422 extension instruction. Also sets the preprocessor symbol
14423 @code{__Xswape}.
14424
14425 @item -mtelephony
14426 @opindex mtelephony
14427 Passed down to the assembler to enable dual and single operand
14428 instructions for telephony. Also sets the preprocessor symbol
14429 @code{__Xtelephony}.
14430
14431 @item -mxy
14432 @opindex mxy
14433 Passed down to the assembler to enable the XY Memory extension. Also
14434 sets the preprocessor symbol @code{__Xxy}.
14435
14436 @end table
14437
14438 The following options control how the assembly code is annotated:
14439
14440 @c Assembly annotation options
14441 @table @gcctabopt
14442 @item -misize
14443 @opindex misize
14444 Annotate assembler instructions with estimated addresses.
14445
14446 @item -mannotate-align
14447 @opindex mannotate-align
14448 Explain what alignment considerations lead to the decision to make an
14449 instruction short or long.
14450
14451 @end table
14452
14453 The following options are passed through to the linker:
14454
14455 @c options passed through to the linker
14456 @table @gcctabopt
14457 @item -marclinux
14458 @opindex marclinux
14459 Passed through to the linker, to specify use of the @code{arclinux} emulation.
14460 This option is enabled by default in tool chains built for
14461 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
14462 when profiling is not requested.
14463
14464 @item -marclinux_prof
14465 @opindex marclinux_prof
14466 Passed through to the linker, to specify use of the
14467 @code{arclinux_prof} emulation. This option is enabled by default in
14468 tool chains built for @w{@code{arc-linux-uclibc}} and
14469 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
14470
14471 @end table
14472
14473 The following options control the semantics of generated code:
14474
14475 @c semantically relevant code generation options
14476 @table @gcctabopt
14477 @item -mlong-calls
14478 @opindex mlong-calls
14479 Generate call insns as register indirect calls, thus providing access
14480 to the full 32-bit address range.
14481
14482 @item -mmedium-calls
14483 @opindex mmedium-calls
14484 Don't use less than 25 bit addressing range for calls, which is the
14485 offset available for an unconditional branch-and-link
14486 instruction. Conditional execution of function calls is suppressed, to
14487 allow use of the 25-bit range, rather than the 21-bit range with
14488 conditional branch-and-link. This is the default for tool chains built
14489 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
14490
14491 @item -mno-sdata
14492 @opindex mno-sdata
14493 Do not generate sdata references. This is the default for tool chains
14494 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
14495 targets.
14496
14497 @item -mucb-mcount
14498 @opindex mucb-mcount
14499 Instrument with mcount calls as used in UCB code. I.e. do the
14500 counting in the callee, not the caller. By default ARC instrumentation
14501 counts in the caller.
14502
14503 @item -mvolatile-cache
14504 @opindex mvolatile-cache
14505 Use ordinarily cached memory accesses for volatile references. This is the
14506 default.
14507
14508 @item -mno-volatile-cache
14509 @opindex mno-volatile-cache
14510 Enable cache bypass for volatile references.
14511
14512 @end table
14513
14514 The following options fine tune code generation:
14515 @c code generation tuning options
14516 @table @gcctabopt
14517 @item -malign-call
14518 @opindex malign-call
14519 Do alignment optimizations for call instructions.
14520
14521 @item -mauto-modify-reg
14522 @opindex mauto-modify-reg
14523 Enable the use of pre/post modify with register displacement.
14524
14525 @item -mbbit-peephole
14526 @opindex mbbit-peephole
14527 Enable bbit peephole2.
14528
14529 @item -mno-brcc
14530 @opindex mno-brcc
14531 This option disables a target-specific pass in @file{arc_reorg} to
14532 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
14533 generation driven by the combiner pass.
14534
14535 @item -mcase-vector-pcrel
14536 @opindex mcase-vector-pcrel
14537 Use pc-relative switch case tables - this enables case table shortening.
14538 This is the default for @option{-Os}.
14539
14540 @item -mcompact-casesi
14541 @opindex mcompact-casesi
14542 Enable compact casesi pattern. This is the default for @option{-Os},
14543 and only available for ARCv1 cores.
14544
14545 @item -mno-cond-exec
14546 @opindex mno-cond-exec
14547 Disable ARCompact specific pass to generate conditional execution instructions.
14548 Due to delay slot scheduling and interactions between operand numbers,
14549 literal sizes, instruction lengths, and the support for conditional execution,
14550 the target-independent pass to generate conditional execution is often lacking,
14551 so the ARC port has kept a special pass around that tries to find more
14552 conditional execution generating opportunities after register allocation,
14553 branch shortening, and delay slot scheduling have been done. This pass
14554 generally, but not always, improves performance and code size, at the cost of
14555 extra compilation time, which is why there is an option to switch it off.
14556 If you have a problem with call instructions exceeding their allowable
14557 offset range because they are conditionalized, you should consider using
14558 @option{-mmedium-calls} instead.
14559
14560 @item -mearly-cbranchsi
14561 @opindex mearly-cbranchsi
14562 Enable pre-reload use of the cbranchsi pattern.
14563
14564 @item -mexpand-adddi
14565 @opindex mexpand-adddi
14566 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
14567 @code{add.f}, @code{adc} etc.
14568
14569 @item -mindexed-loads
14570 @opindex mindexed-loads
14571 Enable the use of indexed loads. This can be problematic because some
14572 optimizers then assume that indexed stores exist, which is not
14573 the case.
14574
14575 @opindex mlra
14576 Enable Local Register Allocation. This is still experimental for ARC,
14577 so by default the compiler uses standard reload
14578 (i.e. @option{-mno-lra}).
14579
14580 @item -mlra-priority-none
14581 @opindex mlra-priority-none
14582 Don't indicate any priority for target registers.
14583
14584 @item -mlra-priority-compact
14585 @opindex mlra-priority-compact
14586 Indicate target register priority for r0..r3 / r12..r15.
14587
14588 @item -mlra-priority-noncompact
14589 @opindex mlra-priority-noncompact
14590 Reduce target register priority for r0..r3 / r12..r15.
14591
14592 @item -mno-millicode
14593 @opindex mno-millicode
14594 When optimizing for size (using @option{-Os}), prologues and epilogues
14595 that have to save or restore a large number of registers are often
14596 shortened by using call to a special function in libgcc; this is
14597 referred to as a @emph{millicode} call. As these calls can pose
14598 performance issues, and/or cause linking issues when linking in a
14599 nonstandard way, this option is provided to turn off millicode call
14600 generation.
14601
14602 @item -mmixed-code
14603 @opindex mmixed-code
14604 Tweak register allocation to help 16-bit instruction generation.
14605 This generally has the effect of decreasing the average instruction size
14606 while increasing the instruction count.
14607
14608 @item -mq-class
14609 @opindex mq-class
14610 Enable 'q' instruction alternatives.
14611 This is the default for @option{-Os}.
14612
14613 @item -mRcq
14614 @opindex mRcq
14615 Enable Rcq constraint handling - most short code generation depends on this.
14616 This is the default.
14617
14618 @item -mRcw
14619 @opindex mRcw
14620 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
14621 This is the default.
14622
14623 @item -msize-level=@var{level}
14624 @opindex msize-level
14625 Fine-tune size optimization with regards to instruction lengths and alignment.
14626 The recognized values for @var{level} are:
14627 @table @samp
14628 @item 0
14629 No size optimization. This level is deprecated and treated like @samp{1}.
14630
14631 @item 1
14632 Short instructions are used opportunistically.
14633
14634 @item 2
14635 In addition, alignment of loops and of code after barriers are dropped.
14636
14637 @item 3
14638 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
14639
14640 @end table
14641
14642 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
14643 the behavior when this is not set is equivalent to level @samp{1}.
14644
14645 @item -mtune=@var{cpu}
14646 @opindex mtune
14647 Set instruction scheduling parameters for @var{cpu}, overriding any implied
14648 by @option{-mcpu=}.
14649
14650 Supported values for @var{cpu} are
14651
14652 @table @samp
14653 @item ARC600
14654 Tune for ARC600 cpu.
14655
14656 @item ARC601
14657 Tune for ARC601 cpu.
14658
14659 @item ARC700
14660 Tune for ARC700 cpu with standard multiplier block.
14661
14662 @item ARC700-xmac
14663 Tune for ARC700 cpu with XMAC block.
14664
14665 @item ARC725D
14666 Tune for ARC725D cpu.
14667
14668 @item ARC750D
14669 Tune for ARC750D cpu.
14670
14671 @end table
14672
14673 @item -mmultcost=@var{num}
14674 @opindex mmultcost
14675 Cost to assume for a multiply instruction, with @samp{4} being equal to a
14676 normal instruction.
14677
14678 @item -munalign-prob-threshold=@var{probability}
14679 @opindex munalign-prob-threshold
14680 Set probability threshold for unaligning branches.
14681 When tuning for @samp{ARC700} and optimizing for speed, branches without
14682 filled delay slot are preferably emitted unaligned and long, unless
14683 profiling indicates that the probability for the branch to be taken
14684 is below @var{probability}. @xref{Cross-profiling}.
14685 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
14686
14687 @end table
14688
14689 The following options are maintained for backward compatibility, but
14690 are now deprecated and will be removed in a future release:
14691
14692 @c Deprecated options
14693 @table @gcctabopt
14694
14695 @item -margonaut
14696 @opindex margonaut
14697 Obsolete FPX.
14698
14699 @item -mbig-endian
14700 @opindex mbig-endian
14701 @itemx -EB
14702 @opindex EB
14703 Compile code for big endian targets. Use of these options is now
14704 deprecated. Users wanting big-endian code, should use the
14705 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
14706 building the tool chain, for which big-endian is the default.
14707
14708 @item -mlittle-endian
14709 @opindex mlittle-endian
14710 @itemx -EL
14711 @opindex EL
14712 Compile code for little endian targets. Use of these options is now
14713 deprecated. Users wanting little-endian code should use the
14714 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
14715 building the tool chain, for which little-endian is the default.
14716
14717 @item -mbarrel_shifter
14718 @opindex mbarrel_shifter
14719 Replaced by @option{-mbarrel-shifter}.
14720
14721 @item -mdpfp_compact
14722 @opindex mdpfp_compact
14723 Replaced by @option{-mdpfp-compact}.
14724
14725 @item -mdpfp_fast
14726 @opindex mdpfp_fast
14727 Replaced by @option{-mdpfp-fast}.
14728
14729 @item -mdsp_packa
14730 @opindex mdsp_packa
14731 Replaced by @option{-mdsp-packa}.
14732
14733 @item -mEA
14734 @opindex mEA
14735 Replaced by @option{-mea}.
14736
14737 @item -mmac_24
14738 @opindex mmac_24
14739 Replaced by @option{-mmac-24}.
14740
14741 @item -mmac_d16
14742 @opindex mmac_d16
14743 Replaced by @option{-mmac-d16}.
14744
14745 @item -mspfp_compact
14746 @opindex mspfp_compact
14747 Replaced by @option{-mspfp-compact}.
14748
14749 @item -mspfp_fast
14750 @opindex mspfp_fast
14751 Replaced by @option{-mspfp-fast}.
14752
14753 @item -mtune=@var{cpu}
14754 @opindex mtune
14755 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
14756 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
14757 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
14758
14759 @item -multcost=@var{num}
14760 @opindex multcost
14761 Replaced by @option{-mmultcost}.
14762
14763 @end table
14764
14765 @node ARM Options
14766 @subsection ARM Options
14767 @cindex ARM options
14768
14769 These @samp{-m} options are defined for the ARM port:
14770
14771 @table @gcctabopt
14772 @item -mabi=@var{name}
14773 @opindex mabi
14774 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
14775 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
14776
14777 @item -mapcs-frame
14778 @opindex mapcs-frame
14779 Generate a stack frame that is compliant with the ARM Procedure Call
14780 Standard for all functions, even if this is not strictly necessary for
14781 correct execution of the code. Specifying @option{-fomit-frame-pointer}
14782 with this option causes the stack frames not to be generated for
14783 leaf functions. The default is @option{-mno-apcs-frame}.
14784 This option is deprecated.
14785
14786 @item -mapcs
14787 @opindex mapcs
14788 This is a synonym for @option{-mapcs-frame} and is deprecated.
14789
14790 @ignore
14791 @c not currently implemented
14792 @item -mapcs-stack-check
14793 @opindex mapcs-stack-check
14794 Generate code to check the amount of stack space available upon entry to
14795 every function (that actually uses some stack space). If there is
14796 insufficient space available then either the function
14797 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
14798 called, depending upon the amount of stack space required. The runtime
14799 system is required to provide these functions. The default is
14800 @option{-mno-apcs-stack-check}, since this produces smaller code.
14801
14802 @c not currently implemented
14803 @item -mapcs-float
14804 @opindex mapcs-float
14805 Pass floating-point arguments using the floating-point registers. This is
14806 one of the variants of the APCS@. This option is recommended if the
14807 target hardware has a floating-point unit or if a lot of floating-point
14808 arithmetic is going to be performed by the code. The default is
14809 @option{-mno-apcs-float}, since the size of integer-only code is
14810 slightly increased if @option{-mapcs-float} is used.
14811
14812 @c not currently implemented
14813 @item -mapcs-reentrant
14814 @opindex mapcs-reentrant
14815 Generate reentrant, position-independent code. The default is
14816 @option{-mno-apcs-reentrant}.
14817 @end ignore
14818
14819 @item -mthumb-interwork
14820 @opindex mthumb-interwork
14821 Generate code that supports calling between the ARM and Thumb
14822 instruction sets. Without this option, on pre-v5 architectures, the
14823 two instruction sets cannot be reliably used inside one program. The
14824 default is @option{-mno-thumb-interwork}, since slightly larger code
14825 is generated when @option{-mthumb-interwork} is specified. In AAPCS
14826 configurations this option is meaningless.
14827
14828 @item -mno-sched-prolog
14829 @opindex mno-sched-prolog
14830 Prevent the reordering of instructions in the function prologue, or the
14831 merging of those instruction with the instructions in the function's
14832 body. This means that all functions start with a recognizable set
14833 of instructions (or in fact one of a choice from a small set of
14834 different function prologues), and this information can be used to
14835 locate the start of functions inside an executable piece of code. The
14836 default is @option{-msched-prolog}.
14837
14838 @item -mfloat-abi=@var{name}
14839 @opindex mfloat-abi
14840 Specifies which floating-point ABI to use. Permissible values
14841 are: @samp{soft}, @samp{softfp} and @samp{hard}.
14842
14843 Specifying @samp{soft} causes GCC to generate output containing
14844 library calls for floating-point operations.
14845 @samp{softfp} allows the generation of code using hardware floating-point
14846 instructions, but still uses the soft-float calling conventions.
14847 @samp{hard} allows generation of floating-point instructions
14848 and uses FPU-specific calling conventions.
14849
14850 The default depends on the specific target configuration. Note that
14851 the hard-float and soft-float ABIs are not link-compatible; you must
14852 compile your entire program with the same ABI, and link with a
14853 compatible set of libraries.
14854
14855 @item -mlittle-endian
14856 @opindex mlittle-endian
14857 Generate code for a processor running in little-endian mode. This is
14858 the default for all standard configurations.
14859
14860 @item -mbig-endian
14861 @opindex mbig-endian
14862 Generate code for a processor running in big-endian mode; the default is
14863 to compile code for a little-endian processor.
14864
14865 @item -march=@var{name}
14866 @opindex march
14867 This specifies the name of the target ARM architecture. GCC uses this
14868 name to determine what kind of instructions it can emit when generating
14869 assembly code. This option can be used in conjunction with or instead
14870 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
14871 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
14872 @samp{armv5}, @samp{armv5e}, @samp{armv5t}, @samp{armv5te},
14873 @samp{armv6}, @samp{armv6-m}, @samp{armv6j}, @samp{armv6k},
14874 @samp{armv6kz}, @samp{armv6s-m},
14875 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk},
14876 @samp{armv7}, @samp{armv7-a}, @samp{armv7-m}, @samp{armv7-r}, @samp{armv7e-m},
14877 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
14878 @samp{armv8.1-a+crc}, @samp{armv8-m.base}, @samp{armv8-m.main},
14879 @samp{armv8-m.main+dsp}, @samp{iwmmxt}, @samp{iwmmxt2}.
14880
14881 Architecture revisions older than @samp{armv4t} are deprecated.
14882
14883 @option{-march=armv6s-m} is the @samp{armv6-m} architecture with support for
14884 the (now mandatory) SVC instruction.
14885
14886 @option{-march=armv6zk} is an alias for @samp{armv6kz}, existing for backwards
14887 compatibility.
14888
14889 @option{-march=armv7ve} is the @samp{armv7-a} architecture with virtualization
14890 extensions.
14891
14892 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
14893 architecture together with the optional CRC32 extensions.
14894
14895 @option{-march=armv8.1-a} enables compiler support for the ARMv8.1-A
14896 architecture. This also enables the features provided by
14897 @option{-march=armv8-a+crc}.
14898
14899 @option{-march=armv8.2-a} enables compiler support for the ARMv8.2-A
14900 architecture. This also enables the features provided by
14901 @option{-march=armv8.1-a}.
14902
14903 @option{-march=armv8.2-a+fp16} enables compiler support for the
14904 ARMv8.2-A architecture with the optional FP16 instructions extension.
14905 This also enables the features provided by @option{-march=armv8.1-a}
14906 and implies @option{-mfp16-format=ieee}.
14907
14908 @option{-march=native} causes the compiler to auto-detect the architecture
14909 of the build computer. At present, this feature is only supported on
14910 GNU/Linux, and not all architectures are recognized. If the auto-detect
14911 is unsuccessful the option has no effect.
14912
14913 @item -mtune=@var{name}
14914 @opindex mtune
14915 This option specifies the name of the target ARM processor for
14916 which GCC should tune the performance of the code.
14917 For some ARM implementations better performance can be obtained by using
14918 this option.
14919 Permissible names are: @samp{arm2}, @samp{arm250},
14920 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
14921 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
14922 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
14923 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
14924 @samp{arm720},
14925 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
14926 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
14927 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
14928 @samp{strongarm1110},
14929 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
14930 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
14931 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
14932 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
14933 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
14934 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
14935 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
14936 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
14937 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
14938 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
14939 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-r4},
14940 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
14941 @samp{cortex-m33},
14942 @samp{cortex-m23},
14943 @samp{cortex-m7},
14944 @samp{cortex-m4},
14945 @samp{cortex-m3},
14946 @samp{cortex-m1},
14947 @samp{cortex-m0},
14948 @samp{cortex-m0plus},
14949 @samp{cortex-m1.small-multiply},
14950 @samp{cortex-m0.small-multiply},
14951 @samp{cortex-m0plus.small-multiply},
14952 @samp{exynos-m1},
14953 @samp{qdf24xx},
14954 @samp{marvell-pj4},
14955 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
14956 @samp{fa526}, @samp{fa626},
14957 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
14958 @samp{xgene1}.
14959
14960 Additionally, this option can specify that GCC should tune the performance
14961 of the code for a big.LITTLE system. Permissible names are:
14962 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
14963 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14964 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}.
14965
14966 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
14967 performance for a blend of processors within architecture @var{arch}.
14968 The aim is to generate code that run well on the current most popular
14969 processors, balancing between optimizations that benefit some CPUs in the
14970 range, and avoiding performance pitfalls of other CPUs. The effects of
14971 this option may change in future GCC versions as CPU models come and go.
14972
14973 @option{-mtune=native} causes the compiler to auto-detect the CPU
14974 of the build computer. At present, this feature is only supported on
14975 GNU/Linux, and not all architectures are recognized. If the auto-detect is
14976 unsuccessful the option has no effect.
14977
14978 @item -mcpu=@var{name}
14979 @opindex mcpu
14980 This specifies the name of the target ARM processor. GCC uses this name
14981 to derive the name of the target ARM architecture (as if specified
14982 by @option{-march}) and the ARM processor type for which to tune for
14983 performance (as if specified by @option{-mtune}). Where this option
14984 is used in conjunction with @option{-march} or @option{-mtune},
14985 those options take precedence over the appropriate part of this option.
14986
14987 Permissible names for this option are the same as those for
14988 @option{-mtune}.
14989
14990 @option{-mcpu=generic-@var{arch}} is also permissible, and is
14991 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
14992 See @option{-mtune} for more information.
14993
14994 @option{-mcpu=native} causes the compiler to auto-detect the CPU
14995 of the build computer. At present, this feature is only supported on
14996 GNU/Linux, and not all architectures are recognized. If the auto-detect
14997 is unsuccessful the option has no effect.
14998
14999 @item -mfpu=@var{name}
15000 @opindex mfpu
15001 This specifies what floating-point hardware (or hardware emulation) is
15002 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
15003 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
15004 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
15005 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
15006 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
15007 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
15008
15009 If @option{-msoft-float} is specified this specifies the format of
15010 floating-point values.
15011
15012 If the selected floating-point hardware includes the NEON extension
15013 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
15014 operations are not generated by GCC's auto-vectorization pass unless
15015 @option{-funsafe-math-optimizations} is also specified. This is
15016 because NEON hardware does not fully implement the IEEE 754 standard for
15017 floating-point arithmetic (in particular denormal values are treated as
15018 zero), so the use of NEON instructions may lead to a loss of precision.
15019
15020 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}).
15021
15022 @item -mfp16-format=@var{name}
15023 @opindex mfp16-format
15024 Specify the format of the @code{__fp16} half-precision floating-point type.
15025 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
15026 the default is @samp{none}, in which case the @code{__fp16} type is not
15027 defined. @xref{Half-Precision}, for more information.
15028
15029 @item -mstructure-size-boundary=@var{n}
15030 @opindex mstructure-size-boundary
15031 The sizes of all structures and unions are rounded up to a multiple
15032 of the number of bits set by this option. Permissible values are 8, 32
15033 and 64. The default value varies for different toolchains. For the COFF
15034 targeted toolchain the default value is 8. A value of 64 is only allowed
15035 if the underlying ABI supports it.
15036
15037 Specifying a larger number can produce faster, more efficient code, but
15038 can also increase the size of the program. Different values are potentially
15039 incompatible. Code compiled with one value cannot necessarily expect to
15040 work with code or libraries compiled with another value, if they exchange
15041 information using structures or unions.
15042
15043 @item -mabort-on-noreturn
15044 @opindex mabort-on-noreturn
15045 Generate a call to the function @code{abort} at the end of a
15046 @code{noreturn} function. It is executed if the function tries to
15047 return.
15048
15049 @item -mlong-calls
15050 @itemx -mno-long-calls
15051 @opindex mlong-calls
15052 @opindex mno-long-calls
15053 Tells the compiler to perform function calls by first loading the
15054 address of the function into a register and then performing a subroutine
15055 call on this register. This switch is needed if the target function
15056 lies outside of the 64-megabyte addressing range of the offset-based
15057 version of subroutine call instruction.
15058
15059 Even if this switch is enabled, not all function calls are turned
15060 into long calls. The heuristic is that static functions, functions
15061 that have the @code{short_call} attribute, functions that are inside
15062 the scope of a @code{#pragma no_long_calls} directive, and functions whose
15063 definitions have already been compiled within the current compilation
15064 unit are not turned into long calls. The exceptions to this rule are
15065 that weak function definitions, functions with the @code{long_call}
15066 attribute or the @code{section} attribute, and functions that are within
15067 the scope of a @code{#pragma long_calls} directive are always
15068 turned into long calls.
15069
15070 This feature is not enabled by default. Specifying
15071 @option{-mno-long-calls} restores the default behavior, as does
15072 placing the function calls within the scope of a @code{#pragma
15073 long_calls_off} directive. Note these switches have no effect on how
15074 the compiler generates code to handle function calls via function
15075 pointers.
15076
15077 @item -msingle-pic-base
15078 @opindex msingle-pic-base
15079 Treat the register used for PIC addressing as read-only, rather than
15080 loading it in the prologue for each function. The runtime system is
15081 responsible for initializing this register with an appropriate value
15082 before execution begins.
15083
15084 @item -mpic-register=@var{reg}
15085 @opindex mpic-register
15086 Specify the register to be used for PIC addressing.
15087 For standard PIC base case, the default is any suitable register
15088 determined by compiler. For single PIC base case, the default is
15089 @samp{R9} if target is EABI based or stack-checking is enabled,
15090 otherwise the default is @samp{R10}.
15091
15092 @item -mpic-data-is-text-relative
15093 @opindex mpic-data-is-text-relative
15094 Assume that the displacement between the text and data segments is fixed
15095 at static link time. This permits using PC-relative addressing
15096 operations to access data known to be in the data segment. For
15097 non-VxWorks RTP targets, this option is enabled by default. When
15098 disabled on such targets, it will enable @option{-msingle-pic-base} by
15099 default.
15100
15101 @item -mpoke-function-name
15102 @opindex mpoke-function-name
15103 Write the name of each function into the text section, directly
15104 preceding the function prologue. The generated code is similar to this:
15105
15106 @smallexample
15107 t0
15108 .ascii "arm_poke_function_name", 0
15109 .align
15110 t1
15111 .word 0xff000000 + (t1 - t0)
15112 arm_poke_function_name
15113 mov ip, sp
15114 stmfd sp!, @{fp, ip, lr, pc@}
15115 sub fp, ip, #4
15116 @end smallexample
15117
15118 When performing a stack backtrace, code can inspect the value of
15119 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
15120 location @code{pc - 12} and the top 8 bits are set, then we know that
15121 there is a function name embedded immediately preceding this location
15122 and has length @code{((pc[-3]) & 0xff000000)}.
15123
15124 @item -mthumb
15125 @itemx -marm
15126 @opindex marm
15127 @opindex mthumb
15128
15129 Select between generating code that executes in ARM and Thumb
15130 states. The default for most configurations is to generate code
15131 that executes in ARM state, but the default can be changed by
15132 configuring GCC with the @option{--with-mode=}@var{state}
15133 configure option.
15134
15135 You can also override the ARM and Thumb mode for each function
15136 by using the @code{target("thumb")} and @code{target("arm")} function attributes
15137 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
15138
15139 @item -mtpcs-frame
15140 @opindex mtpcs-frame
15141 Generate a stack frame that is compliant with the Thumb Procedure Call
15142 Standard for all non-leaf functions. (A leaf function is one that does
15143 not call any other functions.) The default is @option{-mno-tpcs-frame}.
15144
15145 @item -mtpcs-leaf-frame
15146 @opindex mtpcs-leaf-frame
15147 Generate a stack frame that is compliant with the Thumb Procedure Call
15148 Standard for all leaf functions. (A leaf function is one that does
15149 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
15150
15151 @item -mcallee-super-interworking
15152 @opindex mcallee-super-interworking
15153 Gives all externally visible functions in the file being compiled an ARM
15154 instruction set header which switches to Thumb mode before executing the
15155 rest of the function. This allows these functions to be called from
15156 non-interworking code. This option is not valid in AAPCS configurations
15157 because interworking is enabled by default.
15158
15159 @item -mcaller-super-interworking
15160 @opindex mcaller-super-interworking
15161 Allows calls via function pointers (including virtual functions) to
15162 execute correctly regardless of whether the target code has been
15163 compiled for interworking or not. There is a small overhead in the cost
15164 of executing a function pointer if this option is enabled. This option
15165 is not valid in AAPCS configurations because interworking is enabled
15166 by default.
15167
15168 @item -mtp=@var{name}
15169 @opindex mtp
15170 Specify the access model for the thread local storage pointer. The valid
15171 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
15172 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
15173 (supported in the arm6k architecture), and @samp{auto}, which uses the
15174 best available method for the selected processor. The default setting is
15175 @samp{auto}.
15176
15177 @item -mtls-dialect=@var{dialect}
15178 @opindex mtls-dialect
15179 Specify the dialect to use for accessing thread local storage. Two
15180 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
15181 @samp{gnu} dialect selects the original GNU scheme for supporting
15182 local and global dynamic TLS models. The @samp{gnu2} dialect
15183 selects the GNU descriptor scheme, which provides better performance
15184 for shared libraries. The GNU descriptor scheme is compatible with
15185 the original scheme, but does require new assembler, linker and
15186 library support. Initial and local exec TLS models are unaffected by
15187 this option and always use the original scheme.
15188
15189 @item -mword-relocations
15190 @opindex mword-relocations
15191 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
15192 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
15193 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
15194 is specified.
15195
15196 @item -mfix-cortex-m3-ldrd
15197 @opindex mfix-cortex-m3-ldrd
15198 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
15199 with overlapping destination and base registers are used. This option avoids
15200 generating these instructions. This option is enabled by default when
15201 @option{-mcpu=cortex-m3} is specified.
15202
15203 @item -munaligned-access
15204 @itemx -mno-unaligned-access
15205 @opindex munaligned-access
15206 @opindex mno-unaligned-access
15207 Enables (or disables) reading and writing of 16- and 32- bit values
15208 from addresses that are not 16- or 32- bit aligned. By default
15209 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
15210 ARMv8-M Baseline architectures, and enabled for all other
15211 architectures. If unaligned access is not enabled then words in packed
15212 data structures are accessed a byte at a time.
15213
15214 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
15215 generated object file to either true or false, depending upon the
15216 setting of this option. If unaligned access is enabled then the
15217 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
15218 defined.
15219
15220 @item -mneon-for-64bits
15221 @opindex mneon-for-64bits
15222 Enables using Neon to handle scalar 64-bits operations. This is
15223 disabled by default since the cost of moving data from core registers
15224 to Neon is high.
15225
15226 @item -mslow-flash-data
15227 @opindex mslow-flash-data
15228 Assume loading data from flash is slower than fetching instruction.
15229 Therefore literal load is minimized for better performance.
15230 This option is only supported when compiling for ARMv7 M-profile and
15231 off by default.
15232
15233 @item -masm-syntax-unified
15234 @opindex masm-syntax-unified
15235 Assume inline assembler is using unified asm syntax. The default is
15236 currently off which implies divided syntax. This option has no impact
15237 on Thumb2. However, this may change in future releases of GCC.
15238 Divided syntax should be considered deprecated.
15239
15240 @item -mrestrict-it
15241 @opindex mrestrict-it
15242 Restricts generation of IT blocks to conform to the rules of ARMv8.
15243 IT blocks can only contain a single 16-bit instruction from a select
15244 set of instructions. This option is on by default for ARMv8 Thumb mode.
15245
15246 @item -mprint-tune-info
15247 @opindex mprint-tune-info
15248 Print CPU tuning information as comment in assembler file. This is
15249 an option used only for regression testing of the compiler and not
15250 intended for ordinary use in compiling code. This option is disabled
15251 by default.
15252
15253 @item -mpure-code
15254 @opindex mpure-code
15255 Do not allow constant data to be placed in code sections.
15256 Additionally, when compiling for ELF object format give all text sections the
15257 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
15258 is only available when generating non-pic code for ARMv7-M targets.
15259
15260 @end table
15261
15262 @node AVR Options
15263 @subsection AVR Options
15264 @cindex AVR Options
15265
15266 These options are defined for AVR implementations:
15267
15268 @table @gcctabopt
15269 @item -mmcu=@var{mcu}
15270 @opindex mmcu
15271 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
15272
15273 The default for this option is@tie{}@samp{avr2}.
15274
15275 GCC supports the following AVR devices and ISAs:
15276
15277 @include avr-mmcu.texi
15278
15279 @item -maccumulate-args
15280 @opindex maccumulate-args
15281 Accumulate outgoing function arguments and acquire/release the needed
15282 stack space for outgoing function arguments once in function
15283 prologue/epilogue. Without this option, outgoing arguments are pushed
15284 before calling a function and popped afterwards.
15285
15286 Popping the arguments after the function call can be expensive on
15287 AVR so that accumulating the stack space might lead to smaller
15288 executables because arguments need not to be removed from the
15289 stack after such a function call.
15290
15291 This option can lead to reduced code size for functions that perform
15292 several calls to functions that get their arguments on the stack like
15293 calls to printf-like functions.
15294
15295 @item -mbranch-cost=@var{cost}
15296 @opindex mbranch-cost
15297 Set the branch costs for conditional branch instructions to
15298 @var{cost}. Reasonable values for @var{cost} are small, non-negative
15299 integers. The default branch cost is 0.
15300
15301 @item -mcall-prologues
15302 @opindex mcall-prologues
15303 Functions prologues/epilogues are expanded as calls to appropriate
15304 subroutines. Code size is smaller.
15305
15306 @item -mint8
15307 @opindex mint8
15308 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
15309 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
15310 and @code{long long} is 4 bytes. Please note that this option does not
15311 conform to the C standards, but it results in smaller code
15312 size.
15313
15314 @item -mn-flash=@var{num}
15315 @opindex mn-flash
15316 Assume that the flash memory has a size of
15317 @var{num} times 64@tie{}KiB.
15318
15319 @item -mno-interrupts
15320 @opindex mno-interrupts
15321 Generated code is not compatible with hardware interrupts.
15322 Code size is smaller.
15323
15324 @item -mrelax
15325 @opindex mrelax
15326 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
15327 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
15328 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
15329 the assembler's command line and the @option{--relax} option to the
15330 linker's command line.
15331
15332 Jump relaxing is performed by the linker because jump offsets are not
15333 known before code is located. Therefore, the assembler code generated by the
15334 compiler is the same, but the instructions in the executable may
15335 differ from instructions in the assembler code.
15336
15337 Relaxing must be turned on if linker stubs are needed, see the
15338 section on @code{EIND} and linker stubs below.
15339
15340 @item -mrmw
15341 @opindex mrmw
15342 Assume that the device supports the Read-Modify-Write
15343 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
15344
15345 @item -msp8
15346 @opindex msp8
15347 Treat the stack pointer register as an 8-bit register,
15348 i.e.@: assume the high byte of the stack pointer is zero.
15349 In general, you don't need to set this option by hand.
15350
15351 This option is used internally by the compiler to select and
15352 build multilibs for architectures @code{avr2} and @code{avr25}.
15353 These architectures mix devices with and without @code{SPH}.
15354 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
15355 the compiler driver adds or removes this option from the compiler
15356 proper's command line, because the compiler then knows if the device
15357 or architecture has an 8-bit stack pointer and thus no @code{SPH}
15358 register or not.
15359
15360 @item -mstrict-X
15361 @opindex mstrict-X
15362 Use address register @code{X} in a way proposed by the hardware. This means
15363 that @code{X} is only used in indirect, post-increment or
15364 pre-decrement addressing.
15365
15366 Without this option, the @code{X} register may be used in the same way
15367 as @code{Y} or @code{Z} which then is emulated by additional
15368 instructions.
15369 For example, loading a value with @code{X+const} addressing with a
15370 small non-negative @code{const < 64} to a register @var{Rn} is
15371 performed as
15372
15373 @example
15374 adiw r26, const ; X += const
15375 ld @var{Rn}, X ; @var{Rn} = *X
15376 sbiw r26, const ; X -= const
15377 @end example
15378
15379 @item -mtiny-stack
15380 @opindex mtiny-stack
15381 Only change the lower 8@tie{}bits of the stack pointer.
15382
15383 @item -mfract-convert-truncate
15384 @opindex mfract-convert-truncate
15385 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
15386
15387 @item -nodevicelib
15388 @opindex nodevicelib
15389 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
15390
15391 @item -Waddr-space-convert
15392 @opindex Waddr-space-convert
15393 Warn about conversions between address spaces in the case where the
15394 resulting address space is not contained in the incoming address space.
15395
15396 @item -Wmisspelled-isr
15397 @opindex Wmisspelled-isr
15398 Warn if the ISR is misspelled, i.e. without __vector prefix.
15399 Enabled by default.
15400 @end table
15401
15402 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
15403 @cindex @code{EIND}
15404 Pointers in the implementation are 16@tie{}bits wide.
15405 The address of a function or label is represented as word address so
15406 that indirect jumps and calls can target any code address in the
15407 range of 64@tie{}Ki words.
15408
15409 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
15410 bytes of program memory space, there is a special function register called
15411 @code{EIND} that serves as most significant part of the target address
15412 when @code{EICALL} or @code{EIJMP} instructions are used.
15413
15414 Indirect jumps and calls on these devices are handled as follows by
15415 the compiler and are subject to some limitations:
15416
15417 @itemize @bullet
15418
15419 @item
15420 The compiler never sets @code{EIND}.
15421
15422 @item
15423 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
15424 instructions or might read @code{EIND} directly in order to emulate an
15425 indirect call/jump by means of a @code{RET} instruction.
15426
15427 @item
15428 The compiler assumes that @code{EIND} never changes during the startup
15429 code or during the application. In particular, @code{EIND} is not
15430 saved/restored in function or interrupt service routine
15431 prologue/epilogue.
15432
15433 @item
15434 For indirect calls to functions and computed goto, the linker
15435 generates @emph{stubs}. Stubs are jump pads sometimes also called
15436 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
15437 The stub contains a direct jump to the desired address.
15438
15439 @item
15440 Linker relaxation must be turned on so that the linker generates
15441 the stubs correctly in all situations. See the compiler option
15442 @option{-mrelax} and the linker option @option{--relax}.
15443 There are corner cases where the linker is supposed to generate stubs
15444 but aborts without relaxation and without a helpful error message.
15445
15446 @item
15447 The default linker script is arranged for code with @code{EIND = 0}.
15448 If code is supposed to work for a setup with @code{EIND != 0}, a custom
15449 linker script has to be used in order to place the sections whose
15450 name start with @code{.trampolines} into the segment where @code{EIND}
15451 points to.
15452
15453 @item
15454 The startup code from libgcc never sets @code{EIND}.
15455 Notice that startup code is a blend of code from libgcc and AVR-LibC.
15456 For the impact of AVR-LibC on @code{EIND}, see the
15457 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
15458
15459 @item
15460 It is legitimate for user-specific startup code to set up @code{EIND}
15461 early, for example by means of initialization code located in
15462 section @code{.init3}. Such code runs prior to general startup code
15463 that initializes RAM and calls constructors, but after the bit
15464 of startup code from AVR-LibC that sets @code{EIND} to the segment
15465 where the vector table is located.
15466 @example
15467 #include <avr/io.h>
15468
15469 static void
15470 __attribute__((section(".init3"),naked,used,no_instrument_function))
15471 init3_set_eind (void)
15472 @{
15473 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
15474 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
15475 @}
15476 @end example
15477
15478 @noindent
15479 The @code{__trampolines_start} symbol is defined in the linker script.
15480
15481 @item
15482 Stubs are generated automatically by the linker if
15483 the following two conditions are met:
15484 @itemize @minus
15485
15486 @item The address of a label is taken by means of the @code{gs} modifier
15487 (short for @emph{generate stubs}) like so:
15488 @example
15489 LDI r24, lo8(gs(@var{func}))
15490 LDI r25, hi8(gs(@var{func}))
15491 @end example
15492 @item The final location of that label is in a code segment
15493 @emph{outside} the segment where the stubs are located.
15494 @end itemize
15495
15496 @item
15497 The compiler emits such @code{gs} modifiers for code labels in the
15498 following situations:
15499 @itemize @minus
15500 @item Taking address of a function or code label.
15501 @item Computed goto.
15502 @item If prologue-save function is used, see @option{-mcall-prologues}
15503 command-line option.
15504 @item Switch/case dispatch tables. If you do not want such dispatch
15505 tables you can specify the @option{-fno-jump-tables} command-line option.
15506 @item C and C++ constructors/destructors called during startup/shutdown.
15507 @item If the tools hit a @code{gs()} modifier explained above.
15508 @end itemize
15509
15510 @item
15511 Jumping to non-symbolic addresses like so is @emph{not} supported:
15512
15513 @example
15514 int main (void)
15515 @{
15516 /* Call function at word address 0x2 */
15517 return ((int(*)(void)) 0x2)();
15518 @}
15519 @end example
15520
15521 Instead, a stub has to be set up, i.e.@: the function has to be called
15522 through a symbol (@code{func_4} in the example):
15523
15524 @example
15525 int main (void)
15526 @{
15527 extern int func_4 (void);
15528
15529 /* Call function at byte address 0x4 */
15530 return func_4();
15531 @}
15532 @end example
15533
15534 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
15535 Alternatively, @code{func_4} can be defined in the linker script.
15536 @end itemize
15537
15538 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
15539 @cindex @code{RAMPD}
15540 @cindex @code{RAMPX}
15541 @cindex @code{RAMPY}
15542 @cindex @code{RAMPZ}
15543 Some AVR devices support memories larger than the 64@tie{}KiB range
15544 that can be accessed with 16-bit pointers. To access memory locations
15545 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
15546 register is used as high part of the address:
15547 The @code{X}, @code{Y}, @code{Z} address register is concatenated
15548 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
15549 register, respectively, to get a wide address. Similarly,
15550 @code{RAMPD} is used together with direct addressing.
15551
15552 @itemize
15553 @item
15554 The startup code initializes the @code{RAMP} special function
15555 registers with zero.
15556
15557 @item
15558 If a @ref{AVR Named Address Spaces,named address space} other than
15559 generic or @code{__flash} is used, then @code{RAMPZ} is set
15560 as needed before the operation.
15561
15562 @item
15563 If the device supports RAM larger than 64@tie{}KiB and the compiler
15564 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
15565 is reset to zero after the operation.
15566
15567 @item
15568 If the device comes with a specific @code{RAMP} register, the ISR
15569 prologue/epilogue saves/restores that SFR and initializes it with
15570 zero in case the ISR code might (implicitly) use it.
15571
15572 @item
15573 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
15574 If you use inline assembler to read from locations outside the
15575 16-bit address range and change one of the @code{RAMP} registers,
15576 you must reset it to zero after the access.
15577
15578 @end itemize
15579
15580 @subsubsection AVR Built-in Macros
15581
15582 GCC defines several built-in macros so that the user code can test
15583 for the presence or absence of features. Almost any of the following
15584 built-in macros are deduced from device capabilities and thus
15585 triggered by the @option{-mmcu=} command-line option.
15586
15587 For even more AVR-specific built-in macros see
15588 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
15589
15590 @table @code
15591
15592 @item __AVR_ARCH__
15593 Build-in macro that resolves to a decimal number that identifies the
15594 architecture and depends on the @option{-mmcu=@var{mcu}} option.
15595 Possible values are:
15596
15597 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
15598 @code{4}, @code{5}, @code{51}, @code{6}
15599
15600 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
15601 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
15602
15603 respectively and
15604
15605 @code{100}, @code{102}, @code{104},
15606 @code{105}, @code{106}, @code{107}
15607
15608 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
15609 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
15610 If @var{mcu} specifies a device, this built-in macro is set
15611 accordingly. For example, with @option{-mmcu=atmega8} the macro is
15612 defined to @code{4}.
15613
15614 @item __AVR_@var{Device}__
15615 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
15616 the device's name. For example, @option{-mmcu=atmega8} defines the
15617 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
15618 @code{__AVR_ATtiny261A__}, etc.
15619
15620 The built-in macros' names follow
15621 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
15622 the device name as from the AVR user manual. The difference between
15623 @var{Device} in the built-in macro and @var{device} in
15624 @option{-mmcu=@var{device}} is that the latter is always lowercase.
15625
15626 If @var{device} is not a device but only a core architecture like
15627 @samp{avr51}, this macro is not defined.
15628
15629 @item __AVR_DEVICE_NAME__
15630 Setting @option{-mmcu=@var{device}} defines this built-in macro to
15631 the device's name. For example, with @option{-mmcu=atmega8} the macro
15632 is defined to @code{atmega8}.
15633
15634 If @var{device} is not a device but only a core architecture like
15635 @samp{avr51}, this macro is not defined.
15636
15637 @item __AVR_XMEGA__
15638 The device / architecture belongs to the XMEGA family of devices.
15639
15640 @item __AVR_HAVE_ELPM__
15641 The device has the @code{ELPM} instruction.
15642
15643 @item __AVR_HAVE_ELPMX__
15644 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
15645 R@var{n},Z+} instructions.
15646
15647 @item __AVR_HAVE_MOVW__
15648 The device has the @code{MOVW} instruction to perform 16-bit
15649 register-register moves.
15650
15651 @item __AVR_HAVE_LPMX__
15652 The device has the @code{LPM R@var{n},Z} and
15653 @code{LPM R@var{n},Z+} instructions.
15654
15655 @item __AVR_HAVE_MUL__
15656 The device has a hardware multiplier.
15657
15658 @item __AVR_HAVE_JMP_CALL__
15659 The device has the @code{JMP} and @code{CALL} instructions.
15660 This is the case for devices with at least 16@tie{}KiB of program
15661 memory.
15662
15663 @item __AVR_HAVE_EIJMP_EICALL__
15664 @itemx __AVR_3_BYTE_PC__
15665 The device has the @code{EIJMP} and @code{EICALL} instructions.
15666 This is the case for devices with more than 128@tie{}KiB of program memory.
15667 This also means that the program counter
15668 (PC) is 3@tie{}bytes wide.
15669
15670 @item __AVR_2_BYTE_PC__
15671 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
15672 with up to 128@tie{}KiB of program memory.
15673
15674 @item __AVR_HAVE_8BIT_SP__
15675 @itemx __AVR_HAVE_16BIT_SP__
15676 The stack pointer (SP) register is treated as 8-bit respectively
15677 16-bit register by the compiler.
15678 The definition of these macros is affected by @option{-mtiny-stack}.
15679
15680 @item __AVR_HAVE_SPH__
15681 @itemx __AVR_SP8__
15682 The device has the SPH (high part of stack pointer) special function
15683 register or has an 8-bit stack pointer, respectively.
15684 The definition of these macros is affected by @option{-mmcu=} and
15685 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
15686 by @option{-msp8}.
15687
15688 @item __AVR_HAVE_RAMPD__
15689 @itemx __AVR_HAVE_RAMPX__
15690 @itemx __AVR_HAVE_RAMPY__
15691 @itemx __AVR_HAVE_RAMPZ__
15692 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
15693 @code{RAMPZ} special function register, respectively.
15694
15695 @item __NO_INTERRUPTS__
15696 This macro reflects the @option{-mno-interrupts} command-line option.
15697
15698 @item __AVR_ERRATA_SKIP__
15699 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
15700 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
15701 instructions because of a hardware erratum. Skip instructions are
15702 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
15703 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
15704 set.
15705
15706 @item __AVR_ISA_RMW__
15707 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
15708
15709 @item __AVR_SFR_OFFSET__=@var{offset}
15710 Instructions that can address I/O special function registers directly
15711 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
15712 address as if addressed by an instruction to access RAM like @code{LD}
15713 or @code{STS}. This offset depends on the device architecture and has
15714 to be subtracted from the RAM address in order to get the
15715 respective I/O@tie{}address.
15716
15717 @item __WITH_AVRLIBC__
15718 The compiler is configured to be used together with AVR-Libc.
15719 See the @option{--with-avrlibc} configure option.
15720
15721 @end table
15722
15723 @node Blackfin Options
15724 @subsection Blackfin Options
15725 @cindex Blackfin Options
15726
15727 @table @gcctabopt
15728 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
15729 @opindex mcpu=
15730 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
15731 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
15732 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
15733 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
15734 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
15735 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
15736 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
15737 @samp{bf561}, @samp{bf592}.
15738
15739 The optional @var{sirevision} specifies the silicon revision of the target
15740 Blackfin processor. Any workarounds available for the targeted silicon revision
15741 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
15742 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
15743 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
15744 hexadecimal digits representing the major and minor numbers in the silicon
15745 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
15746 is not defined. If @var{sirevision} is @samp{any}, the
15747 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
15748 If this optional @var{sirevision} is not used, GCC assumes the latest known
15749 silicon revision of the targeted Blackfin processor.
15750
15751 GCC defines a preprocessor macro for the specified @var{cpu}.
15752 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
15753 provided by libgloss to be linked in if @option{-msim} is not given.
15754
15755 Without this option, @samp{bf532} is used as the processor by default.
15756
15757 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
15758 only the preprocessor macro is defined.
15759
15760 @item -msim
15761 @opindex msim
15762 Specifies that the program will be run on the simulator. This causes
15763 the simulator BSP provided by libgloss to be linked in. This option
15764 has effect only for @samp{bfin-elf} toolchain.
15765 Certain other options, such as @option{-mid-shared-library} and
15766 @option{-mfdpic}, imply @option{-msim}.
15767
15768 @item -momit-leaf-frame-pointer
15769 @opindex momit-leaf-frame-pointer
15770 Don't keep the frame pointer in a register for leaf functions. This
15771 avoids the instructions to save, set up and restore frame pointers and
15772 makes an extra register available in leaf functions. The option
15773 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
15774 which might make debugging harder.
15775
15776 @item -mspecld-anomaly
15777 @opindex mspecld-anomaly
15778 When enabled, the compiler ensures that the generated code does not
15779 contain speculative loads after jump instructions. If this option is used,
15780 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
15781
15782 @item -mno-specld-anomaly
15783 @opindex mno-specld-anomaly
15784 Don't generate extra code to prevent speculative loads from occurring.
15785
15786 @item -mcsync-anomaly
15787 @opindex mcsync-anomaly
15788 When enabled, the compiler ensures that the generated code does not
15789 contain CSYNC or SSYNC instructions too soon after conditional branches.
15790 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
15791
15792 @item -mno-csync-anomaly
15793 @opindex mno-csync-anomaly
15794 Don't generate extra code to prevent CSYNC or SSYNC instructions from
15795 occurring too soon after a conditional branch.
15796
15797 @item -mlow-64k
15798 @opindex mlow-64k
15799 When enabled, the compiler is free to take advantage of the knowledge that
15800 the entire program fits into the low 64k of memory.
15801
15802 @item -mno-low-64k
15803 @opindex mno-low-64k
15804 Assume that the program is arbitrarily large. This is the default.
15805
15806 @item -mstack-check-l1
15807 @opindex mstack-check-l1
15808 Do stack checking using information placed into L1 scratchpad memory by the
15809 uClinux kernel.
15810
15811 @item -mid-shared-library
15812 @opindex mid-shared-library
15813 Generate code that supports shared libraries via the library ID method.
15814 This allows for execute in place and shared libraries in an environment
15815 without virtual memory management. This option implies @option{-fPIC}.
15816 With a @samp{bfin-elf} target, this option implies @option{-msim}.
15817
15818 @item -mno-id-shared-library
15819 @opindex mno-id-shared-library
15820 Generate code that doesn't assume ID-based shared libraries are being used.
15821 This is the default.
15822
15823 @item -mleaf-id-shared-library
15824 @opindex mleaf-id-shared-library
15825 Generate code that supports shared libraries via the library ID method,
15826 but assumes that this library or executable won't link against any other
15827 ID shared libraries. That allows the compiler to use faster code for jumps
15828 and calls.
15829
15830 @item -mno-leaf-id-shared-library
15831 @opindex mno-leaf-id-shared-library
15832 Do not assume that the code being compiled won't link against any ID shared
15833 libraries. Slower code is generated for jump and call insns.
15834
15835 @item -mshared-library-id=n
15836 @opindex mshared-library-id
15837 Specifies the identification number of the ID-based shared library being
15838 compiled. Specifying a value of 0 generates more compact code; specifying
15839 other values forces the allocation of that number to the current
15840 library but is no more space- or time-efficient than omitting this option.
15841
15842 @item -msep-data
15843 @opindex msep-data
15844 Generate code that allows the data segment to be located in a different
15845 area of memory from the text segment. This allows for execute in place in
15846 an environment without virtual memory management by eliminating relocations
15847 against the text section.
15848
15849 @item -mno-sep-data
15850 @opindex mno-sep-data
15851 Generate code that assumes that the data segment follows the text segment.
15852 This is the default.
15853
15854 @item -mlong-calls
15855 @itemx -mno-long-calls
15856 @opindex mlong-calls
15857 @opindex mno-long-calls
15858 Tells the compiler to perform function calls by first loading the
15859 address of the function into a register and then performing a subroutine
15860 call on this register. This switch is needed if the target function
15861 lies outside of the 24-bit addressing range of the offset-based
15862 version of subroutine call instruction.
15863
15864 This feature is not enabled by default. Specifying
15865 @option{-mno-long-calls} restores the default behavior. Note these
15866 switches have no effect on how the compiler generates code to handle
15867 function calls via function pointers.
15868
15869 @item -mfast-fp
15870 @opindex mfast-fp
15871 Link with the fast floating-point library. This library relaxes some of
15872 the IEEE floating-point standard's rules for checking inputs against
15873 Not-a-Number (NAN), in the interest of performance.
15874
15875 @item -minline-plt
15876 @opindex minline-plt
15877 Enable inlining of PLT entries in function calls to functions that are
15878 not known to bind locally. It has no effect without @option{-mfdpic}.
15879
15880 @item -mmulticore
15881 @opindex mmulticore
15882 Build a standalone application for multicore Blackfin processors.
15883 This option causes proper start files and link scripts supporting
15884 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
15885 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
15886
15887 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
15888 selects the one-application-per-core programming model. Without
15889 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
15890 programming model is used. In this model, the main function of Core B
15891 should be named as @code{coreb_main}.
15892
15893 If this option is not used, the single-core application programming
15894 model is used.
15895
15896 @item -mcorea
15897 @opindex mcorea
15898 Build a standalone application for Core A of BF561 when using
15899 the one-application-per-core programming model. Proper start files
15900 and link scripts are used to support Core A, and the macro
15901 @code{__BFIN_COREA} is defined.
15902 This option can only be used in conjunction with @option{-mmulticore}.
15903
15904 @item -mcoreb
15905 @opindex mcoreb
15906 Build a standalone application for Core B of BF561 when using
15907 the one-application-per-core programming model. Proper start files
15908 and link scripts are used to support Core B, and the macro
15909 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
15910 should be used instead of @code{main}.
15911 This option can only be used in conjunction with @option{-mmulticore}.
15912
15913 @item -msdram
15914 @opindex msdram
15915 Build a standalone application for SDRAM. Proper start files and
15916 link scripts are used to put the application into SDRAM, and the macro
15917 @code{__BFIN_SDRAM} is defined.
15918 The loader should initialize SDRAM before loading the application.
15919
15920 @item -micplb
15921 @opindex micplb
15922 Assume that ICPLBs are enabled at run time. This has an effect on certain
15923 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
15924 are enabled; for standalone applications the default is off.
15925 @end table
15926
15927 @node C6X Options
15928 @subsection C6X Options
15929 @cindex C6X Options
15930
15931 @table @gcctabopt
15932 @item -march=@var{name}
15933 @opindex march
15934 This specifies the name of the target architecture. GCC uses this
15935 name to determine what kind of instructions it can emit when generating
15936 assembly code. Permissible names are: @samp{c62x},
15937 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
15938
15939 @item -mbig-endian
15940 @opindex mbig-endian
15941 Generate code for a big-endian target.
15942
15943 @item -mlittle-endian
15944 @opindex mlittle-endian
15945 Generate code for a little-endian target. This is the default.
15946
15947 @item -msim
15948 @opindex msim
15949 Choose startup files and linker script suitable for the simulator.
15950
15951 @item -msdata=default
15952 @opindex msdata=default
15953 Put small global and static data in the @code{.neardata} section,
15954 which is pointed to by register @code{B14}. Put small uninitialized
15955 global and static data in the @code{.bss} section, which is adjacent
15956 to the @code{.neardata} section. Put small read-only data into the
15957 @code{.rodata} section. The corresponding sections used for large
15958 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
15959
15960 @item -msdata=all
15961 @opindex msdata=all
15962 Put all data, not just small objects, into the sections reserved for
15963 small data, and use addressing relative to the @code{B14} register to
15964 access them.
15965
15966 @item -msdata=none
15967 @opindex msdata=none
15968 Make no use of the sections reserved for small data, and use absolute
15969 addresses to access all data. Put all initialized global and static
15970 data in the @code{.fardata} section, and all uninitialized data in the
15971 @code{.far} section. Put all constant data into the @code{.const}
15972 section.
15973 @end table
15974
15975 @node CRIS Options
15976 @subsection CRIS Options
15977 @cindex CRIS Options
15978
15979 These options are defined specifically for the CRIS ports.
15980
15981 @table @gcctabopt
15982 @item -march=@var{architecture-type}
15983 @itemx -mcpu=@var{architecture-type}
15984 @opindex march
15985 @opindex mcpu
15986 Generate code for the specified architecture. The choices for
15987 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
15988 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
15989 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
15990 @samp{v10}.
15991
15992 @item -mtune=@var{architecture-type}
15993 @opindex mtune
15994 Tune to @var{architecture-type} everything applicable about the generated
15995 code, except for the ABI and the set of available instructions. The
15996 choices for @var{architecture-type} are the same as for
15997 @option{-march=@var{architecture-type}}.
15998
15999 @item -mmax-stack-frame=@var{n}
16000 @opindex mmax-stack-frame
16001 Warn when the stack frame of a function exceeds @var{n} bytes.
16002
16003 @item -metrax4
16004 @itemx -metrax100
16005 @opindex metrax4
16006 @opindex metrax100
16007 The options @option{-metrax4} and @option{-metrax100} are synonyms for
16008 @option{-march=v3} and @option{-march=v8} respectively.
16009
16010 @item -mmul-bug-workaround
16011 @itemx -mno-mul-bug-workaround
16012 @opindex mmul-bug-workaround
16013 @opindex mno-mul-bug-workaround
16014 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
16015 models where it applies. This option is active by default.
16016
16017 @item -mpdebug
16018 @opindex mpdebug
16019 Enable CRIS-specific verbose debug-related information in the assembly
16020 code. This option also has the effect of turning off the @samp{#NO_APP}
16021 formatted-code indicator to the assembler at the beginning of the
16022 assembly file.
16023
16024 @item -mcc-init
16025 @opindex mcc-init
16026 Do not use condition-code results from previous instruction; always emit
16027 compare and test instructions before use of condition codes.
16028
16029 @item -mno-side-effects
16030 @opindex mno-side-effects
16031 Do not emit instructions with side effects in addressing modes other than
16032 post-increment.
16033
16034 @item -mstack-align
16035 @itemx -mno-stack-align
16036 @itemx -mdata-align
16037 @itemx -mno-data-align
16038 @itemx -mconst-align
16039 @itemx -mno-const-align
16040 @opindex mstack-align
16041 @opindex mno-stack-align
16042 @opindex mdata-align
16043 @opindex mno-data-align
16044 @opindex mconst-align
16045 @opindex mno-const-align
16046 These options (@samp{no-} options) arrange (eliminate arrangements) for the
16047 stack frame, individual data and constants to be aligned for the maximum
16048 single data access size for the chosen CPU model. The default is to
16049 arrange for 32-bit alignment. ABI details such as structure layout are
16050 not affected by these options.
16051
16052 @item -m32-bit
16053 @itemx -m16-bit
16054 @itemx -m8-bit
16055 @opindex m32-bit
16056 @opindex m16-bit
16057 @opindex m8-bit
16058 Similar to the stack- data- and const-align options above, these options
16059 arrange for stack frame, writable data and constants to all be 32-bit,
16060 16-bit or 8-bit aligned. The default is 32-bit alignment.
16061
16062 @item -mno-prologue-epilogue
16063 @itemx -mprologue-epilogue
16064 @opindex mno-prologue-epilogue
16065 @opindex mprologue-epilogue
16066 With @option{-mno-prologue-epilogue}, the normal function prologue and
16067 epilogue which set up the stack frame are omitted and no return
16068 instructions or return sequences are generated in the code. Use this
16069 option only together with visual inspection of the compiled code: no
16070 warnings or errors are generated when call-saved registers must be saved,
16071 or storage for local variables needs to be allocated.
16072
16073 @item -mno-gotplt
16074 @itemx -mgotplt
16075 @opindex mno-gotplt
16076 @opindex mgotplt
16077 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
16078 instruction sequences that load addresses for functions from the PLT part
16079 of the GOT rather than (traditional on other architectures) calls to the
16080 PLT@. The default is @option{-mgotplt}.
16081
16082 @item -melf
16083 @opindex melf
16084 Legacy no-op option only recognized with the cris-axis-elf and
16085 cris-axis-linux-gnu targets.
16086
16087 @item -mlinux
16088 @opindex mlinux
16089 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
16090
16091 @item -sim
16092 @opindex sim
16093 This option, recognized for the cris-axis-elf, arranges
16094 to link with input-output functions from a simulator library. Code,
16095 initialized data and zero-initialized data are allocated consecutively.
16096
16097 @item -sim2
16098 @opindex sim2
16099 Like @option{-sim}, but pass linker options to locate initialized data at
16100 0x40000000 and zero-initialized data at 0x80000000.
16101 @end table
16102
16103 @node CR16 Options
16104 @subsection CR16 Options
16105 @cindex CR16 Options
16106
16107 These options are defined specifically for the CR16 ports.
16108
16109 @table @gcctabopt
16110
16111 @item -mmac
16112 @opindex mmac
16113 Enable the use of multiply-accumulate instructions. Disabled by default.
16114
16115 @item -mcr16cplus
16116 @itemx -mcr16c
16117 @opindex mcr16cplus
16118 @opindex mcr16c
16119 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
16120 is default.
16121
16122 @item -msim
16123 @opindex msim
16124 Links the library libsim.a which is in compatible with simulator. Applicable
16125 to ELF compiler only.
16126
16127 @item -mint32
16128 @opindex mint32
16129 Choose integer type as 32-bit wide.
16130
16131 @item -mbit-ops
16132 @opindex mbit-ops
16133 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
16134
16135 @item -mdata-model=@var{model}
16136 @opindex mdata-model
16137 Choose a data model. The choices for @var{model} are @samp{near},
16138 @samp{far} or @samp{medium}. @samp{medium} is default.
16139 However, @samp{far} is not valid with @option{-mcr16c}, as the
16140 CR16C architecture does not support the far data model.
16141 @end table
16142
16143 @node Darwin Options
16144 @subsection Darwin Options
16145 @cindex Darwin options
16146
16147 These options are defined for all architectures running the Darwin operating
16148 system.
16149
16150 FSF GCC on Darwin does not create ``fat'' object files; it creates
16151 an object file for the single architecture that GCC was built to
16152 target. Apple's GCC on Darwin does create ``fat'' files if multiple
16153 @option{-arch} options are used; it does so by running the compiler or
16154 linker multiple times and joining the results together with
16155 @file{lipo}.
16156
16157 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
16158 @samp{i686}) is determined by the flags that specify the ISA
16159 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
16160 @option{-force_cpusubtype_ALL} option can be used to override this.
16161
16162 The Darwin tools vary in their behavior when presented with an ISA
16163 mismatch. The assembler, @file{as}, only permits instructions to
16164 be used that are valid for the subtype of the file it is generating,
16165 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
16166 The linker for shared libraries, @file{/usr/bin/libtool}, fails
16167 and prints an error if asked to create a shared library with a less
16168 restrictive subtype than its input files (for instance, trying to put
16169 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
16170 for executables, @command{ld}, quietly gives the executable the most
16171 restrictive subtype of any of its input files.
16172
16173 @table @gcctabopt
16174 @item -F@var{dir}
16175 @opindex F
16176 Add the framework directory @var{dir} to the head of the list of
16177 directories to be searched for header files. These directories are
16178 interleaved with those specified by @option{-I} options and are
16179 scanned in a left-to-right order.
16180
16181 A framework directory is a directory with frameworks in it. A
16182 framework is a directory with a @file{Headers} and/or
16183 @file{PrivateHeaders} directory contained directly in it that ends
16184 in @file{.framework}. The name of a framework is the name of this
16185 directory excluding the @file{.framework}. Headers associated with
16186 the framework are found in one of those two directories, with
16187 @file{Headers} being searched first. A subframework is a framework
16188 directory that is in a framework's @file{Frameworks} directory.
16189 Includes of subframework headers can only appear in a header of a
16190 framework that contains the subframework, or in a sibling subframework
16191 header. Two subframeworks are siblings if they occur in the same
16192 framework. A subframework should not have the same name as a
16193 framework; a warning is issued if this is violated. Currently a
16194 subframework cannot have subframeworks; in the future, the mechanism
16195 may be extended to support this. The standard frameworks can be found
16196 in @file{/System/Library/Frameworks} and
16197 @file{/Library/Frameworks}. An example include looks like
16198 @code{#include <Framework/header.h>}, where @file{Framework} denotes
16199 the name of the framework and @file{header.h} is found in the
16200 @file{PrivateHeaders} or @file{Headers} directory.
16201
16202 @item -iframework@var{dir}
16203 @opindex iframework
16204 Like @option{-F} except the directory is a treated as a system
16205 directory. The main difference between this @option{-iframework} and
16206 @option{-F} is that with @option{-iframework} the compiler does not
16207 warn about constructs contained within header files found via
16208 @var{dir}. This option is valid only for the C family of languages.
16209
16210 @item -gused
16211 @opindex gused
16212 Emit debugging information for symbols that are used. For stabs
16213 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
16214 This is by default ON@.
16215
16216 @item -gfull
16217 @opindex gfull
16218 Emit debugging information for all symbols and types.
16219
16220 @item -mmacosx-version-min=@var{version}
16221 The earliest version of MacOS X that this executable will run on
16222 is @var{version}. Typical values of @var{version} include @code{10.1},
16223 @code{10.2}, and @code{10.3.9}.
16224
16225 If the compiler was built to use the system's headers by default,
16226 then the default for this option is the system version on which the
16227 compiler is running, otherwise the default is to make choices that
16228 are compatible with as many systems and code bases as possible.
16229
16230 @item -mkernel
16231 @opindex mkernel
16232 Enable kernel development mode. The @option{-mkernel} option sets
16233 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
16234 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
16235 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
16236 applicable. This mode also sets @option{-mno-altivec},
16237 @option{-msoft-float}, @option{-fno-builtin} and
16238 @option{-mlong-branch} for PowerPC targets.
16239
16240 @item -mone-byte-bool
16241 @opindex mone-byte-bool
16242 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
16243 By default @code{sizeof(bool)} is @code{4} when compiling for
16244 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
16245 option has no effect on x86.
16246
16247 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
16248 to generate code that is not binary compatible with code generated
16249 without that switch. Using this switch may require recompiling all
16250 other modules in a program, including system libraries. Use this
16251 switch to conform to a non-default data model.
16252
16253 @item -mfix-and-continue
16254 @itemx -ffix-and-continue
16255 @itemx -findirect-data
16256 @opindex mfix-and-continue
16257 @opindex ffix-and-continue
16258 @opindex findirect-data
16259 Generate code suitable for fast turnaround development, such as to
16260 allow GDB to dynamically load @file{.o} files into already-running
16261 programs. @option{-findirect-data} and @option{-ffix-and-continue}
16262 are provided for backwards compatibility.
16263
16264 @item -all_load
16265 @opindex all_load
16266 Loads all members of static archive libraries.
16267 See man ld(1) for more information.
16268
16269 @item -arch_errors_fatal
16270 @opindex arch_errors_fatal
16271 Cause the errors having to do with files that have the wrong architecture
16272 to be fatal.
16273
16274 @item -bind_at_load
16275 @opindex bind_at_load
16276 Causes the output file to be marked such that the dynamic linker will
16277 bind all undefined references when the file is loaded or launched.
16278
16279 @item -bundle
16280 @opindex bundle
16281 Produce a Mach-o bundle format file.
16282 See man ld(1) for more information.
16283
16284 @item -bundle_loader @var{executable}
16285 @opindex bundle_loader
16286 This option specifies the @var{executable} that will load the build
16287 output file being linked. See man ld(1) for more information.
16288
16289 @item -dynamiclib
16290 @opindex dynamiclib
16291 When passed this option, GCC produces a dynamic library instead of
16292 an executable when linking, using the Darwin @file{libtool} command.
16293
16294 @item -force_cpusubtype_ALL
16295 @opindex force_cpusubtype_ALL
16296 This causes GCC's output file to have the @samp{ALL} subtype, instead of
16297 one controlled by the @option{-mcpu} or @option{-march} option.
16298
16299 @item -allowable_client @var{client_name}
16300 @itemx -client_name
16301 @itemx -compatibility_version
16302 @itemx -current_version
16303 @itemx -dead_strip
16304 @itemx -dependency-file
16305 @itemx -dylib_file
16306 @itemx -dylinker_install_name
16307 @itemx -dynamic
16308 @itemx -exported_symbols_list
16309 @itemx -filelist
16310 @need 800
16311 @itemx -flat_namespace
16312 @itemx -force_flat_namespace
16313 @itemx -headerpad_max_install_names
16314 @itemx -image_base
16315 @itemx -init
16316 @itemx -install_name
16317 @itemx -keep_private_externs
16318 @itemx -multi_module
16319 @itemx -multiply_defined
16320 @itemx -multiply_defined_unused
16321 @need 800
16322 @itemx -noall_load
16323 @itemx -no_dead_strip_inits_and_terms
16324 @itemx -nofixprebinding
16325 @itemx -nomultidefs
16326 @itemx -noprebind
16327 @itemx -noseglinkedit
16328 @itemx -pagezero_size
16329 @itemx -prebind
16330 @itemx -prebind_all_twolevel_modules
16331 @itemx -private_bundle
16332 @need 800
16333 @itemx -read_only_relocs
16334 @itemx -sectalign
16335 @itemx -sectobjectsymbols
16336 @itemx -whyload
16337 @itemx -seg1addr
16338 @itemx -sectcreate
16339 @itemx -sectobjectsymbols
16340 @itemx -sectorder
16341 @itemx -segaddr
16342 @itemx -segs_read_only_addr
16343 @need 800
16344 @itemx -segs_read_write_addr
16345 @itemx -seg_addr_table
16346 @itemx -seg_addr_table_filename
16347 @itemx -seglinkedit
16348 @itemx -segprot
16349 @itemx -segs_read_only_addr
16350 @itemx -segs_read_write_addr
16351 @itemx -single_module
16352 @itemx -static
16353 @itemx -sub_library
16354 @need 800
16355 @itemx -sub_umbrella
16356 @itemx -twolevel_namespace
16357 @itemx -umbrella
16358 @itemx -undefined
16359 @itemx -unexported_symbols_list
16360 @itemx -weak_reference_mismatches
16361 @itemx -whatsloaded
16362 @opindex allowable_client
16363 @opindex client_name
16364 @opindex compatibility_version
16365 @opindex current_version
16366 @opindex dead_strip
16367 @opindex dependency-file
16368 @opindex dylib_file
16369 @opindex dylinker_install_name
16370 @opindex dynamic
16371 @opindex exported_symbols_list
16372 @opindex filelist
16373 @opindex flat_namespace
16374 @opindex force_flat_namespace
16375 @opindex headerpad_max_install_names
16376 @opindex image_base
16377 @opindex init
16378 @opindex install_name
16379 @opindex keep_private_externs
16380 @opindex multi_module
16381 @opindex multiply_defined
16382 @opindex multiply_defined_unused
16383 @opindex noall_load
16384 @opindex no_dead_strip_inits_and_terms
16385 @opindex nofixprebinding
16386 @opindex nomultidefs
16387 @opindex noprebind
16388 @opindex noseglinkedit
16389 @opindex pagezero_size
16390 @opindex prebind
16391 @opindex prebind_all_twolevel_modules
16392 @opindex private_bundle
16393 @opindex read_only_relocs
16394 @opindex sectalign
16395 @opindex sectobjectsymbols
16396 @opindex whyload
16397 @opindex seg1addr
16398 @opindex sectcreate
16399 @opindex sectobjectsymbols
16400 @opindex sectorder
16401 @opindex segaddr
16402 @opindex segs_read_only_addr
16403 @opindex segs_read_write_addr
16404 @opindex seg_addr_table
16405 @opindex seg_addr_table_filename
16406 @opindex seglinkedit
16407 @opindex segprot
16408 @opindex segs_read_only_addr
16409 @opindex segs_read_write_addr
16410 @opindex single_module
16411 @opindex static
16412 @opindex sub_library
16413 @opindex sub_umbrella
16414 @opindex twolevel_namespace
16415 @opindex umbrella
16416 @opindex undefined
16417 @opindex unexported_symbols_list
16418 @opindex weak_reference_mismatches
16419 @opindex whatsloaded
16420 These options are passed to the Darwin linker. The Darwin linker man page
16421 describes them in detail.
16422 @end table
16423
16424 @node DEC Alpha Options
16425 @subsection DEC Alpha Options
16426
16427 These @samp{-m} options are defined for the DEC Alpha implementations:
16428
16429 @table @gcctabopt
16430 @item -mno-soft-float
16431 @itemx -msoft-float
16432 @opindex mno-soft-float
16433 @opindex msoft-float
16434 Use (do not use) the hardware floating-point instructions for
16435 floating-point operations. When @option{-msoft-float} is specified,
16436 functions in @file{libgcc.a} are used to perform floating-point
16437 operations. Unless they are replaced by routines that emulate the
16438 floating-point operations, or compiled in such a way as to call such
16439 emulations routines, these routines issue floating-point
16440 operations. If you are compiling for an Alpha without floating-point
16441 operations, you must ensure that the library is built so as not to call
16442 them.
16443
16444 Note that Alpha implementations without floating-point operations are
16445 required to have floating-point registers.
16446
16447 @item -mfp-reg
16448 @itemx -mno-fp-regs
16449 @opindex mfp-reg
16450 @opindex mno-fp-regs
16451 Generate code that uses (does not use) the floating-point register set.
16452 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
16453 register set is not used, floating-point operands are passed in integer
16454 registers as if they were integers and floating-point results are passed
16455 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
16456 so any function with a floating-point argument or return value called by code
16457 compiled with @option{-mno-fp-regs} must also be compiled with that
16458 option.
16459
16460 A typical use of this option is building a kernel that does not use,
16461 and hence need not save and restore, any floating-point registers.
16462
16463 @item -mieee
16464 @opindex mieee
16465 The Alpha architecture implements floating-point hardware optimized for
16466 maximum performance. It is mostly compliant with the IEEE floating-point
16467 standard. However, for full compliance, software assistance is
16468 required. This option generates code fully IEEE-compliant code
16469 @emph{except} that the @var{inexact-flag} is not maintained (see below).
16470 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
16471 defined during compilation. The resulting code is less efficient but is
16472 able to correctly support denormalized numbers and exceptional IEEE
16473 values such as not-a-number and plus/minus infinity. Other Alpha
16474 compilers call this option @option{-ieee_with_no_inexact}.
16475
16476 @item -mieee-with-inexact
16477 @opindex mieee-with-inexact
16478 This is like @option{-mieee} except the generated code also maintains
16479 the IEEE @var{inexact-flag}. Turning on this option causes the
16480 generated code to implement fully-compliant IEEE math. In addition to
16481 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
16482 macro. On some Alpha implementations the resulting code may execute
16483 significantly slower than the code generated by default. Since there is
16484 very little code that depends on the @var{inexact-flag}, you should
16485 normally not specify this option. Other Alpha compilers call this
16486 option @option{-ieee_with_inexact}.
16487
16488 @item -mfp-trap-mode=@var{trap-mode}
16489 @opindex mfp-trap-mode
16490 This option controls what floating-point related traps are enabled.
16491 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
16492 The trap mode can be set to one of four values:
16493
16494 @table @samp
16495 @item n
16496 This is the default (normal) setting. The only traps that are enabled
16497 are the ones that cannot be disabled in software (e.g., division by zero
16498 trap).
16499
16500 @item u
16501 In addition to the traps enabled by @samp{n}, underflow traps are enabled
16502 as well.
16503
16504 @item su
16505 Like @samp{u}, but the instructions are marked to be safe for software
16506 completion (see Alpha architecture manual for details).
16507
16508 @item sui
16509 Like @samp{su}, but inexact traps are enabled as well.
16510 @end table
16511
16512 @item -mfp-rounding-mode=@var{rounding-mode}
16513 @opindex mfp-rounding-mode
16514 Selects the IEEE rounding mode. Other Alpha compilers call this option
16515 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
16516 of:
16517
16518 @table @samp
16519 @item n
16520 Normal IEEE rounding mode. Floating-point numbers are rounded towards
16521 the nearest machine number or towards the even machine number in case
16522 of a tie.
16523
16524 @item m
16525 Round towards minus infinity.
16526
16527 @item c
16528 Chopped rounding mode. Floating-point numbers are rounded towards zero.
16529
16530 @item d
16531 Dynamic rounding mode. A field in the floating-point control register
16532 (@var{fpcr}, see Alpha architecture reference manual) controls the
16533 rounding mode in effect. The C library initializes this register for
16534 rounding towards plus infinity. Thus, unless your program modifies the
16535 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
16536 @end table
16537
16538 @item -mtrap-precision=@var{trap-precision}
16539 @opindex mtrap-precision
16540 In the Alpha architecture, floating-point traps are imprecise. This
16541 means without software assistance it is impossible to recover from a
16542 floating trap and program execution normally needs to be terminated.
16543 GCC can generate code that can assist operating system trap handlers
16544 in determining the exact location that caused a floating-point trap.
16545 Depending on the requirements of an application, different levels of
16546 precisions can be selected:
16547
16548 @table @samp
16549 @item p
16550 Program precision. This option is the default and means a trap handler
16551 can only identify which program caused a floating-point exception.
16552
16553 @item f
16554 Function precision. The trap handler can determine the function that
16555 caused a floating-point exception.
16556
16557 @item i
16558 Instruction precision. The trap handler can determine the exact
16559 instruction that caused a floating-point exception.
16560 @end table
16561
16562 Other Alpha compilers provide the equivalent options called
16563 @option{-scope_safe} and @option{-resumption_safe}.
16564
16565 @item -mieee-conformant
16566 @opindex mieee-conformant
16567 This option marks the generated code as IEEE conformant. You must not
16568 use this option unless you also specify @option{-mtrap-precision=i} and either
16569 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
16570 is to emit the line @samp{.eflag 48} in the function prologue of the
16571 generated assembly file.
16572
16573 @item -mbuild-constants
16574 @opindex mbuild-constants
16575 Normally GCC examines a 32- or 64-bit integer constant to
16576 see if it can construct it from smaller constants in two or three
16577 instructions. If it cannot, it outputs the constant as a literal and
16578 generates code to load it from the data segment at run time.
16579
16580 Use this option to require GCC to construct @emph{all} integer constants
16581 using code, even if it takes more instructions (the maximum is six).
16582
16583 You typically use this option to build a shared library dynamic
16584 loader. Itself a shared library, it must relocate itself in memory
16585 before it can find the variables and constants in its own data segment.
16586
16587 @item -mbwx
16588 @itemx -mno-bwx
16589 @itemx -mcix
16590 @itemx -mno-cix
16591 @itemx -mfix
16592 @itemx -mno-fix
16593 @itemx -mmax
16594 @itemx -mno-max
16595 @opindex mbwx
16596 @opindex mno-bwx
16597 @opindex mcix
16598 @opindex mno-cix
16599 @opindex mfix
16600 @opindex mno-fix
16601 @opindex mmax
16602 @opindex mno-max
16603 Indicate whether GCC should generate code to use the optional BWX,
16604 CIX, FIX and MAX instruction sets. The default is to use the instruction
16605 sets supported by the CPU type specified via @option{-mcpu=} option or that
16606 of the CPU on which GCC was built if none is specified.
16607
16608 @item -mfloat-vax
16609 @itemx -mfloat-ieee
16610 @opindex mfloat-vax
16611 @opindex mfloat-ieee
16612 Generate code that uses (does not use) VAX F and G floating-point
16613 arithmetic instead of IEEE single and double precision.
16614
16615 @item -mexplicit-relocs
16616 @itemx -mno-explicit-relocs
16617 @opindex mexplicit-relocs
16618 @opindex mno-explicit-relocs
16619 Older Alpha assemblers provided no way to generate symbol relocations
16620 except via assembler macros. Use of these macros does not allow
16621 optimal instruction scheduling. GNU binutils as of version 2.12
16622 supports a new syntax that allows the compiler to explicitly mark
16623 which relocations should apply to which instructions. This option
16624 is mostly useful for debugging, as GCC detects the capabilities of
16625 the assembler when it is built and sets the default accordingly.
16626
16627 @item -msmall-data
16628 @itemx -mlarge-data
16629 @opindex msmall-data
16630 @opindex mlarge-data
16631 When @option{-mexplicit-relocs} is in effect, static data is
16632 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
16633 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
16634 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
16635 16-bit relocations off of the @code{$gp} register. This limits the
16636 size of the small data area to 64KB, but allows the variables to be
16637 directly accessed via a single instruction.
16638
16639 The default is @option{-mlarge-data}. With this option the data area
16640 is limited to just below 2GB@. Programs that require more than 2GB of
16641 data must use @code{malloc} or @code{mmap} to allocate the data in the
16642 heap instead of in the program's data segment.
16643
16644 When generating code for shared libraries, @option{-fpic} implies
16645 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
16646
16647 @item -msmall-text
16648 @itemx -mlarge-text
16649 @opindex msmall-text
16650 @opindex mlarge-text
16651 When @option{-msmall-text} is used, the compiler assumes that the
16652 code of the entire program (or shared library) fits in 4MB, and is
16653 thus reachable with a branch instruction. When @option{-msmall-data}
16654 is used, the compiler can assume that all local symbols share the
16655 same @code{$gp} value, and thus reduce the number of instructions
16656 required for a function call from 4 to 1.
16657
16658 The default is @option{-mlarge-text}.
16659
16660 @item -mcpu=@var{cpu_type}
16661 @opindex mcpu
16662 Set the instruction set and instruction scheduling parameters for
16663 machine type @var{cpu_type}. You can specify either the @samp{EV}
16664 style name or the corresponding chip number. GCC supports scheduling
16665 parameters for the EV4, EV5 and EV6 family of processors and
16666 chooses the default values for the instruction set from the processor
16667 you specify. If you do not specify a processor type, GCC defaults
16668 to the processor on which the compiler was built.
16669
16670 Supported values for @var{cpu_type} are
16671
16672 @table @samp
16673 @item ev4
16674 @itemx ev45
16675 @itemx 21064
16676 Schedules as an EV4 and has no instruction set extensions.
16677
16678 @item ev5
16679 @itemx 21164
16680 Schedules as an EV5 and has no instruction set extensions.
16681
16682 @item ev56
16683 @itemx 21164a
16684 Schedules as an EV5 and supports the BWX extension.
16685
16686 @item pca56
16687 @itemx 21164pc
16688 @itemx 21164PC
16689 Schedules as an EV5 and supports the BWX and MAX extensions.
16690
16691 @item ev6
16692 @itemx 21264
16693 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
16694
16695 @item ev67
16696 @itemx 21264a
16697 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
16698 @end table
16699
16700 Native toolchains also support the value @samp{native},
16701 which selects the best architecture option for the host processor.
16702 @option{-mcpu=native} has no effect if GCC does not recognize
16703 the processor.
16704
16705 @item -mtune=@var{cpu_type}
16706 @opindex mtune
16707 Set only the instruction scheduling parameters for machine type
16708 @var{cpu_type}. The instruction set is not changed.
16709
16710 Native toolchains also support the value @samp{native},
16711 which selects the best architecture option for the host processor.
16712 @option{-mtune=native} has no effect if GCC does not recognize
16713 the processor.
16714
16715 @item -mmemory-latency=@var{time}
16716 @opindex mmemory-latency
16717 Sets the latency the scheduler should assume for typical memory
16718 references as seen by the application. This number is highly
16719 dependent on the memory access patterns used by the application
16720 and the size of the external cache on the machine.
16721
16722 Valid options for @var{time} are
16723
16724 @table @samp
16725 @item @var{number}
16726 A decimal number representing clock cycles.
16727
16728 @item L1
16729 @itemx L2
16730 @itemx L3
16731 @itemx main
16732 The compiler contains estimates of the number of clock cycles for
16733 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
16734 (also called Dcache, Scache, and Bcache), as well as to main memory.
16735 Note that L3 is only valid for EV5.
16736
16737 @end table
16738 @end table
16739
16740 @node FR30 Options
16741 @subsection FR30 Options
16742 @cindex FR30 Options
16743
16744 These options are defined specifically for the FR30 port.
16745
16746 @table @gcctabopt
16747
16748 @item -msmall-model
16749 @opindex msmall-model
16750 Use the small address space model. This can produce smaller code, but
16751 it does assume that all symbolic values and addresses fit into a
16752 20-bit range.
16753
16754 @item -mno-lsim
16755 @opindex mno-lsim
16756 Assume that runtime support has been provided and so there is no need
16757 to include the simulator library (@file{libsim.a}) on the linker
16758 command line.
16759
16760 @end table
16761
16762 @node FT32 Options
16763 @subsection FT32 Options
16764 @cindex FT32 Options
16765
16766 These options are defined specifically for the FT32 port.
16767
16768 @table @gcctabopt
16769
16770 @item -msim
16771 @opindex msim
16772 Specifies that the program will be run on the simulator. This causes
16773 an alternate runtime startup and library to be linked.
16774 You must not use this option when generating programs that will run on
16775 real hardware; you must provide your own runtime library for whatever
16776 I/O functions are needed.
16777
16778 @item -mlra
16779 @opindex mlra
16780 Enable Local Register Allocation. This is still experimental for FT32,
16781 so by default the compiler uses standard reload.
16782
16783 @item -mnodiv
16784 @opindex mnodiv
16785 Do not use div and mod instructions.
16786
16787 @end table
16788
16789 @node FRV Options
16790 @subsection FRV Options
16791 @cindex FRV Options
16792
16793 @table @gcctabopt
16794 @item -mgpr-32
16795 @opindex mgpr-32
16796
16797 Only use the first 32 general-purpose registers.
16798
16799 @item -mgpr-64
16800 @opindex mgpr-64
16801
16802 Use all 64 general-purpose registers.
16803
16804 @item -mfpr-32
16805 @opindex mfpr-32
16806
16807 Use only the first 32 floating-point registers.
16808
16809 @item -mfpr-64
16810 @opindex mfpr-64
16811
16812 Use all 64 floating-point registers.
16813
16814 @item -mhard-float
16815 @opindex mhard-float
16816
16817 Use hardware instructions for floating-point operations.
16818
16819 @item -msoft-float
16820 @opindex msoft-float
16821
16822 Use library routines for floating-point operations.
16823
16824 @item -malloc-cc
16825 @opindex malloc-cc
16826
16827 Dynamically allocate condition code registers.
16828
16829 @item -mfixed-cc
16830 @opindex mfixed-cc
16831
16832 Do not try to dynamically allocate condition code registers, only
16833 use @code{icc0} and @code{fcc0}.
16834
16835 @item -mdword
16836 @opindex mdword
16837
16838 Change ABI to use double word insns.
16839
16840 @item -mno-dword
16841 @opindex mno-dword
16842
16843 Do not use double word instructions.
16844
16845 @item -mdouble
16846 @opindex mdouble
16847
16848 Use floating-point double instructions.
16849
16850 @item -mno-double
16851 @opindex mno-double
16852
16853 Do not use floating-point double instructions.
16854
16855 @item -mmedia
16856 @opindex mmedia
16857
16858 Use media instructions.
16859
16860 @item -mno-media
16861 @opindex mno-media
16862
16863 Do not use media instructions.
16864
16865 @item -mmuladd
16866 @opindex mmuladd
16867
16868 Use multiply and add/subtract instructions.
16869
16870 @item -mno-muladd
16871 @opindex mno-muladd
16872
16873 Do not use multiply and add/subtract instructions.
16874
16875 @item -mfdpic
16876 @opindex mfdpic
16877
16878 Select the FDPIC ABI, which uses function descriptors to represent
16879 pointers to functions. Without any PIC/PIE-related options, it
16880 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
16881 assumes GOT entries and small data are within a 12-bit range from the
16882 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
16883 are computed with 32 bits.
16884 With a @samp{bfin-elf} target, this option implies @option{-msim}.
16885
16886 @item -minline-plt
16887 @opindex minline-plt
16888
16889 Enable inlining of PLT entries in function calls to functions that are
16890 not known to bind locally. It has no effect without @option{-mfdpic}.
16891 It's enabled by default if optimizing for speed and compiling for
16892 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
16893 optimization option such as @option{-O3} or above is present in the
16894 command line.
16895
16896 @item -mTLS
16897 @opindex mTLS
16898
16899 Assume a large TLS segment when generating thread-local code.
16900
16901 @item -mtls
16902 @opindex mtls
16903
16904 Do not assume a large TLS segment when generating thread-local code.
16905
16906 @item -mgprel-ro
16907 @opindex mgprel-ro
16908
16909 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
16910 that is known to be in read-only sections. It's enabled by default,
16911 except for @option{-fpic} or @option{-fpie}: even though it may help
16912 make the global offset table smaller, it trades 1 instruction for 4.
16913 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
16914 one of which may be shared by multiple symbols, and it avoids the need
16915 for a GOT entry for the referenced symbol, so it's more likely to be a
16916 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
16917
16918 @item -multilib-library-pic
16919 @opindex multilib-library-pic
16920
16921 Link with the (library, not FD) pic libraries. It's implied by
16922 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
16923 @option{-fpic} without @option{-mfdpic}. You should never have to use
16924 it explicitly.
16925
16926 @item -mlinked-fp
16927 @opindex mlinked-fp
16928
16929 Follow the EABI requirement of always creating a frame pointer whenever
16930 a stack frame is allocated. This option is enabled by default and can
16931 be disabled with @option{-mno-linked-fp}.
16932
16933 @item -mlong-calls
16934 @opindex mlong-calls
16935
16936 Use indirect addressing to call functions outside the current
16937 compilation unit. This allows the functions to be placed anywhere
16938 within the 32-bit address space.
16939
16940 @item -malign-labels
16941 @opindex malign-labels
16942
16943 Try to align labels to an 8-byte boundary by inserting NOPs into the
16944 previous packet. This option only has an effect when VLIW packing
16945 is enabled. It doesn't create new packets; it merely adds NOPs to
16946 existing ones.
16947
16948 @item -mlibrary-pic
16949 @opindex mlibrary-pic
16950
16951 Generate position-independent EABI code.
16952
16953 @item -macc-4
16954 @opindex macc-4
16955
16956 Use only the first four media accumulator registers.
16957
16958 @item -macc-8
16959 @opindex macc-8
16960
16961 Use all eight media accumulator registers.
16962
16963 @item -mpack
16964 @opindex mpack
16965
16966 Pack VLIW instructions.
16967
16968 @item -mno-pack
16969 @opindex mno-pack
16970
16971 Do not pack VLIW instructions.
16972
16973 @item -mno-eflags
16974 @opindex mno-eflags
16975
16976 Do not mark ABI switches in e_flags.
16977
16978 @item -mcond-move
16979 @opindex mcond-move
16980
16981 Enable the use of conditional-move instructions (default).
16982
16983 This switch is mainly for debugging the compiler and will likely be removed
16984 in a future version.
16985
16986 @item -mno-cond-move
16987 @opindex mno-cond-move
16988
16989 Disable the use of conditional-move instructions.
16990
16991 This switch is mainly for debugging the compiler and will likely be removed
16992 in a future version.
16993
16994 @item -mscc
16995 @opindex mscc
16996
16997 Enable the use of conditional set instructions (default).
16998
16999 This switch is mainly for debugging the compiler and will likely be removed
17000 in a future version.
17001
17002 @item -mno-scc
17003 @opindex mno-scc
17004
17005 Disable the use of conditional set instructions.
17006
17007 This switch is mainly for debugging the compiler and will likely be removed
17008 in a future version.
17009
17010 @item -mcond-exec
17011 @opindex mcond-exec
17012
17013 Enable the use of conditional execution (default).
17014
17015 This switch is mainly for debugging the compiler and will likely be removed
17016 in a future version.
17017
17018 @item -mno-cond-exec
17019 @opindex mno-cond-exec
17020
17021 Disable the use of conditional execution.
17022
17023 This switch is mainly for debugging the compiler and will likely be removed
17024 in a future version.
17025
17026 @item -mvliw-branch
17027 @opindex mvliw-branch
17028
17029 Run a pass to pack branches into VLIW instructions (default).
17030
17031 This switch is mainly for debugging the compiler and will likely be removed
17032 in a future version.
17033
17034 @item -mno-vliw-branch
17035 @opindex mno-vliw-branch
17036
17037 Do not run a pass to pack branches into VLIW instructions.
17038
17039 This switch is mainly for debugging the compiler and will likely be removed
17040 in a future version.
17041
17042 @item -mmulti-cond-exec
17043 @opindex mmulti-cond-exec
17044
17045 Enable optimization of @code{&&} and @code{||} in conditional execution
17046 (default).
17047
17048 This switch is mainly for debugging the compiler and will likely be removed
17049 in a future version.
17050
17051 @item -mno-multi-cond-exec
17052 @opindex mno-multi-cond-exec
17053
17054 Disable optimization of @code{&&} and @code{||} in conditional execution.
17055
17056 This switch is mainly for debugging the compiler and will likely be removed
17057 in a future version.
17058
17059 @item -mnested-cond-exec
17060 @opindex mnested-cond-exec
17061
17062 Enable nested conditional execution optimizations (default).
17063
17064 This switch is mainly for debugging the compiler and will likely be removed
17065 in a future version.
17066
17067 @item -mno-nested-cond-exec
17068 @opindex mno-nested-cond-exec
17069
17070 Disable nested conditional execution optimizations.
17071
17072 This switch is mainly for debugging the compiler and will likely be removed
17073 in a future version.
17074
17075 @item -moptimize-membar
17076 @opindex moptimize-membar
17077
17078 This switch removes redundant @code{membar} instructions from the
17079 compiler-generated code. It is enabled by default.
17080
17081 @item -mno-optimize-membar
17082 @opindex mno-optimize-membar
17083
17084 This switch disables the automatic removal of redundant @code{membar}
17085 instructions from the generated code.
17086
17087 @item -mtomcat-stats
17088 @opindex mtomcat-stats
17089
17090 Cause gas to print out tomcat statistics.
17091
17092 @item -mcpu=@var{cpu}
17093 @opindex mcpu
17094
17095 Select the processor type for which to generate code. Possible values are
17096 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
17097 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
17098
17099 @end table
17100
17101 @node GNU/Linux Options
17102 @subsection GNU/Linux Options
17103
17104 These @samp{-m} options are defined for GNU/Linux targets:
17105
17106 @table @gcctabopt
17107 @item -mglibc
17108 @opindex mglibc
17109 Use the GNU C library. This is the default except
17110 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
17111 @samp{*-*-linux-*android*} targets.
17112
17113 @item -muclibc
17114 @opindex muclibc
17115 Use uClibc C library. This is the default on
17116 @samp{*-*-linux-*uclibc*} targets.
17117
17118 @item -mmusl
17119 @opindex mmusl
17120 Use the musl C library. This is the default on
17121 @samp{*-*-linux-*musl*} targets.
17122
17123 @item -mbionic
17124 @opindex mbionic
17125 Use Bionic C library. This is the default on
17126 @samp{*-*-linux-*android*} targets.
17127
17128 @item -mandroid
17129 @opindex mandroid
17130 Compile code compatible with Android platform. This is the default on
17131 @samp{*-*-linux-*android*} targets.
17132
17133 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
17134 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
17135 this option makes the GCC driver pass Android-specific options to the linker.
17136 Finally, this option causes the preprocessor macro @code{__ANDROID__}
17137 to be defined.
17138
17139 @item -tno-android-cc
17140 @opindex tno-android-cc
17141 Disable compilation effects of @option{-mandroid}, i.e., do not enable
17142 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
17143 @option{-fno-rtti} by default.
17144
17145 @item -tno-android-ld
17146 @opindex tno-android-ld
17147 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
17148 linking options to the linker.
17149
17150 @end table
17151
17152 @node H8/300 Options
17153 @subsection H8/300 Options
17154
17155 These @samp{-m} options are defined for the H8/300 implementations:
17156
17157 @table @gcctabopt
17158 @item -mrelax
17159 @opindex mrelax
17160 Shorten some address references at link time, when possible; uses the
17161 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
17162 ld, Using ld}, for a fuller description.
17163
17164 @item -mh
17165 @opindex mh
17166 Generate code for the H8/300H@.
17167
17168 @item -ms
17169 @opindex ms
17170 Generate code for the H8S@.
17171
17172 @item -mn
17173 @opindex mn
17174 Generate code for the H8S and H8/300H in the normal mode. This switch
17175 must be used either with @option{-mh} or @option{-ms}.
17176
17177 @item -ms2600
17178 @opindex ms2600
17179 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
17180
17181 @item -mexr
17182 @opindex mexr
17183 Extended registers are stored on stack before execution of function
17184 with monitor attribute. Default option is @option{-mexr}.
17185 This option is valid only for H8S targets.
17186
17187 @item -mno-exr
17188 @opindex mno-exr
17189 Extended registers are not stored on stack before execution of function
17190 with monitor attribute. Default option is @option{-mno-exr}.
17191 This option is valid only for H8S targets.
17192
17193 @item -mint32
17194 @opindex mint32
17195 Make @code{int} data 32 bits by default.
17196
17197 @item -malign-300
17198 @opindex malign-300
17199 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
17200 The default for the H8/300H and H8S is to align longs and floats on
17201 4-byte boundaries.
17202 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
17203 This option has no effect on the H8/300.
17204 @end table
17205
17206 @node HPPA Options
17207 @subsection HPPA Options
17208 @cindex HPPA Options
17209
17210 These @samp{-m} options are defined for the HPPA family of computers:
17211
17212 @table @gcctabopt
17213 @item -march=@var{architecture-type}
17214 @opindex march
17215 Generate code for the specified architecture. The choices for
17216 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
17217 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
17218 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
17219 architecture option for your machine. Code compiled for lower numbered
17220 architectures runs on higher numbered architectures, but not the
17221 other way around.
17222
17223 @item -mpa-risc-1-0
17224 @itemx -mpa-risc-1-1
17225 @itemx -mpa-risc-2-0
17226 @opindex mpa-risc-1-0
17227 @opindex mpa-risc-1-1
17228 @opindex mpa-risc-2-0
17229 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
17230
17231 @item -mjump-in-delay
17232 @opindex mjump-in-delay
17233 This option is ignored and provided for compatibility purposes only.
17234
17235 @item -mdisable-fpregs
17236 @opindex mdisable-fpregs
17237 Prevent floating-point registers from being used in any manner. This is
17238 necessary for compiling kernels that perform lazy context switching of
17239 floating-point registers. If you use this option and attempt to perform
17240 floating-point operations, the compiler aborts.
17241
17242 @item -mdisable-indexing
17243 @opindex mdisable-indexing
17244 Prevent the compiler from using indexing address modes. This avoids some
17245 rather obscure problems when compiling MIG generated code under MACH@.
17246
17247 @item -mno-space-regs
17248 @opindex mno-space-regs
17249 Generate code that assumes the target has no space registers. This allows
17250 GCC to generate faster indirect calls and use unscaled index address modes.
17251
17252 Such code is suitable for level 0 PA systems and kernels.
17253
17254 @item -mfast-indirect-calls
17255 @opindex mfast-indirect-calls
17256 Generate code that assumes calls never cross space boundaries. This
17257 allows GCC to emit code that performs faster indirect calls.
17258
17259 This option does not work in the presence of shared libraries or nested
17260 functions.
17261
17262 @item -mfixed-range=@var{register-range}
17263 @opindex mfixed-range
17264 Generate code treating the given register range as fixed registers.
17265 A fixed register is one that the register allocator cannot use. This is
17266 useful when compiling kernel code. A register range is specified as
17267 two registers separated by a dash. Multiple register ranges can be
17268 specified separated by a comma.
17269
17270 @item -mlong-load-store
17271 @opindex mlong-load-store
17272 Generate 3-instruction load and store sequences as sometimes required by
17273 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
17274 the HP compilers.
17275
17276 @item -mportable-runtime
17277 @opindex mportable-runtime
17278 Use the portable calling conventions proposed by HP for ELF systems.
17279
17280 @item -mgas
17281 @opindex mgas
17282 Enable the use of assembler directives only GAS understands.
17283
17284 @item -mschedule=@var{cpu-type}
17285 @opindex mschedule
17286 Schedule code according to the constraints for the machine type
17287 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
17288 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
17289 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
17290 proper scheduling option for your machine. The default scheduling is
17291 @samp{8000}.
17292
17293 @item -mlinker-opt
17294 @opindex mlinker-opt
17295 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
17296 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
17297 linkers in which they give bogus error messages when linking some programs.
17298
17299 @item -msoft-float
17300 @opindex msoft-float
17301 Generate output containing library calls for floating point.
17302 @strong{Warning:} the requisite libraries are not available for all HPPA
17303 targets. Normally the facilities of the machine's usual C compiler are
17304 used, but this cannot be done directly in cross-compilation. You must make
17305 your own arrangements to provide suitable library functions for
17306 cross-compilation.
17307
17308 @option{-msoft-float} changes the calling convention in the output file;
17309 therefore, it is only useful if you compile @emph{all} of a program with
17310 this option. In particular, you need to compile @file{libgcc.a}, the
17311 library that comes with GCC, with @option{-msoft-float} in order for
17312 this to work.
17313
17314 @item -msio
17315 @opindex msio
17316 Generate the predefine, @code{_SIO}, for server IO@. The default is
17317 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
17318 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
17319 options are available under HP-UX and HI-UX@.
17320
17321 @item -mgnu-ld
17322 @opindex mgnu-ld
17323 Use options specific to GNU @command{ld}.
17324 This passes @option{-shared} to @command{ld} when
17325 building a shared library. It is the default when GCC is configured,
17326 explicitly or implicitly, with the GNU linker. This option does not
17327 affect which @command{ld} is called; it only changes what parameters
17328 are passed to that @command{ld}.
17329 The @command{ld} that is called is determined by the
17330 @option{--with-ld} configure option, GCC's program search path, and
17331 finally by the user's @env{PATH}. The linker used by GCC can be printed
17332 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
17333 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
17334
17335 @item -mhp-ld
17336 @opindex mhp-ld
17337 Use options specific to HP @command{ld}.
17338 This passes @option{-b} to @command{ld} when building
17339 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
17340 links. It is the default when GCC is configured, explicitly or
17341 implicitly, with the HP linker. This option does not affect
17342 which @command{ld} is called; it only changes what parameters are passed to that
17343 @command{ld}.
17344 The @command{ld} that is called is determined by the @option{--with-ld}
17345 configure option, GCC's program search path, and finally by the user's
17346 @env{PATH}. The linker used by GCC can be printed using @samp{which
17347 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
17348 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
17349
17350 @item -mlong-calls
17351 @opindex mno-long-calls
17352 Generate code that uses long call sequences. This ensures that a call
17353 is always able to reach linker generated stubs. The default is to generate
17354 long calls only when the distance from the call site to the beginning
17355 of the function or translation unit, as the case may be, exceeds a
17356 predefined limit set by the branch type being used. The limits for
17357 normal calls are 7,600,000 and 240,000 bytes, respectively for the
17358 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
17359 240,000 bytes.
17360
17361 Distances are measured from the beginning of functions when using the
17362 @option{-ffunction-sections} option, or when using the @option{-mgas}
17363 and @option{-mno-portable-runtime} options together under HP-UX with
17364 the SOM linker.
17365
17366 It is normally not desirable to use this option as it degrades
17367 performance. However, it may be useful in large applications,
17368 particularly when partial linking is used to build the application.
17369
17370 The types of long calls used depends on the capabilities of the
17371 assembler and linker, and the type of code being generated. The
17372 impact on systems that support long absolute calls, and long pic
17373 symbol-difference or pc-relative calls should be relatively small.
17374 However, an indirect call is used on 32-bit ELF systems in pic code
17375 and it is quite long.
17376
17377 @item -munix=@var{unix-std}
17378 @opindex march
17379 Generate compiler predefines and select a startfile for the specified
17380 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
17381 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
17382 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
17383 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
17384 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
17385 and later.
17386
17387 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
17388 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
17389 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
17390 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
17391 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
17392 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
17393
17394 It is @emph{important} to note that this option changes the interfaces
17395 for various library routines. It also affects the operational behavior
17396 of the C library. Thus, @emph{extreme} care is needed in using this
17397 option.
17398
17399 Library code that is intended to operate with more than one UNIX
17400 standard must test, set and restore the variable @code{__xpg4_extended_mask}
17401 as appropriate. Most GNU software doesn't provide this capability.
17402
17403 @item -nolibdld
17404 @opindex nolibdld
17405 Suppress the generation of link options to search libdld.sl when the
17406 @option{-static} option is specified on HP-UX 10 and later.
17407
17408 @item -static
17409 @opindex static
17410 The HP-UX implementation of setlocale in libc has a dependency on
17411 libdld.sl. There isn't an archive version of libdld.sl. Thus,
17412 when the @option{-static} option is specified, special link options
17413 are needed to resolve this dependency.
17414
17415 On HP-UX 10 and later, the GCC driver adds the necessary options to
17416 link with libdld.sl when the @option{-static} option is specified.
17417 This causes the resulting binary to be dynamic. On the 64-bit port,
17418 the linkers generate dynamic binaries by default in any case. The
17419 @option{-nolibdld} option can be used to prevent the GCC driver from
17420 adding these link options.
17421
17422 @item -threads
17423 @opindex threads
17424 Add support for multithreading with the @dfn{dce thread} library
17425 under HP-UX@. This option sets flags for both the preprocessor and
17426 linker.
17427 @end table
17428
17429 @node IA-64 Options
17430 @subsection IA-64 Options
17431 @cindex IA-64 Options
17432
17433 These are the @samp{-m} options defined for the Intel IA-64 architecture.
17434
17435 @table @gcctabopt
17436 @item -mbig-endian
17437 @opindex mbig-endian
17438 Generate code for a big-endian target. This is the default for HP-UX@.
17439
17440 @item -mlittle-endian
17441 @opindex mlittle-endian
17442 Generate code for a little-endian target. This is the default for AIX5
17443 and GNU/Linux.
17444
17445 @item -mgnu-as
17446 @itemx -mno-gnu-as
17447 @opindex mgnu-as
17448 @opindex mno-gnu-as
17449 Generate (or don't) code for the GNU assembler. This is the default.
17450 @c Also, this is the default if the configure option @option{--with-gnu-as}
17451 @c is used.
17452
17453 @item -mgnu-ld
17454 @itemx -mno-gnu-ld
17455 @opindex mgnu-ld
17456 @opindex mno-gnu-ld
17457 Generate (or don't) code for the GNU linker. This is the default.
17458 @c Also, this is the default if the configure option @option{--with-gnu-ld}
17459 @c is used.
17460
17461 @item -mno-pic
17462 @opindex mno-pic
17463 Generate code that does not use a global pointer register. The result
17464 is not position independent code, and violates the IA-64 ABI@.
17465
17466 @item -mvolatile-asm-stop
17467 @itemx -mno-volatile-asm-stop
17468 @opindex mvolatile-asm-stop
17469 @opindex mno-volatile-asm-stop
17470 Generate (or don't) a stop bit immediately before and after volatile asm
17471 statements.
17472
17473 @item -mregister-names
17474 @itemx -mno-register-names
17475 @opindex mregister-names
17476 @opindex mno-register-names
17477 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
17478 the stacked registers. This may make assembler output more readable.
17479
17480 @item -mno-sdata
17481 @itemx -msdata
17482 @opindex mno-sdata
17483 @opindex msdata
17484 Disable (or enable) optimizations that use the small data section. This may
17485 be useful for working around optimizer bugs.
17486
17487 @item -mconstant-gp
17488 @opindex mconstant-gp
17489 Generate code that uses a single constant global pointer value. This is
17490 useful when compiling kernel code.
17491
17492 @item -mauto-pic
17493 @opindex mauto-pic
17494 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
17495 This is useful when compiling firmware code.
17496
17497 @item -minline-float-divide-min-latency
17498 @opindex minline-float-divide-min-latency
17499 Generate code for inline divides of floating-point values
17500 using the minimum latency algorithm.
17501
17502 @item -minline-float-divide-max-throughput
17503 @opindex minline-float-divide-max-throughput
17504 Generate code for inline divides of floating-point values
17505 using the maximum throughput algorithm.
17506
17507 @item -mno-inline-float-divide
17508 @opindex mno-inline-float-divide
17509 Do not generate inline code for divides of floating-point values.
17510
17511 @item -minline-int-divide-min-latency
17512 @opindex minline-int-divide-min-latency
17513 Generate code for inline divides of integer values
17514 using the minimum latency algorithm.
17515
17516 @item -minline-int-divide-max-throughput
17517 @opindex minline-int-divide-max-throughput
17518 Generate code for inline divides of integer values
17519 using the maximum throughput algorithm.
17520
17521 @item -mno-inline-int-divide
17522 @opindex mno-inline-int-divide
17523 Do not generate inline code for divides of integer values.
17524
17525 @item -minline-sqrt-min-latency
17526 @opindex minline-sqrt-min-latency
17527 Generate code for inline square roots
17528 using the minimum latency algorithm.
17529
17530 @item -minline-sqrt-max-throughput
17531 @opindex minline-sqrt-max-throughput
17532 Generate code for inline square roots
17533 using the maximum throughput algorithm.
17534
17535 @item -mno-inline-sqrt
17536 @opindex mno-inline-sqrt
17537 Do not generate inline code for @code{sqrt}.
17538
17539 @item -mfused-madd
17540 @itemx -mno-fused-madd
17541 @opindex mfused-madd
17542 @opindex mno-fused-madd
17543 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
17544 instructions. The default is to use these instructions.
17545
17546 @item -mno-dwarf2-asm
17547 @itemx -mdwarf2-asm
17548 @opindex mno-dwarf2-asm
17549 @opindex mdwarf2-asm
17550 Don't (or do) generate assembler code for the DWARF line number debugging
17551 info. This may be useful when not using the GNU assembler.
17552
17553 @item -mearly-stop-bits
17554 @itemx -mno-early-stop-bits
17555 @opindex mearly-stop-bits
17556 @opindex mno-early-stop-bits
17557 Allow stop bits to be placed earlier than immediately preceding the
17558 instruction that triggered the stop bit. This can improve instruction
17559 scheduling, but does not always do so.
17560
17561 @item -mfixed-range=@var{register-range}
17562 @opindex mfixed-range
17563 Generate code treating the given register range as fixed registers.
17564 A fixed register is one that the register allocator cannot use. This is
17565 useful when compiling kernel code. A register range is specified as
17566 two registers separated by a dash. Multiple register ranges can be
17567 specified separated by a comma.
17568
17569 @item -mtls-size=@var{tls-size}
17570 @opindex mtls-size
17571 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
17572 64.
17573
17574 @item -mtune=@var{cpu-type}
17575 @opindex mtune
17576 Tune the instruction scheduling for a particular CPU, Valid values are
17577 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
17578 and @samp{mckinley}.
17579
17580 @item -milp32
17581 @itemx -mlp64
17582 @opindex milp32
17583 @opindex mlp64
17584 Generate code for a 32-bit or 64-bit environment.
17585 The 32-bit environment sets int, long and pointer to 32 bits.
17586 The 64-bit environment sets int to 32 bits and long and pointer
17587 to 64 bits. These are HP-UX specific flags.
17588
17589 @item -mno-sched-br-data-spec
17590 @itemx -msched-br-data-spec
17591 @opindex mno-sched-br-data-spec
17592 @opindex msched-br-data-spec
17593 (Dis/En)able data speculative scheduling before reload.
17594 This results in generation of @code{ld.a} instructions and
17595 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17596 The default setting is disabled.
17597
17598 @item -msched-ar-data-spec
17599 @itemx -mno-sched-ar-data-spec
17600 @opindex msched-ar-data-spec
17601 @opindex mno-sched-ar-data-spec
17602 (En/Dis)able data speculative scheduling after reload.
17603 This results in generation of @code{ld.a} instructions and
17604 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17605 The default setting is enabled.
17606
17607 @item -mno-sched-control-spec
17608 @itemx -msched-control-spec
17609 @opindex mno-sched-control-spec
17610 @opindex msched-control-spec
17611 (Dis/En)able control speculative scheduling. This feature is
17612 available only during region scheduling (i.e.@: before reload).
17613 This results in generation of the @code{ld.s} instructions and
17614 the corresponding check instructions @code{chk.s}.
17615 The default setting is disabled.
17616
17617 @item -msched-br-in-data-spec
17618 @itemx -mno-sched-br-in-data-spec
17619 @opindex msched-br-in-data-spec
17620 @opindex mno-sched-br-in-data-spec
17621 (En/Dis)able speculative scheduling of the instructions that
17622 are dependent on the data speculative loads before reload.
17623 This is effective only with @option{-msched-br-data-spec} enabled.
17624 The default setting is enabled.
17625
17626 @item -msched-ar-in-data-spec
17627 @itemx -mno-sched-ar-in-data-spec
17628 @opindex msched-ar-in-data-spec
17629 @opindex mno-sched-ar-in-data-spec
17630 (En/Dis)able speculative scheduling of the instructions that
17631 are dependent on the data speculative loads after reload.
17632 This is effective only with @option{-msched-ar-data-spec} enabled.
17633 The default setting is enabled.
17634
17635 @item -msched-in-control-spec
17636 @itemx -mno-sched-in-control-spec
17637 @opindex msched-in-control-spec
17638 @opindex mno-sched-in-control-spec
17639 (En/Dis)able speculative scheduling of the instructions that
17640 are dependent on the control speculative loads.
17641 This is effective only with @option{-msched-control-spec} enabled.
17642 The default setting is enabled.
17643
17644 @item -mno-sched-prefer-non-data-spec-insns
17645 @itemx -msched-prefer-non-data-spec-insns
17646 @opindex mno-sched-prefer-non-data-spec-insns
17647 @opindex msched-prefer-non-data-spec-insns
17648 If enabled, data-speculative instructions are chosen for schedule
17649 only if there are no other choices at the moment. This makes
17650 the use of the data speculation much more conservative.
17651 The default setting is disabled.
17652
17653 @item -mno-sched-prefer-non-control-spec-insns
17654 @itemx -msched-prefer-non-control-spec-insns
17655 @opindex mno-sched-prefer-non-control-spec-insns
17656 @opindex msched-prefer-non-control-spec-insns
17657 If enabled, control-speculative instructions are chosen for schedule
17658 only if there are no other choices at the moment. This makes
17659 the use of the control speculation much more conservative.
17660 The default setting is disabled.
17661
17662 @item -mno-sched-count-spec-in-critical-path
17663 @itemx -msched-count-spec-in-critical-path
17664 @opindex mno-sched-count-spec-in-critical-path
17665 @opindex msched-count-spec-in-critical-path
17666 If enabled, speculative dependencies are considered during
17667 computation of the instructions priorities. This makes the use of the
17668 speculation a bit more conservative.
17669 The default setting is disabled.
17670
17671 @item -msched-spec-ldc
17672 @opindex msched-spec-ldc
17673 Use a simple data speculation check. This option is on by default.
17674
17675 @item -msched-control-spec-ldc
17676 @opindex msched-spec-ldc
17677 Use a simple check for control speculation. This option is on by default.
17678
17679 @item -msched-stop-bits-after-every-cycle
17680 @opindex msched-stop-bits-after-every-cycle
17681 Place a stop bit after every cycle when scheduling. This option is on
17682 by default.
17683
17684 @item -msched-fp-mem-deps-zero-cost
17685 @opindex msched-fp-mem-deps-zero-cost
17686 Assume that floating-point stores and loads are not likely to cause a conflict
17687 when placed into the same instruction group. This option is disabled by
17688 default.
17689
17690 @item -msel-sched-dont-check-control-spec
17691 @opindex msel-sched-dont-check-control-spec
17692 Generate checks for control speculation in selective scheduling.
17693 This flag is disabled by default.
17694
17695 @item -msched-max-memory-insns=@var{max-insns}
17696 @opindex msched-max-memory-insns
17697 Limit on the number of memory insns per instruction group, giving lower
17698 priority to subsequent memory insns attempting to schedule in the same
17699 instruction group. Frequently useful to prevent cache bank conflicts.
17700 The default value is 1.
17701
17702 @item -msched-max-memory-insns-hard-limit
17703 @opindex msched-max-memory-insns-hard-limit
17704 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
17705 disallowing more than that number in an instruction group.
17706 Otherwise, the limit is ``soft'', meaning that non-memory operations
17707 are preferred when the limit is reached, but memory operations may still
17708 be scheduled.
17709
17710 @end table
17711
17712 @node LM32 Options
17713 @subsection LM32 Options
17714 @cindex LM32 options
17715
17716 These @option{-m} options are defined for the LatticeMico32 architecture:
17717
17718 @table @gcctabopt
17719 @item -mbarrel-shift-enabled
17720 @opindex mbarrel-shift-enabled
17721 Enable barrel-shift instructions.
17722
17723 @item -mdivide-enabled
17724 @opindex mdivide-enabled
17725 Enable divide and modulus instructions.
17726
17727 @item -mmultiply-enabled
17728 @opindex multiply-enabled
17729 Enable multiply instructions.
17730
17731 @item -msign-extend-enabled
17732 @opindex msign-extend-enabled
17733 Enable sign extend instructions.
17734
17735 @item -muser-enabled
17736 @opindex muser-enabled
17737 Enable user-defined instructions.
17738
17739 @end table
17740
17741 @node M32C Options
17742 @subsection M32C Options
17743 @cindex M32C options
17744
17745 @table @gcctabopt
17746 @item -mcpu=@var{name}
17747 @opindex mcpu=
17748 Select the CPU for which code is generated. @var{name} may be one of
17749 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
17750 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
17751 the M32C/80 series.
17752
17753 @item -msim
17754 @opindex msim
17755 Specifies that the program will be run on the simulator. This causes
17756 an alternate runtime library to be linked in which supports, for
17757 example, file I/O@. You must not use this option when generating
17758 programs that will run on real hardware; you must provide your own
17759 runtime library for whatever I/O functions are needed.
17760
17761 @item -memregs=@var{number}
17762 @opindex memregs=
17763 Specifies the number of memory-based pseudo-registers GCC uses
17764 during code generation. These pseudo-registers are used like real
17765 registers, so there is a tradeoff between GCC's ability to fit the
17766 code into available registers, and the performance penalty of using
17767 memory instead of registers. Note that all modules in a program must
17768 be compiled with the same value for this option. Because of that, you
17769 must not use this option with GCC's default runtime libraries.
17770
17771 @end table
17772
17773 @node M32R/D Options
17774 @subsection M32R/D Options
17775 @cindex M32R/D options
17776
17777 These @option{-m} options are defined for Renesas M32R/D architectures:
17778
17779 @table @gcctabopt
17780 @item -m32r2
17781 @opindex m32r2
17782 Generate code for the M32R/2@.
17783
17784 @item -m32rx
17785 @opindex m32rx
17786 Generate code for the M32R/X@.
17787
17788 @item -m32r
17789 @opindex m32r
17790 Generate code for the M32R@. This is the default.
17791
17792 @item -mmodel=small
17793 @opindex mmodel=small
17794 Assume all objects live in the lower 16MB of memory (so that their addresses
17795 can be loaded with the @code{ld24} instruction), and assume all subroutines
17796 are reachable with the @code{bl} instruction.
17797 This is the default.
17798
17799 The addressability of a particular object can be set with the
17800 @code{model} attribute.
17801
17802 @item -mmodel=medium
17803 @opindex mmodel=medium
17804 Assume objects may be anywhere in the 32-bit address space (the compiler
17805 generates @code{seth/add3} instructions to load their addresses), and
17806 assume all subroutines are reachable with the @code{bl} instruction.
17807
17808 @item -mmodel=large
17809 @opindex mmodel=large
17810 Assume objects may be anywhere in the 32-bit address space (the compiler
17811 generates @code{seth/add3} instructions to load their addresses), and
17812 assume subroutines may not be reachable with the @code{bl} instruction
17813 (the compiler generates the much slower @code{seth/add3/jl}
17814 instruction sequence).
17815
17816 @item -msdata=none
17817 @opindex msdata=none
17818 Disable use of the small data area. Variables are put into
17819 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
17820 @code{section} attribute has been specified).
17821 This is the default.
17822
17823 The small data area consists of sections @code{.sdata} and @code{.sbss}.
17824 Objects may be explicitly put in the small data area with the
17825 @code{section} attribute using one of these sections.
17826
17827 @item -msdata=sdata
17828 @opindex msdata=sdata
17829 Put small global and static data in the small data area, but do not
17830 generate special code to reference them.
17831
17832 @item -msdata=use
17833 @opindex msdata=use
17834 Put small global and static data in the small data area, and generate
17835 special instructions to reference them.
17836
17837 @item -G @var{num}
17838 @opindex G
17839 @cindex smaller data references
17840 Put global and static objects less than or equal to @var{num} bytes
17841 into the small data or BSS sections instead of the normal data or BSS
17842 sections. The default value of @var{num} is 8.
17843 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
17844 for this option to have any effect.
17845
17846 All modules should be compiled with the same @option{-G @var{num}} value.
17847 Compiling with different values of @var{num} may or may not work; if it
17848 doesn't the linker gives an error message---incorrect code is not
17849 generated.
17850
17851 @item -mdebug
17852 @opindex mdebug
17853 Makes the M32R-specific code in the compiler display some statistics
17854 that might help in debugging programs.
17855
17856 @item -malign-loops
17857 @opindex malign-loops
17858 Align all loops to a 32-byte boundary.
17859
17860 @item -mno-align-loops
17861 @opindex mno-align-loops
17862 Do not enforce a 32-byte alignment for loops. This is the default.
17863
17864 @item -missue-rate=@var{number}
17865 @opindex missue-rate=@var{number}
17866 Issue @var{number} instructions per cycle. @var{number} can only be 1
17867 or 2.
17868
17869 @item -mbranch-cost=@var{number}
17870 @opindex mbranch-cost=@var{number}
17871 @var{number} can only be 1 or 2. If it is 1 then branches are
17872 preferred over conditional code, if it is 2, then the opposite applies.
17873
17874 @item -mflush-trap=@var{number}
17875 @opindex mflush-trap=@var{number}
17876 Specifies the trap number to use to flush the cache. The default is
17877 12. Valid numbers are between 0 and 15 inclusive.
17878
17879 @item -mno-flush-trap
17880 @opindex mno-flush-trap
17881 Specifies that the cache cannot be flushed by using a trap.
17882
17883 @item -mflush-func=@var{name}
17884 @opindex mflush-func=@var{name}
17885 Specifies the name of the operating system function to call to flush
17886 the cache. The default is @samp{_flush_cache}, but a function call
17887 is only used if a trap is not available.
17888
17889 @item -mno-flush-func
17890 @opindex mno-flush-func
17891 Indicates that there is no OS function for flushing the cache.
17892
17893 @end table
17894
17895 @node M680x0 Options
17896 @subsection M680x0 Options
17897 @cindex M680x0 options
17898
17899 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
17900 The default settings depend on which architecture was selected when
17901 the compiler was configured; the defaults for the most common choices
17902 are given below.
17903
17904 @table @gcctabopt
17905 @item -march=@var{arch}
17906 @opindex march
17907 Generate code for a specific M680x0 or ColdFire instruction set
17908 architecture. Permissible values of @var{arch} for M680x0
17909 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
17910 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
17911 architectures are selected according to Freescale's ISA classification
17912 and the permissible values are: @samp{isaa}, @samp{isaaplus},
17913 @samp{isab} and @samp{isac}.
17914
17915 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
17916 code for a ColdFire target. The @var{arch} in this macro is one of the
17917 @option{-march} arguments given above.
17918
17919 When used together, @option{-march} and @option{-mtune} select code
17920 that runs on a family of similar processors but that is optimized
17921 for a particular microarchitecture.
17922
17923 @item -mcpu=@var{cpu}
17924 @opindex mcpu
17925 Generate code for a specific M680x0 or ColdFire processor.
17926 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
17927 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
17928 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
17929 below, which also classifies the CPUs into families:
17930
17931 @multitable @columnfractions 0.20 0.80
17932 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
17933 @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}
17934 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
17935 @item @samp{5206e} @tab @samp{5206e}
17936 @item @samp{5208} @tab @samp{5207} @samp{5208}
17937 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
17938 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
17939 @item @samp{5216} @tab @samp{5214} @samp{5216}
17940 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
17941 @item @samp{5225} @tab @samp{5224} @samp{5225}
17942 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
17943 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
17944 @item @samp{5249} @tab @samp{5249}
17945 @item @samp{5250} @tab @samp{5250}
17946 @item @samp{5271} @tab @samp{5270} @samp{5271}
17947 @item @samp{5272} @tab @samp{5272}
17948 @item @samp{5275} @tab @samp{5274} @samp{5275}
17949 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
17950 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
17951 @item @samp{5307} @tab @samp{5307}
17952 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
17953 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
17954 @item @samp{5407} @tab @samp{5407}
17955 @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}
17956 @end multitable
17957
17958 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
17959 @var{arch} is compatible with @var{cpu}. Other combinations of
17960 @option{-mcpu} and @option{-march} are rejected.
17961
17962 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
17963 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
17964 where the value of @var{family} is given by the table above.
17965
17966 @item -mtune=@var{tune}
17967 @opindex mtune
17968 Tune the code for a particular microarchitecture within the
17969 constraints set by @option{-march} and @option{-mcpu}.
17970 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
17971 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
17972 and @samp{cpu32}. The ColdFire microarchitectures
17973 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
17974
17975 You can also use @option{-mtune=68020-40} for code that needs
17976 to run relatively well on 68020, 68030 and 68040 targets.
17977 @option{-mtune=68020-60} is similar but includes 68060 targets
17978 as well. These two options select the same tuning decisions as
17979 @option{-m68020-40} and @option{-m68020-60} respectively.
17980
17981 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
17982 when tuning for 680x0 architecture @var{arch}. It also defines
17983 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
17984 option is used. If GCC is tuning for a range of architectures,
17985 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
17986 it defines the macros for every architecture in the range.
17987
17988 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
17989 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
17990 of the arguments given above.
17991
17992 @item -m68000
17993 @itemx -mc68000
17994 @opindex m68000
17995 @opindex mc68000
17996 Generate output for a 68000. This is the default
17997 when the compiler is configured for 68000-based systems.
17998 It is equivalent to @option{-march=68000}.
17999
18000 Use this option for microcontrollers with a 68000 or EC000 core,
18001 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
18002
18003 @item -m68010
18004 @opindex m68010
18005 Generate output for a 68010. This is the default
18006 when the compiler is configured for 68010-based systems.
18007 It is equivalent to @option{-march=68010}.
18008
18009 @item -m68020
18010 @itemx -mc68020
18011 @opindex m68020
18012 @opindex mc68020
18013 Generate output for a 68020. This is the default
18014 when the compiler is configured for 68020-based systems.
18015 It is equivalent to @option{-march=68020}.
18016
18017 @item -m68030
18018 @opindex m68030
18019 Generate output for a 68030. This is the default when the compiler is
18020 configured for 68030-based systems. It is equivalent to
18021 @option{-march=68030}.
18022
18023 @item -m68040
18024 @opindex m68040
18025 Generate output for a 68040. This is the default when the compiler is
18026 configured for 68040-based systems. It is equivalent to
18027 @option{-march=68040}.
18028
18029 This option inhibits the use of 68881/68882 instructions that have to be
18030 emulated by software on the 68040. Use this option if your 68040 does not
18031 have code to emulate those instructions.
18032
18033 @item -m68060
18034 @opindex m68060
18035 Generate output for a 68060. This is the default when the compiler is
18036 configured for 68060-based systems. It is equivalent to
18037 @option{-march=68060}.
18038
18039 This option inhibits the use of 68020 and 68881/68882 instructions that
18040 have to be emulated by software on the 68060. Use this option if your 68060
18041 does not have code to emulate those instructions.
18042
18043 @item -mcpu32
18044 @opindex mcpu32
18045 Generate output for a CPU32. This is the default
18046 when the compiler is configured for CPU32-based systems.
18047 It is equivalent to @option{-march=cpu32}.
18048
18049 Use this option for microcontrollers with a
18050 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
18051 68336, 68340, 68341, 68349 and 68360.
18052
18053 @item -m5200
18054 @opindex m5200
18055 Generate output for a 520X ColdFire CPU@. This is the default
18056 when the compiler is configured for 520X-based systems.
18057 It is equivalent to @option{-mcpu=5206}, and is now deprecated
18058 in favor of that option.
18059
18060 Use this option for microcontroller with a 5200 core, including
18061 the MCF5202, MCF5203, MCF5204 and MCF5206.
18062
18063 @item -m5206e
18064 @opindex m5206e
18065 Generate output for a 5206e ColdFire CPU@. The option is now
18066 deprecated in favor of the equivalent @option{-mcpu=5206e}.
18067
18068 @item -m528x
18069 @opindex m528x
18070 Generate output for a member of the ColdFire 528X family.
18071 The option is now deprecated in favor of the equivalent
18072 @option{-mcpu=528x}.
18073
18074 @item -m5307
18075 @opindex m5307
18076 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
18077 in favor of the equivalent @option{-mcpu=5307}.
18078
18079 @item -m5407
18080 @opindex m5407
18081 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
18082 in favor of the equivalent @option{-mcpu=5407}.
18083
18084 @item -mcfv4e
18085 @opindex mcfv4e
18086 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
18087 This includes use of hardware floating-point instructions.
18088 The option is equivalent to @option{-mcpu=547x}, and is now
18089 deprecated in favor of that option.
18090
18091 @item -m68020-40
18092 @opindex m68020-40
18093 Generate output for a 68040, without using any of the new instructions.
18094 This results in code that can run relatively efficiently on either a
18095 68020/68881 or a 68030 or a 68040. The generated code does use the
18096 68881 instructions that are emulated on the 68040.
18097
18098 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
18099
18100 @item -m68020-60
18101 @opindex m68020-60
18102 Generate output for a 68060, without using any of the new instructions.
18103 This results in code that can run relatively efficiently on either a
18104 68020/68881 or a 68030 or a 68040. The generated code does use the
18105 68881 instructions that are emulated on the 68060.
18106
18107 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
18108
18109 @item -mhard-float
18110 @itemx -m68881
18111 @opindex mhard-float
18112 @opindex m68881
18113 Generate floating-point instructions. This is the default for 68020
18114 and above, and for ColdFire devices that have an FPU@. It defines the
18115 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
18116 on ColdFire targets.
18117
18118 @item -msoft-float
18119 @opindex msoft-float
18120 Do not generate floating-point instructions; use library calls instead.
18121 This is the default for 68000, 68010, and 68832 targets. It is also
18122 the default for ColdFire devices that have no FPU.
18123
18124 @item -mdiv
18125 @itemx -mno-div
18126 @opindex mdiv
18127 @opindex mno-div
18128 Generate (do not generate) ColdFire hardware divide and remainder
18129 instructions. If @option{-march} is used without @option{-mcpu},
18130 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
18131 architectures. Otherwise, the default is taken from the target CPU
18132 (either the default CPU, or the one specified by @option{-mcpu}). For
18133 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
18134 @option{-mcpu=5206e}.
18135
18136 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
18137
18138 @item -mshort
18139 @opindex mshort
18140 Consider type @code{int} to be 16 bits wide, like @code{short int}.
18141 Additionally, parameters passed on the stack are also aligned to a
18142 16-bit boundary even on targets whose API mandates promotion to 32-bit.
18143
18144 @item -mno-short
18145 @opindex mno-short
18146 Do not consider type @code{int} to be 16 bits wide. This is the default.
18147
18148 @item -mnobitfield
18149 @itemx -mno-bitfield
18150 @opindex mnobitfield
18151 @opindex mno-bitfield
18152 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
18153 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
18154
18155 @item -mbitfield
18156 @opindex mbitfield
18157 Do use the bit-field instructions. The @option{-m68020} option implies
18158 @option{-mbitfield}. This is the default if you use a configuration
18159 designed for a 68020.
18160
18161 @item -mrtd
18162 @opindex mrtd
18163 Use a different function-calling convention, in which functions
18164 that take a fixed number of arguments return with the @code{rtd}
18165 instruction, which pops their arguments while returning. This
18166 saves one instruction in the caller since there is no need to pop
18167 the arguments there.
18168
18169 This calling convention is incompatible with the one normally
18170 used on Unix, so you cannot use it if you need to call libraries
18171 compiled with the Unix compiler.
18172
18173 Also, you must provide function prototypes for all functions that
18174 take variable numbers of arguments (including @code{printf});
18175 otherwise incorrect code is generated for calls to those
18176 functions.
18177
18178 In addition, seriously incorrect code results if you call a
18179 function with too many arguments. (Normally, extra arguments are
18180 harmlessly ignored.)
18181
18182 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
18183 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
18184
18185 @item -mno-rtd
18186 @opindex mno-rtd
18187 Do not use the calling conventions selected by @option{-mrtd}.
18188 This is the default.
18189
18190 @item -malign-int
18191 @itemx -mno-align-int
18192 @opindex malign-int
18193 @opindex mno-align-int
18194 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
18195 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
18196 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
18197 Aligning variables on 32-bit boundaries produces code that runs somewhat
18198 faster on processors with 32-bit busses at the expense of more memory.
18199
18200 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
18201 aligns structures containing the above types differently than
18202 most published application binary interface specifications for the m68k.
18203
18204 @item -mpcrel
18205 @opindex mpcrel
18206 Use the pc-relative addressing mode of the 68000 directly, instead of
18207 using a global offset table. At present, this option implies @option{-fpic},
18208 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
18209 not presently supported with @option{-mpcrel}, though this could be supported for
18210 68020 and higher processors.
18211
18212 @item -mno-strict-align
18213 @itemx -mstrict-align
18214 @opindex mno-strict-align
18215 @opindex mstrict-align
18216 Do not (do) assume that unaligned memory references are handled by
18217 the system.
18218
18219 @item -msep-data
18220 Generate code that allows the data segment to be located in a different
18221 area of memory from the text segment. This allows for execute-in-place in
18222 an environment without virtual memory management. This option implies
18223 @option{-fPIC}.
18224
18225 @item -mno-sep-data
18226 Generate code that assumes that the data segment follows the text segment.
18227 This is the default.
18228
18229 @item -mid-shared-library
18230 Generate code that supports shared libraries via the library ID method.
18231 This allows for execute-in-place and shared libraries in an environment
18232 without virtual memory management. This option implies @option{-fPIC}.
18233
18234 @item -mno-id-shared-library
18235 Generate code that doesn't assume ID-based shared libraries are being used.
18236 This is the default.
18237
18238 @item -mshared-library-id=n
18239 Specifies the identification number of the ID-based shared library being
18240 compiled. Specifying a value of 0 generates more compact code; specifying
18241 other values forces the allocation of that number to the current
18242 library, but is no more space- or time-efficient than omitting this option.
18243
18244 @item -mxgot
18245 @itemx -mno-xgot
18246 @opindex mxgot
18247 @opindex mno-xgot
18248 When generating position-independent code for ColdFire, generate code
18249 that works if the GOT has more than 8192 entries. This code is
18250 larger and slower than code generated without this option. On M680x0
18251 processors, this option is not needed; @option{-fPIC} suffices.
18252
18253 GCC normally uses a single instruction to load values from the GOT@.
18254 While this is relatively efficient, it only works if the GOT
18255 is smaller than about 64k. Anything larger causes the linker
18256 to report an error such as:
18257
18258 @cindex relocation truncated to fit (ColdFire)
18259 @smallexample
18260 relocation truncated to fit: R_68K_GOT16O foobar
18261 @end smallexample
18262
18263 If this happens, you should recompile your code with @option{-mxgot}.
18264 It should then work with very large GOTs. However, code generated with
18265 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
18266 the value of a global symbol.
18267
18268 Note that some linkers, including newer versions of the GNU linker,
18269 can create multiple GOTs and sort GOT entries. If you have such a linker,
18270 you should only need to use @option{-mxgot} when compiling a single
18271 object file that accesses more than 8192 GOT entries. Very few do.
18272
18273 These options have no effect unless GCC is generating
18274 position-independent code.
18275
18276 @end table
18277
18278 @node MCore Options
18279 @subsection MCore Options
18280 @cindex MCore options
18281
18282 These are the @samp{-m} options defined for the Motorola M*Core
18283 processors.
18284
18285 @table @gcctabopt
18286
18287 @item -mhardlit
18288 @itemx -mno-hardlit
18289 @opindex mhardlit
18290 @opindex mno-hardlit
18291 Inline constants into the code stream if it can be done in two
18292 instructions or less.
18293
18294 @item -mdiv
18295 @itemx -mno-div
18296 @opindex mdiv
18297 @opindex mno-div
18298 Use the divide instruction. (Enabled by default).
18299
18300 @item -mrelax-immediate
18301 @itemx -mno-relax-immediate
18302 @opindex mrelax-immediate
18303 @opindex mno-relax-immediate
18304 Allow arbitrary-sized immediates in bit operations.
18305
18306 @item -mwide-bitfields
18307 @itemx -mno-wide-bitfields
18308 @opindex mwide-bitfields
18309 @opindex mno-wide-bitfields
18310 Always treat bit-fields as @code{int}-sized.
18311
18312 @item -m4byte-functions
18313 @itemx -mno-4byte-functions
18314 @opindex m4byte-functions
18315 @opindex mno-4byte-functions
18316 Force all functions to be aligned to a 4-byte boundary.
18317
18318 @item -mcallgraph-data
18319 @itemx -mno-callgraph-data
18320 @opindex mcallgraph-data
18321 @opindex mno-callgraph-data
18322 Emit callgraph information.
18323
18324 @item -mslow-bytes
18325 @itemx -mno-slow-bytes
18326 @opindex mslow-bytes
18327 @opindex mno-slow-bytes
18328 Prefer word access when reading byte quantities.
18329
18330 @item -mlittle-endian
18331 @itemx -mbig-endian
18332 @opindex mlittle-endian
18333 @opindex mbig-endian
18334 Generate code for a little-endian target.
18335
18336 @item -m210
18337 @itemx -m340
18338 @opindex m210
18339 @opindex m340
18340 Generate code for the 210 processor.
18341
18342 @item -mno-lsim
18343 @opindex mno-lsim
18344 Assume that runtime support has been provided and so omit the
18345 simulator library (@file{libsim.a)} from the linker command line.
18346
18347 @item -mstack-increment=@var{size}
18348 @opindex mstack-increment
18349 Set the maximum amount for a single stack increment operation. Large
18350 values can increase the speed of programs that contain functions
18351 that need a large amount of stack space, but they can also trigger a
18352 segmentation fault if the stack is extended too much. The default
18353 value is 0x1000.
18354
18355 @end table
18356
18357 @node MeP Options
18358 @subsection MeP Options
18359 @cindex MeP options
18360
18361 @table @gcctabopt
18362
18363 @item -mabsdiff
18364 @opindex mabsdiff
18365 Enables the @code{abs} instruction, which is the absolute difference
18366 between two registers.
18367
18368 @item -mall-opts
18369 @opindex mall-opts
18370 Enables all the optional instructions---average, multiply, divide, bit
18371 operations, leading zero, absolute difference, min/max, clip, and
18372 saturation.
18373
18374
18375 @item -maverage
18376 @opindex maverage
18377 Enables the @code{ave} instruction, which computes the average of two
18378 registers.
18379
18380 @item -mbased=@var{n}
18381 @opindex mbased=
18382 Variables of size @var{n} bytes or smaller are placed in the
18383 @code{.based} section by default. Based variables use the @code{$tp}
18384 register as a base register, and there is a 128-byte limit to the
18385 @code{.based} section.
18386
18387 @item -mbitops
18388 @opindex mbitops
18389 Enables the bit operation instructions---bit test (@code{btstm}), set
18390 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
18391 test-and-set (@code{tas}).
18392
18393 @item -mc=@var{name}
18394 @opindex mc=
18395 Selects which section constant data is placed in. @var{name} may
18396 be @samp{tiny}, @samp{near}, or @samp{far}.
18397
18398 @item -mclip
18399 @opindex mclip
18400 Enables the @code{clip} instruction. Note that @option{-mclip} is not
18401 useful unless you also provide @option{-mminmax}.
18402
18403 @item -mconfig=@var{name}
18404 @opindex mconfig=
18405 Selects one of the built-in core configurations. Each MeP chip has
18406 one or more modules in it; each module has a core CPU and a variety of
18407 coprocessors, optional instructions, and peripherals. The
18408 @code{MeP-Integrator} tool, not part of GCC, provides these
18409 configurations through this option; using this option is the same as
18410 using all the corresponding command-line options. The default
18411 configuration is @samp{default}.
18412
18413 @item -mcop
18414 @opindex mcop
18415 Enables the coprocessor instructions. By default, this is a 32-bit
18416 coprocessor. Note that the coprocessor is normally enabled via the
18417 @option{-mconfig=} option.
18418
18419 @item -mcop32
18420 @opindex mcop32
18421 Enables the 32-bit coprocessor's instructions.
18422
18423 @item -mcop64
18424 @opindex mcop64
18425 Enables the 64-bit coprocessor's instructions.
18426
18427 @item -mivc2
18428 @opindex mivc2
18429 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
18430
18431 @item -mdc
18432 @opindex mdc
18433 Causes constant variables to be placed in the @code{.near} section.
18434
18435 @item -mdiv
18436 @opindex mdiv
18437 Enables the @code{div} and @code{divu} instructions.
18438
18439 @item -meb
18440 @opindex meb
18441 Generate big-endian code.
18442
18443 @item -mel
18444 @opindex mel
18445 Generate little-endian code.
18446
18447 @item -mio-volatile
18448 @opindex mio-volatile
18449 Tells the compiler that any variable marked with the @code{io}
18450 attribute is to be considered volatile.
18451
18452 @item -ml
18453 @opindex ml
18454 Causes variables to be assigned to the @code{.far} section by default.
18455
18456 @item -mleadz
18457 @opindex mleadz
18458 Enables the @code{leadz} (leading zero) instruction.
18459
18460 @item -mm
18461 @opindex mm
18462 Causes variables to be assigned to the @code{.near} section by default.
18463
18464 @item -mminmax
18465 @opindex mminmax
18466 Enables the @code{min} and @code{max} instructions.
18467
18468 @item -mmult
18469 @opindex mmult
18470 Enables the multiplication and multiply-accumulate instructions.
18471
18472 @item -mno-opts
18473 @opindex mno-opts
18474 Disables all the optional instructions enabled by @option{-mall-opts}.
18475
18476 @item -mrepeat
18477 @opindex mrepeat
18478 Enables the @code{repeat} and @code{erepeat} instructions, used for
18479 low-overhead looping.
18480
18481 @item -ms
18482 @opindex ms
18483 Causes all variables to default to the @code{.tiny} section. Note
18484 that there is a 65536-byte limit to this section. Accesses to these
18485 variables use the @code{%gp} base register.
18486
18487 @item -msatur
18488 @opindex msatur
18489 Enables the saturation instructions. Note that the compiler does not
18490 currently generate these itself, but this option is included for
18491 compatibility with other tools, like @code{as}.
18492
18493 @item -msdram
18494 @opindex msdram
18495 Link the SDRAM-based runtime instead of the default ROM-based runtime.
18496
18497 @item -msim
18498 @opindex msim
18499 Link the simulator run-time libraries.
18500
18501 @item -msimnovec
18502 @opindex msimnovec
18503 Link the simulator runtime libraries, excluding built-in support
18504 for reset and exception vectors and tables.
18505
18506 @item -mtf
18507 @opindex mtf
18508 Causes all functions to default to the @code{.far} section. Without
18509 this option, functions default to the @code{.near} section.
18510
18511 @item -mtiny=@var{n}
18512 @opindex mtiny=
18513 Variables that are @var{n} bytes or smaller are allocated to the
18514 @code{.tiny} section. These variables use the @code{$gp} base
18515 register. The default for this option is 4, but note that there's a
18516 65536-byte limit to the @code{.tiny} section.
18517
18518 @end table
18519
18520 @node MicroBlaze Options
18521 @subsection MicroBlaze Options
18522 @cindex MicroBlaze Options
18523
18524 @table @gcctabopt
18525
18526 @item -msoft-float
18527 @opindex msoft-float
18528 Use software emulation for floating point (default).
18529
18530 @item -mhard-float
18531 @opindex mhard-float
18532 Use hardware floating-point instructions.
18533
18534 @item -mmemcpy
18535 @opindex mmemcpy
18536 Do not optimize block moves, use @code{memcpy}.
18537
18538 @item -mno-clearbss
18539 @opindex mno-clearbss
18540 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
18541
18542 @item -mcpu=@var{cpu-type}
18543 @opindex mcpu=
18544 Use features of, and schedule code for, the given CPU.
18545 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
18546 where @var{X} is a major version, @var{YY} is the minor version, and
18547 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
18548 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
18549
18550 @item -mxl-soft-mul
18551 @opindex mxl-soft-mul
18552 Use software multiply emulation (default).
18553
18554 @item -mxl-soft-div
18555 @opindex mxl-soft-div
18556 Use software emulation for divides (default).
18557
18558 @item -mxl-barrel-shift
18559 @opindex mxl-barrel-shift
18560 Use the hardware barrel shifter.
18561
18562 @item -mxl-pattern-compare
18563 @opindex mxl-pattern-compare
18564 Use pattern compare instructions.
18565
18566 @item -msmall-divides
18567 @opindex msmall-divides
18568 Use table lookup optimization for small signed integer divisions.
18569
18570 @item -mxl-stack-check
18571 @opindex mxl-stack-check
18572 This option is deprecated. Use @option{-fstack-check} instead.
18573
18574 @item -mxl-gp-opt
18575 @opindex mxl-gp-opt
18576 Use GP-relative @code{.sdata}/@code{.sbss} sections.
18577
18578 @item -mxl-multiply-high
18579 @opindex mxl-multiply-high
18580 Use multiply high instructions for high part of 32x32 multiply.
18581
18582 @item -mxl-float-convert
18583 @opindex mxl-float-convert
18584 Use hardware floating-point conversion instructions.
18585
18586 @item -mxl-float-sqrt
18587 @opindex mxl-float-sqrt
18588 Use hardware floating-point square root instruction.
18589
18590 @item -mbig-endian
18591 @opindex mbig-endian
18592 Generate code for a big-endian target.
18593
18594 @item -mlittle-endian
18595 @opindex mlittle-endian
18596 Generate code for a little-endian target.
18597
18598 @item -mxl-reorder
18599 @opindex mxl-reorder
18600 Use reorder instructions (swap and byte reversed load/store).
18601
18602 @item -mxl-mode-@var{app-model}
18603 Select application model @var{app-model}. Valid models are
18604 @table @samp
18605 @item executable
18606 normal executable (default), uses startup code @file{crt0.o}.
18607
18608 @item xmdstub
18609 for use with Xilinx Microprocessor Debugger (XMD) based
18610 software intrusive debug agent called xmdstub. This uses startup file
18611 @file{crt1.o} and sets the start address of the program to 0x800.
18612
18613 @item bootstrap
18614 for applications that are loaded using a bootloader.
18615 This model uses startup file @file{crt2.o} which does not contain a processor
18616 reset vector handler. This is suitable for transferring control on a
18617 processor reset to the bootloader rather than the application.
18618
18619 @item novectors
18620 for applications that do not require any of the
18621 MicroBlaze vectors. This option may be useful for applications running
18622 within a monitoring application. This model uses @file{crt3.o} as a startup file.
18623 @end table
18624
18625 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
18626 @option{-mxl-mode-@var{app-model}}.
18627
18628 @end table
18629
18630 @node MIPS Options
18631 @subsection MIPS Options
18632 @cindex MIPS options
18633
18634 @table @gcctabopt
18635
18636 @item -EB
18637 @opindex EB
18638 Generate big-endian code.
18639
18640 @item -EL
18641 @opindex EL
18642 Generate little-endian code. This is the default for @samp{mips*el-*-*}
18643 configurations.
18644
18645 @item -march=@var{arch}
18646 @opindex march
18647 Generate code that runs on @var{arch}, which can be the name of a
18648 generic MIPS ISA, or the name of a particular processor.
18649 The ISA names are:
18650 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
18651 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
18652 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
18653 @samp{mips64r5} and @samp{mips64r6}.
18654 The processor names are:
18655 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
18656 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
18657 @samp{5kc}, @samp{5kf},
18658 @samp{20kc},
18659 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
18660 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
18661 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
18662 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
18663 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
18664 @samp{i6400},
18665 @samp{interaptiv},
18666 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
18667 @samp{m4k},
18668 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
18669 @samp{m5100}, @samp{m5101},
18670 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
18671 @samp{orion},
18672 @samp{p5600},
18673 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
18674 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
18675 @samp{rm7000}, @samp{rm9000},
18676 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
18677 @samp{sb1},
18678 @samp{sr71000},
18679 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
18680 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
18681 @samp{xlr} and @samp{xlp}.
18682 The special value @samp{from-abi} selects the
18683 most compatible architecture for the selected ABI (that is,
18684 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
18685
18686 The native Linux/GNU toolchain also supports the value @samp{native},
18687 which selects the best architecture option for the host processor.
18688 @option{-march=native} has no effect if GCC does not recognize
18689 the processor.
18690
18691 In processor names, a final @samp{000} can be abbreviated as @samp{k}
18692 (for example, @option{-march=r2k}). Prefixes are optional, and
18693 @samp{vr} may be written @samp{r}.
18694
18695 Names of the form @samp{@var{n}f2_1} refer to processors with
18696 FPUs clocked at half the rate of the core, names of the form
18697 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
18698 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
18699 processors with FPUs clocked a ratio of 3:2 with respect to the core.
18700 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
18701 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
18702 accepted as synonyms for @samp{@var{n}f1_1}.
18703
18704 GCC defines two macros based on the value of this option. The first
18705 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
18706 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
18707 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
18708 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
18709 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
18710
18711 Note that the @code{_MIPS_ARCH} macro uses the processor names given
18712 above. In other words, it has the full prefix and does not
18713 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
18714 the macro names the resolved architecture (either @code{"mips1"} or
18715 @code{"mips3"}). It names the default architecture when no
18716 @option{-march} option is given.
18717
18718 @item -mtune=@var{arch}
18719 @opindex mtune
18720 Optimize for @var{arch}. Among other things, this option controls
18721 the way instructions are scheduled, and the perceived cost of arithmetic
18722 operations. The list of @var{arch} values is the same as for
18723 @option{-march}.
18724
18725 When this option is not used, GCC optimizes for the processor
18726 specified by @option{-march}. By using @option{-march} and
18727 @option{-mtune} together, it is possible to generate code that
18728 runs on a family of processors, but optimize the code for one
18729 particular member of that family.
18730
18731 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
18732 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
18733 @option{-march} ones described above.
18734
18735 @item -mips1
18736 @opindex mips1
18737 Equivalent to @option{-march=mips1}.
18738
18739 @item -mips2
18740 @opindex mips2
18741 Equivalent to @option{-march=mips2}.
18742
18743 @item -mips3
18744 @opindex mips3
18745 Equivalent to @option{-march=mips3}.
18746
18747 @item -mips4
18748 @opindex mips4
18749 Equivalent to @option{-march=mips4}.
18750
18751 @item -mips32
18752 @opindex mips32
18753 Equivalent to @option{-march=mips32}.
18754
18755 @item -mips32r3
18756 @opindex mips32r3
18757 Equivalent to @option{-march=mips32r3}.
18758
18759 @item -mips32r5
18760 @opindex mips32r5
18761 Equivalent to @option{-march=mips32r5}.
18762
18763 @item -mips32r6
18764 @opindex mips32r6
18765 Equivalent to @option{-march=mips32r6}.
18766
18767 @item -mips64
18768 @opindex mips64
18769 Equivalent to @option{-march=mips64}.
18770
18771 @item -mips64r2
18772 @opindex mips64r2
18773 Equivalent to @option{-march=mips64r2}.
18774
18775 @item -mips64r3
18776 @opindex mips64r3
18777 Equivalent to @option{-march=mips64r3}.
18778
18779 @item -mips64r5
18780 @opindex mips64r5
18781 Equivalent to @option{-march=mips64r5}.
18782
18783 @item -mips64r6
18784 @opindex mips64r6
18785 Equivalent to @option{-march=mips64r6}.
18786
18787 @item -mips16
18788 @itemx -mno-mips16
18789 @opindex mips16
18790 @opindex mno-mips16
18791 Generate (do not generate) MIPS16 code. If GCC is targeting a
18792 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
18793
18794 MIPS16 code generation can also be controlled on a per-function basis
18795 by means of @code{mips16} and @code{nomips16} attributes.
18796 @xref{Function Attributes}, for more information.
18797
18798 @item -mflip-mips16
18799 @opindex mflip-mips16
18800 Generate MIPS16 code on alternating functions. This option is provided
18801 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
18802 not intended for ordinary use in compiling user code.
18803
18804 @item -minterlink-compressed
18805 @item -mno-interlink-compressed
18806 @opindex minterlink-compressed
18807 @opindex mno-interlink-compressed
18808 Require (do not require) that code using the standard (uncompressed) MIPS ISA
18809 be link-compatible with MIPS16 and microMIPS code, and vice versa.
18810
18811 For example, code using the standard ISA encoding cannot jump directly
18812 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
18813 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
18814 knows that the target of the jump is not compressed.
18815
18816 @item -minterlink-mips16
18817 @itemx -mno-interlink-mips16
18818 @opindex minterlink-mips16
18819 @opindex mno-interlink-mips16
18820 Aliases of @option{-minterlink-compressed} and
18821 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
18822 and are retained for backwards compatibility.
18823
18824 @item -mabi=32
18825 @itemx -mabi=o64
18826 @itemx -mabi=n32
18827 @itemx -mabi=64
18828 @itemx -mabi=eabi
18829 @opindex mabi=32
18830 @opindex mabi=o64
18831 @opindex mabi=n32
18832 @opindex mabi=64
18833 @opindex mabi=eabi
18834 Generate code for the given ABI@.
18835
18836 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
18837 generates 64-bit code when you select a 64-bit architecture, but you
18838 can use @option{-mgp32} to get 32-bit code instead.
18839
18840 For information about the O64 ABI, see
18841 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
18842
18843 GCC supports a variant of the o32 ABI in which floating-point registers
18844 are 64 rather than 32 bits wide. You can select this combination with
18845 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
18846 and @code{mfhc1} instructions and is therefore only supported for
18847 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
18848
18849 The register assignments for arguments and return values remain the
18850 same, but each scalar value is passed in a single 64-bit register
18851 rather than a pair of 32-bit registers. For example, scalar
18852 floating-point values are returned in @samp{$f0} only, not a
18853 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
18854 remains the same in that the even-numbered double-precision registers
18855 are saved.
18856
18857 Two additional variants of the o32 ABI are supported to enable
18858 a transition from 32-bit to 64-bit registers. These are FPXX
18859 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
18860 The FPXX extension mandates that all code must execute correctly
18861 when run using 32-bit or 64-bit registers. The code can be interlinked
18862 with either FP32 or FP64, but not both.
18863 The FP64A extension is similar to the FP64 extension but forbids the
18864 use of odd-numbered single-precision registers. This can be used
18865 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
18866 processors and allows both FP32 and FP64A code to interlink and
18867 run in the same process without changing FPU modes.
18868
18869 @item -mabicalls
18870 @itemx -mno-abicalls
18871 @opindex mabicalls
18872 @opindex mno-abicalls
18873 Generate (do not generate) code that is suitable for SVR4-style
18874 dynamic objects. @option{-mabicalls} is the default for SVR4-based
18875 systems.
18876
18877 @item -mshared
18878 @itemx -mno-shared
18879 Generate (do not generate) code that is fully position-independent,
18880 and that can therefore be linked into shared libraries. This option
18881 only affects @option{-mabicalls}.
18882
18883 All @option{-mabicalls} code has traditionally been position-independent,
18884 regardless of options like @option{-fPIC} and @option{-fpic}. However,
18885 as an extension, the GNU toolchain allows executables to use absolute
18886 accesses for locally-binding symbols. It can also use shorter GP
18887 initialization sequences and generate direct calls to locally-defined
18888 functions. This mode is selected by @option{-mno-shared}.
18889
18890 @option{-mno-shared} depends on binutils 2.16 or higher and generates
18891 objects that can only be linked by the GNU linker. However, the option
18892 does not affect the ABI of the final executable; it only affects the ABI
18893 of relocatable objects. Using @option{-mno-shared} generally makes
18894 executables both smaller and quicker.
18895
18896 @option{-mshared} is the default.
18897
18898 @item -mplt
18899 @itemx -mno-plt
18900 @opindex mplt
18901 @opindex mno-plt
18902 Assume (do not assume) that the static and dynamic linkers
18903 support PLTs and copy relocations. This option only affects
18904 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
18905 has no effect without @option{-msym32}.
18906
18907 You can make @option{-mplt} the default by configuring
18908 GCC with @option{--with-mips-plt}. The default is
18909 @option{-mno-plt} otherwise.
18910
18911 @item -mxgot
18912 @itemx -mno-xgot
18913 @opindex mxgot
18914 @opindex mno-xgot
18915 Lift (do not lift) the usual restrictions on the size of the global
18916 offset table.
18917
18918 GCC normally uses a single instruction to load values from the GOT@.
18919 While this is relatively efficient, it only works if the GOT
18920 is smaller than about 64k. Anything larger causes the linker
18921 to report an error such as:
18922
18923 @cindex relocation truncated to fit (MIPS)
18924 @smallexample
18925 relocation truncated to fit: R_MIPS_GOT16 foobar
18926 @end smallexample
18927
18928 If this happens, you should recompile your code with @option{-mxgot}.
18929 This works with very large GOTs, although the code is also
18930 less efficient, since it takes three instructions to fetch the
18931 value of a global symbol.
18932
18933 Note that some linkers can create multiple GOTs. If you have such a
18934 linker, you should only need to use @option{-mxgot} when a single object
18935 file accesses more than 64k's worth of GOT entries. Very few do.
18936
18937 These options have no effect unless GCC is generating position
18938 independent code.
18939
18940 @item -mgp32
18941 @opindex mgp32
18942 Assume that general-purpose registers are 32 bits wide.
18943
18944 @item -mgp64
18945 @opindex mgp64
18946 Assume that general-purpose registers are 64 bits wide.
18947
18948 @item -mfp32
18949 @opindex mfp32
18950 Assume that floating-point registers are 32 bits wide.
18951
18952 @item -mfp64
18953 @opindex mfp64
18954 Assume that floating-point registers are 64 bits wide.
18955
18956 @item -mfpxx
18957 @opindex mfpxx
18958 Do not assume the width of floating-point registers.
18959
18960 @item -mhard-float
18961 @opindex mhard-float
18962 Use floating-point coprocessor instructions.
18963
18964 @item -msoft-float
18965 @opindex msoft-float
18966 Do not use floating-point coprocessor instructions. Implement
18967 floating-point calculations using library calls instead.
18968
18969 @item -mno-float
18970 @opindex mno-float
18971 Equivalent to @option{-msoft-float}, but additionally asserts that the
18972 program being compiled does not perform any floating-point operations.
18973 This option is presently supported only by some bare-metal MIPS
18974 configurations, where it may select a special set of libraries
18975 that lack all floating-point support (including, for example, the
18976 floating-point @code{printf} formats).
18977 If code compiled with @option{-mno-float} accidentally contains
18978 floating-point operations, it is likely to suffer a link-time
18979 or run-time failure.
18980
18981 @item -msingle-float
18982 @opindex msingle-float
18983 Assume that the floating-point coprocessor only supports single-precision
18984 operations.
18985
18986 @item -mdouble-float
18987 @opindex mdouble-float
18988 Assume that the floating-point coprocessor supports double-precision
18989 operations. This is the default.
18990
18991 @item -modd-spreg
18992 @itemx -mno-odd-spreg
18993 @opindex modd-spreg
18994 @opindex mno-odd-spreg
18995 Enable the use of odd-numbered single-precision floating-point registers
18996 for the o32 ABI. This is the default for processors that are known to
18997 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
18998 is set by default.
18999
19000 @item -mabs=2008
19001 @itemx -mabs=legacy
19002 @opindex mabs=2008
19003 @opindex mabs=legacy
19004 These options control the treatment of the special not-a-number (NaN)
19005 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
19006 @code{neg.@i{fmt}} machine instructions.
19007
19008 By default or when @option{-mabs=legacy} is used the legacy
19009 treatment is selected. In this case these instructions are considered
19010 arithmetic and avoided where correct operation is required and the
19011 input operand might be a NaN. A longer sequence of instructions that
19012 manipulate the sign bit of floating-point datum manually is used
19013 instead unless the @option{-ffinite-math-only} option has also been
19014 specified.
19015
19016 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
19017 this case these instructions are considered non-arithmetic and therefore
19018 operating correctly in all cases, including in particular where the
19019 input operand is a NaN. These instructions are therefore always used
19020 for the respective operations.
19021
19022 @item -mnan=2008
19023 @itemx -mnan=legacy
19024 @opindex mnan=2008
19025 @opindex mnan=legacy
19026 These options control the encoding of the special not-a-number (NaN)
19027 IEEE 754 floating-point data.
19028
19029 The @option{-mnan=legacy} option selects the legacy encoding. In this
19030 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
19031 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
19032 by the first bit of their trailing significand field being 1.
19033
19034 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
19035 this case qNaNs are denoted by the first bit of their trailing
19036 significand field being 1, whereas sNaNs are denoted by the first bit of
19037 their trailing significand field being 0.
19038
19039 The default is @option{-mnan=legacy} unless GCC has been configured with
19040 @option{--with-nan=2008}.
19041
19042 @item -mllsc
19043 @itemx -mno-llsc
19044 @opindex mllsc
19045 @opindex mno-llsc
19046 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
19047 implement atomic memory built-in functions. When neither option is
19048 specified, GCC uses the instructions if the target architecture
19049 supports them.
19050
19051 @option{-mllsc} is useful if the runtime environment can emulate the
19052 instructions and @option{-mno-llsc} can be useful when compiling for
19053 nonstandard ISAs. You can make either option the default by
19054 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
19055 respectively. @option{--with-llsc} is the default for some
19056 configurations; see the installation documentation for details.
19057
19058 @item -mdsp
19059 @itemx -mno-dsp
19060 @opindex mdsp
19061 @opindex mno-dsp
19062 Use (do not use) revision 1 of the MIPS DSP ASE@.
19063 @xref{MIPS DSP Built-in Functions}. This option defines the
19064 preprocessor macro @code{__mips_dsp}. It also defines
19065 @code{__mips_dsp_rev} to 1.
19066
19067 @item -mdspr2
19068 @itemx -mno-dspr2
19069 @opindex mdspr2
19070 @opindex mno-dspr2
19071 Use (do not use) revision 2 of the MIPS DSP ASE@.
19072 @xref{MIPS DSP Built-in Functions}. This option defines the
19073 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
19074 It also defines @code{__mips_dsp_rev} to 2.
19075
19076 @item -msmartmips
19077 @itemx -mno-smartmips
19078 @opindex msmartmips
19079 @opindex mno-smartmips
19080 Use (do not use) the MIPS SmartMIPS ASE.
19081
19082 @item -mpaired-single
19083 @itemx -mno-paired-single
19084 @opindex mpaired-single
19085 @opindex mno-paired-single
19086 Use (do not use) paired-single floating-point instructions.
19087 @xref{MIPS Paired-Single Support}. This option requires
19088 hardware floating-point support to be enabled.
19089
19090 @item -mdmx
19091 @itemx -mno-mdmx
19092 @opindex mdmx
19093 @opindex mno-mdmx
19094 Use (do not use) MIPS Digital Media Extension instructions.
19095 This option can only be used when generating 64-bit code and requires
19096 hardware floating-point support to be enabled.
19097
19098 @item -mips3d
19099 @itemx -mno-mips3d
19100 @opindex mips3d
19101 @opindex mno-mips3d
19102 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
19103 The option @option{-mips3d} implies @option{-mpaired-single}.
19104
19105 @item -mmicromips
19106 @itemx -mno-micromips
19107 @opindex mmicromips
19108 @opindex mno-mmicromips
19109 Generate (do not generate) microMIPS code.
19110
19111 MicroMIPS code generation can also be controlled on a per-function basis
19112 by means of @code{micromips} and @code{nomicromips} attributes.
19113 @xref{Function Attributes}, for more information.
19114
19115 @item -mmt
19116 @itemx -mno-mt
19117 @opindex mmt
19118 @opindex mno-mt
19119 Use (do not use) MT Multithreading instructions.
19120
19121 @item -mmcu
19122 @itemx -mno-mcu
19123 @opindex mmcu
19124 @opindex mno-mcu
19125 Use (do not use) the MIPS MCU ASE instructions.
19126
19127 @item -meva
19128 @itemx -mno-eva
19129 @opindex meva
19130 @opindex mno-eva
19131 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
19132
19133 @item -mvirt
19134 @itemx -mno-virt
19135 @opindex mvirt
19136 @opindex mno-virt
19137 Use (do not use) the MIPS Virtualization Application Specific instructions.
19138
19139 @item -mxpa
19140 @itemx -mno-xpa
19141 @opindex mxpa
19142 @opindex mno-xpa
19143 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
19144
19145 @item -mlong64
19146 @opindex mlong64
19147 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
19148 an explanation of the default and the way that the pointer size is
19149 determined.
19150
19151 @item -mlong32
19152 @opindex mlong32
19153 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
19154
19155 The default size of @code{int}s, @code{long}s and pointers depends on
19156 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
19157 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
19158 32-bit @code{long}s. Pointers are the same size as @code{long}s,
19159 or the same size as integer registers, whichever is smaller.
19160
19161 @item -msym32
19162 @itemx -mno-sym32
19163 @opindex msym32
19164 @opindex mno-sym32
19165 Assume (do not assume) that all symbols have 32-bit values, regardless
19166 of the selected ABI@. This option is useful in combination with
19167 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
19168 to generate shorter and faster references to symbolic addresses.
19169
19170 @item -G @var{num}
19171 @opindex G
19172 Put definitions of externally-visible data in a small data section
19173 if that data is no bigger than @var{num} bytes. GCC can then generate
19174 more efficient accesses to the data; see @option{-mgpopt} for details.
19175
19176 The default @option{-G} option depends on the configuration.
19177
19178 @item -mlocal-sdata
19179 @itemx -mno-local-sdata
19180 @opindex mlocal-sdata
19181 @opindex mno-local-sdata
19182 Extend (do not extend) the @option{-G} behavior to local data too,
19183 such as to static variables in C@. @option{-mlocal-sdata} is the
19184 default for all configurations.
19185
19186 If the linker complains that an application is using too much small data,
19187 you might want to try rebuilding the less performance-critical parts with
19188 @option{-mno-local-sdata}. You might also want to build large
19189 libraries with @option{-mno-local-sdata}, so that the libraries leave
19190 more room for the main program.
19191
19192 @item -mextern-sdata
19193 @itemx -mno-extern-sdata
19194 @opindex mextern-sdata
19195 @opindex mno-extern-sdata
19196 Assume (do not assume) that externally-defined data is in
19197 a small data section if the size of that data is within the @option{-G} limit.
19198 @option{-mextern-sdata} is the default for all configurations.
19199
19200 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
19201 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
19202 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
19203 is placed in a small data section. If @var{Var} is defined by another
19204 module, you must either compile that module with a high-enough
19205 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
19206 definition. If @var{Var} is common, you must link the application
19207 with a high-enough @option{-G} setting.
19208
19209 The easiest way of satisfying these restrictions is to compile
19210 and link every module with the same @option{-G} option. However,
19211 you may wish to build a library that supports several different
19212 small data limits. You can do this by compiling the library with
19213 the highest supported @option{-G} setting and additionally using
19214 @option{-mno-extern-sdata} to stop the library from making assumptions
19215 about externally-defined data.
19216
19217 @item -mgpopt
19218 @itemx -mno-gpopt
19219 @opindex mgpopt
19220 @opindex mno-gpopt
19221 Use (do not use) GP-relative accesses for symbols that are known to be
19222 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
19223 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
19224 configurations.
19225
19226 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
19227 might not hold the value of @code{_gp}. For example, if the code is
19228 part of a library that might be used in a boot monitor, programs that
19229 call boot monitor routines pass an unknown value in @code{$gp}.
19230 (In such situations, the boot monitor itself is usually compiled
19231 with @option{-G0}.)
19232
19233 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
19234 @option{-mno-extern-sdata}.
19235
19236 @item -membedded-data
19237 @itemx -mno-embedded-data
19238 @opindex membedded-data
19239 @opindex mno-embedded-data
19240 Allocate variables to the read-only data section first if possible, then
19241 next in the small data section if possible, otherwise in data. This gives
19242 slightly slower code than the default, but reduces the amount of RAM required
19243 when executing, and thus may be preferred for some embedded systems.
19244
19245 @item -muninit-const-in-rodata
19246 @itemx -mno-uninit-const-in-rodata
19247 @opindex muninit-const-in-rodata
19248 @opindex mno-uninit-const-in-rodata
19249 Put uninitialized @code{const} variables in the read-only data section.
19250 This option is only meaningful in conjunction with @option{-membedded-data}.
19251
19252 @item -mcode-readable=@var{setting}
19253 @opindex mcode-readable
19254 Specify whether GCC may generate code that reads from executable sections.
19255 There are three possible settings:
19256
19257 @table @gcctabopt
19258 @item -mcode-readable=yes
19259 Instructions may freely access executable sections. This is the
19260 default setting.
19261
19262 @item -mcode-readable=pcrel
19263 MIPS16 PC-relative load instructions can access executable sections,
19264 but other instructions must not do so. This option is useful on 4KSc
19265 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
19266 It is also useful on processors that can be configured to have a dual
19267 instruction/data SRAM interface and that, like the M4K, automatically
19268 redirect PC-relative loads to the instruction RAM.
19269
19270 @item -mcode-readable=no
19271 Instructions must not access executable sections. This option can be
19272 useful on targets that are configured to have a dual instruction/data
19273 SRAM interface but that (unlike the M4K) do not automatically redirect
19274 PC-relative loads to the instruction RAM.
19275 @end table
19276
19277 @item -msplit-addresses
19278 @itemx -mno-split-addresses
19279 @opindex msplit-addresses
19280 @opindex mno-split-addresses
19281 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
19282 relocation operators. This option has been superseded by
19283 @option{-mexplicit-relocs} but is retained for backwards compatibility.
19284
19285 @item -mexplicit-relocs
19286 @itemx -mno-explicit-relocs
19287 @opindex mexplicit-relocs
19288 @opindex mno-explicit-relocs
19289 Use (do not use) assembler relocation operators when dealing with symbolic
19290 addresses. The alternative, selected by @option{-mno-explicit-relocs},
19291 is to use assembler macros instead.
19292
19293 @option{-mexplicit-relocs} is the default if GCC was configured
19294 to use an assembler that supports relocation operators.
19295
19296 @item -mcheck-zero-division
19297 @itemx -mno-check-zero-division
19298 @opindex mcheck-zero-division
19299 @opindex mno-check-zero-division
19300 Trap (do not trap) on integer division by zero.
19301
19302 The default is @option{-mcheck-zero-division}.
19303
19304 @item -mdivide-traps
19305 @itemx -mdivide-breaks
19306 @opindex mdivide-traps
19307 @opindex mdivide-breaks
19308 MIPS systems check for division by zero by generating either a
19309 conditional trap or a break instruction. Using traps results in
19310 smaller code, but is only supported on MIPS II and later. Also, some
19311 versions of the Linux kernel have a bug that prevents trap from
19312 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
19313 allow conditional traps on architectures that support them and
19314 @option{-mdivide-breaks} to force the use of breaks.
19315
19316 The default is usually @option{-mdivide-traps}, but this can be
19317 overridden at configure time using @option{--with-divide=breaks}.
19318 Divide-by-zero checks can be completely disabled using
19319 @option{-mno-check-zero-division}.
19320
19321 @item -mmemcpy
19322 @itemx -mno-memcpy
19323 @opindex mmemcpy
19324 @opindex mno-memcpy
19325 Force (do not force) the use of @code{memcpy} for non-trivial block
19326 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
19327 most constant-sized copies.
19328
19329 @item -mlong-calls
19330 @itemx -mno-long-calls
19331 @opindex mlong-calls
19332 @opindex mno-long-calls
19333 Disable (do not disable) use of the @code{jal} instruction. Calling
19334 functions using @code{jal} is more efficient but requires the caller
19335 and callee to be in the same 256 megabyte segment.
19336
19337 This option has no effect on abicalls code. The default is
19338 @option{-mno-long-calls}.
19339
19340 @item -mmad
19341 @itemx -mno-mad
19342 @opindex mmad
19343 @opindex mno-mad
19344 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
19345 instructions, as provided by the R4650 ISA@.
19346
19347 @item -mimadd
19348 @itemx -mno-imadd
19349 @opindex mimadd
19350 @opindex mno-imadd
19351 Enable (disable) use of the @code{madd} and @code{msub} integer
19352 instructions. The default is @option{-mimadd} on architectures
19353 that support @code{madd} and @code{msub} except for the 74k
19354 architecture where it was found to generate slower code.
19355
19356 @item -mfused-madd
19357 @itemx -mno-fused-madd
19358 @opindex mfused-madd
19359 @opindex mno-fused-madd
19360 Enable (disable) use of the floating-point multiply-accumulate
19361 instructions, when they are available. The default is
19362 @option{-mfused-madd}.
19363
19364 On the R8000 CPU when multiply-accumulate instructions are used,
19365 the intermediate product is calculated to infinite precision
19366 and is not subject to the FCSR Flush to Zero bit. This may be
19367 undesirable in some circumstances. On other processors the result
19368 is numerically identical to the equivalent computation using
19369 separate multiply, add, subtract and negate instructions.
19370
19371 @item -nocpp
19372 @opindex nocpp
19373 Tell the MIPS assembler to not run its preprocessor over user
19374 assembler files (with a @samp{.s} suffix) when assembling them.
19375
19376 @item -mfix-24k
19377 @item -mno-fix-24k
19378 @opindex mfix-24k
19379 @opindex mno-fix-24k
19380 Work around the 24K E48 (lost data on stores during refill) errata.
19381 The workarounds are implemented by the assembler rather than by GCC@.
19382
19383 @item -mfix-r4000
19384 @itemx -mno-fix-r4000
19385 @opindex mfix-r4000
19386 @opindex mno-fix-r4000
19387 Work around certain R4000 CPU errata:
19388 @itemize @minus
19389 @item
19390 A double-word or a variable shift may give an incorrect result if executed
19391 immediately after starting an integer division.
19392 @item
19393 A double-word or a variable shift may give an incorrect result if executed
19394 while an integer multiplication is in progress.
19395 @item
19396 An integer division may give an incorrect result if started in a delay slot
19397 of a taken branch or a jump.
19398 @end itemize
19399
19400 @item -mfix-r4400
19401 @itemx -mno-fix-r4400
19402 @opindex mfix-r4400
19403 @opindex mno-fix-r4400
19404 Work around certain R4400 CPU errata:
19405 @itemize @minus
19406 @item
19407 A double-word or a variable shift may give an incorrect result if executed
19408 immediately after starting an integer division.
19409 @end itemize
19410
19411 @item -mfix-r10000
19412 @itemx -mno-fix-r10000
19413 @opindex mfix-r10000
19414 @opindex mno-fix-r10000
19415 Work around certain R10000 errata:
19416 @itemize @minus
19417 @item
19418 @code{ll}/@code{sc} sequences may not behave atomically on revisions
19419 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
19420 @end itemize
19421
19422 This option can only be used if the target architecture supports
19423 branch-likely instructions. @option{-mfix-r10000} is the default when
19424 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
19425 otherwise.
19426
19427 @item -mfix-rm7000
19428 @itemx -mno-fix-rm7000
19429 @opindex mfix-rm7000
19430 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
19431 workarounds are implemented by the assembler rather than by GCC@.
19432
19433 @item -mfix-vr4120
19434 @itemx -mno-fix-vr4120
19435 @opindex mfix-vr4120
19436 Work around certain VR4120 errata:
19437 @itemize @minus
19438 @item
19439 @code{dmultu} does not always produce the correct result.
19440 @item
19441 @code{div} and @code{ddiv} do not always produce the correct result if one
19442 of the operands is negative.
19443 @end itemize
19444 The workarounds for the division errata rely on special functions in
19445 @file{libgcc.a}. At present, these functions are only provided by
19446 the @code{mips64vr*-elf} configurations.
19447
19448 Other VR4120 errata require a NOP to be inserted between certain pairs of
19449 instructions. These errata are handled by the assembler, not by GCC itself.
19450
19451 @item -mfix-vr4130
19452 @opindex mfix-vr4130
19453 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
19454 workarounds are implemented by the assembler rather than by GCC,
19455 although GCC avoids using @code{mflo} and @code{mfhi} if the
19456 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
19457 instructions are available instead.
19458
19459 @item -mfix-sb1
19460 @itemx -mno-fix-sb1
19461 @opindex mfix-sb1
19462 Work around certain SB-1 CPU core errata.
19463 (This flag currently works around the SB-1 revision 2
19464 ``F1'' and ``F2'' floating-point errata.)
19465
19466 @item -mr10k-cache-barrier=@var{setting}
19467 @opindex mr10k-cache-barrier
19468 Specify whether GCC should insert cache barriers to avoid the
19469 side-effects of speculation on R10K processors.
19470
19471 In common with many processors, the R10K tries to predict the outcome
19472 of a conditional branch and speculatively executes instructions from
19473 the ``taken'' branch. It later aborts these instructions if the
19474 predicted outcome is wrong. However, on the R10K, even aborted
19475 instructions can have side effects.
19476
19477 This problem only affects kernel stores and, depending on the system,
19478 kernel loads. As an example, a speculatively-executed store may load
19479 the target memory into cache and mark the cache line as dirty, even if
19480 the store itself is later aborted. If a DMA operation writes to the
19481 same area of memory before the ``dirty'' line is flushed, the cached
19482 data overwrites the DMA-ed data. See the R10K processor manual
19483 for a full description, including other potential problems.
19484
19485 One workaround is to insert cache barrier instructions before every memory
19486 access that might be speculatively executed and that might have side
19487 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
19488 controls GCC's implementation of this workaround. It assumes that
19489 aborted accesses to any byte in the following regions does not have
19490 side effects:
19491
19492 @enumerate
19493 @item
19494 the memory occupied by the current function's stack frame;
19495
19496 @item
19497 the memory occupied by an incoming stack argument;
19498
19499 @item
19500 the memory occupied by an object with a link-time-constant address.
19501 @end enumerate
19502
19503 It is the kernel's responsibility to ensure that speculative
19504 accesses to these regions are indeed safe.
19505
19506 If the input program contains a function declaration such as:
19507
19508 @smallexample
19509 void foo (void);
19510 @end smallexample
19511
19512 then the implementation of @code{foo} must allow @code{j foo} and
19513 @code{jal foo} to be executed speculatively. GCC honors this
19514 restriction for functions it compiles itself. It expects non-GCC
19515 functions (such as hand-written assembly code) to do the same.
19516
19517 The option has three forms:
19518
19519 @table @gcctabopt
19520 @item -mr10k-cache-barrier=load-store
19521 Insert a cache barrier before a load or store that might be
19522 speculatively executed and that might have side effects even
19523 if aborted.
19524
19525 @item -mr10k-cache-barrier=store
19526 Insert a cache barrier before a store that might be speculatively
19527 executed and that might have side effects even if aborted.
19528
19529 @item -mr10k-cache-barrier=none
19530 Disable the insertion of cache barriers. This is the default setting.
19531 @end table
19532
19533 @item -mflush-func=@var{func}
19534 @itemx -mno-flush-func
19535 @opindex mflush-func
19536 Specifies the function to call to flush the I and D caches, or to not
19537 call any such function. If called, the function must take the same
19538 arguments as the common @code{_flush_func}, that is, the address of the
19539 memory range for which the cache is being flushed, the size of the
19540 memory range, and the number 3 (to flush both caches). The default
19541 depends on the target GCC was configured for, but commonly is either
19542 @code{_flush_func} or @code{__cpu_flush}.
19543
19544 @item mbranch-cost=@var{num}
19545 @opindex mbranch-cost
19546 Set the cost of branches to roughly @var{num} ``simple'' instructions.
19547 This cost is only a heuristic and is not guaranteed to produce
19548 consistent results across releases. A zero cost redundantly selects
19549 the default, which is based on the @option{-mtune} setting.
19550
19551 @item -mbranch-likely
19552 @itemx -mno-branch-likely
19553 @opindex mbranch-likely
19554 @opindex mno-branch-likely
19555 Enable or disable use of Branch Likely instructions, regardless of the
19556 default for the selected architecture. By default, Branch Likely
19557 instructions may be generated if they are supported by the selected
19558 architecture. An exception is for the MIPS32 and MIPS64 architectures
19559 and processors that implement those architectures; for those, Branch
19560 Likely instructions are not be generated by default because the MIPS32
19561 and MIPS64 architectures specifically deprecate their use.
19562
19563 @item -mcompact-branches=never
19564 @itemx -mcompact-branches=optimal
19565 @itemx -mcompact-branches=always
19566 @opindex mcompact-branches=never
19567 @opindex mcompact-branches=optimal
19568 @opindex mcompact-branches=always
19569 These options control which form of branches will be generated. The
19570 default is @option{-mcompact-branches=optimal}.
19571
19572 The @option{-mcompact-branches=never} option ensures that compact branch
19573 instructions will never be generated.
19574
19575 The @option{-mcompact-branches=always} option ensures that a compact
19576 branch instruction will be generated if available. If a compact branch
19577 instruction is not available, a delay slot form of the branch will be
19578 used instead.
19579
19580 This option is supported from MIPS Release 6 onwards.
19581
19582 The @option{-mcompact-branches=optimal} option will cause a delay slot
19583 branch to be used if one is available in the current ISA and the delay
19584 slot is successfully filled. If the delay slot is not filled, a compact
19585 branch will be chosen if one is available.
19586
19587 @item -mfp-exceptions
19588 @itemx -mno-fp-exceptions
19589 @opindex mfp-exceptions
19590 Specifies whether FP exceptions are enabled. This affects how
19591 FP instructions are scheduled for some processors.
19592 The default is that FP exceptions are
19593 enabled.
19594
19595 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
19596 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
19597 FP pipe.
19598
19599 @item -mvr4130-align
19600 @itemx -mno-vr4130-align
19601 @opindex mvr4130-align
19602 The VR4130 pipeline is two-way superscalar, but can only issue two
19603 instructions together if the first one is 8-byte aligned. When this
19604 option is enabled, GCC aligns pairs of instructions that it
19605 thinks should execute in parallel.
19606
19607 This option only has an effect when optimizing for the VR4130.
19608 It normally makes code faster, but at the expense of making it bigger.
19609 It is enabled by default at optimization level @option{-O3}.
19610
19611 @item -msynci
19612 @itemx -mno-synci
19613 @opindex msynci
19614 Enable (disable) generation of @code{synci} instructions on
19615 architectures that support it. The @code{synci} instructions (if
19616 enabled) are generated when @code{__builtin___clear_cache} is
19617 compiled.
19618
19619 This option defaults to @option{-mno-synci}, but the default can be
19620 overridden by configuring GCC with @option{--with-synci}.
19621
19622 When compiling code for single processor systems, it is generally safe
19623 to use @code{synci}. However, on many multi-core (SMP) systems, it
19624 does not invalidate the instruction caches on all cores and may lead
19625 to undefined behavior.
19626
19627 @item -mrelax-pic-calls
19628 @itemx -mno-relax-pic-calls
19629 @opindex mrelax-pic-calls
19630 Try to turn PIC calls that are normally dispatched via register
19631 @code{$25} into direct calls. This is only possible if the linker can
19632 resolve the destination at link time and if the destination is within
19633 range for a direct call.
19634
19635 @option{-mrelax-pic-calls} is the default if GCC was configured to use
19636 an assembler and a linker that support the @code{.reloc} assembly
19637 directive and @option{-mexplicit-relocs} is in effect. With
19638 @option{-mno-explicit-relocs}, this optimization can be performed by the
19639 assembler and the linker alone without help from the compiler.
19640
19641 @item -mmcount-ra-address
19642 @itemx -mno-mcount-ra-address
19643 @opindex mmcount-ra-address
19644 @opindex mno-mcount-ra-address
19645 Emit (do not emit) code that allows @code{_mcount} to modify the
19646 calling function's return address. When enabled, this option extends
19647 the usual @code{_mcount} interface with a new @var{ra-address}
19648 parameter, which has type @code{intptr_t *} and is passed in register
19649 @code{$12}. @code{_mcount} can then modify the return address by
19650 doing both of the following:
19651 @itemize
19652 @item
19653 Returning the new address in register @code{$31}.
19654 @item
19655 Storing the new address in @code{*@var{ra-address}},
19656 if @var{ra-address} is nonnull.
19657 @end itemize
19658
19659 The default is @option{-mno-mcount-ra-address}.
19660
19661 @item -mframe-header-opt
19662 @itemx -mno-frame-header-opt
19663 @opindex mframe-header-opt
19664 Enable (disable) frame header optimization in the o32 ABI. When using the
19665 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
19666 function to write out register arguments. When enabled, this optimization
19667 will suppress the allocation of the frame header if it can be determined that
19668 it is unused.
19669
19670 This optimization is off by default at all optimization levels.
19671
19672 @end table
19673
19674 @node MMIX Options
19675 @subsection MMIX Options
19676 @cindex MMIX Options
19677
19678 These options are defined for the MMIX:
19679
19680 @table @gcctabopt
19681 @item -mlibfuncs
19682 @itemx -mno-libfuncs
19683 @opindex mlibfuncs
19684 @opindex mno-libfuncs
19685 Specify that intrinsic library functions are being compiled, passing all
19686 values in registers, no matter the size.
19687
19688 @item -mepsilon
19689 @itemx -mno-epsilon
19690 @opindex mepsilon
19691 @opindex mno-epsilon
19692 Generate floating-point comparison instructions that compare with respect
19693 to the @code{rE} epsilon register.
19694
19695 @item -mabi=mmixware
19696 @itemx -mabi=gnu
19697 @opindex mabi=mmixware
19698 @opindex mabi=gnu
19699 Generate code that passes function parameters and return values that (in
19700 the called function) are seen as registers @code{$0} and up, as opposed to
19701 the GNU ABI which uses global registers @code{$231} and up.
19702
19703 @item -mzero-extend
19704 @itemx -mno-zero-extend
19705 @opindex mzero-extend
19706 @opindex mno-zero-extend
19707 When reading data from memory in sizes shorter than 64 bits, use (do not
19708 use) zero-extending load instructions by default, rather than
19709 sign-extending ones.
19710
19711 @item -mknuthdiv
19712 @itemx -mno-knuthdiv
19713 @opindex mknuthdiv
19714 @opindex mno-knuthdiv
19715 Make the result of a division yielding a remainder have the same sign as
19716 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
19717 remainder follows the sign of the dividend. Both methods are
19718 arithmetically valid, the latter being almost exclusively used.
19719
19720 @item -mtoplevel-symbols
19721 @itemx -mno-toplevel-symbols
19722 @opindex mtoplevel-symbols
19723 @opindex mno-toplevel-symbols
19724 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
19725 code can be used with the @code{PREFIX} assembly directive.
19726
19727 @item -melf
19728 @opindex melf
19729 Generate an executable in the ELF format, rather than the default
19730 @samp{mmo} format used by the @command{mmix} simulator.
19731
19732 @item -mbranch-predict
19733 @itemx -mno-branch-predict
19734 @opindex mbranch-predict
19735 @opindex mno-branch-predict
19736 Use (do not use) the probable-branch instructions, when static branch
19737 prediction indicates a probable branch.
19738
19739 @item -mbase-addresses
19740 @itemx -mno-base-addresses
19741 @opindex mbase-addresses
19742 @opindex mno-base-addresses
19743 Generate (do not generate) code that uses @emph{base addresses}. Using a
19744 base address automatically generates a request (handled by the assembler
19745 and the linker) for a constant to be set up in a global register. The
19746 register is used for one or more base address requests within the range 0
19747 to 255 from the value held in the register. The generally leads to short
19748 and fast code, but the number of different data items that can be
19749 addressed is limited. This means that a program that uses lots of static
19750 data may require @option{-mno-base-addresses}.
19751
19752 @item -msingle-exit
19753 @itemx -mno-single-exit
19754 @opindex msingle-exit
19755 @opindex mno-single-exit
19756 Force (do not force) generated code to have a single exit point in each
19757 function.
19758 @end table
19759
19760 @node MN10300 Options
19761 @subsection MN10300 Options
19762 @cindex MN10300 options
19763
19764 These @option{-m} options are defined for Matsushita MN10300 architectures:
19765
19766 @table @gcctabopt
19767 @item -mmult-bug
19768 @opindex mmult-bug
19769 Generate code to avoid bugs in the multiply instructions for the MN10300
19770 processors. This is the default.
19771
19772 @item -mno-mult-bug
19773 @opindex mno-mult-bug
19774 Do not generate code to avoid bugs in the multiply instructions for the
19775 MN10300 processors.
19776
19777 @item -mam33
19778 @opindex mam33
19779 Generate code using features specific to the AM33 processor.
19780
19781 @item -mno-am33
19782 @opindex mno-am33
19783 Do not generate code using features specific to the AM33 processor. This
19784 is the default.
19785
19786 @item -mam33-2
19787 @opindex mam33-2
19788 Generate code using features specific to the AM33/2.0 processor.
19789
19790 @item -mam34
19791 @opindex mam34
19792 Generate code using features specific to the AM34 processor.
19793
19794 @item -mtune=@var{cpu-type}
19795 @opindex mtune
19796 Use the timing characteristics of the indicated CPU type when
19797 scheduling instructions. This does not change the targeted processor
19798 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
19799 @samp{am33-2} or @samp{am34}.
19800
19801 @item -mreturn-pointer-on-d0
19802 @opindex mreturn-pointer-on-d0
19803 When generating a function that returns a pointer, return the pointer
19804 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
19805 only in @code{a0}, and attempts to call such functions without a prototype
19806 result in errors. Note that this option is on by default; use
19807 @option{-mno-return-pointer-on-d0} to disable it.
19808
19809 @item -mno-crt0
19810 @opindex mno-crt0
19811 Do not link in the C run-time initialization object file.
19812
19813 @item -mrelax
19814 @opindex mrelax
19815 Indicate to the linker that it should perform a relaxation optimization pass
19816 to shorten branches, calls and absolute memory addresses. This option only
19817 has an effect when used on the command line for the final link step.
19818
19819 This option makes symbolic debugging impossible.
19820
19821 @item -mliw
19822 @opindex mliw
19823 Allow the compiler to generate @emph{Long Instruction Word}
19824 instructions if the target is the @samp{AM33} or later. This is the
19825 default. This option defines the preprocessor macro @code{__LIW__}.
19826
19827 @item -mnoliw
19828 @opindex mnoliw
19829 Do not allow the compiler to generate @emph{Long Instruction Word}
19830 instructions. This option defines the preprocessor macro
19831 @code{__NO_LIW__}.
19832
19833 @item -msetlb
19834 @opindex msetlb
19835 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
19836 instructions if the target is the @samp{AM33} or later. This is the
19837 default. This option defines the preprocessor macro @code{__SETLB__}.
19838
19839 @item -mnosetlb
19840 @opindex mnosetlb
19841 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
19842 instructions. This option defines the preprocessor macro
19843 @code{__NO_SETLB__}.
19844
19845 @end table
19846
19847 @node Moxie Options
19848 @subsection Moxie Options
19849 @cindex Moxie Options
19850
19851 @table @gcctabopt
19852
19853 @item -meb
19854 @opindex meb
19855 Generate big-endian code. This is the default for @samp{moxie-*-*}
19856 configurations.
19857
19858 @item -mel
19859 @opindex mel
19860 Generate little-endian code.
19861
19862 @item -mmul.x
19863 @opindex mmul.x
19864 Generate mul.x and umul.x instructions. This is the default for
19865 @samp{moxiebox-*-*} configurations.
19866
19867 @item -mno-crt0
19868 @opindex mno-crt0
19869 Do not link in the C run-time initialization object file.
19870
19871 @end table
19872
19873 @node MSP430 Options
19874 @subsection MSP430 Options
19875 @cindex MSP430 Options
19876
19877 These options are defined for the MSP430:
19878
19879 @table @gcctabopt
19880
19881 @item -masm-hex
19882 @opindex masm-hex
19883 Force assembly output to always use hex constants. Normally such
19884 constants are signed decimals, but this option is available for
19885 testsuite and/or aesthetic purposes.
19886
19887 @item -mmcu=
19888 @opindex mmcu=
19889 Select the MCU to target. This is used to create a C preprocessor
19890 symbol based upon the MCU name, converted to upper case and pre- and
19891 post-fixed with @samp{__}. This in turn is used by the
19892 @file{msp430.h} header file to select an MCU-specific supplementary
19893 header file.
19894
19895 The option also sets the ISA to use. If the MCU name is one that is
19896 known to only support the 430 ISA then that is selected, otherwise the
19897 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
19898 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
19899 name selects the 430X ISA.
19900
19901 In addition an MCU-specific linker script is added to the linker
19902 command line. The script's name is the name of the MCU with
19903 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
19904 command line defines the C preprocessor symbol @code{__XXX__} and
19905 cause the linker to search for a script called @file{xxx.ld}.
19906
19907 This option is also passed on to the assembler.
19908
19909 @item -mwarn-mcu
19910 @itemx -mno-warn-mcu
19911 @opindex mwarn-mcu
19912 @opindex mno-warn-mcu
19913 This option enables or disables warnings about conflicts between the
19914 MCU name specified by the @option{-mmcu} option and the ISA set by the
19915 @option{-mcpu} option and/or the hardware multiply support set by the
19916 @option{-mhwmult} option. It also toggles warnings about unrecognized
19917 MCU names. This option is on by default.
19918
19919 @item -mcpu=
19920 @opindex mcpu=
19921 Specifies the ISA to use. Accepted values are @samp{msp430},
19922 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
19923 @option{-mmcu=} option should be used to select the ISA.
19924
19925 @item -msim
19926 @opindex msim
19927 Link to the simulator runtime libraries and linker script. Overrides
19928 any scripts that would be selected by the @option{-mmcu=} option.
19929
19930 @item -mlarge
19931 @opindex mlarge
19932 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
19933
19934 @item -msmall
19935 @opindex msmall
19936 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
19937
19938 @item -mrelax
19939 @opindex mrelax
19940 This option is passed to the assembler and linker, and allows the
19941 linker to perform certain optimizations that cannot be done until
19942 the final link.
19943
19944 @item mhwmult=
19945 @opindex mhwmult=
19946 Describes the type of hardware multiply supported by the target.
19947 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
19948 for the original 16-bit-only multiply supported by early MCUs.
19949 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
19950 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
19951 A value of @samp{auto} can also be given. This tells GCC to deduce
19952 the hardware multiply support based upon the MCU name provided by the
19953 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
19954 the MCU name is not recognized then no hardware multiply support is
19955 assumed. @code{auto} is the default setting.
19956
19957 Hardware multiplies are normally performed by calling a library
19958 routine. This saves space in the generated code. When compiling at
19959 @option{-O3} or higher however the hardware multiplier is invoked
19960 inline. This makes for bigger, but faster code.
19961
19962 The hardware multiply routines disable interrupts whilst running and
19963 restore the previous interrupt state when they finish. This makes
19964 them safe to use inside interrupt handlers as well as in normal code.
19965
19966 @item -minrt
19967 @opindex minrt
19968 Enable the use of a minimum runtime environment - no static
19969 initializers or constructors. This is intended for memory-constrained
19970 devices. The compiler includes special symbols in some objects
19971 that tell the linker and runtime which code fragments are required.
19972
19973 @item -mcode-region=
19974 @itemx -mdata-region=
19975 @opindex mcode-region
19976 @opindex mdata-region
19977 These options tell the compiler where to place functions and data that
19978 do not have one of the @code{lower}, @code{upper}, @code{either} or
19979 @code{section} attributes. Possible values are @code{lower},
19980 @code{upper}, @code{either} or @code{any}. The first three behave
19981 like the corresponding attribute. The fourth possible value -
19982 @code{any} - is the default. It leaves placement entirely up to the
19983 linker script and how it assigns the standard sections
19984 (@code{.text}, @code{.data}, etc) to the memory regions.
19985
19986 @item -msilicon-errata=
19987 @opindex msilicon-errata
19988 This option passes on a request to assembler to enable the fixes for
19989 the named silicon errata.
19990
19991 @item -msilicon-errata-warn=
19992 @opindex msilicon-errata-warn
19993 This option passes on a request to the assembler to enable warning
19994 messages when a silicon errata might need to be applied.
19995
19996 @end table
19997
19998 @node NDS32 Options
19999 @subsection NDS32 Options
20000 @cindex NDS32 Options
20001
20002 These options are defined for NDS32 implementations:
20003
20004 @table @gcctabopt
20005
20006 @item -mbig-endian
20007 @opindex mbig-endian
20008 Generate code in big-endian mode.
20009
20010 @item -mlittle-endian
20011 @opindex mlittle-endian
20012 Generate code in little-endian mode.
20013
20014 @item -mreduced-regs
20015 @opindex mreduced-regs
20016 Use reduced-set registers for register allocation.
20017
20018 @item -mfull-regs
20019 @opindex mfull-regs
20020 Use full-set registers for register allocation.
20021
20022 @item -mcmov
20023 @opindex mcmov
20024 Generate conditional move instructions.
20025
20026 @item -mno-cmov
20027 @opindex mno-cmov
20028 Do not generate conditional move instructions.
20029
20030 @item -mperf-ext
20031 @opindex mperf-ext
20032 Generate performance extension instructions.
20033
20034 @item -mno-perf-ext
20035 @opindex mno-perf-ext
20036 Do not generate performance extension instructions.
20037
20038 @item -mv3push
20039 @opindex mv3push
20040 Generate v3 push25/pop25 instructions.
20041
20042 @item -mno-v3push
20043 @opindex mno-v3push
20044 Do not generate v3 push25/pop25 instructions.
20045
20046 @item -m16-bit
20047 @opindex m16-bit
20048 Generate 16-bit instructions.
20049
20050 @item -mno-16-bit
20051 @opindex mno-16-bit
20052 Do not generate 16-bit instructions.
20053
20054 @item -misr-vector-size=@var{num}
20055 @opindex misr-vector-size
20056 Specify the size of each interrupt vector, which must be 4 or 16.
20057
20058 @item -mcache-block-size=@var{num}
20059 @opindex mcache-block-size
20060 Specify the size of each cache block,
20061 which must be a power of 2 between 4 and 512.
20062
20063 @item -march=@var{arch}
20064 @opindex march
20065 Specify the name of the target architecture.
20066
20067 @item -mcmodel=@var{code-model}
20068 @opindex mcmodel
20069 Set the code model to one of
20070 @table @asis
20071 @item @samp{small}
20072 All the data and read-only data segments must be within 512KB addressing space.
20073 The text segment must be within 16MB addressing space.
20074 @item @samp{medium}
20075 The data segment must be within 512KB while the read-only data segment can be
20076 within 4GB addressing space. The text segment should be still within 16MB
20077 addressing space.
20078 @item @samp{large}
20079 All the text and data segments can be within 4GB addressing space.
20080 @end table
20081
20082 @item -mctor-dtor
20083 @opindex mctor-dtor
20084 Enable constructor/destructor feature.
20085
20086 @item -mrelax
20087 @opindex mrelax
20088 Guide linker to relax instructions.
20089
20090 @end table
20091
20092 @node Nios II Options
20093 @subsection Nios II Options
20094 @cindex Nios II options
20095 @cindex Altera Nios II options
20096
20097 These are the options defined for the Altera Nios II processor.
20098
20099 @table @gcctabopt
20100
20101 @item -G @var{num}
20102 @opindex G
20103 @cindex smaller data references
20104 Put global and static objects less than or equal to @var{num} bytes
20105 into the small data or BSS sections instead of the normal data or BSS
20106 sections. The default value of @var{num} is 8.
20107
20108 @item -mgpopt=@var{option}
20109 @item -mgpopt
20110 @itemx -mno-gpopt
20111 @opindex mgpopt
20112 @opindex mno-gpopt
20113 Generate (do not generate) GP-relative accesses. The following
20114 @var{option} names are recognized:
20115
20116 @table @samp
20117
20118 @item none
20119 Do not generate GP-relative accesses.
20120
20121 @item local
20122 Generate GP-relative accesses for small data objects that are not
20123 external, weak, or uninitialized common symbols.
20124 Also use GP-relative addressing for objects that
20125 have been explicitly placed in a small data section via a @code{section}
20126 attribute.
20127
20128 @item global
20129 As for @samp{local}, but also generate GP-relative accesses for
20130 small data objects that are external, weak, or common. If you use this option,
20131 you must ensure that all parts of your program (including libraries) are
20132 compiled with the same @option{-G} setting.
20133
20134 @item data
20135 Generate GP-relative accesses for all data objects in the program. If you
20136 use this option, the entire data and BSS segments
20137 of your program must fit in 64K of memory and you must use an appropriate
20138 linker script to allocate them within the addressable range of the
20139 global pointer.
20140
20141 @item all
20142 Generate GP-relative addresses for function pointers as well as data
20143 pointers. If you use this option, the entire text, data, and BSS segments
20144 of your program must fit in 64K of memory and you must use an appropriate
20145 linker script to allocate them within the addressable range of the
20146 global pointer.
20147
20148 @end table
20149
20150 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
20151 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
20152
20153 The default is @option{-mgpopt} except when @option{-fpic} or
20154 @option{-fPIC} is specified to generate position-independent code.
20155 Note that the Nios II ABI does not permit GP-relative accesses from
20156 shared libraries.
20157
20158 You may need to specify @option{-mno-gpopt} explicitly when building
20159 programs that include large amounts of small data, including large
20160 GOT data sections. In this case, the 16-bit offset for GP-relative
20161 addressing may not be large enough to allow access to the entire
20162 small data section.
20163
20164 @item -mel
20165 @itemx -meb
20166 @opindex mel
20167 @opindex meb
20168 Generate little-endian (default) or big-endian (experimental) code,
20169 respectively.
20170
20171 @item -march=@var{arch}
20172 @opindex march
20173 This specifies the name of the target Nios II architecture. GCC uses this
20174 name to determine what kind of instructions it can emit when generating
20175 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
20176
20177 The preprocessor macro @code{__nios2_arch__} is available to programs,
20178 with value 1 or 2, indicating the targeted ISA level.
20179
20180 @item -mbypass-cache
20181 @itemx -mno-bypass-cache
20182 @opindex mno-bypass-cache
20183 @opindex mbypass-cache
20184 Force all load and store instructions to always bypass cache by
20185 using I/O variants of the instructions. The default is not to
20186 bypass the cache.
20187
20188 @item -mno-cache-volatile
20189 @itemx -mcache-volatile
20190 @opindex mcache-volatile
20191 @opindex mno-cache-volatile
20192 Volatile memory access bypass the cache using the I/O variants of
20193 the load and store instructions. The default is not to bypass the cache.
20194
20195 @item -mno-fast-sw-div
20196 @itemx -mfast-sw-div
20197 @opindex mno-fast-sw-div
20198 @opindex mfast-sw-div
20199 Do not use table-based fast divide for small numbers. The default
20200 is to use the fast divide at @option{-O3} and above.
20201
20202 @item -mno-hw-mul
20203 @itemx -mhw-mul
20204 @itemx -mno-hw-mulx
20205 @itemx -mhw-mulx
20206 @itemx -mno-hw-div
20207 @itemx -mhw-div
20208 @opindex mno-hw-mul
20209 @opindex mhw-mul
20210 @opindex mno-hw-mulx
20211 @opindex mhw-mulx
20212 @opindex mno-hw-div
20213 @opindex mhw-div
20214 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
20215 instructions by the compiler. The default is to emit @code{mul}
20216 and not emit @code{div} and @code{mulx}.
20217
20218 @item -mbmx
20219 @itemx -mno-bmx
20220 @itemx -mcdx
20221 @itemx -mno-cdx
20222 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
20223 CDX (code density) instructions. Enabling these instructions also
20224 requires @option{-march=r2}. Since these instructions are optional
20225 extensions to the R2 architecture, the default is not to emit them.
20226
20227 @item -mcustom-@var{insn}=@var{N}
20228 @itemx -mno-custom-@var{insn}
20229 @opindex mcustom-@var{insn}
20230 @opindex mno-custom-@var{insn}
20231 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
20232 custom instruction with encoding @var{N} when generating code that uses
20233 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
20234 instruction 253 for single-precision floating-point add operations instead
20235 of the default behavior of using a library call.
20236
20237 The following values of @var{insn} are supported. Except as otherwise
20238 noted, floating-point operations are expected to be implemented with
20239 normal IEEE 754 semantics and correspond directly to the C operators or the
20240 equivalent GCC built-in functions (@pxref{Other Builtins}).
20241
20242 Single-precision floating point:
20243 @table @asis
20244
20245 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
20246 Binary arithmetic operations.
20247
20248 @item @samp{fnegs}
20249 Unary negation.
20250
20251 @item @samp{fabss}
20252 Unary absolute value.
20253
20254 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
20255 Comparison operations.
20256
20257 @item @samp{fmins}, @samp{fmaxs}
20258 Floating-point minimum and maximum. These instructions are only
20259 generated if @option{-ffinite-math-only} is specified.
20260
20261 @item @samp{fsqrts}
20262 Unary square root operation.
20263
20264 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
20265 Floating-point trigonometric and exponential functions. These instructions
20266 are only generated if @option{-funsafe-math-optimizations} is also specified.
20267
20268 @end table
20269
20270 Double-precision floating point:
20271 @table @asis
20272
20273 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
20274 Binary arithmetic operations.
20275
20276 @item @samp{fnegd}
20277 Unary negation.
20278
20279 @item @samp{fabsd}
20280 Unary absolute value.
20281
20282 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
20283 Comparison operations.
20284
20285 @item @samp{fmind}, @samp{fmaxd}
20286 Double-precision minimum and maximum. These instructions are only
20287 generated if @option{-ffinite-math-only} is specified.
20288
20289 @item @samp{fsqrtd}
20290 Unary square root operation.
20291
20292 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
20293 Double-precision trigonometric and exponential functions. These instructions
20294 are only generated if @option{-funsafe-math-optimizations} is also specified.
20295
20296 @end table
20297
20298 Conversions:
20299 @table @asis
20300 @item @samp{fextsd}
20301 Conversion from single precision to double precision.
20302
20303 @item @samp{ftruncds}
20304 Conversion from double precision to single precision.
20305
20306 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
20307 Conversion from floating point to signed or unsigned integer types, with
20308 truncation towards zero.
20309
20310 @item @samp{round}
20311 Conversion from single-precision floating point to signed integer,
20312 rounding to the nearest integer and ties away from zero.
20313 This corresponds to the @code{__builtin_lroundf} function when
20314 @option{-fno-math-errno} is used.
20315
20316 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
20317 Conversion from signed or unsigned integer types to floating-point types.
20318
20319 @end table
20320
20321 In addition, all of the following transfer instructions for internal
20322 registers X and Y must be provided to use any of the double-precision
20323 floating-point instructions. Custom instructions taking two
20324 double-precision source operands expect the first operand in the
20325 64-bit register X. The other operand (or only operand of a unary
20326 operation) is given to the custom arithmetic instruction with the
20327 least significant half in source register @var{src1} and the most
20328 significant half in @var{src2}. A custom instruction that returns a
20329 double-precision result returns the most significant 32 bits in the
20330 destination register and the other half in 32-bit register Y.
20331 GCC automatically generates the necessary code sequences to write
20332 register X and/or read register Y when double-precision floating-point
20333 instructions are used.
20334
20335 @table @asis
20336
20337 @item @samp{fwrx}
20338 Write @var{src1} into the least significant half of X and @var{src2} into
20339 the most significant half of X.
20340
20341 @item @samp{fwry}
20342 Write @var{src1} into Y.
20343
20344 @item @samp{frdxhi}, @samp{frdxlo}
20345 Read the most or least (respectively) significant half of X and store it in
20346 @var{dest}.
20347
20348 @item @samp{frdy}
20349 Read the value of Y and store it into @var{dest}.
20350 @end table
20351
20352 Note that you can gain more local control over generation of Nios II custom
20353 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
20354 and @code{target("no-custom-@var{insn}")} function attributes
20355 (@pxref{Function Attributes})
20356 or pragmas (@pxref{Function Specific Option Pragmas}).
20357
20358 @item -mcustom-fpu-cfg=@var{name}
20359 @opindex mcustom-fpu-cfg
20360
20361 This option enables a predefined, named set of custom instruction encodings
20362 (see @option{-mcustom-@var{insn}} above).
20363 Currently, the following sets are defined:
20364
20365 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
20366 @gccoptlist{-mcustom-fmuls=252 @gol
20367 -mcustom-fadds=253 @gol
20368 -mcustom-fsubs=254 @gol
20369 -fsingle-precision-constant}
20370
20371 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
20372 @gccoptlist{-mcustom-fmuls=252 @gol
20373 -mcustom-fadds=253 @gol
20374 -mcustom-fsubs=254 @gol
20375 -mcustom-fdivs=255 @gol
20376 -fsingle-precision-constant}
20377
20378 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
20379 @gccoptlist{-mcustom-floatus=243 @gol
20380 -mcustom-fixsi=244 @gol
20381 -mcustom-floatis=245 @gol
20382 -mcustom-fcmpgts=246 @gol
20383 -mcustom-fcmples=249 @gol
20384 -mcustom-fcmpeqs=250 @gol
20385 -mcustom-fcmpnes=251 @gol
20386 -mcustom-fmuls=252 @gol
20387 -mcustom-fadds=253 @gol
20388 -mcustom-fsubs=254 @gol
20389 -mcustom-fdivs=255 @gol
20390 -fsingle-precision-constant}
20391
20392 Custom instruction assignments given by individual
20393 @option{-mcustom-@var{insn}=} options override those given by
20394 @option{-mcustom-fpu-cfg=}, regardless of the
20395 order of the options on the command line.
20396
20397 Note that you can gain more local control over selection of a FPU
20398 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
20399 function attribute (@pxref{Function Attributes})
20400 or pragma (@pxref{Function Specific Option Pragmas}).
20401
20402 @end table
20403
20404 These additional @samp{-m} options are available for the Altera Nios II
20405 ELF (bare-metal) target:
20406
20407 @table @gcctabopt
20408
20409 @item -mhal
20410 @opindex mhal
20411 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
20412 startup and termination code, and is typically used in conjunction with
20413 @option{-msys-crt0=} to specify the location of the alternate startup code
20414 provided by the HAL BSP.
20415
20416 @item -msmallc
20417 @opindex msmallc
20418 Link with a limited version of the C library, @option{-lsmallc}, rather than
20419 Newlib.
20420
20421 @item -msys-crt0=@var{startfile}
20422 @opindex msys-crt0
20423 @var{startfile} is the file name of the startfile (crt0) to use
20424 when linking. This option is only useful in conjunction with @option{-mhal}.
20425
20426 @item -msys-lib=@var{systemlib}
20427 @opindex msys-lib
20428 @var{systemlib} is the library name of the library that provides
20429 low-level system calls required by the C library,
20430 e.g. @code{read} and @code{write}.
20431 This option is typically used to link with a library provided by a HAL BSP.
20432
20433 @end table
20434
20435 @node Nvidia PTX Options
20436 @subsection Nvidia PTX Options
20437 @cindex Nvidia PTX options
20438 @cindex nvptx options
20439
20440 These options are defined for Nvidia PTX:
20441
20442 @table @gcctabopt
20443
20444 @item -m32
20445 @itemx -m64
20446 @opindex m32
20447 @opindex m64
20448 Generate code for 32-bit or 64-bit ABI.
20449
20450 @item -mmainkernel
20451 @opindex mmainkernel
20452 Link in code for a __main kernel. This is for stand-alone instead of
20453 offloading execution.
20454
20455 @item -moptimize
20456 @opindex moptimize
20457 Apply partitioned execution optimizations. This is the default when any
20458 level of optimization is selected.
20459
20460 @end table
20461
20462 @node PDP-11 Options
20463 @subsection PDP-11 Options
20464 @cindex PDP-11 Options
20465
20466 These options are defined for the PDP-11:
20467
20468 @table @gcctabopt
20469 @item -mfpu
20470 @opindex mfpu
20471 Use hardware FPP floating point. This is the default. (FIS floating
20472 point on the PDP-11/40 is not supported.)
20473
20474 @item -msoft-float
20475 @opindex msoft-float
20476 Do not use hardware floating point.
20477
20478 @item -mac0
20479 @opindex mac0
20480 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
20481
20482 @item -mno-ac0
20483 @opindex mno-ac0
20484 Return floating-point results in memory. This is the default.
20485
20486 @item -m40
20487 @opindex m40
20488 Generate code for a PDP-11/40.
20489
20490 @item -m45
20491 @opindex m45
20492 Generate code for a PDP-11/45. This is the default.
20493
20494 @item -m10
20495 @opindex m10
20496 Generate code for a PDP-11/10.
20497
20498 @item -mbcopy-builtin
20499 @opindex mbcopy-builtin
20500 Use inline @code{movmemhi} patterns for copying memory. This is the
20501 default.
20502
20503 @item -mbcopy
20504 @opindex mbcopy
20505 Do not use inline @code{movmemhi} patterns for copying memory.
20506
20507 @item -mint16
20508 @itemx -mno-int32
20509 @opindex mint16
20510 @opindex mno-int32
20511 Use 16-bit @code{int}. This is the default.
20512
20513 @item -mint32
20514 @itemx -mno-int16
20515 @opindex mint32
20516 @opindex mno-int16
20517 Use 32-bit @code{int}.
20518
20519 @item -mfloat64
20520 @itemx -mno-float32
20521 @opindex mfloat64
20522 @opindex mno-float32
20523 Use 64-bit @code{float}. This is the default.
20524
20525 @item -mfloat32
20526 @itemx -mno-float64
20527 @opindex mfloat32
20528 @opindex mno-float64
20529 Use 32-bit @code{float}.
20530
20531 @item -mabshi
20532 @opindex mabshi
20533 Use @code{abshi2} pattern. This is the default.
20534
20535 @item -mno-abshi
20536 @opindex mno-abshi
20537 Do not use @code{abshi2} pattern.
20538
20539 @item -mbranch-expensive
20540 @opindex mbranch-expensive
20541 Pretend that branches are expensive. This is for experimenting with
20542 code generation only.
20543
20544 @item -mbranch-cheap
20545 @opindex mbranch-cheap
20546 Do not pretend that branches are expensive. This is the default.
20547
20548 @item -munix-asm
20549 @opindex munix-asm
20550 Use Unix assembler syntax. This is the default when configured for
20551 @samp{pdp11-*-bsd}.
20552
20553 @item -mdec-asm
20554 @opindex mdec-asm
20555 Use DEC assembler syntax. This is the default when configured for any
20556 PDP-11 target other than @samp{pdp11-*-bsd}.
20557 @end table
20558
20559 @node picoChip Options
20560 @subsection picoChip Options
20561 @cindex picoChip options
20562
20563 These @samp{-m} options are defined for picoChip implementations:
20564
20565 @table @gcctabopt
20566
20567 @item -mae=@var{ae_type}
20568 @opindex mcpu
20569 Set the instruction set, register set, and instruction scheduling
20570 parameters for array element type @var{ae_type}. Supported values
20571 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
20572
20573 @option{-mae=ANY} selects a completely generic AE type. Code
20574 generated with this option runs on any of the other AE types. The
20575 code is not as efficient as it would be if compiled for a specific
20576 AE type, and some types of operation (e.g., multiplication) do not
20577 work properly on all types of AE.
20578
20579 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
20580 for compiled code, and is the default.
20581
20582 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
20583 option may suffer from poor performance of byte (char) manipulation,
20584 since the DSP AE does not provide hardware support for byte load/stores.
20585
20586 @item -msymbol-as-address
20587 Enable the compiler to directly use a symbol name as an address in a
20588 load/store instruction, without first loading it into a
20589 register. Typically, the use of this option generates larger
20590 programs, which run faster than when the option isn't used. However, the
20591 results vary from program to program, so it is left as a user option,
20592 rather than being permanently enabled.
20593
20594 @item -mno-inefficient-warnings
20595 Disables warnings about the generation of inefficient code. These
20596 warnings can be generated, for example, when compiling code that
20597 performs byte-level memory operations on the MAC AE type. The MAC AE has
20598 no hardware support for byte-level memory operations, so all byte
20599 load/stores must be synthesized from word load/store operations. This is
20600 inefficient and a warning is generated to indicate
20601 that you should rewrite the code to avoid byte operations, or to target
20602 an AE type that has the necessary hardware support. This option disables
20603 these warnings.
20604
20605 @end table
20606
20607 @node PowerPC Options
20608 @subsection PowerPC Options
20609 @cindex PowerPC options
20610
20611 These are listed under @xref{RS/6000 and PowerPC Options}.
20612
20613 @node RL78 Options
20614 @subsection RL78 Options
20615 @cindex RL78 Options
20616
20617 @table @gcctabopt
20618
20619 @item -msim
20620 @opindex msim
20621 Links in additional target libraries to support operation within a
20622 simulator.
20623
20624 @item -mmul=none
20625 @itemx -mmul=g10
20626 @itemx -mmul=g13
20627 @itemx -mmul=g14
20628 @itemx -mmul=rl78
20629 @opindex mmul
20630 Specifies the type of hardware multiplication and division support to
20631 be used. The simplest is @code{none}, which uses software for both
20632 multiplication and division. This is the default. The @code{g13}
20633 value is for the hardware multiply/divide peripheral found on the
20634 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
20635 the multiplication and division instructions supported by the RL78/G14
20636 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
20637 the value @code{mg10} is an alias for @code{none}.
20638
20639 In addition a C preprocessor macro is defined, based upon the setting
20640 of this option. Possible values are: @code{__RL78_MUL_NONE__},
20641 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
20642
20643 @item -mcpu=g10
20644 @itemx -mcpu=g13
20645 @itemx -mcpu=g14
20646 @itemx -mcpu=rl78
20647 @opindex mcpu
20648 Specifies the RL78 core to target. The default is the G14 core, also
20649 known as an S3 core or just RL78. The G13 or S2 core does not have
20650 multiply or divide instructions, instead it uses a hardware peripheral
20651 for these operations. The G10 or S1 core does not have register
20652 banks, so it uses a different calling convention.
20653
20654 If this option is set it also selects the type of hardware multiply
20655 support to use, unless this is overridden by an explicit
20656 @option{-mmul=none} option on the command line. Thus specifying
20657 @option{-mcpu=g13} enables the use of the G13 hardware multiply
20658 peripheral and specifying @option{-mcpu=g10} disables the use of
20659 hardware multiplications altogether.
20660
20661 Note, although the RL78/G14 core is the default target, specifying
20662 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
20663 change the behavior of the toolchain since it also enables G14
20664 hardware multiply support. If these options are not specified on the
20665 command line then software multiplication routines will be used even
20666 though the code targets the RL78 core. This is for backwards
20667 compatibility with older toolchains which did not have hardware
20668 multiply and divide support.
20669
20670 In addition a C preprocessor macro is defined, based upon the setting
20671 of this option. Possible values are: @code{__RL78_G10__},
20672 @code{__RL78_G13__} or @code{__RL78_G14__}.
20673
20674 @item -mg10
20675 @itemx -mg13
20676 @itemx -mg14
20677 @itemx -mrl78
20678 @opindex mg10
20679 @opindex mg13
20680 @opindex mg14
20681 @opindex mrl78
20682 These are aliases for the corresponding @option{-mcpu=} option. They
20683 are provided for backwards compatibility.
20684
20685 @item -mallregs
20686 @opindex mallregs
20687 Allow the compiler to use all of the available registers. By default
20688 registers @code{r24..r31} are reserved for use in interrupt handlers.
20689 With this option enabled these registers can be used in ordinary
20690 functions as well.
20691
20692 @item -m64bit-doubles
20693 @itemx -m32bit-doubles
20694 @opindex m64bit-doubles
20695 @opindex m32bit-doubles
20696 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
20697 or 32 bits (@option{-m32bit-doubles}) in size. The default is
20698 @option{-m32bit-doubles}.
20699
20700 @item -msave-mduc-in-interrupts
20701 @item -mno-save-mduc-in-interrupts
20702 @opindex msave-mduc-in-interrupts
20703 @opindex mno-save-mduc-in-interrupts
20704 Specifies that interrupt handler functions should preserve the
20705 MDUC registers. This is only necessary if normal code might use
20706 the MDUC registers, for example because it performs multiplication
20707 and division operations. The default is to ignore the MDUC registers
20708 as this makes the interrupt handlers faster. The target option -mg13
20709 needs to be passed for this to work as this feature is only available
20710 on the G13 target (S2 core). The MDUC registers will only be saved
20711 if the interrupt handler performs a multiplication or division
20712 operation or it calls another function.
20713
20714 @end table
20715
20716 @node RS/6000 and PowerPC Options
20717 @subsection IBM RS/6000 and PowerPC Options
20718 @cindex RS/6000 and PowerPC Options
20719 @cindex IBM RS/6000 and PowerPC Options
20720
20721 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
20722 @table @gcctabopt
20723 @item -mpowerpc-gpopt
20724 @itemx -mno-powerpc-gpopt
20725 @itemx -mpowerpc-gfxopt
20726 @itemx -mno-powerpc-gfxopt
20727 @need 800
20728 @itemx -mpowerpc64
20729 @itemx -mno-powerpc64
20730 @itemx -mmfcrf
20731 @itemx -mno-mfcrf
20732 @itemx -mpopcntb
20733 @itemx -mno-popcntb
20734 @itemx -mpopcntd
20735 @itemx -mno-popcntd
20736 @itemx -mfprnd
20737 @itemx -mno-fprnd
20738 @need 800
20739 @itemx -mcmpb
20740 @itemx -mno-cmpb
20741 @itemx -mmfpgpr
20742 @itemx -mno-mfpgpr
20743 @itemx -mhard-dfp
20744 @itemx -mno-hard-dfp
20745 @opindex mpowerpc-gpopt
20746 @opindex mno-powerpc-gpopt
20747 @opindex mpowerpc-gfxopt
20748 @opindex mno-powerpc-gfxopt
20749 @opindex mpowerpc64
20750 @opindex mno-powerpc64
20751 @opindex mmfcrf
20752 @opindex mno-mfcrf
20753 @opindex mpopcntb
20754 @opindex mno-popcntb
20755 @opindex mpopcntd
20756 @opindex mno-popcntd
20757 @opindex mfprnd
20758 @opindex mno-fprnd
20759 @opindex mcmpb
20760 @opindex mno-cmpb
20761 @opindex mmfpgpr
20762 @opindex mno-mfpgpr
20763 @opindex mhard-dfp
20764 @opindex mno-hard-dfp
20765 You use these options to specify which instructions are available on the
20766 processor you are using. The default value of these options is
20767 determined when configuring GCC@. Specifying the
20768 @option{-mcpu=@var{cpu_type}} overrides the specification of these
20769 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
20770 rather than the options listed above.
20771
20772 Specifying @option{-mpowerpc-gpopt} allows
20773 GCC to use the optional PowerPC architecture instructions in the
20774 General Purpose group, including floating-point square root. Specifying
20775 @option{-mpowerpc-gfxopt} allows GCC to
20776 use the optional PowerPC architecture instructions in the Graphics
20777 group, including floating-point select.
20778
20779 The @option{-mmfcrf} option allows GCC to generate the move from
20780 condition register field instruction implemented on the POWER4
20781 processor and other processors that support the PowerPC V2.01
20782 architecture.
20783 The @option{-mpopcntb} option allows GCC to generate the popcount and
20784 double-precision FP reciprocal estimate instruction implemented on the
20785 POWER5 processor and other processors that support the PowerPC V2.02
20786 architecture.
20787 The @option{-mpopcntd} option allows GCC to generate the popcount
20788 instruction implemented on the POWER7 processor and other processors
20789 that support the PowerPC V2.06 architecture.
20790 The @option{-mfprnd} option allows GCC to generate the FP round to
20791 integer instructions implemented on the POWER5+ processor and other
20792 processors that support the PowerPC V2.03 architecture.
20793 The @option{-mcmpb} option allows GCC to generate the compare bytes
20794 instruction implemented on the POWER6 processor and other processors
20795 that support the PowerPC V2.05 architecture.
20796 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
20797 general-purpose register instructions implemented on the POWER6X
20798 processor and other processors that support the extended PowerPC V2.05
20799 architecture.
20800 The @option{-mhard-dfp} option allows GCC to generate the decimal
20801 floating-point instructions implemented on some POWER processors.
20802
20803 The @option{-mpowerpc64} option allows GCC to generate the additional
20804 64-bit instructions that are found in the full PowerPC64 architecture
20805 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
20806 @option{-mno-powerpc64}.
20807
20808 @item -mcpu=@var{cpu_type}
20809 @opindex mcpu
20810 Set architecture type, register usage, and
20811 instruction scheduling parameters for machine type @var{cpu_type}.
20812 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
20813 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
20814 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
20815 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
20816 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
20817 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
20818 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
20819 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
20820 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
20821 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
20822 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
20823 and @samp{rs64}.
20824
20825 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
20826 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
20827 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
20828 architecture machine types, with an appropriate, generic processor
20829 model assumed for scheduling purposes.
20830
20831 The other options specify a specific processor. Code generated under
20832 those options runs best on that processor, and may not run at all on
20833 others.
20834
20835 The @option{-mcpu} options automatically enable or disable the
20836 following options:
20837
20838 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
20839 -mpopcntb -mpopcntd -mpowerpc64 @gol
20840 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
20841 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
20842 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
20843 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
20844
20845 The particular options set for any particular CPU varies between
20846 compiler versions, depending on what setting seems to produce optimal
20847 code for that CPU; it doesn't necessarily reflect the actual hardware's
20848 capabilities. If you wish to set an individual option to a particular
20849 value, you may specify it after the @option{-mcpu} option, like
20850 @option{-mcpu=970 -mno-altivec}.
20851
20852 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
20853 not enabled or disabled by the @option{-mcpu} option at present because
20854 AIX does not have full support for these options. You may still
20855 enable or disable them individually if you're sure it'll work in your
20856 environment.
20857
20858 @item -mtune=@var{cpu_type}
20859 @opindex mtune
20860 Set the instruction scheduling parameters for machine type
20861 @var{cpu_type}, but do not set the architecture type or register usage,
20862 as @option{-mcpu=@var{cpu_type}} does. The same
20863 values for @var{cpu_type} are used for @option{-mtune} as for
20864 @option{-mcpu}. If both are specified, the code generated uses the
20865 architecture and registers set by @option{-mcpu}, but the
20866 scheduling parameters set by @option{-mtune}.
20867
20868 @item -mcmodel=small
20869 @opindex mcmodel=small
20870 Generate PowerPC64 code for the small model: The TOC is limited to
20871 64k.
20872
20873 @item -mcmodel=medium
20874 @opindex mcmodel=medium
20875 Generate PowerPC64 code for the medium model: The TOC and other static
20876 data may be up to a total of 4G in size.
20877
20878 @item -mcmodel=large
20879 @opindex mcmodel=large
20880 Generate PowerPC64 code for the large model: The TOC may be up to 4G
20881 in size. Other data and code is only limited by the 64-bit address
20882 space.
20883
20884 @item -maltivec
20885 @itemx -mno-altivec
20886 @opindex maltivec
20887 @opindex mno-altivec
20888 Generate code that uses (does not use) AltiVec instructions, and also
20889 enable the use of built-in functions that allow more direct access to
20890 the AltiVec instruction set. You may also need to set
20891 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
20892 enhancements.
20893
20894 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
20895 @option{-maltivec=be}, the element order for AltiVec intrinsics such
20896 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
20897 match array element order corresponding to the endianness of the
20898 target. That is, element zero identifies the leftmost element in a
20899 vector register when targeting a big-endian platform, and identifies
20900 the rightmost element in a vector register when targeting a
20901 little-endian platform.
20902
20903 @item -maltivec=be
20904 @opindex maltivec=be
20905 Generate AltiVec instructions using big-endian element order,
20906 regardless of whether the target is big- or little-endian. This is
20907 the default when targeting a big-endian platform.
20908
20909 The element order is used to interpret element numbers in AltiVec
20910 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20911 @code{vec_insert}. By default, these match array element order
20912 corresponding to the endianness for the target.
20913
20914 @item -maltivec=le
20915 @opindex maltivec=le
20916 Generate AltiVec instructions using little-endian element order,
20917 regardless of whether the target is big- or little-endian. This is
20918 the default when targeting a little-endian platform. This option is
20919 currently ignored when targeting a big-endian platform.
20920
20921 The element order is used to interpret element numbers in AltiVec
20922 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20923 @code{vec_insert}. By default, these match array element order
20924 corresponding to the endianness for the target.
20925
20926 @item -mvrsave
20927 @itemx -mno-vrsave
20928 @opindex mvrsave
20929 @opindex mno-vrsave
20930 Generate VRSAVE instructions when generating AltiVec code.
20931
20932 @item -mgen-cell-microcode
20933 @opindex mgen-cell-microcode
20934 Generate Cell microcode instructions.
20935
20936 @item -mwarn-cell-microcode
20937 @opindex mwarn-cell-microcode
20938 Warn when a Cell microcode instruction is emitted. An example
20939 of a Cell microcode instruction is a variable shift.
20940
20941 @item -msecure-plt
20942 @opindex msecure-plt
20943 Generate code that allows @command{ld} and @command{ld.so}
20944 to build executables and shared
20945 libraries with non-executable @code{.plt} and @code{.got} sections.
20946 This is a PowerPC
20947 32-bit SYSV ABI option.
20948
20949 @item -mbss-plt
20950 @opindex mbss-plt
20951 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
20952 fills in, and
20953 requires @code{.plt} and @code{.got}
20954 sections that are both writable and executable.
20955 This is a PowerPC 32-bit SYSV ABI option.
20956
20957 @item -misel
20958 @itemx -mno-isel
20959 @opindex misel
20960 @opindex mno-isel
20961 This switch enables or disables the generation of ISEL instructions.
20962
20963 @item -misel=@var{yes/no}
20964 This switch has been deprecated. Use @option{-misel} and
20965 @option{-mno-isel} instead.
20966
20967 @item -mlra
20968 @opindex mlra
20969 Enable Local Register Allocation. This is still experimental for PowerPC,
20970 so by default the compiler uses standard reload
20971 (i.e. @option{-mno-lra}).
20972
20973 @item -mspe
20974 @itemx -mno-spe
20975 @opindex mspe
20976 @opindex mno-spe
20977 This switch enables or disables the generation of SPE simd
20978 instructions.
20979
20980 @item -mpaired
20981 @itemx -mno-paired
20982 @opindex mpaired
20983 @opindex mno-paired
20984 This switch enables or disables the generation of PAIRED simd
20985 instructions.
20986
20987 @item -mspe=@var{yes/no}
20988 This option has been deprecated. Use @option{-mspe} and
20989 @option{-mno-spe} instead.
20990
20991 @item -mvsx
20992 @itemx -mno-vsx
20993 @opindex mvsx
20994 @opindex mno-vsx
20995 Generate code that uses (does not use) vector/scalar (VSX)
20996 instructions, and also enable the use of built-in functions that allow
20997 more direct access to the VSX instruction set.
20998
20999 @item -mcrypto
21000 @itemx -mno-crypto
21001 @opindex mcrypto
21002 @opindex mno-crypto
21003 Enable the use (disable) of the built-in functions that allow direct
21004 access to the cryptographic instructions that were added in version
21005 2.07 of the PowerPC ISA.
21006
21007 @item -mdirect-move
21008 @itemx -mno-direct-move
21009 @opindex mdirect-move
21010 @opindex mno-direct-move
21011 Generate code that uses (does not use) the instructions to move data
21012 between the general purpose registers and the vector/scalar (VSX)
21013 registers that were added in version 2.07 of the PowerPC ISA.
21014
21015 @item -mhtm
21016 @itemx -mno-htm
21017 @opindex mhtm
21018 @opindex mno-htm
21019 Enable (disable) the use of the built-in functions that allow direct
21020 access to the Hardware Transactional Memory (HTM) instructions that
21021 were added in version 2.07 of the PowerPC ISA.
21022
21023 @item -mpower8-fusion
21024 @itemx -mno-power8-fusion
21025 @opindex mpower8-fusion
21026 @opindex mno-power8-fusion
21027 Generate code that keeps (does not keeps) some integer operations
21028 adjacent so that the instructions can be fused together on power8 and
21029 later processors.
21030
21031 @item -mpower8-vector
21032 @itemx -mno-power8-vector
21033 @opindex mpower8-vector
21034 @opindex mno-power8-vector
21035 Generate code that uses (does not use) the vector and scalar
21036 instructions that were added in version 2.07 of the PowerPC ISA. Also
21037 enable the use of built-in functions that allow more direct access to
21038 the vector instructions.
21039
21040 @item -mquad-memory
21041 @itemx -mno-quad-memory
21042 @opindex mquad-memory
21043 @opindex mno-quad-memory
21044 Generate code that uses (does not use) the non-atomic quad word memory
21045 instructions. The @option{-mquad-memory} option requires use of
21046 64-bit mode.
21047
21048 @item -mquad-memory-atomic
21049 @itemx -mno-quad-memory-atomic
21050 @opindex mquad-memory-atomic
21051 @opindex mno-quad-memory-atomic
21052 Generate code that uses (does not use) the atomic quad word memory
21053 instructions. The @option{-mquad-memory-atomic} option requires use of
21054 64-bit mode.
21055
21056 @item -mupper-regs-di
21057 @itemx -mno-upper-regs-di
21058 @opindex mupper-regs-di
21059 @opindex mno-upper-regs-di
21060 Generate code that uses (does not use) the scalar instructions that
21061 target all 64 registers in the vector/scalar floating point register
21062 set that were added in version 2.06 of the PowerPC ISA when processing
21063 integers. @option{-mupper-regs-di} is turned on by default if you use
21064 any of the @option{-mcpu=power7}, @option{-mcpu=power8},
21065 @option{-mcpu=power9}, or @option{-mvsx} options.
21066
21067 @item -mupper-regs-df
21068 @itemx -mno-upper-regs-df
21069 @opindex mupper-regs-df
21070 @opindex mno-upper-regs-df
21071 Generate code that uses (does not use) the scalar double precision
21072 instructions that target all 64 registers in the vector/scalar
21073 floating point register set that were added in version 2.06 of the
21074 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
21075 use any of the @option{-mcpu=power7}, @option{-mcpu=power8},
21076 @option{-mcpu=power9}, or @option{-mvsx} options.
21077
21078 @item -mupper-regs-sf
21079 @itemx -mno-upper-regs-sf
21080 @opindex mupper-regs-sf
21081 @opindex mno-upper-regs-sf
21082 Generate code that uses (does not use) the scalar single precision
21083 instructions that target all 64 registers in the vector/scalar
21084 floating point register set that were added in version 2.07 of the
21085 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
21086 use either of the @option{-mcpu=power8}, @option{-mpower8-vector}, or
21087 @option{-mcpu=power9} options.
21088
21089 @item -mupper-regs
21090 @itemx -mno-upper-regs
21091 @opindex mupper-regs
21092 @opindex mno-upper-regs
21093 Generate code that uses (does not use) the scalar
21094 instructions that target all 64 registers in the vector/scalar
21095 floating point register set, depending on the model of the machine.
21096
21097 If the @option{-mno-upper-regs} option is used, it turns off both
21098 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
21099
21100 @item -mfloat128
21101 @itemx -mno-float128
21102 @opindex mfloat128
21103 @opindex mno-float128
21104 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
21105 and use either software emulation for IEEE 128-bit floating point or
21106 hardware instructions.
21107
21108 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
21109 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
21110 option. The @option{-mfloat128} option only works on PowerPC 64-bit
21111 Linux systems.
21112
21113 If you use the ISA 3.0 instruction set (@option{-mcpu=power9}), the
21114 @option{-mfloat128} option will also enable the generation of ISA 3.0
21115 IEEE 128-bit floating point instructions. Otherwise, IEEE 128-bit
21116 floating point will be done with software emulation.
21117
21118 @item -mfloat128-hardware
21119 @itemx -mno-float128-hardware
21120 @opindex mfloat128-hardware
21121 @opindex mno-float128-hardware
21122 Enable/disable using ISA 3.0 hardware instructions to support the
21123 @var{__float128} data type.
21124
21125 If you use @option{-mfloat128-hardware}, it will enable the option
21126 @option{-mfloat128} as well.
21127
21128 If you select ISA 3.0 instructions with @option{-mcpu=power9}, but do
21129 not use either @option{-mfloat128} or @option{-mfloat128-hardware},
21130 the IEEE 128-bit floating point support will not be enabled.
21131
21132 @item -mfloat-gprs=@var{yes/single/double/no}
21133 @itemx -mfloat-gprs
21134 @opindex mfloat-gprs
21135 This switch enables or disables the generation of floating-point
21136 operations on the general-purpose registers for architectures that
21137 support it.
21138
21139 The argument @samp{yes} or @samp{single} enables the use of
21140 single-precision floating-point operations.
21141
21142 The argument @samp{double} enables the use of single and
21143 double-precision floating-point operations.
21144
21145 The argument @samp{no} disables floating-point operations on the
21146 general-purpose registers.
21147
21148 This option is currently only available on the MPC854x.
21149
21150 @item -m32
21151 @itemx -m64
21152 @opindex m32
21153 @opindex m64
21154 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
21155 targets (including GNU/Linux). The 32-bit environment sets int, long
21156 and pointer to 32 bits and generates code that runs on any PowerPC
21157 variant. The 64-bit environment sets int to 32 bits and long and
21158 pointer to 64 bits, and generates code for PowerPC64, as for
21159 @option{-mpowerpc64}.
21160
21161 @item -mfull-toc
21162 @itemx -mno-fp-in-toc
21163 @itemx -mno-sum-in-toc
21164 @itemx -mminimal-toc
21165 @opindex mfull-toc
21166 @opindex mno-fp-in-toc
21167 @opindex mno-sum-in-toc
21168 @opindex mminimal-toc
21169 Modify generation of the TOC (Table Of Contents), which is created for
21170 every executable file. The @option{-mfull-toc} option is selected by
21171 default. In that case, GCC allocates at least one TOC entry for
21172 each unique non-automatic variable reference in your program. GCC
21173 also places floating-point constants in the TOC@. However, only
21174 16,384 entries are available in the TOC@.
21175
21176 If you receive a linker error message that saying you have overflowed
21177 the available TOC space, you can reduce the amount of TOC space used
21178 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
21179 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
21180 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
21181 generate code to calculate the sum of an address and a constant at
21182 run time instead of putting that sum into the TOC@. You may specify one
21183 or both of these options. Each causes GCC to produce very slightly
21184 slower and larger code at the expense of conserving TOC space.
21185
21186 If you still run out of space in the TOC even when you specify both of
21187 these options, specify @option{-mminimal-toc} instead. This option causes
21188 GCC to make only one TOC entry for every file. When you specify this
21189 option, GCC produces code that is slower and larger but which
21190 uses extremely little TOC space. You may wish to use this option
21191 only on files that contain less frequently-executed code.
21192
21193 @item -maix64
21194 @itemx -maix32
21195 @opindex maix64
21196 @opindex maix32
21197 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
21198 @code{long} type, and the infrastructure needed to support them.
21199 Specifying @option{-maix64} implies @option{-mpowerpc64},
21200 while @option{-maix32} disables the 64-bit ABI and
21201 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
21202
21203 @item -mxl-compat
21204 @itemx -mno-xl-compat
21205 @opindex mxl-compat
21206 @opindex mno-xl-compat
21207 Produce code that conforms more closely to IBM XL compiler semantics
21208 when using AIX-compatible ABI@. Pass floating-point arguments to
21209 prototyped functions beyond the register save area (RSA) on the stack
21210 in addition to argument FPRs. Do not assume that most significant
21211 double in 128-bit long double value is properly rounded when comparing
21212 values and converting to double. Use XL symbol names for long double
21213 support routines.
21214
21215 The AIX calling convention was extended but not initially documented to
21216 handle an obscure K&R C case of calling a function that takes the
21217 address of its arguments with fewer arguments than declared. IBM XL
21218 compilers access floating-point arguments that do not fit in the
21219 RSA from the stack when a subroutine is compiled without
21220 optimization. Because always storing floating-point arguments on the
21221 stack is inefficient and rarely needed, this option is not enabled by
21222 default and only is necessary when calling subroutines compiled by IBM
21223 XL compilers without optimization.
21224
21225 @item -mpe
21226 @opindex mpe
21227 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
21228 application written to use message passing with special startup code to
21229 enable the application to run. The system must have PE installed in the
21230 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
21231 must be overridden with the @option{-specs=} option to specify the
21232 appropriate directory location. The Parallel Environment does not
21233 support threads, so the @option{-mpe} option and the @option{-pthread}
21234 option are incompatible.
21235
21236 @item -malign-natural
21237 @itemx -malign-power
21238 @opindex malign-natural
21239 @opindex malign-power
21240 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
21241 @option{-malign-natural} overrides the ABI-defined alignment of larger
21242 types, such as floating-point doubles, on their natural size-based boundary.
21243 The option @option{-malign-power} instructs GCC to follow the ABI-specified
21244 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
21245
21246 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
21247 is not supported.
21248
21249 @item -msoft-float
21250 @itemx -mhard-float
21251 @opindex msoft-float
21252 @opindex mhard-float
21253 Generate code that does not use (uses) the floating-point register set.
21254 Software floating-point emulation is provided if you use the
21255 @option{-msoft-float} option, and pass the option to GCC when linking.
21256
21257 @item -msingle-float
21258 @itemx -mdouble-float
21259 @opindex msingle-float
21260 @opindex mdouble-float
21261 Generate code for single- or double-precision floating-point operations.
21262 @option{-mdouble-float} implies @option{-msingle-float}.
21263
21264 @item -msimple-fpu
21265 @opindex msimple-fpu
21266 Do not generate @code{sqrt} and @code{div} instructions for hardware
21267 floating-point unit.
21268
21269 @item -mfpu=@var{name}
21270 @opindex mfpu
21271 Specify type of floating-point unit. Valid values for @var{name} are
21272 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
21273 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
21274 @samp{sp_full} (equivalent to @option{-msingle-float}),
21275 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
21276
21277 @item -mxilinx-fpu
21278 @opindex mxilinx-fpu
21279 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
21280
21281 @item -mmultiple
21282 @itemx -mno-multiple
21283 @opindex mmultiple
21284 @opindex mno-multiple
21285 Generate code that uses (does not use) the load multiple word
21286 instructions and the store multiple word instructions. These
21287 instructions are generated by default on POWER systems, and not
21288 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
21289 PowerPC systems, since those instructions do not work when the
21290 processor is in little-endian mode. The exceptions are PPC740 and
21291 PPC750 which permit these instructions in little-endian mode.
21292
21293 @item -mstring
21294 @itemx -mno-string
21295 @opindex mstring
21296 @opindex mno-string
21297 Generate code that uses (does not use) the load string instructions
21298 and the store string word instructions to save multiple registers and
21299 do small block moves. These instructions are generated by default on
21300 POWER systems, and not generated on PowerPC systems. Do not use
21301 @option{-mstring} on little-endian PowerPC systems, since those
21302 instructions do not work when the processor is in little-endian mode.
21303 The exceptions are PPC740 and PPC750 which permit these instructions
21304 in little-endian mode.
21305
21306 @item -mupdate
21307 @itemx -mno-update
21308 @opindex mupdate
21309 @opindex mno-update
21310 Generate code that uses (does not use) the load or store instructions
21311 that update the base register to the address of the calculated memory
21312 location. These instructions are generated by default. If you use
21313 @option{-mno-update}, there is a small window between the time that the
21314 stack pointer is updated and the address of the previous frame is
21315 stored, which means code that walks the stack frame across interrupts or
21316 signals may get corrupted data.
21317
21318 @item -mavoid-indexed-addresses
21319 @itemx -mno-avoid-indexed-addresses
21320 @opindex mavoid-indexed-addresses
21321 @opindex mno-avoid-indexed-addresses
21322 Generate code that tries to avoid (not avoid) the use of indexed load
21323 or store instructions. These instructions can incur a performance
21324 penalty on Power6 processors in certain situations, such as when
21325 stepping through large arrays that cross a 16M boundary. This option
21326 is enabled by default when targeting Power6 and disabled otherwise.
21327
21328 @item -mfused-madd
21329 @itemx -mno-fused-madd
21330 @opindex mfused-madd
21331 @opindex mno-fused-madd
21332 Generate code that uses (does not use) the floating-point multiply and
21333 accumulate instructions. These instructions are generated by default
21334 if hardware floating point is used. The machine-dependent
21335 @option{-mfused-madd} option is now mapped to the machine-independent
21336 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
21337 mapped to @option{-ffp-contract=off}.
21338
21339 @item -mmulhw
21340 @itemx -mno-mulhw
21341 @opindex mmulhw
21342 @opindex mno-mulhw
21343 Generate code that uses (does not use) the half-word multiply and
21344 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
21345 These instructions are generated by default when targeting those
21346 processors.
21347
21348 @item -mdlmzb
21349 @itemx -mno-dlmzb
21350 @opindex mdlmzb
21351 @opindex mno-dlmzb
21352 Generate code that uses (does not use) the string-search @samp{dlmzb}
21353 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
21354 generated by default when targeting those processors.
21355
21356 @item -mno-bit-align
21357 @itemx -mbit-align
21358 @opindex mno-bit-align
21359 @opindex mbit-align
21360 On System V.4 and embedded PowerPC systems do not (do) force structures
21361 and unions that contain bit-fields to be aligned to the base type of the
21362 bit-field.
21363
21364 For example, by default a structure containing nothing but 8
21365 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
21366 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
21367 the structure is aligned to a 1-byte boundary and is 1 byte in
21368 size.
21369
21370 @item -mno-strict-align
21371 @itemx -mstrict-align
21372 @opindex mno-strict-align
21373 @opindex mstrict-align
21374 On System V.4 and embedded PowerPC systems do not (do) assume that
21375 unaligned memory references are handled by the system.
21376
21377 @item -mrelocatable
21378 @itemx -mno-relocatable
21379 @opindex mrelocatable
21380 @opindex mno-relocatable
21381 Generate code that allows (does not allow) a static executable to be
21382 relocated to a different address at run time. A simple embedded
21383 PowerPC system loader should relocate the entire contents of
21384 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
21385 a table of 32-bit addresses generated by this option. For this to
21386 work, all objects linked together must be compiled with
21387 @option{-mrelocatable} or @option{-mrelocatable-lib}.
21388 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
21389
21390 @item -mrelocatable-lib
21391 @itemx -mno-relocatable-lib
21392 @opindex mrelocatable-lib
21393 @opindex mno-relocatable-lib
21394 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
21395 @code{.fixup} section to allow static executables to be relocated at
21396 run time, but @option{-mrelocatable-lib} does not use the smaller stack
21397 alignment of @option{-mrelocatable}. Objects compiled with
21398 @option{-mrelocatable-lib} may be linked with objects compiled with
21399 any combination of the @option{-mrelocatable} options.
21400
21401 @item -mno-toc
21402 @itemx -mtoc
21403 @opindex mno-toc
21404 @opindex mtoc
21405 On System V.4 and embedded PowerPC systems do not (do) assume that
21406 register 2 contains a pointer to a global area pointing to the addresses
21407 used in the program.
21408
21409 @item -mlittle
21410 @itemx -mlittle-endian
21411 @opindex mlittle
21412 @opindex mlittle-endian
21413 On System V.4 and embedded PowerPC systems compile code for the
21414 processor in little-endian mode. The @option{-mlittle-endian} option is
21415 the same as @option{-mlittle}.
21416
21417 @item -mbig
21418 @itemx -mbig-endian
21419 @opindex mbig
21420 @opindex mbig-endian
21421 On System V.4 and embedded PowerPC systems compile code for the
21422 processor in big-endian mode. The @option{-mbig-endian} option is
21423 the same as @option{-mbig}.
21424
21425 @item -mdynamic-no-pic
21426 @opindex mdynamic-no-pic
21427 On Darwin and Mac OS X systems, compile code so that it is not
21428 relocatable, but that its external references are relocatable. The
21429 resulting code is suitable for applications, but not shared
21430 libraries.
21431
21432 @item -msingle-pic-base
21433 @opindex msingle-pic-base
21434 Treat the register used for PIC addressing as read-only, rather than
21435 loading it in the prologue for each function. The runtime system is
21436 responsible for initializing this register with an appropriate value
21437 before execution begins.
21438
21439 @item -mprioritize-restricted-insns=@var{priority}
21440 @opindex mprioritize-restricted-insns
21441 This option controls the priority that is assigned to
21442 dispatch-slot restricted instructions during the second scheduling
21443 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
21444 or @samp{2} to assign no, highest, or second-highest (respectively)
21445 priority to dispatch-slot restricted
21446 instructions.
21447
21448 @item -msched-costly-dep=@var{dependence_type}
21449 @opindex msched-costly-dep
21450 This option controls which dependences are considered costly
21451 by the target during instruction scheduling. The argument
21452 @var{dependence_type} takes one of the following values:
21453
21454 @table @asis
21455 @item @samp{no}
21456 No dependence is costly.
21457
21458 @item @samp{all}
21459 All dependences are costly.
21460
21461 @item @samp{true_store_to_load}
21462 A true dependence from store to load is costly.
21463
21464 @item @samp{store_to_load}
21465 Any dependence from store to load is costly.
21466
21467 @item @var{number}
21468 Any dependence for which the latency is greater than or equal to
21469 @var{number} is costly.
21470 @end table
21471
21472 @item -minsert-sched-nops=@var{scheme}
21473 @opindex minsert-sched-nops
21474 This option controls which NOP insertion scheme is used during
21475 the second scheduling pass. The argument @var{scheme} takes one of the
21476 following values:
21477
21478 @table @asis
21479 @item @samp{no}
21480 Don't insert NOPs.
21481
21482 @item @samp{pad}
21483 Pad with NOPs any dispatch group that has vacant issue slots,
21484 according to the scheduler's grouping.
21485
21486 @item @samp{regroup_exact}
21487 Insert NOPs to force costly dependent insns into
21488 separate groups. Insert exactly as many NOPs as needed to force an insn
21489 to a new group, according to the estimated processor grouping.
21490
21491 @item @var{number}
21492 Insert NOPs to force costly dependent insns into
21493 separate groups. Insert @var{number} NOPs to force an insn to a new group.
21494 @end table
21495
21496 @item -mcall-sysv
21497 @opindex mcall-sysv
21498 On System V.4 and embedded PowerPC systems compile code using calling
21499 conventions that adhere to the March 1995 draft of the System V
21500 Application Binary Interface, PowerPC processor supplement. This is the
21501 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
21502
21503 @item -mcall-sysv-eabi
21504 @itemx -mcall-eabi
21505 @opindex mcall-sysv-eabi
21506 @opindex mcall-eabi
21507 Specify both @option{-mcall-sysv} and @option{-meabi} options.
21508
21509 @item -mcall-sysv-noeabi
21510 @opindex mcall-sysv-noeabi
21511 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
21512
21513 @item -mcall-aixdesc
21514 @opindex m
21515 On System V.4 and embedded PowerPC systems compile code for the AIX
21516 operating system.
21517
21518 @item -mcall-linux
21519 @opindex mcall-linux
21520 On System V.4 and embedded PowerPC systems compile code for the
21521 Linux-based GNU system.
21522
21523 @item -mcall-freebsd
21524 @opindex mcall-freebsd
21525 On System V.4 and embedded PowerPC systems compile code for the
21526 FreeBSD operating system.
21527
21528 @item -mcall-netbsd
21529 @opindex mcall-netbsd
21530 On System V.4 and embedded PowerPC systems compile code for the
21531 NetBSD operating system.
21532
21533 @item -mcall-openbsd
21534 @opindex mcall-netbsd
21535 On System V.4 and embedded PowerPC systems compile code for the
21536 OpenBSD operating system.
21537
21538 @item -maix-struct-return
21539 @opindex maix-struct-return
21540 Return all structures in memory (as specified by the AIX ABI)@.
21541
21542 @item -msvr4-struct-return
21543 @opindex msvr4-struct-return
21544 Return structures smaller than 8 bytes in registers (as specified by the
21545 SVR4 ABI)@.
21546
21547 @item -mabi=@var{abi-type}
21548 @opindex mabi
21549 Extend the current ABI with a particular extension, or remove such extension.
21550 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
21551 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
21552 @samp{elfv1}, @samp{elfv2}@.
21553
21554 @item -mabi=spe
21555 @opindex mabi=spe
21556 Extend the current ABI with SPE ABI extensions. This does not change
21557 the default ABI, instead it adds the SPE ABI extensions to the current
21558 ABI@.
21559
21560 @item -mabi=no-spe
21561 @opindex mabi=no-spe
21562 Disable Book-E SPE ABI extensions for the current ABI@.
21563
21564 @item -mabi=ibmlongdouble
21565 @opindex mabi=ibmlongdouble
21566 Change the current ABI to use IBM extended-precision long double.
21567 This is a PowerPC 32-bit SYSV ABI option.
21568
21569 @item -mabi=ieeelongdouble
21570 @opindex mabi=ieeelongdouble
21571 Change the current ABI to use IEEE extended-precision long double.
21572 This is a PowerPC 32-bit Linux ABI option.
21573
21574 @item -mabi=elfv1
21575 @opindex mabi=elfv1
21576 Change the current ABI to use the ELFv1 ABI.
21577 This is the default ABI for big-endian PowerPC 64-bit Linux.
21578 Overriding the default ABI requires special system support and is
21579 likely to fail in spectacular ways.
21580
21581 @item -mabi=elfv2
21582 @opindex mabi=elfv2
21583 Change the current ABI to use the ELFv2 ABI.
21584 This is the default ABI for little-endian PowerPC 64-bit Linux.
21585 Overriding the default ABI requires special system support and is
21586 likely to fail in spectacular ways.
21587
21588 @item -mgnu-attribute
21589 @itemx -mno-gnu-attribute
21590 @opindex mgnu-attribute
21591 @opindex mno-gnu-attribute
21592 Emit .gnu_attribute assembly directives to set tag/value pairs in a
21593 .gnu.attributes section that specify ABI variations in function
21594 parameters or return values.
21595
21596 @item -mprototype
21597 @itemx -mno-prototype
21598 @opindex mprototype
21599 @opindex mno-prototype
21600 On System V.4 and embedded PowerPC systems assume that all calls to
21601 variable argument functions are properly prototyped. Otherwise, the
21602 compiler must insert an instruction before every non-prototyped call to
21603 set or clear bit 6 of the condition code register (@code{CR}) to
21604 indicate whether floating-point values are passed in the floating-point
21605 registers in case the function takes variable arguments. With
21606 @option{-mprototype}, only calls to prototyped variable argument functions
21607 set or clear the bit.
21608
21609 @item -msim
21610 @opindex msim
21611 On embedded PowerPC systems, assume that the startup module is called
21612 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
21613 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
21614 configurations.
21615
21616 @item -mmvme
21617 @opindex mmvme
21618 On embedded PowerPC systems, assume that the startup module is called
21619 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
21620 @file{libc.a}.
21621
21622 @item -mads
21623 @opindex mads
21624 On embedded PowerPC systems, assume that the startup module is called
21625 @file{crt0.o} and the standard C libraries are @file{libads.a} and
21626 @file{libc.a}.
21627
21628 @item -myellowknife
21629 @opindex myellowknife
21630 On embedded PowerPC systems, assume that the startup module is called
21631 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
21632 @file{libc.a}.
21633
21634 @item -mvxworks
21635 @opindex mvxworks
21636 On System V.4 and embedded PowerPC systems, specify that you are
21637 compiling for a VxWorks system.
21638
21639 @item -memb
21640 @opindex memb
21641 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
21642 header to indicate that @samp{eabi} extended relocations are used.
21643
21644 @item -meabi
21645 @itemx -mno-eabi
21646 @opindex meabi
21647 @opindex mno-eabi
21648 On System V.4 and embedded PowerPC systems do (do not) adhere to the
21649 Embedded Applications Binary Interface (EABI), which is a set of
21650 modifications to the System V.4 specifications. Selecting @option{-meabi}
21651 means that the stack is aligned to an 8-byte boundary, a function
21652 @code{__eabi} is called from @code{main} to set up the EABI
21653 environment, and the @option{-msdata} option can use both @code{r2} and
21654 @code{r13} to point to two separate small data areas. Selecting
21655 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
21656 no EABI initialization function is called from @code{main}, and the
21657 @option{-msdata} option only uses @code{r13} to point to a single
21658 small data area. The @option{-meabi} option is on by default if you
21659 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
21660
21661 @item -msdata=eabi
21662 @opindex msdata=eabi
21663 On System V.4 and embedded PowerPC systems, put small initialized
21664 @code{const} global and static data in the @code{.sdata2} section, which
21665 is pointed to by register @code{r2}. Put small initialized
21666 non-@code{const} global and static data in the @code{.sdata} section,
21667 which is pointed to by register @code{r13}. Put small uninitialized
21668 global and static data in the @code{.sbss} section, which is adjacent to
21669 the @code{.sdata} section. The @option{-msdata=eabi} option is
21670 incompatible with the @option{-mrelocatable} option. The
21671 @option{-msdata=eabi} option also sets the @option{-memb} option.
21672
21673 @item -msdata=sysv
21674 @opindex msdata=sysv
21675 On System V.4 and embedded PowerPC systems, put small global and static
21676 data in the @code{.sdata} section, which is pointed to by register
21677 @code{r13}. Put small uninitialized global and static data in the
21678 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
21679 The @option{-msdata=sysv} option is incompatible with the
21680 @option{-mrelocatable} option.
21681
21682 @item -msdata=default
21683 @itemx -msdata
21684 @opindex msdata=default
21685 @opindex msdata
21686 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
21687 compile code the same as @option{-msdata=eabi}, otherwise compile code the
21688 same as @option{-msdata=sysv}.
21689
21690 @item -msdata=data
21691 @opindex msdata=data
21692 On System V.4 and embedded PowerPC systems, put small global
21693 data in the @code{.sdata} section. Put small uninitialized global
21694 data in the @code{.sbss} section. Do not use register @code{r13}
21695 to address small data however. This is the default behavior unless
21696 other @option{-msdata} options are used.
21697
21698 @item -msdata=none
21699 @itemx -mno-sdata
21700 @opindex msdata=none
21701 @opindex mno-sdata
21702 On embedded PowerPC systems, put all initialized global and static data
21703 in the @code{.data} section, and all uninitialized data in the
21704 @code{.bss} section.
21705
21706 @item -mblock-move-inline-limit=@var{num}
21707 @opindex mblock-move-inline-limit
21708 Inline all block moves (such as calls to @code{memcpy} or structure
21709 copies) less than or equal to @var{num} bytes. The minimum value for
21710 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
21711 targets. The default value is target-specific.
21712
21713 @item -G @var{num}
21714 @opindex G
21715 @cindex smaller data references (PowerPC)
21716 @cindex .sdata/.sdata2 references (PowerPC)
21717 On embedded PowerPC systems, put global and static items less than or
21718 equal to @var{num} bytes into the small data or BSS sections instead of
21719 the normal data or BSS section. By default, @var{num} is 8. The
21720 @option{-G @var{num}} switch is also passed to the linker.
21721 All modules should be compiled with the same @option{-G @var{num}} value.
21722
21723 @item -mregnames
21724 @itemx -mno-regnames
21725 @opindex mregnames
21726 @opindex mno-regnames
21727 On System V.4 and embedded PowerPC systems do (do not) emit register
21728 names in the assembly language output using symbolic forms.
21729
21730 @item -mlongcall
21731 @itemx -mno-longcall
21732 @opindex mlongcall
21733 @opindex mno-longcall
21734 By default assume that all calls are far away so that a longer and more
21735 expensive calling sequence is required. This is required for calls
21736 farther than 32 megabytes (33,554,432 bytes) from the current location.
21737 A short call is generated if the compiler knows
21738 the call cannot be that far away. This setting can be overridden by
21739 the @code{shortcall} function attribute, or by @code{#pragma
21740 longcall(0)}.
21741
21742 Some linkers are capable of detecting out-of-range calls and generating
21743 glue code on the fly. On these systems, long calls are unnecessary and
21744 generate slower code. As of this writing, the AIX linker can do this,
21745 as can the GNU linker for PowerPC/64. It is planned to add this feature
21746 to the GNU linker for 32-bit PowerPC systems as well.
21747
21748 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
21749 callee, L42}, plus a @dfn{branch island} (glue code). The two target
21750 addresses represent the callee and the branch island. The
21751 Darwin/PPC linker prefers the first address and generates a @code{bl
21752 callee} if the PPC @code{bl} instruction reaches the callee directly;
21753 otherwise, the linker generates @code{bl L42} to call the branch
21754 island. The branch island is appended to the body of the
21755 calling function; it computes the full 32-bit address of the callee
21756 and jumps to it.
21757
21758 On Mach-O (Darwin) systems, this option directs the compiler emit to
21759 the glue for every direct call, and the Darwin linker decides whether
21760 to use or discard it.
21761
21762 In the future, GCC may ignore all longcall specifications
21763 when the linker is known to generate glue.
21764
21765 @item -mtls-markers
21766 @itemx -mno-tls-markers
21767 @opindex mtls-markers
21768 @opindex mno-tls-markers
21769 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
21770 specifying the function argument. The relocation allows the linker to
21771 reliably associate function call with argument setup instructions for
21772 TLS optimization, which in turn allows GCC to better schedule the
21773 sequence.
21774
21775 @item -pthread
21776 @opindex pthread
21777 Adds support for multithreading with the @dfn{pthreads} library.
21778 This option sets flags for both the preprocessor and linker.
21779
21780 @item -mrecip
21781 @itemx -mno-recip
21782 @opindex mrecip
21783 This option enables use of the reciprocal estimate and
21784 reciprocal square root estimate instructions with additional
21785 Newton-Raphson steps to increase precision instead of doing a divide or
21786 square root and divide for floating-point arguments. You should use
21787 the @option{-ffast-math} option when using @option{-mrecip} (or at
21788 least @option{-funsafe-math-optimizations},
21789 @option{-ffinite-math-only}, @option{-freciprocal-math} and
21790 @option{-fno-trapping-math}). Note that while the throughput of the
21791 sequence is generally higher than the throughput of the non-reciprocal
21792 instruction, the precision of the sequence can be decreased by up to 2
21793 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
21794 roots.
21795
21796 @item -mrecip=@var{opt}
21797 @opindex mrecip=opt
21798 This option controls which reciprocal estimate instructions
21799 may be used. @var{opt} is a comma-separated list of options, which may
21800 be preceded by a @code{!} to invert the option:
21801
21802 @table @samp
21803
21804 @item all
21805 Enable all estimate instructions.
21806
21807 @item default
21808 Enable the default instructions, equivalent to @option{-mrecip}.
21809
21810 @item none
21811 Disable all estimate instructions, equivalent to @option{-mno-recip}.
21812
21813 @item div
21814 Enable the reciprocal approximation instructions for both
21815 single and double precision.
21816
21817 @item divf
21818 Enable the single-precision reciprocal approximation instructions.
21819
21820 @item divd
21821 Enable the double-precision reciprocal approximation instructions.
21822
21823 @item rsqrt
21824 Enable the reciprocal square root approximation instructions for both
21825 single and double precision.
21826
21827 @item rsqrtf
21828 Enable the single-precision reciprocal square root approximation instructions.
21829
21830 @item rsqrtd
21831 Enable the double-precision reciprocal square root approximation instructions.
21832
21833 @end table
21834
21835 So, for example, @option{-mrecip=all,!rsqrtd} enables
21836 all of the reciprocal estimate instructions, except for the
21837 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
21838 which handle the double-precision reciprocal square root calculations.
21839
21840 @item -mrecip-precision
21841 @itemx -mno-recip-precision
21842 @opindex mrecip-precision
21843 Assume (do not assume) that the reciprocal estimate instructions
21844 provide higher-precision estimates than is mandated by the PowerPC
21845 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
21846 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
21847 The double-precision square root estimate instructions are not generated by
21848 default on low-precision machines, since they do not provide an
21849 estimate that converges after three steps.
21850
21851 @item -mveclibabi=@var{type}
21852 @opindex mveclibabi
21853 Specifies the ABI type to use for vectorizing intrinsics using an
21854 external library. The only type supported at present is @samp{mass},
21855 which specifies to use IBM's Mathematical Acceleration Subsystem
21856 (MASS) libraries for vectorizing intrinsics using external libraries.
21857 GCC currently emits calls to @code{acosd2}, @code{acosf4},
21858 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
21859 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
21860 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
21861 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
21862 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
21863 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
21864 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
21865 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
21866 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
21867 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
21868 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
21869 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
21870 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
21871 for power7. Both @option{-ftree-vectorize} and
21872 @option{-funsafe-math-optimizations} must also be enabled. The MASS
21873 libraries must be specified at link time.
21874
21875 @item -mfriz
21876 @itemx -mno-friz
21877 @opindex mfriz
21878 Generate (do not generate) the @code{friz} instruction when the
21879 @option{-funsafe-math-optimizations} option is used to optimize
21880 rounding of floating-point values to 64-bit integer and back to floating
21881 point. The @code{friz} instruction does not return the same value if
21882 the floating-point number is too large to fit in an integer.
21883
21884 @item -mpointers-to-nested-functions
21885 @itemx -mno-pointers-to-nested-functions
21886 @opindex mpointers-to-nested-functions
21887 Generate (do not generate) code to load up the static chain register
21888 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
21889 systems where a function pointer points to a 3-word descriptor giving
21890 the function address, TOC value to be loaded in register @code{r2}, and
21891 static chain value to be loaded in register @code{r11}. The
21892 @option{-mpointers-to-nested-functions} is on by default. You cannot
21893 call through pointers to nested functions or pointers
21894 to functions compiled in other languages that use the static chain if
21895 you use @option{-mno-pointers-to-nested-functions}.
21896
21897 @item -msave-toc-indirect
21898 @itemx -mno-save-toc-indirect
21899 @opindex msave-toc-indirect
21900 Generate (do not generate) code to save the TOC value in the reserved
21901 stack location in the function prologue if the function calls through
21902 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
21903 saved in the prologue, it is saved just before the call through the
21904 pointer. The @option{-mno-save-toc-indirect} option is the default.
21905
21906 @item -mcompat-align-parm
21907 @itemx -mno-compat-align-parm
21908 @opindex mcompat-align-parm
21909 Generate (do not generate) code to pass structure parameters with a
21910 maximum alignment of 64 bits, for compatibility with older versions
21911 of GCC.
21912
21913 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
21914 structure parameter on a 128-bit boundary when that structure contained
21915 a member requiring 128-bit alignment. This is corrected in more
21916 recent versions of GCC. This option may be used to generate code
21917 that is compatible with functions compiled with older versions of
21918 GCC.
21919
21920 The @option{-mno-compat-align-parm} option is the default.
21921 @end table
21922
21923 @node RX Options
21924 @subsection RX Options
21925 @cindex RX Options
21926
21927 These command-line options are defined for RX targets:
21928
21929 @table @gcctabopt
21930 @item -m64bit-doubles
21931 @itemx -m32bit-doubles
21932 @opindex m64bit-doubles
21933 @opindex m32bit-doubles
21934 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
21935 or 32 bits (@option{-m32bit-doubles}) in size. The default is
21936 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
21937 works on 32-bit values, which is why the default is
21938 @option{-m32bit-doubles}.
21939
21940 @item -fpu
21941 @itemx -nofpu
21942 @opindex fpu
21943 @opindex nofpu
21944 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
21945 floating-point hardware. The default is enabled for the RX600
21946 series and disabled for the RX200 series.
21947
21948 Floating-point instructions are only generated for 32-bit floating-point
21949 values, however, so the FPU hardware is not used for doubles if the
21950 @option{-m64bit-doubles} option is used.
21951
21952 @emph{Note} If the @option{-fpu} option is enabled then
21953 @option{-funsafe-math-optimizations} is also enabled automatically.
21954 This is because the RX FPU instructions are themselves unsafe.
21955
21956 @item -mcpu=@var{name}
21957 @opindex mcpu
21958 Selects the type of RX CPU to be targeted. Currently three types are
21959 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
21960 the specific @samp{RX610} CPU. The default is @samp{RX600}.
21961
21962 The only difference between @samp{RX600} and @samp{RX610} is that the
21963 @samp{RX610} does not support the @code{MVTIPL} instruction.
21964
21965 The @samp{RX200} series does not have a hardware floating-point unit
21966 and so @option{-nofpu} is enabled by default when this type is
21967 selected.
21968
21969 @item -mbig-endian-data
21970 @itemx -mlittle-endian-data
21971 @opindex mbig-endian-data
21972 @opindex mlittle-endian-data
21973 Store data (but not code) in the big-endian format. The default is
21974 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
21975 format.
21976
21977 @item -msmall-data-limit=@var{N}
21978 @opindex msmall-data-limit
21979 Specifies the maximum size in bytes of global and static variables
21980 which can be placed into the small data area. Using the small data
21981 area can lead to smaller and faster code, but the size of area is
21982 limited and it is up to the programmer to ensure that the area does
21983 not overflow. Also when the small data area is used one of the RX's
21984 registers (usually @code{r13}) is reserved for use pointing to this
21985 area, so it is no longer available for use by the compiler. This
21986 could result in slower and/or larger code if variables are pushed onto
21987 the stack instead of being held in this register.
21988
21989 Note, common variables (variables that have not been initialized) and
21990 constants are not placed into the small data area as they are assigned
21991 to other sections in the output executable.
21992
21993 The default value is zero, which disables this feature. Note, this
21994 feature is not enabled by default with higher optimization levels
21995 (@option{-O2} etc) because of the potentially detrimental effects of
21996 reserving a register. It is up to the programmer to experiment and
21997 discover whether this feature is of benefit to their program. See the
21998 description of the @option{-mpid} option for a description of how the
21999 actual register to hold the small data area pointer is chosen.
22000
22001 @item -msim
22002 @itemx -mno-sim
22003 @opindex msim
22004 @opindex mno-sim
22005 Use the simulator runtime. The default is to use the libgloss
22006 board-specific runtime.
22007
22008 @item -mas100-syntax
22009 @itemx -mno-as100-syntax
22010 @opindex mas100-syntax
22011 @opindex mno-as100-syntax
22012 When generating assembler output use a syntax that is compatible with
22013 Renesas's AS100 assembler. This syntax can also be handled by the GAS
22014 assembler, but it has some restrictions so it is not generated by default.
22015
22016 @item -mmax-constant-size=@var{N}
22017 @opindex mmax-constant-size
22018 Specifies the maximum size, in bytes, of a constant that can be used as
22019 an operand in a RX instruction. Although the RX instruction set does
22020 allow constants of up to 4 bytes in length to be used in instructions,
22021 a longer value equates to a longer instruction. Thus in some
22022 circumstances it can be beneficial to restrict the size of constants
22023 that are used in instructions. Constants that are too big are instead
22024 placed into a constant pool and referenced via register indirection.
22025
22026 The value @var{N} can be between 0 and 4. A value of 0 (the default)
22027 or 4 means that constants of any size are allowed.
22028
22029 @item -mrelax
22030 @opindex mrelax
22031 Enable linker relaxation. Linker relaxation is a process whereby the
22032 linker attempts to reduce the size of a program by finding shorter
22033 versions of various instructions. Disabled by default.
22034
22035 @item -mint-register=@var{N}
22036 @opindex mint-register
22037 Specify the number of registers to reserve for fast interrupt handler
22038 functions. The value @var{N} can be between 0 and 4. A value of 1
22039 means that register @code{r13} is reserved for the exclusive use
22040 of fast interrupt handlers. A value of 2 reserves @code{r13} and
22041 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
22042 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
22043 A value of 0, the default, does not reserve any registers.
22044
22045 @item -msave-acc-in-interrupts
22046 @opindex msave-acc-in-interrupts
22047 Specifies that interrupt handler functions should preserve the
22048 accumulator register. This is only necessary if normal code might use
22049 the accumulator register, for example because it performs 64-bit
22050 multiplications. The default is to ignore the accumulator as this
22051 makes the interrupt handlers faster.
22052
22053 @item -mpid
22054 @itemx -mno-pid
22055 @opindex mpid
22056 @opindex mno-pid
22057 Enables the generation of position independent data. When enabled any
22058 access to constant data is done via an offset from a base address
22059 held in a register. This allows the location of constant data to be
22060 determined at run time without requiring the executable to be
22061 relocated, which is a benefit to embedded applications with tight
22062 memory constraints. Data that can be modified is not affected by this
22063 option.
22064
22065 Note, using this feature reserves a register, usually @code{r13}, for
22066 the constant data base address. This can result in slower and/or
22067 larger code, especially in complicated functions.
22068
22069 The actual register chosen to hold the constant data base address
22070 depends upon whether the @option{-msmall-data-limit} and/or the
22071 @option{-mint-register} command-line options are enabled. Starting
22072 with register @code{r13} and proceeding downwards, registers are
22073 allocated first to satisfy the requirements of @option{-mint-register},
22074 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
22075 is possible for the small data area register to be @code{r8} if both
22076 @option{-mint-register=4} and @option{-mpid} are specified on the
22077 command line.
22078
22079 By default this feature is not enabled. The default can be restored
22080 via the @option{-mno-pid} command-line option.
22081
22082 @item -mno-warn-multiple-fast-interrupts
22083 @itemx -mwarn-multiple-fast-interrupts
22084 @opindex mno-warn-multiple-fast-interrupts
22085 @opindex mwarn-multiple-fast-interrupts
22086 Prevents GCC from issuing a warning message if it finds more than one
22087 fast interrupt handler when it is compiling a file. The default is to
22088 issue a warning for each extra fast interrupt handler found, as the RX
22089 only supports one such interrupt.
22090
22091 @item -mallow-string-insns
22092 @itemx -mno-allow-string-insns
22093 @opindex mallow-string-insns
22094 @opindex mno-allow-string-insns
22095 Enables or disables the use of the string manipulation instructions
22096 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
22097 @code{SWHILE} and also the @code{RMPA} instruction. These
22098 instructions may prefetch data, which is not safe to do if accessing
22099 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
22100 for more information).
22101
22102 The default is to allow these instructions, but it is not possible for
22103 GCC to reliably detect all circumstances where a string instruction
22104 might be used to access an I/O register, so their use cannot be
22105 disabled automatically. Instead it is reliant upon the programmer to
22106 use the @option{-mno-allow-string-insns} option if their program
22107 accesses I/O space.
22108
22109 When the instructions are enabled GCC defines the C preprocessor
22110 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
22111 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
22112
22113 @item -mjsr
22114 @itemx -mno-jsr
22115 @opindex mjsr
22116 @opindex mno-jsr
22117 Use only (or not only) @code{JSR} instructions to access functions.
22118 This option can be used when code size exceeds the range of @code{BSR}
22119 instructions. Note that @option{-mno-jsr} does not mean to not use
22120 @code{JSR} but instead means that any type of branch may be used.
22121 @end table
22122
22123 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
22124 has special significance to the RX port when used with the
22125 @code{interrupt} function attribute. This attribute indicates a
22126 function intended to process fast interrupts. GCC ensures
22127 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
22128 and/or @code{r13} and only provided that the normal use of the
22129 corresponding registers have been restricted via the
22130 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
22131 options.
22132
22133 @node S/390 and zSeries Options
22134 @subsection S/390 and zSeries Options
22135 @cindex S/390 and zSeries Options
22136
22137 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
22138
22139 @table @gcctabopt
22140 @item -mhard-float
22141 @itemx -msoft-float
22142 @opindex mhard-float
22143 @opindex msoft-float
22144 Use (do not use) the hardware floating-point instructions and registers
22145 for floating-point operations. When @option{-msoft-float} is specified,
22146 functions in @file{libgcc.a} are used to perform floating-point
22147 operations. When @option{-mhard-float} is specified, the compiler
22148 generates IEEE floating-point instructions. This is the default.
22149
22150 @item -mhard-dfp
22151 @itemx -mno-hard-dfp
22152 @opindex mhard-dfp
22153 @opindex mno-hard-dfp
22154 Use (do not use) the hardware decimal-floating-point instructions for
22155 decimal-floating-point operations. When @option{-mno-hard-dfp} is
22156 specified, functions in @file{libgcc.a} are used to perform
22157 decimal-floating-point operations. When @option{-mhard-dfp} is
22158 specified, the compiler generates decimal-floating-point hardware
22159 instructions. This is the default for @option{-march=z9-ec} or higher.
22160
22161 @item -mlong-double-64
22162 @itemx -mlong-double-128
22163 @opindex mlong-double-64
22164 @opindex mlong-double-128
22165 These switches control the size of @code{long double} type. A size
22166 of 64 bits makes the @code{long double} type equivalent to the @code{double}
22167 type. This is the default.
22168
22169 @item -mbackchain
22170 @itemx -mno-backchain
22171 @opindex mbackchain
22172 @opindex mno-backchain
22173 Store (do not store) the address of the caller's frame as backchain pointer
22174 into the callee's stack frame.
22175 A backchain may be needed to allow debugging using tools that do not understand
22176 DWARF call frame information.
22177 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
22178 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
22179 the backchain is placed into the topmost word of the 96/160 byte register
22180 save area.
22181
22182 In general, code compiled with @option{-mbackchain} is call-compatible with
22183 code compiled with @option{-mmo-backchain}; however, use of the backchain
22184 for debugging purposes usually requires that the whole binary is built with
22185 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
22186 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
22187 to build a linux kernel use @option{-msoft-float}.
22188
22189 The default is to not maintain the backchain.
22190
22191 @item -mpacked-stack
22192 @itemx -mno-packed-stack
22193 @opindex mpacked-stack
22194 @opindex mno-packed-stack
22195 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
22196 specified, the compiler uses the all fields of the 96/160 byte register save
22197 area only for their default purpose; unused fields still take up stack space.
22198 When @option{-mpacked-stack} is specified, register save slots are densely
22199 packed at the top of the register save area; unused space is reused for other
22200 purposes, allowing for more efficient use of the available stack space.
22201 However, when @option{-mbackchain} is also in effect, the topmost word of
22202 the save area is always used to store the backchain, and the return address
22203 register is always saved two words below the backchain.
22204
22205 As long as the stack frame backchain is not used, code generated with
22206 @option{-mpacked-stack} is call-compatible with code generated with
22207 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
22208 S/390 or zSeries generated code that uses the stack frame backchain at run
22209 time, not just for debugging purposes. Such code is not call-compatible
22210 with code compiled with @option{-mpacked-stack}. Also, note that the
22211 combination of @option{-mbackchain},
22212 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
22213 to build a linux kernel use @option{-msoft-float}.
22214
22215 The default is to not use the packed stack layout.
22216
22217 @item -msmall-exec
22218 @itemx -mno-small-exec
22219 @opindex msmall-exec
22220 @opindex mno-small-exec
22221 Generate (or do not generate) code using the @code{bras} instruction
22222 to do subroutine calls.
22223 This only works reliably if the total executable size does not
22224 exceed 64k. The default is to use the @code{basr} instruction instead,
22225 which does not have this limitation.
22226
22227 @item -m64
22228 @itemx -m31
22229 @opindex m64
22230 @opindex m31
22231 When @option{-m31} is specified, generate code compliant to the
22232 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
22233 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
22234 particular to generate 64-bit instructions. For the @samp{s390}
22235 targets, the default is @option{-m31}, while the @samp{s390x}
22236 targets default to @option{-m64}.
22237
22238 @item -mzarch
22239 @itemx -mesa
22240 @opindex mzarch
22241 @opindex mesa
22242 When @option{-mzarch} is specified, generate code using the
22243 instructions available on z/Architecture.
22244 When @option{-mesa} is specified, generate code using the
22245 instructions available on ESA/390. Note that @option{-mesa} is
22246 not possible with @option{-m64}.
22247 When generating code compliant to the GNU/Linux for S/390 ABI,
22248 the default is @option{-mesa}. When generating code compliant
22249 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
22250
22251 @item -mhtm
22252 @itemx -mno-htm
22253 @opindex mhtm
22254 @opindex mno-htm
22255 The @option{-mhtm} option enables a set of builtins making use of
22256 instructions available with the transactional execution facility
22257 introduced with the IBM zEnterprise EC12 machine generation
22258 @ref{S/390 System z Built-in Functions}.
22259 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
22260
22261 @item -mvx
22262 @itemx -mno-vx
22263 @opindex mvx
22264 @opindex mno-vx
22265 When @option{-mvx} is specified, generate code using the instructions
22266 available with the vector extension facility introduced with the IBM
22267 z13 machine generation.
22268 This option changes the ABI for some vector type values with regard to
22269 alignment and calling conventions. In case vector type values are
22270 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
22271 command will be added to mark the resulting binary with the ABI used.
22272 @option{-mvx} is enabled by default when using @option{-march=z13}.
22273
22274 @item -mzvector
22275 @itemx -mno-zvector
22276 @opindex mzvector
22277 @opindex mno-zvector
22278 The @option{-mzvector} option enables vector language extensions and
22279 builtins using instructions available with the vector extension
22280 facility introduced with the IBM z13 machine generation.
22281 This option adds support for @samp{vector} to be used as a keyword to
22282 define vector type variables and arguments. @samp{vector} is only
22283 available when GNU extensions are enabled. It will not be expanded
22284 when requesting strict standard compliance e.g. with @option{-std=c99}.
22285 In addition to the GCC low-level builtins @option{-mzvector} enables
22286 a set of builtins added for compatibility with AltiVec-style
22287 implementations like Power and Cell. In order to make use of these
22288 builtins the header file @file{vecintrin.h} needs to be included.
22289 @option{-mzvector} is disabled by default.
22290
22291 @item -mmvcle
22292 @itemx -mno-mvcle
22293 @opindex mmvcle
22294 @opindex mno-mvcle
22295 Generate (or do not generate) code using the @code{mvcle} instruction
22296 to perform block moves. When @option{-mno-mvcle} is specified,
22297 use a @code{mvc} loop instead. This is the default unless optimizing for
22298 size.
22299
22300 @item -mdebug
22301 @itemx -mno-debug
22302 @opindex mdebug
22303 @opindex mno-debug
22304 Print (or do not print) additional debug information when compiling.
22305 The default is to not print debug information.
22306
22307 @item -march=@var{cpu-type}
22308 @opindex march
22309 Generate code that runs on @var{cpu-type}, which is the name of a
22310 system representing a certain processor type. Possible values for
22311 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
22312 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
22313 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
22314 @samp{native}.
22315
22316 The default is @option{-march=z900}. @samp{g5}/@samp{arch3} and
22317 @samp{g6} are deprecated and will be removed with future releases.
22318
22319 Specifying @samp{native} as cpu type can be used to select the best
22320 architecture option for the host processor.
22321 @option{-march=native} has no effect if GCC does not recognize the
22322 processor.
22323
22324 @item -mtune=@var{cpu-type}
22325 @opindex mtune
22326 Tune to @var{cpu-type} everything applicable about the generated code,
22327 except for the ABI and the set of available instructions.
22328 The list of @var{cpu-type} values is the same as for @option{-march}.
22329 The default is the value used for @option{-march}.
22330
22331 @item -mtpf-trace
22332 @itemx -mno-tpf-trace
22333 @opindex mtpf-trace
22334 @opindex mno-tpf-trace
22335 Generate code that adds (does not add) in TPF OS specific branches to trace
22336 routines in the operating system. This option is off by default, even
22337 when compiling for the TPF OS@.
22338
22339 @item -mfused-madd
22340 @itemx -mno-fused-madd
22341 @opindex mfused-madd
22342 @opindex mno-fused-madd
22343 Generate code that uses (does not use) the floating-point multiply and
22344 accumulate instructions. These instructions are generated by default if
22345 hardware floating point is used.
22346
22347 @item -mwarn-framesize=@var{framesize}
22348 @opindex mwarn-framesize
22349 Emit a warning if the current function exceeds the given frame size. Because
22350 this is a compile-time check it doesn't need to be a real problem when the program
22351 runs. It is intended to identify functions that most probably cause
22352 a stack overflow. It is useful to be used in an environment with limited stack
22353 size e.g.@: the linux kernel.
22354
22355 @item -mwarn-dynamicstack
22356 @opindex mwarn-dynamicstack
22357 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
22358 arrays. This is generally a bad idea with a limited stack size.
22359
22360 @item -mstack-guard=@var{stack-guard}
22361 @itemx -mstack-size=@var{stack-size}
22362 @opindex mstack-guard
22363 @opindex mstack-size
22364 If these options are provided the S/390 back end emits additional instructions in
22365 the function prologue that trigger a trap if the stack size is @var{stack-guard}
22366 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
22367 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
22368 the frame size of the compiled function is chosen.
22369 These options are intended to be used to help debugging stack overflow problems.
22370 The additionally emitted code causes only little overhead and hence can also be
22371 used in production-like systems without greater performance degradation. The given
22372 values have to be exact powers of 2 and @var{stack-size} has to be greater than
22373 @var{stack-guard} without exceeding 64k.
22374 In order to be efficient the extra code makes the assumption that the stack starts
22375 at an address aligned to the value given by @var{stack-size}.
22376 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
22377
22378 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
22379 @opindex mhotpatch
22380 If the hotpatch option is enabled, a ``hot-patching'' function
22381 prologue is generated for all functions in the compilation unit.
22382 The funtion label is prepended with the given number of two-byte
22383 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
22384 the label, 2 * @var{post-halfwords} bytes are appended, using the
22385 largest NOP like instructions the architecture allows (maximum
22386 1000000).
22387
22388 If both arguments are zero, hotpatching is disabled.
22389
22390 This option can be overridden for individual functions with the
22391 @code{hotpatch} attribute.
22392 @end table
22393
22394 @node Score Options
22395 @subsection Score Options
22396 @cindex Score Options
22397
22398 These options are defined for Score implementations:
22399
22400 @table @gcctabopt
22401 @item -meb
22402 @opindex meb
22403 Compile code for big-endian mode. This is the default.
22404
22405 @item -mel
22406 @opindex mel
22407 Compile code for little-endian mode.
22408
22409 @item -mnhwloop
22410 @opindex mnhwloop
22411 Disable generation of @code{bcnz} instructions.
22412
22413 @item -muls
22414 @opindex muls
22415 Enable generation of unaligned load and store instructions.
22416
22417 @item -mmac
22418 @opindex mmac
22419 Enable the use of multiply-accumulate instructions. Disabled by default.
22420
22421 @item -mscore5
22422 @opindex mscore5
22423 Specify the SCORE5 as the target architecture.
22424
22425 @item -mscore5u
22426 @opindex mscore5u
22427 Specify the SCORE5U of the target architecture.
22428
22429 @item -mscore7
22430 @opindex mscore7
22431 Specify the SCORE7 as the target architecture. This is the default.
22432
22433 @item -mscore7d
22434 @opindex mscore7d
22435 Specify the SCORE7D as the target architecture.
22436 @end table
22437
22438 @node SH Options
22439 @subsection SH Options
22440
22441 These @samp{-m} options are defined for the SH implementations:
22442
22443 @table @gcctabopt
22444 @item -m1
22445 @opindex m1
22446 Generate code for the SH1.
22447
22448 @item -m2
22449 @opindex m2
22450 Generate code for the SH2.
22451
22452 @item -m2e
22453 Generate code for the SH2e.
22454
22455 @item -m2a-nofpu
22456 @opindex m2a-nofpu
22457 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
22458 that the floating-point unit is not used.
22459
22460 @item -m2a-single-only
22461 @opindex m2a-single-only
22462 Generate code for the SH2a-FPU, in such a way that no double-precision
22463 floating-point operations are used.
22464
22465 @item -m2a-single
22466 @opindex m2a-single
22467 Generate code for the SH2a-FPU assuming the floating-point unit is in
22468 single-precision mode by default.
22469
22470 @item -m2a
22471 @opindex m2a
22472 Generate code for the SH2a-FPU assuming the floating-point unit is in
22473 double-precision mode by default.
22474
22475 @item -m3
22476 @opindex m3
22477 Generate code for the SH3.
22478
22479 @item -m3e
22480 @opindex m3e
22481 Generate code for the SH3e.
22482
22483 @item -m4-nofpu
22484 @opindex m4-nofpu
22485 Generate code for the SH4 without a floating-point unit.
22486
22487 @item -m4-single-only
22488 @opindex m4-single-only
22489 Generate code for the SH4 with a floating-point unit that only
22490 supports single-precision arithmetic.
22491
22492 @item -m4-single
22493 @opindex m4-single
22494 Generate code for the SH4 assuming the floating-point unit is in
22495 single-precision mode by default.
22496
22497 @item -m4
22498 @opindex m4
22499 Generate code for the SH4.
22500
22501 @item -m4-100
22502 @opindex m4-100
22503 Generate code for SH4-100.
22504
22505 @item -m4-100-nofpu
22506 @opindex m4-100-nofpu
22507 Generate code for SH4-100 in such a way that the
22508 floating-point unit is not used.
22509
22510 @item -m4-100-single
22511 @opindex m4-100-single
22512 Generate code for SH4-100 assuming the floating-point unit is in
22513 single-precision mode by default.
22514
22515 @item -m4-100-single-only
22516 @opindex m4-100-single-only
22517 Generate code for SH4-100 in such a way that no double-precision
22518 floating-point operations are used.
22519
22520 @item -m4-200
22521 @opindex m4-200
22522 Generate code for SH4-200.
22523
22524 @item -m4-200-nofpu
22525 @opindex m4-200-nofpu
22526 Generate code for SH4-200 without in such a way that the
22527 floating-point unit is not used.
22528
22529 @item -m4-200-single
22530 @opindex m4-200-single
22531 Generate code for SH4-200 assuming the floating-point unit is in
22532 single-precision mode by default.
22533
22534 @item -m4-200-single-only
22535 @opindex m4-200-single-only
22536 Generate code for SH4-200 in such a way that no double-precision
22537 floating-point operations are used.
22538
22539 @item -m4-300
22540 @opindex m4-300
22541 Generate code for SH4-300.
22542
22543 @item -m4-300-nofpu
22544 @opindex m4-300-nofpu
22545 Generate code for SH4-300 without in such a way that the
22546 floating-point unit is not used.
22547
22548 @item -m4-300-single
22549 @opindex m4-300-single
22550 Generate code for SH4-300 in such a way that no double-precision
22551 floating-point operations are used.
22552
22553 @item -m4-300-single-only
22554 @opindex m4-300-single-only
22555 Generate code for SH4-300 in such a way that no double-precision
22556 floating-point operations are used.
22557
22558 @item -m4-340
22559 @opindex m4-340
22560 Generate code for SH4-340 (no MMU, no FPU).
22561
22562 @item -m4-500
22563 @opindex m4-500
22564 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
22565 assembler.
22566
22567 @item -m4a-nofpu
22568 @opindex m4a-nofpu
22569 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
22570 floating-point unit is not used.
22571
22572 @item -m4a-single-only
22573 @opindex m4a-single-only
22574 Generate code for the SH4a, in such a way that no double-precision
22575 floating-point operations are used.
22576
22577 @item -m4a-single
22578 @opindex m4a-single
22579 Generate code for the SH4a assuming the floating-point unit is in
22580 single-precision mode by default.
22581
22582 @item -m4a
22583 @opindex m4a
22584 Generate code for the SH4a.
22585
22586 @item -m4al
22587 @opindex m4al
22588 Same as @option{-m4a-nofpu}, except that it implicitly passes
22589 @option{-dsp} to the assembler. GCC doesn't generate any DSP
22590 instructions at the moment.
22591
22592 @item -mb
22593 @opindex mb
22594 Compile code for the processor in big-endian mode.
22595
22596 @item -ml
22597 @opindex ml
22598 Compile code for the processor in little-endian mode.
22599
22600 @item -mdalign
22601 @opindex mdalign
22602 Align doubles at 64-bit boundaries. Note that this changes the calling
22603 conventions, and thus some functions from the standard C library do
22604 not work unless you recompile it first with @option{-mdalign}.
22605
22606 @item -mrelax
22607 @opindex mrelax
22608 Shorten some address references at link time, when possible; uses the
22609 linker option @option{-relax}.
22610
22611 @item -mbigtable
22612 @opindex mbigtable
22613 Use 32-bit offsets in @code{switch} tables. The default is to use
22614 16-bit offsets.
22615
22616 @item -mbitops
22617 @opindex mbitops
22618 Enable the use of bit manipulation instructions on SH2A.
22619
22620 @item -mfmovd
22621 @opindex mfmovd
22622 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
22623 alignment constraints.
22624
22625 @item -mrenesas
22626 @opindex mrenesas
22627 Comply with the calling conventions defined by Renesas.
22628
22629 @item -mno-renesas
22630 @opindex mno-renesas
22631 Comply with the calling conventions defined for GCC before the Renesas
22632 conventions were available. This option is the default for all
22633 targets of the SH toolchain.
22634
22635 @item -mnomacsave
22636 @opindex mnomacsave
22637 Mark the @code{MAC} register as call-clobbered, even if
22638 @option{-mrenesas} is given.
22639
22640 @item -mieee
22641 @itemx -mno-ieee
22642 @opindex mieee
22643 @opindex mno-ieee
22644 Control the IEEE compliance of floating-point comparisons, which affects the
22645 handling of cases where the result of a comparison is unordered. By default
22646 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
22647 enabled @option{-mno-ieee} is implicitly set, which results in faster
22648 floating-point greater-equal and less-equal comparisons. The implicit settings
22649 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
22650
22651 @item -minline-ic_invalidate
22652 @opindex minline-ic_invalidate
22653 Inline code to invalidate instruction cache entries after setting up
22654 nested function trampolines.
22655 This option has no effect if @option{-musermode} is in effect and the selected
22656 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
22657 instruction.
22658 If the selected code generation option does not allow the use of the @code{icbi}
22659 instruction, and @option{-musermode} is not in effect, the inlined code
22660 manipulates the instruction cache address array directly with an associative
22661 write. This not only requires privileged mode at run time, but it also
22662 fails if the cache line had been mapped via the TLB and has become unmapped.
22663
22664 @item -misize
22665 @opindex misize
22666 Dump instruction size and location in the assembly code.
22667
22668 @item -mpadstruct
22669 @opindex mpadstruct
22670 This option is deprecated. It pads structures to multiple of 4 bytes,
22671 which is incompatible with the SH ABI@.
22672
22673 @item -matomic-model=@var{model}
22674 @opindex matomic-model=@var{model}
22675 Sets the model of atomic operations and additional parameters as a comma
22676 separated list. For details on the atomic built-in functions see
22677 @ref{__atomic Builtins}. The following models and parameters are supported:
22678
22679 @table @samp
22680
22681 @item none
22682 Disable compiler generated atomic sequences and emit library calls for atomic
22683 operations. This is the default if the target is not @code{sh*-*-linux*}.
22684
22685 @item soft-gusa
22686 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
22687 built-in functions. The generated atomic sequences require additional support
22688 from the interrupt/exception handling code of the system and are only suitable
22689 for SH3* and SH4* single-core systems. This option is enabled by default when
22690 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
22691 this option also partially utilizes the hardware atomic instructions
22692 @code{movli.l} and @code{movco.l} to create more efficient code, unless
22693 @samp{strict} is specified.
22694
22695 @item soft-tcb
22696 Generate software atomic sequences that use a variable in the thread control
22697 block. This is a variation of the gUSA sequences which can also be used on
22698 SH1* and SH2* targets. The generated atomic sequences require additional
22699 support from the interrupt/exception handling code of the system and are only
22700 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
22701 parameter has to be specified as well.
22702
22703 @item soft-imask
22704 Generate software atomic sequences that temporarily disable interrupts by
22705 setting @code{SR.IMASK = 1111}. This model works only when the program runs
22706 in privileged mode and is only suitable for single-core systems. Additional
22707 support from the interrupt/exception handling code of the system is not
22708 required. This model is enabled by default when the target is
22709 @code{sh*-*-linux*} and SH1* or SH2*.
22710
22711 @item hard-llcs
22712 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
22713 instructions only. This is only available on SH4A and is suitable for
22714 multi-core systems. Since the hardware instructions support only 32 bit atomic
22715 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
22716 Code compiled with this option is also compatible with other software
22717 atomic model interrupt/exception handling systems if executed on an SH4A
22718 system. Additional support from the interrupt/exception handling code of the
22719 system is not required for this model.
22720
22721 @item gbr-offset=
22722 This parameter specifies the offset in bytes of the variable in the thread
22723 control block structure that should be used by the generated atomic sequences
22724 when the @samp{soft-tcb} model has been selected. For other models this
22725 parameter is ignored. The specified value must be an integer multiple of four
22726 and in the range 0-1020.
22727
22728 @item strict
22729 This parameter prevents mixed usage of multiple atomic models, even if they
22730 are compatible, and makes the compiler generate atomic sequences of the
22731 specified model only.
22732
22733 @end table
22734
22735 @item -mtas
22736 @opindex mtas
22737 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
22738 Notice that depending on the particular hardware and software configuration
22739 this can degrade overall performance due to the operand cache line flushes
22740 that are implied by the @code{tas.b} instruction. On multi-core SH4A
22741 processors the @code{tas.b} instruction must be used with caution since it
22742 can result in data corruption for certain cache configurations.
22743
22744 @item -mprefergot
22745 @opindex mprefergot
22746 When generating position-independent code, emit function calls using
22747 the Global Offset Table instead of the Procedure Linkage Table.
22748
22749 @item -musermode
22750 @itemx -mno-usermode
22751 @opindex musermode
22752 @opindex mno-usermode
22753 Don't allow (allow) the compiler generating privileged mode code. Specifying
22754 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
22755 inlined code would not work in user mode. @option{-musermode} is the default
22756 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
22757 @option{-musermode} has no effect, since there is no user mode.
22758
22759 @item -multcost=@var{number}
22760 @opindex multcost=@var{number}
22761 Set the cost to assume for a multiply insn.
22762
22763 @item -mdiv=@var{strategy}
22764 @opindex mdiv=@var{strategy}
22765 Set the division strategy to be used for integer division operations.
22766 @var{strategy} can be one of:
22767
22768 @table @samp
22769
22770 @item call-div1
22771 Calls a library function that uses the single-step division instruction
22772 @code{div1} to perform the operation. Division by zero calculates an
22773 unspecified result and does not trap. This is the default except for SH4,
22774 SH2A and SHcompact.
22775
22776 @item call-fp
22777 Calls a library function that performs the operation in double precision
22778 floating point. Division by zero causes a floating-point exception. This is
22779 the default for SHcompact with FPU. Specifying this for targets that do not
22780 have a double precision FPU defaults to @code{call-div1}.
22781
22782 @item call-table
22783 Calls a library function that uses a lookup table for small divisors and
22784 the @code{div1} instruction with case distinction for larger divisors. Division
22785 by zero calculates an unspecified result and does not trap. This is the default
22786 for SH4. Specifying this for targets that do not have dynamic shift
22787 instructions defaults to @code{call-div1}.
22788
22789 @end table
22790
22791 When a division strategy has not been specified the default strategy is
22792 selected based on the current target. For SH2A the default strategy is to
22793 use the @code{divs} and @code{divu} instructions instead of library function
22794 calls.
22795
22796 @item -maccumulate-outgoing-args
22797 @opindex maccumulate-outgoing-args
22798 Reserve space once for outgoing arguments in the function prologue rather
22799 than around each call. Generally beneficial for performance and size. Also
22800 needed for unwinding to avoid changing the stack frame around conditional code.
22801
22802 @item -mdivsi3_libfunc=@var{name}
22803 @opindex mdivsi3_libfunc=@var{name}
22804 Set the name of the library function used for 32-bit signed division to
22805 @var{name}.
22806 This only affects the name used in the @samp{call} division strategies, and
22807 the compiler still expects the same sets of input/output/clobbered registers as
22808 if this option were not present.
22809
22810 @item -mfixed-range=@var{register-range}
22811 @opindex mfixed-range
22812 Generate code treating the given register range as fixed registers.
22813 A fixed register is one that the register allocator can not use. This is
22814 useful when compiling kernel code. A register range is specified as
22815 two registers separated by a dash. Multiple register ranges can be
22816 specified separated by a comma.
22817
22818 @item -mbranch-cost=@var{num}
22819 @opindex mbranch-cost=@var{num}
22820 Assume @var{num} to be the cost for a branch instruction. Higher numbers
22821 make the compiler try to generate more branch-free code if possible.
22822 If not specified the value is selected depending on the processor type that
22823 is being compiled for.
22824
22825 @item -mzdcbranch
22826 @itemx -mno-zdcbranch
22827 @opindex mzdcbranch
22828 @opindex mno-zdcbranch
22829 Assume (do not assume) that zero displacement conditional branch instructions
22830 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
22831 compiler prefers zero displacement branch code sequences. This is
22832 enabled by default when generating code for SH4 and SH4A. It can be explicitly
22833 disabled by specifying @option{-mno-zdcbranch}.
22834
22835 @item -mcbranch-force-delay-slot
22836 @opindex mcbranch-force-delay-slot
22837 Force the usage of delay slots for conditional branches, which stuffs the delay
22838 slot with a @code{nop} if a suitable instruction can't be found. By default
22839 this option is disabled. It can be enabled to work around hardware bugs as
22840 found in the original SH7055.
22841
22842 @item -mfused-madd
22843 @itemx -mno-fused-madd
22844 @opindex mfused-madd
22845 @opindex mno-fused-madd
22846 Generate code that uses (does not use) the floating-point multiply and
22847 accumulate instructions. These instructions are generated by default
22848 if hardware floating point is used. The machine-dependent
22849 @option{-mfused-madd} option is now mapped to the machine-independent
22850 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22851 mapped to @option{-ffp-contract=off}.
22852
22853 @item -mfsca
22854 @itemx -mno-fsca
22855 @opindex mfsca
22856 @opindex mno-fsca
22857 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
22858 and cosine approximations. The option @option{-mfsca} must be used in
22859 combination with @option{-funsafe-math-optimizations}. It is enabled by default
22860 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
22861 approximations even if @option{-funsafe-math-optimizations} is in effect.
22862
22863 @item -mfsrra
22864 @itemx -mno-fsrra
22865 @opindex mfsrra
22866 @opindex mno-fsrra
22867 Allow or disallow the compiler to emit the @code{fsrra} instruction for
22868 reciprocal square root approximations. The option @option{-mfsrra} must be used
22869 in combination with @option{-funsafe-math-optimizations} and
22870 @option{-ffinite-math-only}. It is enabled by default when generating code for
22871 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
22872 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
22873 in effect.
22874
22875 @item -mpretend-cmove
22876 @opindex mpretend-cmove
22877 Prefer zero-displacement conditional branches for conditional move instruction
22878 patterns. This can result in faster code on the SH4 processor.
22879
22880 @item -mfdpic
22881 @opindex fdpic
22882 Generate code using the FDPIC ABI.
22883
22884 @end table
22885
22886 @node Solaris 2 Options
22887 @subsection Solaris 2 Options
22888 @cindex Solaris 2 options
22889
22890 These @samp{-m} options are supported on Solaris 2:
22891
22892 @table @gcctabopt
22893 @item -mclear-hwcap
22894 @opindex mclear-hwcap
22895 @option{-mclear-hwcap} tells the compiler to remove the hardware
22896 capabilities generated by the Solaris assembler. This is only necessary
22897 when object files use ISA extensions not supported by the current
22898 machine, but check at runtime whether or not to use them.
22899
22900 @item -mimpure-text
22901 @opindex mimpure-text
22902 @option{-mimpure-text}, used in addition to @option{-shared}, tells
22903 the compiler to not pass @option{-z text} to the linker when linking a
22904 shared object. Using this option, you can link position-dependent
22905 code into a shared object.
22906
22907 @option{-mimpure-text} suppresses the ``relocations remain against
22908 allocatable but non-writable sections'' linker error message.
22909 However, the necessary relocations trigger copy-on-write, and the
22910 shared object is not actually shared across processes. Instead of
22911 using @option{-mimpure-text}, you should compile all source code with
22912 @option{-fpic} or @option{-fPIC}.
22913
22914 @end table
22915
22916 These switches are supported in addition to the above on Solaris 2:
22917
22918 @table @gcctabopt
22919 @item -pthreads
22920 @opindex pthreads
22921 Add support for multithreading using the POSIX threads library. This
22922 option sets flags for both the preprocessor and linker. This option does
22923 not affect the thread safety of object code produced by the compiler or
22924 that of libraries supplied with it.
22925
22926 @item -pthread
22927 @opindex pthread
22928 This is a synonym for @option{-pthreads}.
22929 @end table
22930
22931 @node SPARC Options
22932 @subsection SPARC Options
22933 @cindex SPARC options
22934
22935 These @samp{-m} options are supported on the SPARC:
22936
22937 @table @gcctabopt
22938 @item -mno-app-regs
22939 @itemx -mapp-regs
22940 @opindex mno-app-regs
22941 @opindex mapp-regs
22942 Specify @option{-mapp-regs} to generate output using the global registers
22943 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
22944 global register 1, each global register 2 through 4 is then treated as an
22945 allocable register that is clobbered by function calls. This is the default.
22946
22947 To be fully SVR4 ABI-compliant at the cost of some performance loss,
22948 specify @option{-mno-app-regs}. You should compile libraries and system
22949 software with this option.
22950
22951 @item -mflat
22952 @itemx -mno-flat
22953 @opindex mflat
22954 @opindex mno-flat
22955 With @option{-mflat}, the compiler does not generate save/restore instructions
22956 and uses a ``flat'' or single register window model. This model is compatible
22957 with the regular register window model. The local registers and the input
22958 registers (0--5) are still treated as ``call-saved'' registers and are
22959 saved on the stack as needed.
22960
22961 With @option{-mno-flat} (the default), the compiler generates save/restore
22962 instructions (except for leaf functions). This is the normal operating mode.
22963
22964 @item -mfpu
22965 @itemx -mhard-float
22966 @opindex mfpu
22967 @opindex mhard-float
22968 Generate output containing floating-point instructions. This is the
22969 default.
22970
22971 @item -mno-fpu
22972 @itemx -msoft-float
22973 @opindex mno-fpu
22974 @opindex msoft-float
22975 Generate output containing library calls for floating point.
22976 @strong{Warning:} the requisite libraries are not available for all SPARC
22977 targets. Normally the facilities of the machine's usual C compiler are
22978 used, but this cannot be done directly in cross-compilation. You must make
22979 your own arrangements to provide suitable library functions for
22980 cross-compilation. The embedded targets @samp{sparc-*-aout} and
22981 @samp{sparclite-*-*} do provide software floating-point support.
22982
22983 @option{-msoft-float} changes the calling convention in the output file;
22984 therefore, it is only useful if you compile @emph{all} of a program with
22985 this option. In particular, you need to compile @file{libgcc.a}, the
22986 library that comes with GCC, with @option{-msoft-float} in order for
22987 this to work.
22988
22989 @item -mhard-quad-float
22990 @opindex mhard-quad-float
22991 Generate output containing quad-word (long double) floating-point
22992 instructions.
22993
22994 @item -msoft-quad-float
22995 @opindex msoft-quad-float
22996 Generate output containing library calls for quad-word (long double)
22997 floating-point instructions. The functions called are those specified
22998 in the SPARC ABI@. This is the default.
22999
23000 As of this writing, there are no SPARC implementations that have hardware
23001 support for the quad-word floating-point instructions. They all invoke
23002 a trap handler for one of these instructions, and then the trap handler
23003 emulates the effect of the instruction. Because of the trap handler overhead,
23004 this is much slower than calling the ABI library routines. Thus the
23005 @option{-msoft-quad-float} option is the default.
23006
23007 @item -mno-unaligned-doubles
23008 @itemx -munaligned-doubles
23009 @opindex mno-unaligned-doubles
23010 @opindex munaligned-doubles
23011 Assume that doubles have 8-byte alignment. This is the default.
23012
23013 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
23014 alignment only if they are contained in another type, or if they have an
23015 absolute address. Otherwise, it assumes they have 4-byte alignment.
23016 Specifying this option avoids some rare compatibility problems with code
23017 generated by other compilers. It is not the default because it results
23018 in a performance loss, especially for floating-point code.
23019
23020 @item -muser-mode
23021 @itemx -mno-user-mode
23022 @opindex muser-mode
23023 @opindex mno-user-mode
23024 Do not generate code that can only run in supervisor mode. This is relevant
23025 only for the @code{casa} instruction emitted for the LEON3 processor. This
23026 is the default.
23027
23028 @item -mfaster-structs
23029 @itemx -mno-faster-structs
23030 @opindex mfaster-structs
23031 @opindex mno-faster-structs
23032 With @option{-mfaster-structs}, the compiler assumes that structures
23033 should have 8-byte alignment. This enables the use of pairs of
23034 @code{ldd} and @code{std} instructions for copies in structure
23035 assignment, in place of twice as many @code{ld} and @code{st} pairs.
23036 However, the use of this changed alignment directly violates the SPARC
23037 ABI@. Thus, it's intended only for use on targets where the developer
23038 acknowledges that their resulting code is not directly in line with
23039 the rules of the ABI@.
23040
23041 @item -mstd-struct-return
23042 @itemx -mno-std-struct-return
23043 @opindex mstd-struct-return
23044 @opindex mno-std-struct-return
23045 With @option{-mstd-struct-return}, the compiler generates checking code
23046 in functions returning structures or unions to detect size mismatches
23047 between the two sides of function calls, as per the 32-bit ABI@.
23048
23049 The default is @option{-mno-std-struct-return}. This option has no effect
23050 in 64-bit mode.
23051
23052 @item -mcpu=@var{cpu_type}
23053 @opindex mcpu
23054 Set the instruction set, register set, and instruction scheduling parameters
23055 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23056 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
23057 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
23058 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
23059 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
23060 @samp{niagara3}, @samp{niagara4} and @samp{niagara7}.
23061
23062 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
23063 which selects the best architecture option for the host processor.
23064 @option{-mcpu=native} has no effect if GCC does not recognize
23065 the processor.
23066
23067 Default instruction scheduling parameters are used for values that select
23068 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
23069 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
23070
23071 Here is a list of each supported architecture and their supported
23072 implementations.
23073
23074 @table @asis
23075 @item v7
23076 cypress, leon3v7
23077
23078 @item v8
23079 supersparc, hypersparc, leon, leon3
23080
23081 @item sparclite
23082 f930, f934, sparclite86x
23083
23084 @item sparclet
23085 tsc701
23086
23087 @item v9
23088 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7
23089 @end table
23090
23091 By default (unless configured otherwise), GCC generates code for the V7
23092 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
23093 additionally optimizes it for the Cypress CY7C602 chip, as used in the
23094 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
23095 SPARCStation 1, 2, IPX etc.
23096
23097 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
23098 architecture. The only difference from V7 code is that the compiler emits
23099 the integer multiply and integer divide instructions which exist in SPARC-V8
23100 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
23101 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
23102 2000 series.
23103
23104 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
23105 the SPARC architecture. This adds the integer multiply, integer divide step
23106 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
23107 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
23108 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
23109 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
23110 MB86934 chip, which is the more recent SPARClite with FPU@.
23111
23112 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
23113 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
23114 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
23115 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
23116 optimizes it for the TEMIC SPARClet chip.
23117
23118 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
23119 architecture. This adds 64-bit integer and floating-point move instructions,
23120 3 additional floating-point condition code registers and conditional move
23121 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
23122 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
23123 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
23124 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
23125 @option{-mcpu=niagara}, the compiler additionally optimizes it for
23126 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
23127 additionally optimizes it for Sun UltraSPARC T2 chips. With
23128 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
23129 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
23130 additionally optimizes it for Sun UltraSPARC T4 chips. With
23131 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
23132 Oracle SPARC M7 chips.
23133
23134 @item -mtune=@var{cpu_type}
23135 @opindex mtune
23136 Set the instruction scheduling parameters for machine type
23137 @var{cpu_type}, but do not set the instruction set or register set that the
23138 option @option{-mcpu=@var{cpu_type}} does.
23139
23140 The same values for @option{-mcpu=@var{cpu_type}} can be used for
23141 @option{-mtune=@var{cpu_type}}, but the only useful values are those
23142 that select a particular CPU implementation. Those are
23143 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
23144 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
23145 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
23146 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
23147 @samp{niagara4} and @samp{niagara7}. With native Solaris and
23148 GNU/Linux toolchains, @samp{native} can also be used.
23149
23150 @item -mv8plus
23151 @itemx -mno-v8plus
23152 @opindex mv8plus
23153 @opindex mno-v8plus
23154 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
23155 difference from the V8 ABI is that the global and out registers are
23156 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
23157 mode for all SPARC-V9 processors.
23158
23159 @item -mvis
23160 @itemx -mno-vis
23161 @opindex mvis
23162 @opindex mno-vis
23163 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
23164 Visual Instruction Set extensions. The default is @option{-mno-vis}.
23165
23166 @item -mvis2
23167 @itemx -mno-vis2
23168 @opindex mvis2
23169 @opindex mno-vis2
23170 With @option{-mvis2}, GCC generates code that takes advantage of
23171 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
23172 default is @option{-mvis2} when targeting a cpu that supports such
23173 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
23174 also sets @option{-mvis}.
23175
23176 @item -mvis3
23177 @itemx -mno-vis3
23178 @opindex mvis3
23179 @opindex mno-vis3
23180 With @option{-mvis3}, GCC generates code that takes advantage of
23181 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
23182 default is @option{-mvis3} when targeting a cpu that supports such
23183 instructions, such as niagara-3 and later. Setting @option{-mvis3}
23184 also sets @option{-mvis2} and @option{-mvis}.
23185
23186 @item -mvis4
23187 @itemx -mno-vis4
23188 @opindex mvis4
23189 @opindex mno-vis4
23190 With @option{-mvis4}, GCC generates code that takes advantage of
23191 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
23192 default is @option{-mvis4} when targeting a cpu that supports such
23193 instructions, such as niagara-7 and later. Setting @option{-mvis4}
23194 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
23195
23196 @item -mcbcond
23197 @itemx -mno-cbcond
23198 @opindex mcbcond
23199 @opindex mno-cbcond
23200 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
23201 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
23202 when targeting a CPU that supports such instructions, such as Niagara-4 and
23203 later.
23204
23205 @item -mfmaf
23206 @itemx -mno-fmaf
23207 @opindex mfmaf
23208 @opindex mno-fmaf
23209 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
23210 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
23211 when targeting a CPU that supports such instructions, such as Niagara-3 and
23212 later.
23213
23214 @item -mpopc
23215 @itemx -mno-popc
23216 @opindex mpopc
23217 @opindex mno-popc
23218 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
23219 Population Count instruction. The default is @option{-mpopc}
23220 when targeting a CPU that supports such an instruction, such as Niagara-2 and
23221 later.
23222
23223 @item -msubxc
23224 @itemx -mno-subxc
23225 @opindex msubxc
23226 @opindex mno-subxc
23227 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
23228 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
23229 when targeting a CPU that supports such an instruction, such as Niagara-7 and
23230 later.
23231
23232 @item -mfix-at697f
23233 @opindex mfix-at697f
23234 Enable the documented workaround for the single erratum of the Atmel AT697F
23235 processor (which corresponds to erratum #13 of the AT697E processor).
23236
23237 @item -mfix-ut699
23238 @opindex mfix-ut699
23239 Enable the documented workarounds for the floating-point errata and the data
23240 cache nullify errata of the UT699 processor.
23241 @end table
23242
23243 These @samp{-m} options are supported in addition to the above
23244 on SPARC-V9 processors in 64-bit environments:
23245
23246 @table @gcctabopt
23247 @item -m32
23248 @itemx -m64
23249 @opindex m32
23250 @opindex m64
23251 Generate code for a 32-bit or 64-bit environment.
23252 The 32-bit environment sets int, long and pointer to 32 bits.
23253 The 64-bit environment sets int to 32 bits and long and pointer
23254 to 64 bits.
23255
23256 @item -mcmodel=@var{which}
23257 @opindex mcmodel
23258 Set the code model to one of
23259
23260 @table @samp
23261 @item medlow
23262 The Medium/Low code model: 64-bit addresses, programs
23263 must be linked in the low 32 bits of memory. Programs can be statically
23264 or dynamically linked.
23265
23266 @item medmid
23267 The Medium/Middle code model: 64-bit addresses, programs
23268 must be linked in the low 44 bits of memory, the text and data segments must
23269 be less than 2GB in size and the data segment must be located within 2GB of
23270 the text segment.
23271
23272 @item medany
23273 The Medium/Anywhere code model: 64-bit addresses, programs
23274 may be linked anywhere in memory, the text and data segments must be less
23275 than 2GB in size and the data segment must be located within 2GB of the
23276 text segment.
23277
23278 @item embmedany
23279 The Medium/Anywhere code model for embedded systems:
23280 64-bit addresses, the text and data segments must be less than 2GB in
23281 size, both starting anywhere in memory (determined at link time). The
23282 global register %g4 points to the base of the data segment. Programs
23283 are statically linked and PIC is not supported.
23284 @end table
23285
23286 @item -mmemory-model=@var{mem-model}
23287 @opindex mmemory-model
23288 Set the memory model in force on the processor to one of
23289
23290 @table @samp
23291 @item default
23292 The default memory model for the processor and operating system.
23293
23294 @item rmo
23295 Relaxed Memory Order
23296
23297 @item pso
23298 Partial Store Order
23299
23300 @item tso
23301 Total Store Order
23302
23303 @item sc
23304 Sequential Consistency
23305 @end table
23306
23307 These memory models are formally defined in Appendix D of the Sparc V9
23308 architecture manual, as set in the processor's @code{PSTATE.MM} field.
23309
23310 @item -mstack-bias
23311 @itemx -mno-stack-bias
23312 @opindex mstack-bias
23313 @opindex mno-stack-bias
23314 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
23315 frame pointer if present, are offset by @minus{}2047 which must be added back
23316 when making stack frame references. This is the default in 64-bit mode.
23317 Otherwise, assume no such offset is present.
23318 @end table
23319
23320 @node SPU Options
23321 @subsection SPU Options
23322 @cindex SPU options
23323
23324 These @samp{-m} options are supported on the SPU:
23325
23326 @table @gcctabopt
23327 @item -mwarn-reloc
23328 @itemx -merror-reloc
23329 @opindex mwarn-reloc
23330 @opindex merror-reloc
23331
23332 The loader for SPU does not handle dynamic relocations. By default, GCC
23333 gives an error when it generates code that requires a dynamic
23334 relocation. @option{-mno-error-reloc} disables the error,
23335 @option{-mwarn-reloc} generates a warning instead.
23336
23337 @item -msafe-dma
23338 @itemx -munsafe-dma
23339 @opindex msafe-dma
23340 @opindex munsafe-dma
23341
23342 Instructions that initiate or test completion of DMA must not be
23343 reordered with respect to loads and stores of the memory that is being
23344 accessed.
23345 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
23346 memory accesses, but that can lead to inefficient code in places where the
23347 memory is known to not change. Rather than mark the memory as volatile,
23348 you can use @option{-msafe-dma} to tell the compiler to treat
23349 the DMA instructions as potentially affecting all memory.
23350
23351 @item -mbranch-hints
23352 @opindex mbranch-hints
23353
23354 By default, GCC generates a branch hint instruction to avoid
23355 pipeline stalls for always-taken or probably-taken branches. A hint
23356 is not generated closer than 8 instructions away from its branch.
23357 There is little reason to disable them, except for debugging purposes,
23358 or to make an object a little bit smaller.
23359
23360 @item -msmall-mem
23361 @itemx -mlarge-mem
23362 @opindex msmall-mem
23363 @opindex mlarge-mem
23364
23365 By default, GCC generates code assuming that addresses are never larger
23366 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
23367 a full 32-bit address.
23368
23369 @item -mstdmain
23370 @opindex mstdmain
23371
23372 By default, GCC links against startup code that assumes the SPU-style
23373 main function interface (which has an unconventional parameter list).
23374 With @option{-mstdmain}, GCC links your program against startup
23375 code that assumes a C99-style interface to @code{main}, including a
23376 local copy of @code{argv} strings.
23377
23378 @item -mfixed-range=@var{register-range}
23379 @opindex mfixed-range
23380 Generate code treating the given register range as fixed registers.
23381 A fixed register is one that the register allocator cannot use. This is
23382 useful when compiling kernel code. A register range is specified as
23383 two registers separated by a dash. Multiple register ranges can be
23384 specified separated by a comma.
23385
23386 @item -mea32
23387 @itemx -mea64
23388 @opindex mea32
23389 @opindex mea64
23390 Compile code assuming that pointers to the PPU address space accessed
23391 via the @code{__ea} named address space qualifier are either 32 or 64
23392 bits wide. The default is 32 bits. As this is an ABI-changing option,
23393 all object code in an executable must be compiled with the same setting.
23394
23395 @item -maddress-space-conversion
23396 @itemx -mno-address-space-conversion
23397 @opindex maddress-space-conversion
23398 @opindex mno-address-space-conversion
23399 Allow/disallow treating the @code{__ea} address space as superset
23400 of the generic address space. This enables explicit type casts
23401 between @code{__ea} and generic pointer as well as implicit
23402 conversions of generic pointers to @code{__ea} pointers. The
23403 default is to allow address space pointer conversions.
23404
23405 @item -mcache-size=@var{cache-size}
23406 @opindex mcache-size
23407 This option controls the version of libgcc that the compiler links to an
23408 executable and selects a software-managed cache for accessing variables
23409 in the @code{__ea} address space with a particular cache size. Possible
23410 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
23411 and @samp{128}. The default cache size is 64KB.
23412
23413 @item -matomic-updates
23414 @itemx -mno-atomic-updates
23415 @opindex matomic-updates
23416 @opindex mno-atomic-updates
23417 This option controls the version of libgcc that the compiler links to an
23418 executable and selects whether atomic updates to the software-managed
23419 cache of PPU-side variables are used. If you use atomic updates, changes
23420 to a PPU variable from SPU code using the @code{__ea} named address space
23421 qualifier do not interfere with changes to other PPU variables residing
23422 in the same cache line from PPU code. If you do not use atomic updates,
23423 such interference may occur; however, writing back cache lines is
23424 more efficient. The default behavior is to use atomic updates.
23425
23426 @item -mdual-nops
23427 @itemx -mdual-nops=@var{n}
23428 @opindex mdual-nops
23429 By default, GCC inserts NOPs to increase dual issue when it expects
23430 it to increase performance. @var{n} can be a value from 0 to 10. A
23431 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
23432 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
23433
23434 @item -mhint-max-nops=@var{n}
23435 @opindex mhint-max-nops
23436 Maximum number of NOPs to insert for a branch hint. A branch hint must
23437 be at least 8 instructions away from the branch it is affecting. GCC
23438 inserts up to @var{n} NOPs to enforce this, otherwise it does not
23439 generate the branch hint.
23440
23441 @item -mhint-max-distance=@var{n}
23442 @opindex mhint-max-distance
23443 The encoding of the branch hint instruction limits the hint to be within
23444 256 instructions of the branch it is affecting. By default, GCC makes
23445 sure it is within 125.
23446
23447 @item -msafe-hints
23448 @opindex msafe-hints
23449 Work around a hardware bug that causes the SPU to stall indefinitely.
23450 By default, GCC inserts the @code{hbrp} instruction to make sure
23451 this stall won't happen.
23452
23453 @end table
23454
23455 @node System V Options
23456 @subsection Options for System V
23457
23458 These additional options are available on System V Release 4 for
23459 compatibility with other compilers on those systems:
23460
23461 @table @gcctabopt
23462 @item -G
23463 @opindex G
23464 Create a shared object.
23465 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
23466
23467 @item -Qy
23468 @opindex Qy
23469 Identify the versions of each tool used by the compiler, in a
23470 @code{.ident} assembler directive in the output.
23471
23472 @item -Qn
23473 @opindex Qn
23474 Refrain from adding @code{.ident} directives to the output file (this is
23475 the default).
23476
23477 @item -YP,@var{dirs}
23478 @opindex YP
23479 Search the directories @var{dirs}, and no others, for libraries
23480 specified with @option{-l}.
23481
23482 @item -Ym,@var{dir}
23483 @opindex Ym
23484 Look in the directory @var{dir} to find the M4 preprocessor.
23485 The assembler uses this option.
23486 @c This is supposed to go with a -Yd for predefined M4 macro files, but
23487 @c the generic assembler that comes with Solaris takes just -Ym.
23488 @end table
23489
23490 @node TILE-Gx Options
23491 @subsection TILE-Gx Options
23492 @cindex TILE-Gx options
23493
23494 These @samp{-m} options are supported on the TILE-Gx:
23495
23496 @table @gcctabopt
23497 @item -mcmodel=small
23498 @opindex mcmodel=small
23499 Generate code for the small model. The distance for direct calls is
23500 limited to 500M in either direction. PC-relative addresses are 32
23501 bits. Absolute addresses support the full address range.
23502
23503 @item -mcmodel=large
23504 @opindex mcmodel=large
23505 Generate code for the large model. There is no limitation on call
23506 distance, pc-relative addresses, or absolute addresses.
23507
23508 @item -mcpu=@var{name}
23509 @opindex mcpu
23510 Selects the type of CPU to be targeted. Currently the only supported
23511 type is @samp{tilegx}.
23512
23513 @item -m32
23514 @itemx -m64
23515 @opindex m32
23516 @opindex m64
23517 Generate code for a 32-bit or 64-bit environment. The 32-bit
23518 environment sets int, long, and pointer to 32 bits. The 64-bit
23519 environment sets int to 32 bits and long and pointer to 64 bits.
23520
23521 @item -mbig-endian
23522 @itemx -mlittle-endian
23523 @opindex mbig-endian
23524 @opindex mlittle-endian
23525 Generate code in big/little endian mode, respectively.
23526 @end table
23527
23528 @node TILEPro Options
23529 @subsection TILEPro Options
23530 @cindex TILEPro options
23531
23532 These @samp{-m} options are supported on the TILEPro:
23533
23534 @table @gcctabopt
23535 @item -mcpu=@var{name}
23536 @opindex mcpu
23537 Selects the type of CPU to be targeted. Currently the only supported
23538 type is @samp{tilepro}.
23539
23540 @item -m32
23541 @opindex m32
23542 Generate code for a 32-bit environment, which sets int, long, and
23543 pointer to 32 bits. This is the only supported behavior so the flag
23544 is essentially ignored.
23545 @end table
23546
23547 @node V850 Options
23548 @subsection V850 Options
23549 @cindex V850 Options
23550
23551 These @samp{-m} options are defined for V850 implementations:
23552
23553 @table @gcctabopt
23554 @item -mlong-calls
23555 @itemx -mno-long-calls
23556 @opindex mlong-calls
23557 @opindex mno-long-calls
23558 Treat all calls as being far away (near). If calls are assumed to be
23559 far away, the compiler always loads the function's address into a
23560 register, and calls indirect through the pointer.
23561
23562 @item -mno-ep
23563 @itemx -mep
23564 @opindex mno-ep
23565 @opindex mep
23566 Do not optimize (do optimize) basic blocks that use the same index
23567 pointer 4 or more times to copy pointer into the @code{ep} register, and
23568 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
23569 option is on by default if you optimize.
23570
23571 @item -mno-prolog-function
23572 @itemx -mprolog-function
23573 @opindex mno-prolog-function
23574 @opindex mprolog-function
23575 Do not use (do use) external functions to save and restore registers
23576 at the prologue and epilogue of a function. The external functions
23577 are slower, but use less code space if more than one function saves
23578 the same number of registers. The @option{-mprolog-function} option
23579 is on by default if you optimize.
23580
23581 @item -mspace
23582 @opindex mspace
23583 Try to make the code as small as possible. At present, this just turns
23584 on the @option{-mep} and @option{-mprolog-function} options.
23585
23586 @item -mtda=@var{n}
23587 @opindex mtda
23588 Put static or global variables whose size is @var{n} bytes or less into
23589 the tiny data area that register @code{ep} points to. The tiny data
23590 area can hold up to 256 bytes in total (128 bytes for byte references).
23591
23592 @item -msda=@var{n}
23593 @opindex msda
23594 Put static or global variables whose size is @var{n} bytes or less into
23595 the small data area that register @code{gp} points to. The small data
23596 area can hold up to 64 kilobytes.
23597
23598 @item -mzda=@var{n}
23599 @opindex mzda
23600 Put static or global variables whose size is @var{n} bytes or less into
23601 the first 32 kilobytes of memory.
23602
23603 @item -mv850
23604 @opindex mv850
23605 Specify that the target processor is the V850.
23606
23607 @item -mv850e3v5
23608 @opindex mv850e3v5
23609 Specify that the target processor is the V850E3V5. The preprocessor
23610 constant @code{__v850e3v5__} is defined if this option is used.
23611
23612 @item -mv850e2v4
23613 @opindex mv850e2v4
23614 Specify that the target processor is the V850E3V5. This is an alias for
23615 the @option{-mv850e3v5} option.
23616
23617 @item -mv850e2v3
23618 @opindex mv850e2v3
23619 Specify that the target processor is the V850E2V3. The preprocessor
23620 constant @code{__v850e2v3__} is defined if this option is used.
23621
23622 @item -mv850e2
23623 @opindex mv850e2
23624 Specify that the target processor is the V850E2. The preprocessor
23625 constant @code{__v850e2__} is defined if this option is used.
23626
23627 @item -mv850e1
23628 @opindex mv850e1
23629 Specify that the target processor is the V850E1. The preprocessor
23630 constants @code{__v850e1__} and @code{__v850e__} are defined if
23631 this option is used.
23632
23633 @item -mv850es
23634 @opindex mv850es
23635 Specify that the target processor is the V850ES. This is an alias for
23636 the @option{-mv850e1} option.
23637
23638 @item -mv850e
23639 @opindex mv850e
23640 Specify that the target processor is the V850E@. The preprocessor
23641 constant @code{__v850e__} is defined if this option is used.
23642
23643 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
23644 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
23645 are defined then a default target processor is chosen and the
23646 relevant @samp{__v850*__} preprocessor constant is defined.
23647
23648 The preprocessor constants @code{__v850} and @code{__v851__} are always
23649 defined, regardless of which processor variant is the target.
23650
23651 @item -mdisable-callt
23652 @itemx -mno-disable-callt
23653 @opindex mdisable-callt
23654 @opindex mno-disable-callt
23655 This option suppresses generation of the @code{CALLT} instruction for the
23656 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
23657 architecture.
23658
23659 This option is enabled by default when the RH850 ABI is
23660 in use (see @option{-mrh850-abi}), and disabled by default when the
23661 GCC ABI is in use. If @code{CALLT} instructions are being generated
23662 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
23663
23664 @item -mrelax
23665 @itemx -mno-relax
23666 @opindex mrelax
23667 @opindex mno-relax
23668 Pass on (or do not pass on) the @option{-mrelax} command-line option
23669 to the assembler.
23670
23671 @item -mlong-jumps
23672 @itemx -mno-long-jumps
23673 @opindex mlong-jumps
23674 @opindex mno-long-jumps
23675 Disable (or re-enable) the generation of PC-relative jump instructions.
23676
23677 @item -msoft-float
23678 @itemx -mhard-float
23679 @opindex msoft-float
23680 @opindex mhard-float
23681 Disable (or re-enable) the generation of hardware floating point
23682 instructions. This option is only significant when the target
23683 architecture is @samp{V850E2V3} or higher. If hardware floating point
23684 instructions are being generated then the C preprocessor symbol
23685 @code{__FPU_OK__} is defined, otherwise the symbol
23686 @code{__NO_FPU__} is defined.
23687
23688 @item -mloop
23689 @opindex mloop
23690 Enables the use of the e3v5 LOOP instruction. The use of this
23691 instruction is not enabled by default when the e3v5 architecture is
23692 selected because its use is still experimental.
23693
23694 @item -mrh850-abi
23695 @itemx -mghs
23696 @opindex mrh850-abi
23697 @opindex mghs
23698 Enables support for the RH850 version of the V850 ABI. This is the
23699 default. With this version of the ABI the following rules apply:
23700
23701 @itemize
23702 @item
23703 Integer sized structures and unions are returned via a memory pointer
23704 rather than a register.
23705
23706 @item
23707 Large structures and unions (more than 8 bytes in size) are passed by
23708 value.
23709
23710 @item
23711 Functions are aligned to 16-bit boundaries.
23712
23713 @item
23714 The @option{-m8byte-align} command-line option is supported.
23715
23716 @item
23717 The @option{-mdisable-callt} command-line option is enabled by
23718 default. The @option{-mno-disable-callt} command-line option is not
23719 supported.
23720 @end itemize
23721
23722 When this version of the ABI is enabled the C preprocessor symbol
23723 @code{__V850_RH850_ABI__} is defined.
23724
23725 @item -mgcc-abi
23726 @opindex mgcc-abi
23727 Enables support for the old GCC version of the V850 ABI. With this
23728 version of the ABI the following rules apply:
23729
23730 @itemize
23731 @item
23732 Integer sized structures and unions are returned in register @code{r10}.
23733
23734 @item
23735 Large structures and unions (more than 8 bytes in size) are passed by
23736 reference.
23737
23738 @item
23739 Functions are aligned to 32-bit boundaries, unless optimizing for
23740 size.
23741
23742 @item
23743 The @option{-m8byte-align} command-line option is not supported.
23744
23745 @item
23746 The @option{-mdisable-callt} command-line option is supported but not
23747 enabled by default.
23748 @end itemize
23749
23750 When this version of the ABI is enabled the C preprocessor symbol
23751 @code{__V850_GCC_ABI__} is defined.
23752
23753 @item -m8byte-align
23754 @itemx -mno-8byte-align
23755 @opindex m8byte-align
23756 @opindex mno-8byte-align
23757 Enables support for @code{double} and @code{long long} types to be
23758 aligned on 8-byte boundaries. The default is to restrict the
23759 alignment of all objects to at most 4-bytes. When
23760 @option{-m8byte-align} is in effect the C preprocessor symbol
23761 @code{__V850_8BYTE_ALIGN__} is defined.
23762
23763 @item -mbig-switch
23764 @opindex mbig-switch
23765 Generate code suitable for big switch tables. Use this option only if
23766 the assembler/linker complain about out of range branches within a switch
23767 table.
23768
23769 @item -mapp-regs
23770 @opindex mapp-regs
23771 This option causes r2 and r5 to be used in the code generated by
23772 the compiler. This setting is the default.
23773
23774 @item -mno-app-regs
23775 @opindex mno-app-regs
23776 This option causes r2 and r5 to be treated as fixed registers.
23777
23778 @end table
23779
23780 @node VAX Options
23781 @subsection VAX Options
23782 @cindex VAX options
23783
23784 These @samp{-m} options are defined for the VAX:
23785
23786 @table @gcctabopt
23787 @item -munix
23788 @opindex munix
23789 Do not output certain jump instructions (@code{aobleq} and so on)
23790 that the Unix assembler for the VAX cannot handle across long
23791 ranges.
23792
23793 @item -mgnu
23794 @opindex mgnu
23795 Do output those jump instructions, on the assumption that the
23796 GNU assembler is being used.
23797
23798 @item -mg
23799 @opindex mg
23800 Output code for G-format floating-point numbers instead of D-format.
23801 @end table
23802
23803 @node Visium Options
23804 @subsection Visium Options
23805 @cindex Visium options
23806
23807 @table @gcctabopt
23808
23809 @item -mdebug
23810 @opindex mdebug
23811 A program which performs file I/O and is destined to run on an MCM target
23812 should be linked with this option. It causes the libraries libc.a and
23813 libdebug.a to be linked. The program should be run on the target under
23814 the control of the GDB remote debugging stub.
23815
23816 @item -msim
23817 @opindex msim
23818 A program which performs file I/O and is destined to run on the simulator
23819 should be linked with option. This causes libraries libc.a and libsim.a to
23820 be linked.
23821
23822 @item -mfpu
23823 @itemx -mhard-float
23824 @opindex mfpu
23825 @opindex mhard-float
23826 Generate code containing floating-point instructions. This is the
23827 default.
23828
23829 @item -mno-fpu
23830 @itemx -msoft-float
23831 @opindex mno-fpu
23832 @opindex msoft-float
23833 Generate code containing library calls for floating-point.
23834
23835 @option{-msoft-float} changes the calling convention in the output file;
23836 therefore, it is only useful if you compile @emph{all} of a program with
23837 this option. In particular, you need to compile @file{libgcc.a}, the
23838 library that comes with GCC, with @option{-msoft-float} in order for
23839 this to work.
23840
23841 @item -mcpu=@var{cpu_type}
23842 @opindex mcpu
23843 Set the instruction set, register set, and instruction scheduling parameters
23844 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23845 @samp{mcm}, @samp{gr5} and @samp{gr6}.
23846
23847 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
23848
23849 By default (unless configured otherwise), GCC generates code for the GR5
23850 variant of the Visium architecture.
23851
23852 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
23853 architecture. The only difference from GR5 code is that the compiler will
23854 generate block move instructions.
23855
23856 @item -mtune=@var{cpu_type}
23857 @opindex mtune
23858 Set the instruction scheduling parameters for machine type @var{cpu_type},
23859 but do not set the instruction set or register set that the option
23860 @option{-mcpu=@var{cpu_type}} would.
23861
23862 @item -msv-mode
23863 @opindex msv-mode
23864 Generate code for the supervisor mode, where there are no restrictions on
23865 the access to general registers. This is the default.
23866
23867 @item -muser-mode
23868 @opindex muser-mode
23869 Generate code for the user mode, where the access to some general registers
23870 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
23871 mode; on the GR6, only registers r29 to r31 are affected.
23872 @end table
23873
23874 @node VMS Options
23875 @subsection VMS Options
23876
23877 These @samp{-m} options are defined for the VMS implementations:
23878
23879 @table @gcctabopt
23880 @item -mvms-return-codes
23881 @opindex mvms-return-codes
23882 Return VMS condition codes from @code{main}. The default is to return POSIX-style
23883 condition (e.g.@ error) codes.
23884
23885 @item -mdebug-main=@var{prefix}
23886 @opindex mdebug-main=@var{prefix}
23887 Flag the first routine whose name starts with @var{prefix} as the main
23888 routine for the debugger.
23889
23890 @item -mmalloc64
23891 @opindex mmalloc64
23892 Default to 64-bit memory allocation routines.
23893
23894 @item -mpointer-size=@var{size}
23895 @opindex mpointer-size=@var{size}
23896 Set the default size of pointers. Possible options for @var{size} are
23897 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
23898 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
23899 The later option disables @code{pragma pointer_size}.
23900 @end table
23901
23902 @node VxWorks Options
23903 @subsection VxWorks Options
23904 @cindex VxWorks Options
23905
23906 The options in this section are defined for all VxWorks targets.
23907 Options specific to the target hardware are listed with the other
23908 options for that target.
23909
23910 @table @gcctabopt
23911 @item -mrtp
23912 @opindex mrtp
23913 GCC can generate code for both VxWorks kernels and real time processes
23914 (RTPs). This option switches from the former to the latter. It also
23915 defines the preprocessor macro @code{__RTP__}.
23916
23917 @item -non-static
23918 @opindex non-static
23919 Link an RTP executable against shared libraries rather than static
23920 libraries. The options @option{-static} and @option{-shared} can
23921 also be used for RTPs (@pxref{Link Options}); @option{-static}
23922 is the default.
23923
23924 @item -Bstatic
23925 @itemx -Bdynamic
23926 @opindex Bstatic
23927 @opindex Bdynamic
23928 These options are passed down to the linker. They are defined for
23929 compatibility with Diab.
23930
23931 @item -Xbind-lazy
23932 @opindex Xbind-lazy
23933 Enable lazy binding of function calls. This option is equivalent to
23934 @option{-Wl,-z,now} and is defined for compatibility with Diab.
23935
23936 @item -Xbind-now
23937 @opindex Xbind-now
23938 Disable lazy binding of function calls. This option is the default and
23939 is defined for compatibility with Diab.
23940 @end table
23941
23942 @node x86 Options
23943 @subsection x86 Options
23944 @cindex x86 Options
23945
23946 These @samp{-m} options are defined for the x86 family of computers.
23947
23948 @table @gcctabopt
23949
23950 @item -march=@var{cpu-type}
23951 @opindex march
23952 Generate instructions for the machine type @var{cpu-type}. In contrast to
23953 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
23954 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
23955 to generate code that may not run at all on processors other than the one
23956 indicated. Specifying @option{-march=@var{cpu-type}} implies
23957 @option{-mtune=@var{cpu-type}}.
23958
23959 The choices for @var{cpu-type} are:
23960
23961 @table @samp
23962 @item native
23963 This selects the CPU to generate code for at compilation time by determining
23964 the processor type of the compiling machine. Using @option{-march=native}
23965 enables all instruction subsets supported by the local machine (hence
23966 the result might not run on different machines). Using @option{-mtune=native}
23967 produces code optimized for the local machine under the constraints
23968 of the selected instruction set.
23969
23970 @item i386
23971 Original Intel i386 CPU@.
23972
23973 @item i486
23974 Intel i486 CPU@. (No scheduling is implemented for this chip.)
23975
23976 @item i586
23977 @itemx pentium
23978 Intel Pentium CPU with no MMX support.
23979
23980 @item lakemont
23981 Intel Lakemont MCU, based on Intel Pentium CPU.
23982
23983 @item pentium-mmx
23984 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
23985
23986 @item pentiumpro
23987 Intel Pentium Pro CPU@.
23988
23989 @item i686
23990 When used with @option{-march}, the Pentium Pro
23991 instruction set is used, so the code runs on all i686 family chips.
23992 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
23993
23994 @item pentium2
23995 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
23996 support.
23997
23998 @item pentium3
23999 @itemx pentium3m
24000 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
24001 set support.
24002
24003 @item pentium-m
24004 Intel Pentium M; low-power version of Intel Pentium III CPU
24005 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
24006
24007 @item pentium4
24008 @itemx pentium4m
24009 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
24010
24011 @item prescott
24012 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
24013 set support.
24014
24015 @item nocona
24016 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
24017 SSE2 and SSE3 instruction set support.
24018
24019 @item core2
24020 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
24021 instruction set support.
24022
24023 @item nehalem
24024 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24025 SSE4.1, SSE4.2 and POPCNT instruction set support.
24026
24027 @item westmere
24028 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24029 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
24030
24031 @item sandybridge
24032 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24033 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
24034
24035 @item ivybridge
24036 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
24037 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
24038 instruction set support.
24039
24040 @item haswell
24041 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24042 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24043 BMI, BMI2 and F16C instruction set support.
24044
24045 @item broadwell
24046 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24047 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24048 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
24049
24050 @item skylake
24051 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24052 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24053 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
24054 XSAVES instruction set support.
24055
24056 @item bonnell
24057 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
24058 instruction set support.
24059
24060 @item silvermont
24061 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
24062 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
24063
24064 @item knl
24065 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
24066 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24067 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
24068 AVX512CD instruction set support.
24069
24070 @item skylake-avx512
24071 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
24072 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
24073 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
24074 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
24075
24076 @item k6
24077 AMD K6 CPU with MMX instruction set support.
24078
24079 @item k6-2
24080 @itemx k6-3
24081 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
24082
24083 @item athlon
24084 @itemx athlon-tbird
24085 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
24086 support.
24087
24088 @item athlon-4
24089 @itemx athlon-xp
24090 @itemx athlon-mp
24091 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
24092 instruction set support.
24093
24094 @item k8
24095 @itemx opteron
24096 @itemx athlon64
24097 @itemx athlon-fx
24098 Processors based on the AMD K8 core with x86-64 instruction set support,
24099 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
24100 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
24101 instruction set extensions.)
24102
24103 @item k8-sse3
24104 @itemx opteron-sse3
24105 @itemx athlon64-sse3
24106 Improved versions of AMD K8 cores with SSE3 instruction set support.
24107
24108 @item amdfam10
24109 @itemx barcelona
24110 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
24111 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
24112 instruction set extensions.)
24113
24114 @item bdver1
24115 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
24116 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
24117 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
24118 @item bdver2
24119 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
24120 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
24121 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
24122 extensions.)
24123 @item bdver3
24124 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
24125 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
24126 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
24127 64-bit instruction set extensions.
24128 @item bdver4
24129 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
24130 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
24131 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
24132 SSE4.2, ABM and 64-bit instruction set extensions.
24133
24134 @item znver1
24135 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
24136 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
24137 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
24138 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
24139 instruction set extensions.
24140
24141 @item btver1
24142 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
24143 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
24144 instruction set extensions.)
24145
24146 @item btver2
24147 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
24148 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
24149 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
24150
24151 @item winchip-c6
24152 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
24153 set support.
24154
24155 @item winchip2
24156 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
24157 instruction set support.
24158
24159 @item c3
24160 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
24161 (No scheduling is implemented for this chip.)
24162
24163 @item c3-2
24164 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
24165 (No scheduling is implemented for this chip.)
24166
24167 @item c7
24168 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
24169 (No scheduling is implemented for this chip.)
24170
24171 @item samuel-2
24172 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
24173 (No scheduling is implemented for this chip.)
24174
24175 @item nehemiah
24176 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
24177 (No scheduling is implemented for this chip.)
24178
24179 @item esther
24180 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
24181 (No scheduling is implemented for this chip.)
24182
24183 @item eden-x2
24184 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
24185 (No scheduling is implemented for this chip.)
24186
24187 @item eden-x4
24188 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
24189 AVX and AVX2 instruction set support.
24190 (No scheduling is implemented for this chip.)
24191
24192 @item nano
24193 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24194 instruction set support.
24195 (No scheduling is implemented for this chip.)
24196
24197 @item nano-1000
24198 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24199 instruction set support.
24200 (No scheduling is implemented for this chip.)
24201
24202 @item nano-2000
24203 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24204 instruction set support.
24205 (No scheduling is implemented for this chip.)
24206
24207 @item nano-3000
24208 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
24209 instruction set support.
24210 (No scheduling is implemented for this chip.)
24211
24212 @item nano-x2
24213 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
24214 instruction set support.
24215 (No scheduling is implemented for this chip.)
24216
24217 @item nano-x4
24218 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
24219 instruction set support.
24220 (No scheduling is implemented for this chip.)
24221
24222 @item geode
24223 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
24224 @end table
24225
24226 @item -mtune=@var{cpu-type}
24227 @opindex mtune
24228 Tune to @var{cpu-type} everything applicable about the generated code, except
24229 for the ABI and the set of available instructions.
24230 While picking a specific @var{cpu-type} schedules things appropriately
24231 for that particular chip, the compiler does not generate any code that
24232 cannot run on the default machine type unless you use a
24233 @option{-march=@var{cpu-type}} option.
24234 For example, if GCC is configured for i686-pc-linux-gnu
24235 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
24236 but still runs on i686 machines.
24237
24238 The choices for @var{cpu-type} are the same as for @option{-march}.
24239 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
24240
24241 @table @samp
24242 @item generic
24243 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
24244 If you know the CPU on which your code will run, then you should use
24245 the corresponding @option{-mtune} or @option{-march} option instead of
24246 @option{-mtune=generic}. But, if you do not know exactly what CPU users
24247 of your application will have, then you should use this option.
24248
24249 As new processors are deployed in the marketplace, the behavior of this
24250 option will change. Therefore, if you upgrade to a newer version of
24251 GCC, code generation controlled by this option will change to reflect
24252 the processors
24253 that are most common at the time that version of GCC is released.
24254
24255 There is no @option{-march=generic} option because @option{-march}
24256 indicates the instruction set the compiler can use, and there is no
24257 generic instruction set applicable to all processors. In contrast,
24258 @option{-mtune} indicates the processor (or, in this case, collection of
24259 processors) for which the code is optimized.
24260
24261 @item intel
24262 Produce code optimized for the most current Intel processors, which are
24263 Haswell and Silvermont for this version of GCC. If you know the CPU
24264 on which your code will run, then you should use the corresponding
24265 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
24266 But, if you want your application performs better on both Haswell and
24267 Silvermont, then you should use this option.
24268
24269 As new Intel processors are deployed in the marketplace, the behavior of
24270 this option will change. Therefore, if you upgrade to a newer version of
24271 GCC, code generation controlled by this option will change to reflect
24272 the most current Intel processors at the time that version of GCC is
24273 released.
24274
24275 There is no @option{-march=intel} option because @option{-march} indicates
24276 the instruction set the compiler can use, and there is no common
24277 instruction set applicable to all processors. In contrast,
24278 @option{-mtune} indicates the processor (or, in this case, collection of
24279 processors) for which the code is optimized.
24280 @end table
24281
24282 @item -mcpu=@var{cpu-type}
24283 @opindex mcpu
24284 A deprecated synonym for @option{-mtune}.
24285
24286 @item -mfpmath=@var{unit}
24287 @opindex mfpmath
24288 Generate floating-point arithmetic for selected unit @var{unit}. The choices
24289 for @var{unit} are:
24290
24291 @table @samp
24292 @item 387
24293 Use the standard 387 floating-point coprocessor present on the majority of chips and
24294 emulated otherwise. Code compiled with this option runs almost everywhere.
24295 The temporary results are computed in 80-bit precision instead of the precision
24296 specified by the type, resulting in slightly different results compared to most
24297 of other chips. See @option{-ffloat-store} for more detailed description.
24298
24299 This is the default choice for x86-32 targets.
24300
24301 @item sse
24302 Use scalar floating-point instructions present in the SSE instruction set.
24303 This instruction set is supported by Pentium III and newer chips,
24304 and in the AMD line
24305 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
24306 instruction set supports only single-precision arithmetic, thus the double and
24307 extended-precision arithmetic are still done using 387. A later version, present
24308 only in Pentium 4 and AMD x86-64 chips, supports double-precision
24309 arithmetic too.
24310
24311 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
24312 or @option{-msse2} switches to enable SSE extensions and make this option
24313 effective. For the x86-64 compiler, these extensions are enabled by default.
24314
24315 The resulting code should be considerably faster in the majority of cases and avoid
24316 the numerical instability problems of 387 code, but may break some existing
24317 code that expects temporaries to be 80 bits.
24318
24319 This is the default choice for the x86-64 compiler.
24320
24321 @item sse,387
24322 @itemx sse+387
24323 @itemx both
24324 Attempt to utilize both instruction sets at once. This effectively doubles the
24325 amount of available registers, and on chips with separate execution units for
24326 387 and SSE the execution resources too. Use this option with care, as it is
24327 still experimental, because the GCC register allocator does not model separate
24328 functional units well, resulting in unstable performance.
24329 @end table
24330
24331 @item -masm=@var{dialect}
24332 @opindex masm=@var{dialect}
24333 Output assembly instructions using selected @var{dialect}. Also affects
24334 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
24335 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
24336 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
24337 not support @samp{intel}.
24338
24339 @item -mieee-fp
24340 @itemx -mno-ieee-fp
24341 @opindex mieee-fp
24342 @opindex mno-ieee-fp
24343 Control whether or not the compiler uses IEEE floating-point
24344 comparisons. These correctly handle the case where the result of a
24345 comparison is unordered.
24346
24347 @item -m80387
24348 @item -mhard-float
24349 @opindex 80387
24350 @opindex mhard-float
24351 Generate output containing 80387 instructions for floating point.
24352
24353 @item -mno-80387
24354 @item -msoft-float
24355 @opindex no-80387
24356 @opindex msoft-float
24357 Generate output containing library calls for floating point.
24358
24359 @strong{Warning:} the requisite libraries are not part of GCC@.
24360 Normally the facilities of the machine's usual C compiler are used, but
24361 this can't be done directly in cross-compilation. You must make your
24362 own arrangements to provide suitable library functions for
24363 cross-compilation.
24364
24365 On machines where a function returns floating-point results in the 80387
24366 register stack, some floating-point opcodes may be emitted even if
24367 @option{-msoft-float} is used.
24368
24369 @item -mno-fp-ret-in-387
24370 @opindex mno-fp-ret-in-387
24371 Do not use the FPU registers for return values of functions.
24372
24373 The usual calling convention has functions return values of types
24374 @code{float} and @code{double} in an FPU register, even if there
24375 is no FPU@. The idea is that the operating system should emulate
24376 an FPU@.
24377
24378 The option @option{-mno-fp-ret-in-387} causes such values to be returned
24379 in ordinary CPU registers instead.
24380
24381 @item -mno-fancy-math-387
24382 @opindex mno-fancy-math-387
24383 Some 387 emulators do not support the @code{sin}, @code{cos} and
24384 @code{sqrt} instructions for the 387. Specify this option to avoid
24385 generating those instructions. This option is the default on
24386 OpenBSD and NetBSD@. This option is overridden when @option{-march}
24387 indicates that the target CPU always has an FPU and so the
24388 instruction does not need emulation. These
24389 instructions are not generated unless you also use the
24390 @option{-funsafe-math-optimizations} switch.
24391
24392 @item -malign-double
24393 @itemx -mno-align-double
24394 @opindex malign-double
24395 @opindex mno-align-double
24396 Control whether GCC aligns @code{double}, @code{long double}, and
24397 @code{long long} variables on a two-word boundary or a one-word
24398 boundary. Aligning @code{double} variables on a two-word boundary
24399 produces code that runs somewhat faster on a Pentium at the
24400 expense of more memory.
24401
24402 On x86-64, @option{-malign-double} is enabled by default.
24403
24404 @strong{Warning:} if you use the @option{-malign-double} switch,
24405 structures containing the above types are aligned differently than
24406 the published application binary interface specifications for the x86-32
24407 and are not binary compatible with structures in code compiled
24408 without that switch.
24409
24410 @item -m96bit-long-double
24411 @itemx -m128bit-long-double
24412 @opindex m96bit-long-double
24413 @opindex m128bit-long-double
24414 These switches control the size of @code{long double} type. The x86-32
24415 application binary interface specifies the size to be 96 bits,
24416 so @option{-m96bit-long-double} is the default in 32-bit mode.
24417
24418 Modern architectures (Pentium and newer) prefer @code{long double}
24419 to be aligned to an 8- or 16-byte boundary. In arrays or structures
24420 conforming to the ABI, this is not possible. So specifying
24421 @option{-m128bit-long-double} aligns @code{long double}
24422 to a 16-byte boundary by padding the @code{long double} with an additional
24423 32-bit zero.
24424
24425 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
24426 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
24427
24428 Notice that neither of these options enable any extra precision over the x87
24429 standard of 80 bits for a @code{long double}.
24430
24431 @strong{Warning:} if you override the default value for your target ABI, this
24432 changes the size of
24433 structures and arrays containing @code{long double} variables,
24434 as well as modifying the function calling convention for functions taking
24435 @code{long double}. Hence they are not binary-compatible
24436 with code compiled without that switch.
24437
24438 @item -mlong-double-64
24439 @itemx -mlong-double-80
24440 @itemx -mlong-double-128
24441 @opindex mlong-double-64
24442 @opindex mlong-double-80
24443 @opindex mlong-double-128
24444 These switches control the size of @code{long double} type. A size
24445 of 64 bits makes the @code{long double} type equivalent to the @code{double}
24446 type. This is the default for 32-bit Bionic C library. A size
24447 of 128 bits makes the @code{long double} type equivalent to the
24448 @code{__float128} type. This is the default for 64-bit Bionic C library.
24449
24450 @strong{Warning:} if you override the default value for your target ABI, this
24451 changes the size of
24452 structures and arrays containing @code{long double} variables,
24453 as well as modifying the function calling convention for functions taking
24454 @code{long double}. Hence they are not binary-compatible
24455 with code compiled without that switch.
24456
24457 @item -malign-data=@var{type}
24458 @opindex malign-data
24459 Control how GCC aligns variables. Supported values for @var{type} are
24460 @samp{compat} uses increased alignment value compatible uses GCC 4.8
24461 and earlier, @samp{abi} uses alignment value as specified by the
24462 psABI, and @samp{cacheline} uses increased alignment value to match
24463 the cache line size. @samp{compat} is the default.
24464
24465 @item -mlarge-data-threshold=@var{threshold}
24466 @opindex mlarge-data-threshold
24467 When @option{-mcmodel=medium} is specified, data objects larger than
24468 @var{threshold} are placed in the large data section. This value must be the
24469 same across all objects linked into the binary, and defaults to 65535.
24470
24471 @item -mrtd
24472 @opindex mrtd
24473 Use a different function-calling convention, in which functions that
24474 take a fixed number of arguments return with the @code{ret @var{num}}
24475 instruction, which pops their arguments while returning. This saves one
24476 instruction in the caller since there is no need to pop the arguments
24477 there.
24478
24479 You can specify that an individual function is called with this calling
24480 sequence with the function attribute @code{stdcall}. You can also
24481 override the @option{-mrtd} option by using the function attribute
24482 @code{cdecl}. @xref{Function Attributes}.
24483
24484 @strong{Warning:} this calling convention is incompatible with the one
24485 normally used on Unix, so you cannot use it if you need to call
24486 libraries compiled with the Unix compiler.
24487
24488 Also, you must provide function prototypes for all functions that
24489 take variable numbers of arguments (including @code{printf});
24490 otherwise incorrect code is generated for calls to those
24491 functions.
24492
24493 In addition, seriously incorrect code results if you call a
24494 function with too many arguments. (Normally, extra arguments are
24495 harmlessly ignored.)
24496
24497 @item -mregparm=@var{num}
24498 @opindex mregparm
24499 Control how many registers are used to pass integer arguments. By
24500 default, no registers are used to pass arguments, and at most 3
24501 registers can be used. You can control this behavior for a specific
24502 function by using the function attribute @code{regparm}.
24503 @xref{Function Attributes}.
24504
24505 @strong{Warning:} if you use this switch, and
24506 @var{num} is nonzero, then you must build all modules with the same
24507 value, including any libraries. This includes the system libraries and
24508 startup modules.
24509
24510 @item -msseregparm
24511 @opindex msseregparm
24512 Use SSE register passing conventions for float and double arguments
24513 and return values. You can control this behavior for a specific
24514 function by using the function attribute @code{sseregparm}.
24515 @xref{Function Attributes}.
24516
24517 @strong{Warning:} if you use this switch then you must build all
24518 modules with the same value, including any libraries. This includes
24519 the system libraries and startup modules.
24520
24521 @item -mvect8-ret-in-mem
24522 @opindex mvect8-ret-in-mem
24523 Return 8-byte vectors in memory instead of MMX registers. This is the
24524 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
24525 Studio compilers until version 12. Later compiler versions (starting
24526 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
24527 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
24528 you need to remain compatible with existing code produced by those
24529 previous compiler versions or older versions of GCC@.
24530
24531 @item -mpc32
24532 @itemx -mpc64
24533 @itemx -mpc80
24534 @opindex mpc32
24535 @opindex mpc64
24536 @opindex mpc80
24537
24538 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
24539 is specified, the significands of results of floating-point operations are
24540 rounded to 24 bits (single precision); @option{-mpc64} rounds the
24541 significands of results of floating-point operations to 53 bits (double
24542 precision) and @option{-mpc80} rounds the significands of results of
24543 floating-point operations to 64 bits (extended double precision), which is
24544 the default. When this option is used, floating-point operations in higher
24545 precisions are not available to the programmer without setting the FPU
24546 control word explicitly.
24547
24548 Setting the rounding of floating-point operations to less than the default
24549 80 bits can speed some programs by 2% or more. Note that some mathematical
24550 libraries assume that extended-precision (80-bit) floating-point operations
24551 are enabled by default; routines in such libraries could suffer significant
24552 loss of accuracy, typically through so-called ``catastrophic cancellation'',
24553 when this option is used to set the precision to less than extended precision.
24554
24555 @item -mstackrealign
24556 @opindex mstackrealign
24557 Realign the stack at entry. On the x86, the @option{-mstackrealign}
24558 option generates an alternate prologue and epilogue that realigns the
24559 run-time stack if necessary. This supports mixing legacy codes that keep
24560 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
24561 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
24562 applicable to individual functions.
24563
24564 @item -mpreferred-stack-boundary=@var{num}
24565 @opindex mpreferred-stack-boundary
24566 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24567 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24568 the default is 4 (16 bytes or 128 bits).
24569
24570 @strong{Warning:} When generating code for the x86-64 architecture with
24571 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
24572 used to keep the stack boundary aligned to 8 byte boundary. Since
24573 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
24574 intended to be used in controlled environment where stack space is
24575 important limitation. This option leads to wrong code when functions
24576 compiled with 16 byte stack alignment (such as functions from a standard
24577 library) are called with misaligned stack. In this case, SSE
24578 instructions may lead to misaligned memory access traps. In addition,
24579 variable arguments are handled incorrectly for 16 byte aligned
24580 objects (including x87 long double and __int128), leading to wrong
24581 results. You must build all modules with
24582 @option{-mpreferred-stack-boundary=3}, including any libraries. This
24583 includes the system libraries and startup modules.
24584
24585 @item -mincoming-stack-boundary=@var{num}
24586 @opindex mincoming-stack-boundary
24587 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
24588 boundary. If @option{-mincoming-stack-boundary} is not specified,
24589 the one specified by @option{-mpreferred-stack-boundary} is used.
24590
24591 On Pentium and Pentium Pro, @code{double} and @code{long double} values
24592 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
24593 suffer significant run time performance penalties. On Pentium III, the
24594 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
24595 properly if it is not 16-byte aligned.
24596
24597 To ensure proper alignment of this values on the stack, the stack boundary
24598 must be as aligned as that required by any value stored on the stack.
24599 Further, every function must be generated such that it keeps the stack
24600 aligned. Thus calling a function compiled with a higher preferred
24601 stack boundary from a function compiled with a lower preferred stack
24602 boundary most likely misaligns the stack. It is recommended that
24603 libraries that use callbacks always use the default setting.
24604
24605 This extra alignment does consume extra stack space, and generally
24606 increases code size. Code that is sensitive to stack space usage, such
24607 as embedded systems and operating system kernels, may want to reduce the
24608 preferred alignment to @option{-mpreferred-stack-boundary=2}.
24609
24610 @need 200
24611 @item -mmmx
24612 @opindex mmmx
24613 @need 200
24614 @itemx -msse
24615 @opindex msse
24616 @need 200
24617 @itemx -msse2
24618 @opindex msse2
24619 @need 200
24620 @itemx -msse3
24621 @opindex msse3
24622 @need 200
24623 @itemx -mssse3
24624 @opindex mssse3
24625 @need 200
24626 @itemx -msse4
24627 @opindex msse4
24628 @need 200
24629 @itemx -msse4a
24630 @opindex msse4a
24631 @need 200
24632 @itemx -msse4.1
24633 @opindex msse4.1
24634 @need 200
24635 @itemx -msse4.2
24636 @opindex msse4.2
24637 @need 200
24638 @itemx -mavx
24639 @opindex mavx
24640 @need 200
24641 @itemx -mavx2
24642 @opindex mavx2
24643 @need 200
24644 @itemx -mavx512f
24645 @opindex mavx512f
24646 @need 200
24647 @itemx -mavx512pf
24648 @opindex mavx512pf
24649 @need 200
24650 @itemx -mavx512er
24651 @opindex mavx512er
24652 @need 200
24653 @itemx -mavx512cd
24654 @opindex mavx512cd
24655 @need 200
24656 @itemx -mavx512vl
24657 @opindex mavx512vl
24658 @need 200
24659 @itemx -mavx512bw
24660 @opindex mavx512bw
24661 @need 200
24662 @itemx -mavx512dq
24663 @opindex mavx512dq
24664 @need 200
24665 @itemx -mavx512ifma
24666 @opindex mavx512ifma
24667 @need 200
24668 @itemx -mavx512vbmi
24669 @opindex mavx512vbmi
24670 @need 200
24671 @itemx -msha
24672 @opindex msha
24673 @need 200
24674 @itemx -maes
24675 @opindex maes
24676 @need 200
24677 @itemx -mpclmul
24678 @opindex mpclmul
24679 @need 200
24680 @itemx -mclfushopt
24681 @opindex mclfushopt
24682 @need 200
24683 @itemx -mfsgsbase
24684 @opindex mfsgsbase
24685 @need 200
24686 @itemx -mrdrnd
24687 @opindex mrdrnd
24688 @need 200
24689 @itemx -mf16c
24690 @opindex mf16c
24691 @need 200
24692 @itemx -mfma
24693 @opindex mfma
24694 @need 200
24695 @itemx -mfma4
24696 @opindex mfma4
24697 @need 200
24698 @itemx -mprefetchwt1
24699 @opindex mprefetchwt1
24700 @need 200
24701 @itemx -mxop
24702 @opindex mxop
24703 @need 200
24704 @itemx -mlwp
24705 @opindex mlwp
24706 @need 200
24707 @itemx -m3dnow
24708 @opindex m3dnow
24709 @need 200
24710 @itemx -mpopcnt
24711 @opindex mpopcnt
24712 @need 200
24713 @itemx -mabm
24714 @opindex mabm
24715 @need 200
24716 @itemx -mbmi
24717 @opindex mbmi
24718 @need 200
24719 @itemx -mbmi2
24720 @need 200
24721 @itemx -mlzcnt
24722 @opindex mlzcnt
24723 @need 200
24724 @itemx -mfxsr
24725 @opindex mfxsr
24726 @need 200
24727 @itemx -mxsave
24728 @opindex mxsave
24729 @need 200
24730 @itemx -mxsaveopt
24731 @opindex mxsaveopt
24732 @need 200
24733 @itemx -mxsavec
24734 @opindex mxsavec
24735 @need 200
24736 @itemx -mxsaves
24737 @opindex mxsaves
24738 @need 200
24739 @itemx -mrtm
24740 @opindex mrtm
24741 @need 200
24742 @itemx -mtbm
24743 @opindex mtbm
24744 @need 200
24745 @itemx -mmpx
24746 @opindex mmpx
24747 @need 200
24748 @itemx -mmwaitx
24749 @opindex mmwaitx
24750 @need 200
24751 @itemx -mclzero
24752 @opindex mclzero
24753 @itemx -mpku
24754 @opindex mpku
24755 These switches enable the use of instructions in the MMX, SSE,
24756 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
24757 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
24758 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
24759 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU or 3DNow!@:
24760 extended instruction sets. Each has a corresponding @option{-mno-} option
24761 to disable use of these instructions.
24762
24763 These extensions are also available as built-in functions: see
24764 @ref{x86 Built-in Functions}, for details of the functions enabled and
24765 disabled by these switches.
24766
24767 To generate SSE/SSE2 instructions automatically from floating-point
24768 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
24769
24770 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
24771 generates new AVX instructions or AVX equivalence for all SSEx instructions
24772 when needed.
24773
24774 These options enable GCC to use these extended instructions in
24775 generated code, even without @option{-mfpmath=sse}. Applications that
24776 perform run-time CPU detection must compile separate files for each
24777 supported architecture, using the appropriate flags. In particular,
24778 the file containing the CPU detection code should be compiled without
24779 these options.
24780
24781 @item -mdump-tune-features
24782 @opindex mdump-tune-features
24783 This option instructs GCC to dump the names of the x86 performance
24784 tuning features and default settings. The names can be used in
24785 @option{-mtune-ctrl=@var{feature-list}}.
24786
24787 @item -mtune-ctrl=@var{feature-list}
24788 @opindex mtune-ctrl=@var{feature-list}
24789 This option is used to do fine grain control of x86 code generation features.
24790 @var{feature-list} is a comma separated list of @var{feature} names. See also
24791 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
24792 on if it is not preceded with @samp{^}, otherwise, it is turned off.
24793 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
24794 developers. Using it may lead to code paths not covered by testing and can
24795 potentially result in compiler ICEs or runtime errors.
24796
24797 @item -mno-default
24798 @opindex mno-default
24799 This option instructs GCC to turn off all tunable features. See also
24800 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
24801
24802 @item -mcld
24803 @opindex mcld
24804 This option instructs GCC to emit a @code{cld} instruction in the prologue
24805 of functions that use string instructions. String instructions depend on
24806 the DF flag to select between autoincrement or autodecrement mode. While the
24807 ABI specifies the DF flag to be cleared on function entry, some operating
24808 systems violate this specification by not clearing the DF flag in their
24809 exception dispatchers. The exception handler can be invoked with the DF flag
24810 set, which leads to wrong direction mode when string instructions are used.
24811 This option can be enabled by default on 32-bit x86 targets by configuring
24812 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
24813 instructions can be suppressed with the @option{-mno-cld} compiler option
24814 in this case.
24815
24816 @item -mvzeroupper
24817 @opindex mvzeroupper
24818 This option instructs GCC to emit a @code{vzeroupper} instruction
24819 before a transfer of control flow out of the function to minimize
24820 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
24821 intrinsics.
24822
24823 @item -mprefer-avx128
24824 @opindex mprefer-avx128
24825 This option instructs GCC to use 128-bit AVX instructions instead of
24826 256-bit AVX instructions in the auto-vectorizer.
24827
24828 @item -mcx16
24829 @opindex mcx16
24830 This option enables GCC to generate @code{CMPXCHG16B} instructions.
24831 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
24832 (or oword) data types.
24833 This is useful for high-resolution counters that can be updated
24834 by multiple processors (or cores). This instruction is generated as part of
24835 atomic built-in functions: see @ref{__sync Builtins} or
24836 @ref{__atomic Builtins} for details.
24837
24838 @item -msahf
24839 @opindex msahf
24840 This option enables generation of @code{SAHF} instructions in 64-bit code.
24841 Early Intel Pentium 4 CPUs with Intel 64 support,
24842 prior to the introduction of Pentium 4 G1 step in December 2005,
24843 lacked the @code{LAHF} and @code{SAHF} instructions
24844 which are supported by AMD64.
24845 These are load and store instructions, respectively, for certain status flags.
24846 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
24847 @code{drem}, and @code{remainder} built-in functions;
24848 see @ref{Other Builtins} for details.
24849
24850 @item -mmovbe
24851 @opindex mmovbe
24852 This option enables use of the @code{movbe} instruction to implement
24853 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
24854
24855 @item -mcrc32
24856 @opindex mcrc32
24857 This option enables built-in functions @code{__builtin_ia32_crc32qi},
24858 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
24859 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
24860
24861 @item -mrecip
24862 @opindex mrecip
24863 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
24864 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
24865 with an additional Newton-Raphson step
24866 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
24867 (and their vectorized
24868 variants) for single-precision floating-point arguments. These instructions
24869 are generated only when @option{-funsafe-math-optimizations} is enabled
24870 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
24871 Note that while the throughput of the sequence is higher than the throughput
24872 of the non-reciprocal instruction, the precision of the sequence can be
24873 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
24874
24875 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
24876 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
24877 combination), and doesn't need @option{-mrecip}.
24878
24879 Also note that GCC emits the above sequence with additional Newton-Raphson step
24880 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
24881 already with @option{-ffast-math} (or the above option combination), and
24882 doesn't need @option{-mrecip}.
24883
24884 @item -mrecip=@var{opt}
24885 @opindex mrecip=opt
24886 This option controls which reciprocal estimate instructions
24887 may be used. @var{opt} is a comma-separated list of options, which may
24888 be preceded by a @samp{!} to invert the option:
24889
24890 @table @samp
24891 @item all
24892 Enable all estimate instructions.
24893
24894 @item default
24895 Enable the default instructions, equivalent to @option{-mrecip}.
24896
24897 @item none
24898 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24899
24900 @item div
24901 Enable the approximation for scalar division.
24902
24903 @item vec-div
24904 Enable the approximation for vectorized division.
24905
24906 @item sqrt
24907 Enable the approximation for scalar square root.
24908
24909 @item vec-sqrt
24910 Enable the approximation for vectorized square root.
24911 @end table
24912
24913 So, for example, @option{-mrecip=all,!sqrt} enables
24914 all of the reciprocal approximations, except for square root.
24915
24916 @item -mveclibabi=@var{type}
24917 @opindex mveclibabi
24918 Specifies the ABI type to use for vectorizing intrinsics using an
24919 external library. Supported values for @var{type} are @samp{svml}
24920 for the Intel short
24921 vector math library and @samp{acml} for the AMD math core library.
24922 To use this option, both @option{-ftree-vectorize} and
24923 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
24924 ABI-compatible library must be specified at link time.
24925
24926 GCC currently emits calls to @code{vmldExp2},
24927 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
24928 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
24929 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
24930 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
24931 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
24932 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
24933 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
24934 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
24935 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
24936 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
24937 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
24938 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
24939 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
24940 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
24941 when @option{-mveclibabi=acml} is used.
24942
24943 @item -mabi=@var{name}
24944 @opindex mabi
24945 Generate code for the specified calling convention. Permissible values
24946 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
24947 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
24948 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
24949 You can control this behavior for specific functions by
24950 using the function attributes @code{ms_abi} and @code{sysv_abi}.
24951 @xref{Function Attributes}.
24952
24953 @item -mtls-dialect=@var{type}
24954 @opindex mtls-dialect
24955 Generate code to access thread-local storage using the @samp{gnu} or
24956 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
24957 @samp{gnu2} is more efficient, but it may add compile- and run-time
24958 requirements that cannot be satisfied on all systems.
24959
24960 @item -mpush-args
24961 @itemx -mno-push-args
24962 @opindex mpush-args
24963 @opindex mno-push-args
24964 Use PUSH operations to store outgoing parameters. This method is shorter
24965 and usually equally fast as method using SUB/MOV operations and is enabled
24966 by default. In some cases disabling it may improve performance because of
24967 improved scheduling and reduced dependencies.
24968
24969 @item -maccumulate-outgoing-args
24970 @opindex maccumulate-outgoing-args
24971 If enabled, the maximum amount of space required for outgoing arguments is
24972 computed in the function prologue. This is faster on most modern CPUs
24973 because of reduced dependencies, improved scheduling and reduced stack usage
24974 when the preferred stack boundary is not equal to 2. The drawback is a notable
24975 increase in code size. This switch implies @option{-mno-push-args}.
24976
24977 @item -mthreads
24978 @opindex mthreads
24979 Support thread-safe exception handling on MinGW. Programs that rely
24980 on thread-safe exception handling must compile and link all code with the
24981 @option{-mthreads} option. When compiling, @option{-mthreads} defines
24982 @option{-D_MT}; when linking, it links in a special thread helper library
24983 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
24984
24985 @item -mms-bitfields
24986 @itemx -mno-ms-bitfields
24987 @opindex mms-bitfields
24988 @opindex mno-ms-bitfields
24989
24990 Enable/disable bit-field layout compatible with the native Microsoft
24991 Windows compiler.
24992
24993 If @code{packed} is used on a structure, or if bit-fields are used,
24994 it may be that the Microsoft ABI lays out the structure differently
24995 than the way GCC normally does. Particularly when moving packed
24996 data between functions compiled with GCC and the native Microsoft compiler
24997 (either via function call or as data in a file), it may be necessary to access
24998 either format.
24999
25000 This option is enabled by default for Microsoft Windows
25001 targets. This behavior can also be controlled locally by use of variable
25002 or type attributes. For more information, see @ref{x86 Variable Attributes}
25003 and @ref{x86 Type Attributes}.
25004
25005 The Microsoft structure layout algorithm is fairly simple with the exception
25006 of the bit-field packing.
25007 The padding and alignment of members of structures and whether a bit-field
25008 can straddle a storage-unit boundary are determine by these rules:
25009
25010 @enumerate
25011 @item Structure members are stored sequentially in the order in which they are
25012 declared: the first member has the lowest memory address and the last member
25013 the highest.
25014
25015 @item Every data object has an alignment requirement. The alignment requirement
25016 for all data except structures, unions, and arrays is either the size of the
25017 object or the current packing size (specified with either the
25018 @code{aligned} attribute or the @code{pack} pragma),
25019 whichever is less. For structures, unions, and arrays,
25020 the alignment requirement is the largest alignment requirement of its members.
25021 Every object is allocated an offset so that:
25022
25023 @smallexample
25024 offset % alignment_requirement == 0
25025 @end smallexample
25026
25027 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
25028 unit if the integral types are the same size and if the next bit-field fits
25029 into the current allocation unit without crossing the boundary imposed by the
25030 common alignment requirements of the bit-fields.
25031 @end enumerate
25032
25033 MSVC interprets zero-length bit-fields in the following ways:
25034
25035 @enumerate
25036 @item If a zero-length bit-field is inserted between two bit-fields that
25037 are normally coalesced, the bit-fields are not coalesced.
25038
25039 For example:
25040
25041 @smallexample
25042 struct
25043 @{
25044 unsigned long bf_1 : 12;
25045 unsigned long : 0;
25046 unsigned long bf_2 : 12;
25047 @} t1;
25048 @end smallexample
25049
25050 @noindent
25051 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
25052 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
25053
25054 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
25055 alignment of the zero-length bit-field is greater than the member that follows it,
25056 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
25057
25058 For example:
25059
25060 @smallexample
25061 struct
25062 @{
25063 char foo : 4;
25064 short : 0;
25065 char bar;
25066 @} t2;
25067
25068 struct
25069 @{
25070 char foo : 4;
25071 short : 0;
25072 double bar;
25073 @} t3;
25074 @end smallexample
25075
25076 @noindent
25077 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
25078 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
25079 bit-field does not affect the alignment of @code{bar} or, as a result, the size
25080 of the structure.
25081
25082 Taking this into account, it is important to note the following:
25083
25084 @enumerate
25085 @item If a zero-length bit-field follows a normal bit-field, the type of the
25086 zero-length bit-field may affect the alignment of the structure as whole. For
25087 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
25088 normal bit-field, and is of type short.
25089
25090 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
25091 still affect the alignment of the structure:
25092
25093 @smallexample
25094 struct
25095 @{
25096 char foo : 6;
25097 long : 0;
25098 @} t4;
25099 @end smallexample
25100
25101 @noindent
25102 Here, @code{t4} takes up 4 bytes.
25103 @end enumerate
25104
25105 @item Zero-length bit-fields following non-bit-field members are ignored:
25106
25107 @smallexample
25108 struct
25109 @{
25110 char foo;
25111 long : 0;
25112 char bar;
25113 @} t5;
25114 @end smallexample
25115
25116 @noindent
25117 Here, @code{t5} takes up 2 bytes.
25118 @end enumerate
25119
25120
25121 @item -mno-align-stringops
25122 @opindex mno-align-stringops
25123 Do not align the destination of inlined string operations. This switch reduces
25124 code size and improves performance in case the destination is already aligned,
25125 but GCC doesn't know about it.
25126
25127 @item -minline-all-stringops
25128 @opindex minline-all-stringops
25129 By default GCC inlines string operations only when the destination is
25130 known to be aligned to least a 4-byte boundary.
25131 This enables more inlining and increases code
25132 size, but may improve performance of code that depends on fast
25133 @code{memcpy}, @code{strlen},
25134 and @code{memset} for short lengths.
25135
25136 @item -minline-stringops-dynamically
25137 @opindex minline-stringops-dynamically
25138 For string operations of unknown size, use run-time checks with
25139 inline code for small blocks and a library call for large blocks.
25140
25141 @item -mstringop-strategy=@var{alg}
25142 @opindex mstringop-strategy=@var{alg}
25143 Override the internal decision heuristic for the particular algorithm to use
25144 for inlining string operations. The allowed values for @var{alg} are:
25145
25146 @table @samp
25147 @item rep_byte
25148 @itemx rep_4byte
25149 @itemx rep_8byte
25150 Expand using i386 @code{rep} prefix of the specified size.
25151
25152 @item byte_loop
25153 @itemx loop
25154 @itemx unrolled_loop
25155 Expand into an inline loop.
25156
25157 @item libcall
25158 Always use a library call.
25159 @end table
25160
25161 @item -mmemcpy-strategy=@var{strategy}
25162 @opindex mmemcpy-strategy=@var{strategy}
25163 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
25164 should be inlined and what inline algorithm to use when the expected size
25165 of the copy operation is known. @var{strategy}
25166 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
25167 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
25168 the max byte size with which inline algorithm @var{alg} is allowed. For the last
25169 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
25170 in the list must be specified in increasing order. The minimal byte size for
25171 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
25172 preceding range.
25173
25174 @item -mmemset-strategy=@var{strategy}
25175 @opindex mmemset-strategy=@var{strategy}
25176 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
25177 @code{__builtin_memset} expansion.
25178
25179 @item -momit-leaf-frame-pointer
25180 @opindex momit-leaf-frame-pointer
25181 Don't keep the frame pointer in a register for leaf functions. This
25182 avoids the instructions to save, set up, and restore frame pointers and
25183 makes an extra register available in leaf functions. The option
25184 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
25185 which might make debugging harder.
25186
25187 @item -mtls-direct-seg-refs
25188 @itemx -mno-tls-direct-seg-refs
25189 @opindex mtls-direct-seg-refs
25190 Controls whether TLS variables may be accessed with offsets from the
25191 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
25192 or whether the thread base pointer must be added. Whether or not this
25193 is valid depends on the operating system, and whether it maps the
25194 segment to cover the entire TLS area.
25195
25196 For systems that use the GNU C Library, the default is on.
25197
25198 @item -msse2avx
25199 @itemx -mno-sse2avx
25200 @opindex msse2avx
25201 Specify that the assembler should encode SSE instructions with VEX
25202 prefix. The option @option{-mavx} turns this on by default.
25203
25204 @item -mfentry
25205 @itemx -mno-fentry
25206 @opindex mfentry
25207 If profiling is active (@option{-pg}), put the profiling
25208 counter call before the prologue.
25209 Note: On x86 architectures the attribute @code{ms_hook_prologue}
25210 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
25211
25212 @item -mrecord-mcount
25213 @itemx -mno-record-mcount
25214 @opindex mrecord-mcount
25215 If profiling is active (@option{-pg}), generate a __mcount_loc section
25216 that contains pointers to each profiling call. This is useful for
25217 automatically patching and out calls.
25218
25219 @item -mnop-mcount
25220 @itemx -mno-nop-mcount
25221 @opindex mnop-mcount
25222 If profiling is active (@option{-pg}), generate the calls to
25223 the profiling functions as NOPs. This is useful when they
25224 should be patched in later dynamically. This is likely only
25225 useful together with @option{-mrecord-mcount}.
25226
25227 @item -mskip-rax-setup
25228 @itemx -mno-skip-rax-setup
25229 @opindex mskip-rax-setup
25230 When generating code for the x86-64 architecture with SSE extensions
25231 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
25232 register when there are no variable arguments passed in vector registers.
25233
25234 @strong{Warning:} Since RAX register is used to avoid unnecessarily
25235 saving vector registers on stack when passing variable arguments, the
25236 impacts of this option are callees may waste some stack space,
25237 misbehave or jump to a random location. GCC 4.4 or newer don't have
25238 those issues, regardless the RAX register value.
25239
25240 @item -m8bit-idiv
25241 @itemx -mno-8bit-idiv
25242 @opindex m8bit-idiv
25243 On some processors, like Intel Atom, 8-bit unsigned integer divide is
25244 much faster than 32-bit/64-bit integer divide. This option generates a
25245 run-time check. If both dividend and divisor are within range of 0
25246 to 255, 8-bit unsigned integer divide is used instead of
25247 32-bit/64-bit integer divide.
25248
25249 @item -mavx256-split-unaligned-load
25250 @itemx -mavx256-split-unaligned-store
25251 @opindex mavx256-split-unaligned-load
25252 @opindex mavx256-split-unaligned-store
25253 Split 32-byte AVX unaligned load and store.
25254
25255 @item -mstack-protector-guard=@var{guard}
25256 @opindex mstack-protector-guard=@var{guard}
25257 Generate stack protection code using canary at @var{guard}. Supported
25258 locations are @samp{global} for global canary or @samp{tls} for per-thread
25259 canary in the TLS block (the default). This option has effect only when
25260 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
25261
25262 @item -mmitigate-rop
25263 @opindex mmitigate-rop
25264 Try to avoid generating code sequences that contain unintended return
25265 opcodes, to mitigate against certain forms of attack. At the moment,
25266 this option is limited in what it can do and should not be relied
25267 on to provide serious protection.
25268
25269 @item -mgeneral-regs-only
25270 @opindex mgeneral-regs-only
25271 Generate code that uses only the general-purpose registers. This
25272 prevents the compiler from using floating-point, vector, mask and bound
25273 registers.
25274
25275 @end table
25276
25277 These @samp{-m} switches are supported in addition to the above
25278 on x86-64 processors in 64-bit environments.
25279
25280 @table @gcctabopt
25281 @item -m32
25282 @itemx -m64
25283 @itemx -mx32
25284 @itemx -m16
25285 @itemx -miamcu
25286 @opindex m32
25287 @opindex m64
25288 @opindex mx32
25289 @opindex m16
25290 @opindex miamcu
25291 Generate code for a 16-bit, 32-bit or 64-bit environment.
25292 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
25293 to 32 bits, and
25294 generates code that runs on any i386 system.
25295
25296 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
25297 types to 64 bits, and generates code for the x86-64 architecture.
25298 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
25299 and @option{-mdynamic-no-pic} options.
25300
25301 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
25302 to 32 bits, and
25303 generates code for the x86-64 architecture.
25304
25305 The @option{-m16} option is the same as @option{-m32}, except for that
25306 it outputs the @code{.code16gcc} assembly directive at the beginning of
25307 the assembly output so that the binary can run in 16-bit mode.
25308
25309 The @option{-miamcu} option generates code which conforms to Intel MCU
25310 psABI. It requires the @option{-m32} option to be turned on.
25311
25312 @item -mno-red-zone
25313 @opindex mno-red-zone
25314 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
25315 by the x86-64 ABI; it is a 128-byte area beyond the location of the
25316 stack pointer that is not modified by signal or interrupt handlers
25317 and therefore can be used for temporary data without adjusting the stack
25318 pointer. The flag @option{-mno-red-zone} disables this red zone.
25319
25320 @item -mcmodel=small
25321 @opindex mcmodel=small
25322 Generate code for the small code model: the program and its symbols must
25323 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
25324 Programs can be statically or dynamically linked. This is the default
25325 code model.
25326
25327 @item -mcmodel=kernel
25328 @opindex mcmodel=kernel
25329 Generate code for the kernel code model. The kernel runs in the
25330 negative 2 GB of the address space.
25331 This model has to be used for Linux kernel code.
25332
25333 @item -mcmodel=medium
25334 @opindex mcmodel=medium
25335 Generate code for the medium model: the program is linked in the lower 2
25336 GB of the address space. Small symbols are also placed there. Symbols
25337 with sizes larger than @option{-mlarge-data-threshold} are put into
25338 large data or BSS sections and can be located above 2GB. Programs can
25339 be statically or dynamically linked.
25340
25341 @item -mcmodel=large
25342 @opindex mcmodel=large
25343 Generate code for the large model. This model makes no assumptions
25344 about addresses and sizes of sections.
25345
25346 @item -maddress-mode=long
25347 @opindex maddress-mode=long
25348 Generate code for long address mode. This is only supported for 64-bit
25349 and x32 environments. It is the default address mode for 64-bit
25350 environments.
25351
25352 @item -maddress-mode=short
25353 @opindex maddress-mode=short
25354 Generate code for short address mode. This is only supported for 32-bit
25355 and x32 environments. It is the default address mode for 32-bit and
25356 x32 environments.
25357 @end table
25358
25359 @node x86 Windows Options
25360 @subsection x86 Windows Options
25361 @cindex x86 Windows Options
25362 @cindex Windows Options for x86
25363
25364 These additional options are available for Microsoft Windows targets:
25365
25366 @table @gcctabopt
25367 @item -mconsole
25368 @opindex mconsole
25369 This option
25370 specifies that a console application is to be generated, by
25371 instructing the linker to set the PE header subsystem type
25372 required for console applications.
25373 This option is available for Cygwin and MinGW targets and is
25374 enabled by default on those targets.
25375
25376 @item -mdll
25377 @opindex mdll
25378 This option is available for Cygwin and MinGW targets. It
25379 specifies that a DLL---a dynamic link library---is to be
25380 generated, enabling the selection of the required runtime
25381 startup object and entry point.
25382
25383 @item -mnop-fun-dllimport
25384 @opindex mnop-fun-dllimport
25385 This option is available for Cygwin and MinGW targets. It
25386 specifies that the @code{dllimport} attribute should be ignored.
25387
25388 @item -mthread
25389 @opindex mthread
25390 This option is available for MinGW targets. It specifies
25391 that MinGW-specific thread support is to be used.
25392
25393 @item -municode
25394 @opindex municode
25395 This option is available for MinGW-w64 targets. It causes
25396 the @code{UNICODE} preprocessor macro to be predefined, and
25397 chooses Unicode-capable runtime startup code.
25398
25399 @item -mwin32
25400 @opindex mwin32
25401 This option is available for Cygwin and MinGW targets. It
25402 specifies that the typical Microsoft Windows predefined macros are to
25403 be set in the pre-processor, but does not influence the choice
25404 of runtime library/startup code.
25405
25406 @item -mwindows
25407 @opindex mwindows
25408 This option is available for Cygwin and MinGW targets. It
25409 specifies that a GUI application is to be generated by
25410 instructing the linker to set the PE header subsystem type
25411 appropriately.
25412
25413 @item -fno-set-stack-executable
25414 @opindex fno-set-stack-executable
25415 This option is available for MinGW targets. It specifies that
25416 the executable flag for the stack used by nested functions isn't
25417 set. This is necessary for binaries running in kernel mode of
25418 Microsoft Windows, as there the User32 API, which is used to set executable
25419 privileges, isn't available.
25420
25421 @item -fwritable-relocated-rdata
25422 @opindex fno-writable-relocated-rdata
25423 This option is available for MinGW and Cygwin targets. It specifies
25424 that relocated-data in read-only section is put into the @code{.data}
25425 section. This is a necessary for older runtimes not supporting
25426 modification of @code{.rdata} sections for pseudo-relocation.
25427
25428 @item -mpe-aligned-commons
25429 @opindex mpe-aligned-commons
25430 This option is available for Cygwin and MinGW targets. It
25431 specifies that the GNU extension to the PE file format that
25432 permits the correct alignment of COMMON variables should be
25433 used when generating code. It is enabled by default if
25434 GCC detects that the target assembler found during configuration
25435 supports the feature.
25436 @end table
25437
25438 See also under @ref{x86 Options} for standard options.
25439
25440 @node Xstormy16 Options
25441 @subsection Xstormy16 Options
25442 @cindex Xstormy16 Options
25443
25444 These options are defined for Xstormy16:
25445
25446 @table @gcctabopt
25447 @item -msim
25448 @opindex msim
25449 Choose startup files and linker script suitable for the simulator.
25450 @end table
25451
25452 @node Xtensa Options
25453 @subsection Xtensa Options
25454 @cindex Xtensa Options
25455
25456 These options are supported for Xtensa targets:
25457
25458 @table @gcctabopt
25459 @item -mconst16
25460 @itemx -mno-const16
25461 @opindex mconst16
25462 @opindex mno-const16
25463 Enable or disable use of @code{CONST16} instructions for loading
25464 constant values. The @code{CONST16} instruction is currently not a
25465 standard option from Tensilica. When enabled, @code{CONST16}
25466 instructions are always used in place of the standard @code{L32R}
25467 instructions. The use of @code{CONST16} is enabled by default only if
25468 the @code{L32R} instruction is not available.
25469
25470 @item -mfused-madd
25471 @itemx -mno-fused-madd
25472 @opindex mfused-madd
25473 @opindex mno-fused-madd
25474 Enable or disable use of fused multiply/add and multiply/subtract
25475 instructions in the floating-point option. This has no effect if the
25476 floating-point option is not also enabled. Disabling fused multiply/add
25477 and multiply/subtract instructions forces the compiler to use separate
25478 instructions for the multiply and add/subtract operations. This may be
25479 desirable in some cases where strict IEEE 754-compliant results are
25480 required: the fused multiply add/subtract instructions do not round the
25481 intermediate result, thereby producing results with @emph{more} bits of
25482 precision than specified by the IEEE standard. Disabling fused multiply
25483 add/subtract instructions also ensures that the program output is not
25484 sensitive to the compiler's ability to combine multiply and add/subtract
25485 operations.
25486
25487 @item -mserialize-volatile
25488 @itemx -mno-serialize-volatile
25489 @opindex mserialize-volatile
25490 @opindex mno-serialize-volatile
25491 When this option is enabled, GCC inserts @code{MEMW} instructions before
25492 @code{volatile} memory references to guarantee sequential consistency.
25493 The default is @option{-mserialize-volatile}. Use
25494 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
25495
25496 @item -mforce-no-pic
25497 @opindex mforce-no-pic
25498 For targets, like GNU/Linux, where all user-mode Xtensa code must be
25499 position-independent code (PIC), this option disables PIC for compiling
25500 kernel code.
25501
25502 @item -mtext-section-literals
25503 @itemx -mno-text-section-literals
25504 @opindex mtext-section-literals
25505 @opindex mno-text-section-literals
25506 These options control the treatment of literal pools. The default is
25507 @option{-mno-text-section-literals}, which places literals in a separate
25508 section in the output file. This allows the literal pool to be placed
25509 in a data RAM/ROM, and it also allows the linker to combine literal
25510 pools from separate object files to remove redundant literals and
25511 improve code size. With @option{-mtext-section-literals}, the literals
25512 are interspersed in the text section in order to keep them as close as
25513 possible to their references. This may be necessary for large assembly
25514 files. Literals for each function are placed right before that function.
25515
25516 @item -mauto-litpools
25517 @itemx -mno-auto-litpools
25518 @opindex mauto-litpools
25519 @opindex mno-auto-litpools
25520 These options control the treatment of literal pools. The default is
25521 @option{-mno-auto-litpools}, which places literals in a separate
25522 section in the output file unless @option{-mtext-section-literals} is
25523 used. With @option{-mauto-litpools} the literals are interspersed in
25524 the text section by the assembler. Compiler does not produce explicit
25525 @code{.literal} directives and loads literals into registers with
25526 @code{MOVI} instructions instead of @code{L32R} to let the assembler
25527 do relaxation and place literals as necessary. This option allows
25528 assembler to create several literal pools per function and assemble
25529 very big functions, which may not be possible with
25530 @option{-mtext-section-literals}.
25531
25532 @item -mtarget-align
25533 @itemx -mno-target-align
25534 @opindex mtarget-align
25535 @opindex mno-target-align
25536 When this option is enabled, GCC instructs the assembler to
25537 automatically align instructions to reduce branch penalties at the
25538 expense of some code density. The assembler attempts to widen density
25539 instructions to align branch targets and the instructions following call
25540 instructions. If there are not enough preceding safe density
25541 instructions to align a target, no widening is performed. The
25542 default is @option{-mtarget-align}. These options do not affect the
25543 treatment of auto-aligned instructions like @code{LOOP}, which the
25544 assembler always aligns, either by widening density instructions or
25545 by inserting NOP instructions.
25546
25547 @item -mlongcalls
25548 @itemx -mno-longcalls
25549 @opindex mlongcalls
25550 @opindex mno-longcalls
25551 When this option is enabled, GCC instructs the assembler to translate
25552 direct calls to indirect calls unless it can determine that the target
25553 of a direct call is in the range allowed by the call instruction. This
25554 translation typically occurs for calls to functions in other source
25555 files. Specifically, the assembler translates a direct @code{CALL}
25556 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
25557 The default is @option{-mno-longcalls}. This option should be used in
25558 programs where the call target can potentially be out of range. This
25559 option is implemented in the assembler, not the compiler, so the
25560 assembly code generated by GCC still shows direct call
25561 instructions---look at the disassembled object code to see the actual
25562 instructions. Note that the assembler uses an indirect call for
25563 every cross-file call, not just those that really are out of range.
25564 @end table
25565
25566 @node zSeries Options
25567 @subsection zSeries Options
25568 @cindex zSeries options
25569
25570 These are listed under @xref{S/390 and zSeries Options}.
25571
25572
25573 @c man end
25574
25575 @node Spec Files
25576 @section Specifying Subprocesses and the Switches to Pass to Them
25577 @cindex Spec Files
25578
25579 @command{gcc} is a driver program. It performs its job by invoking a
25580 sequence of other programs to do the work of compiling, assembling and
25581 linking. GCC interprets its command-line parameters and uses these to
25582 deduce which programs it should invoke, and which command-line options
25583 it ought to place on their command lines. This behavior is controlled
25584 by @dfn{spec strings}. In most cases there is one spec string for each
25585 program that GCC can invoke, but a few programs have multiple spec
25586 strings to control their behavior. The spec strings built into GCC can
25587 be overridden by using the @option{-specs=} command-line switch to specify
25588 a spec file.
25589
25590 @dfn{Spec files} are plain-text files that are used to construct spec
25591 strings. They consist of a sequence of directives separated by blank
25592 lines. The type of directive is determined by the first non-whitespace
25593 character on the line, which can be one of the following:
25594
25595 @table @code
25596 @item %@var{command}
25597 Issues a @var{command} to the spec file processor. The commands that can
25598 appear here are:
25599
25600 @table @code
25601 @item %include <@var{file}>
25602 @cindex @code{%include}
25603 Search for @var{file} and insert its text at the current point in the
25604 specs file.
25605
25606 @item %include_noerr <@var{file}>
25607 @cindex @code{%include_noerr}
25608 Just like @samp{%include}, but do not generate an error message if the include
25609 file cannot be found.
25610
25611 @item %rename @var{old_name} @var{new_name}
25612 @cindex @code{%rename}
25613 Rename the spec string @var{old_name} to @var{new_name}.
25614
25615 @end table
25616
25617 @item *[@var{spec_name}]:
25618 This tells the compiler to create, override or delete the named spec
25619 string. All lines after this directive up to the next directive or
25620 blank line are considered to be the text for the spec string. If this
25621 results in an empty string then the spec is deleted. (Or, if the
25622 spec did not exist, then nothing happens.) Otherwise, if the spec
25623 does not currently exist a new spec is created. If the spec does
25624 exist then its contents are overridden by the text of this
25625 directive, unless the first character of that text is the @samp{+}
25626 character, in which case the text is appended to the spec.
25627
25628 @item [@var{suffix}]:
25629 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
25630 and up to the next directive or blank line are considered to make up the
25631 spec string for the indicated suffix. When the compiler encounters an
25632 input file with the named suffix, it processes the spec string in
25633 order to work out how to compile that file. For example:
25634
25635 @smallexample
25636 .ZZ:
25637 z-compile -input %i
25638 @end smallexample
25639
25640 This says that any input file whose name ends in @samp{.ZZ} should be
25641 passed to the program @samp{z-compile}, which should be invoked with the
25642 command-line switch @option{-input} and with the result of performing the
25643 @samp{%i} substitution. (See below.)
25644
25645 As an alternative to providing a spec string, the text following a
25646 suffix directive can be one of the following:
25647
25648 @table @code
25649 @item @@@var{language}
25650 This says that the suffix is an alias for a known @var{language}. This is
25651 similar to using the @option{-x} command-line switch to GCC to specify a
25652 language explicitly. For example:
25653
25654 @smallexample
25655 .ZZ:
25656 @@c++
25657 @end smallexample
25658
25659 Says that .ZZ files are, in fact, C++ source files.
25660
25661 @item #@var{name}
25662 This causes an error messages saying:
25663
25664 @smallexample
25665 @var{name} compiler not installed on this system.
25666 @end smallexample
25667 @end table
25668
25669 GCC already has an extensive list of suffixes built into it.
25670 This directive adds an entry to the end of the list of suffixes, but
25671 since the list is searched from the end backwards, it is effectively
25672 possible to override earlier entries using this technique.
25673
25674 @end table
25675
25676 GCC has the following spec strings built into it. Spec files can
25677 override these strings or create their own. Note that individual
25678 targets can also add their own spec strings to this list.
25679
25680 @smallexample
25681 asm Options to pass to the assembler
25682 asm_final Options to pass to the assembler post-processor
25683 cpp Options to pass to the C preprocessor
25684 cc1 Options to pass to the C compiler
25685 cc1plus Options to pass to the C++ compiler
25686 endfile Object files to include at the end of the link
25687 link Options to pass to the linker
25688 lib Libraries to include on the command line to the linker
25689 libgcc Decides which GCC support library to pass to the linker
25690 linker Sets the name of the linker
25691 predefines Defines to be passed to the C preprocessor
25692 signed_char Defines to pass to CPP to say whether @code{char} is signed
25693 by default
25694 startfile Object files to include at the start of the link
25695 @end smallexample
25696
25697 Here is a small example of a spec file:
25698
25699 @smallexample
25700 %rename lib old_lib
25701
25702 *lib:
25703 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
25704 @end smallexample
25705
25706 This example renames the spec called @samp{lib} to @samp{old_lib} and
25707 then overrides the previous definition of @samp{lib} with a new one.
25708 The new definition adds in some extra command-line options before
25709 including the text of the old definition.
25710
25711 @dfn{Spec strings} are a list of command-line options to be passed to their
25712 corresponding program. In addition, the spec strings can contain
25713 @samp{%}-prefixed sequences to substitute variable text or to
25714 conditionally insert text into the command line. Using these constructs
25715 it is possible to generate quite complex command lines.
25716
25717 Here is a table of all defined @samp{%}-sequences for spec
25718 strings. Note that spaces are not generated automatically around the
25719 results of expanding these sequences. Therefore you can concatenate them
25720 together or combine them with constant text in a single argument.
25721
25722 @table @code
25723 @item %%
25724 Substitute one @samp{%} into the program name or argument.
25725
25726 @item %i
25727 Substitute the name of the input file being processed.
25728
25729 @item %b
25730 Substitute the basename of the input file being processed.
25731 This is the substring up to (and not including) the last period
25732 and not including the directory.
25733
25734 @item %B
25735 This is the same as @samp{%b}, but include the file suffix (text after
25736 the last period).
25737
25738 @item %d
25739 Marks the argument containing or following the @samp{%d} as a
25740 temporary file name, so that that file is deleted if GCC exits
25741 successfully. Unlike @samp{%g}, this contributes no text to the
25742 argument.
25743
25744 @item %g@var{suffix}
25745 Substitute a file name that has suffix @var{suffix} and is chosen
25746 once per compilation, and mark the argument in the same way as
25747 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
25748 name is now chosen in a way that is hard to predict even when previously
25749 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
25750 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
25751 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
25752 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
25753 was simply substituted with a file name chosen once per compilation,
25754 without regard to any appended suffix (which was therefore treated
25755 just like ordinary text), making such attacks more likely to succeed.
25756
25757 @item %u@var{suffix}
25758 Like @samp{%g}, but generates a new temporary file name
25759 each time it appears instead of once per compilation.
25760
25761 @item %U@var{suffix}
25762 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
25763 new one if there is no such last file name. In the absence of any
25764 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
25765 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
25766 involves the generation of two distinct file names, one
25767 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
25768 simply substituted with a file name chosen for the previous @samp{%u},
25769 without regard to any appended suffix.
25770
25771 @item %j@var{suffix}
25772 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
25773 writable, and if @option{-save-temps} is not used;
25774 otherwise, substitute the name
25775 of a temporary file, just like @samp{%u}. This temporary file is not
25776 meant for communication between processes, but rather as a junk
25777 disposal mechanism.
25778
25779 @item %|@var{suffix}
25780 @itemx %m@var{suffix}
25781 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
25782 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
25783 all. These are the two most common ways to instruct a program that it
25784 should read from standard input or write to standard output. If you
25785 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
25786 construct: see for example @file{f/lang-specs.h}.
25787
25788 @item %.@var{SUFFIX}
25789 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
25790 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
25791 terminated by the next space or %.
25792
25793 @item %w
25794 Marks the argument containing or following the @samp{%w} as the
25795 designated output file of this compilation. This puts the argument
25796 into the sequence of arguments that @samp{%o} substitutes.
25797
25798 @item %o
25799 Substitutes the names of all the output files, with spaces
25800 automatically placed around them. You should write spaces
25801 around the @samp{%o} as well or the results are undefined.
25802 @samp{%o} is for use in the specs for running the linker.
25803 Input files whose names have no recognized suffix are not compiled
25804 at all, but they are included among the output files, so they are
25805 linked.
25806
25807 @item %O
25808 Substitutes the suffix for object files. Note that this is
25809 handled specially when it immediately follows @samp{%g, %u, or %U},
25810 because of the need for those to form complete file names. The
25811 handling is such that @samp{%O} is treated exactly as if it had already
25812 been substituted, except that @samp{%g, %u, and %U} do not currently
25813 support additional @var{suffix} characters following @samp{%O} as they do
25814 following, for example, @samp{.o}.
25815
25816 @item %p
25817 Substitutes the standard macro predefinitions for the
25818 current target machine. Use this when running @command{cpp}.
25819
25820 @item %P
25821 Like @samp{%p}, but puts @samp{__} before and after the name of each
25822 predefined macro, except for macros that start with @samp{__} or with
25823 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
25824 C@.
25825
25826 @item %I
25827 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
25828 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
25829 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
25830 and @option{-imultilib} as necessary.
25831
25832 @item %s
25833 Current argument is the name of a library or startup file of some sort.
25834 Search for that file in a standard list of directories and substitute
25835 the full name found. The current working directory is included in the
25836 list of directories scanned.
25837
25838 @item %T
25839 Current argument is the name of a linker script. Search for that file
25840 in the current list of directories to scan for libraries. If the file
25841 is located insert a @option{--script} option into the command line
25842 followed by the full path name found. If the file is not found then
25843 generate an error message. Note: the current working directory is not
25844 searched.
25845
25846 @item %e@var{str}
25847 Print @var{str} as an error message. @var{str} is terminated by a newline.
25848 Use this when inconsistent options are detected.
25849
25850 @item %(@var{name})
25851 Substitute the contents of spec string @var{name} at this point.
25852
25853 @item %x@{@var{option}@}
25854 Accumulate an option for @samp{%X}.
25855
25856 @item %X
25857 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
25858 spec string.
25859
25860 @item %Y
25861 Output the accumulated assembler options specified by @option{-Wa}.
25862
25863 @item %Z
25864 Output the accumulated preprocessor options specified by @option{-Wp}.
25865
25866 @item %a
25867 Process the @code{asm} spec. This is used to compute the
25868 switches to be passed to the assembler.
25869
25870 @item %A
25871 Process the @code{asm_final} spec. This is a spec string for
25872 passing switches to an assembler post-processor, if such a program is
25873 needed.
25874
25875 @item %l
25876 Process the @code{link} spec. This is the spec for computing the
25877 command line passed to the linker. Typically it makes use of the
25878 @samp{%L %G %S %D and %E} sequences.
25879
25880 @item %D
25881 Dump out a @option{-L} option for each directory that GCC believes might
25882 contain startup files. If the target supports multilibs then the
25883 current multilib directory is prepended to each of these paths.
25884
25885 @item %L
25886 Process the @code{lib} spec. This is a spec string for deciding which
25887 libraries are included on the command line to the linker.
25888
25889 @item %G
25890 Process the @code{libgcc} spec. This is a spec string for deciding
25891 which GCC support library is included on the command line to the linker.
25892
25893 @item %S
25894 Process the @code{startfile} spec. This is a spec for deciding which
25895 object files are the first ones passed to the linker. Typically
25896 this might be a file named @file{crt0.o}.
25897
25898 @item %E
25899 Process the @code{endfile} spec. This is a spec string that specifies
25900 the last object files that are passed to the linker.
25901
25902 @item %C
25903 Process the @code{cpp} spec. This is used to construct the arguments
25904 to be passed to the C preprocessor.
25905
25906 @item %1
25907 Process the @code{cc1} spec. This is used to construct the options to be
25908 passed to the actual C compiler (@command{cc1}).
25909
25910 @item %2
25911 Process the @code{cc1plus} spec. This is used to construct the options to be
25912 passed to the actual C++ compiler (@command{cc1plus}).
25913
25914 @item %*
25915 Substitute the variable part of a matched option. See below.
25916 Note that each comma in the substituted string is replaced by
25917 a single space.
25918
25919 @item %<@code{S}
25920 Remove all occurrences of @code{-S} from the command line. Note---this
25921 command is position dependent. @samp{%} commands in the spec string
25922 before this one see @code{-S}, @samp{%} commands in the spec string
25923 after this one do not.
25924
25925 @item %:@var{function}(@var{args})
25926 Call the named function @var{function}, passing it @var{args}.
25927 @var{args} is first processed as a nested spec string, then split
25928 into an argument vector in the usual fashion. The function returns
25929 a string which is processed as if it had appeared literally as part
25930 of the current spec.
25931
25932 The following built-in spec functions are provided:
25933
25934 @table @code
25935 @item @code{getenv}
25936 The @code{getenv} spec function takes two arguments: an environment
25937 variable name and a string. If the environment variable is not
25938 defined, a fatal error is issued. Otherwise, the return value is the
25939 value of the environment variable concatenated with the string. For
25940 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
25941
25942 @smallexample
25943 %:getenv(TOPDIR /include)
25944 @end smallexample
25945
25946 expands to @file{/path/to/top/include}.
25947
25948 @item @code{if-exists}
25949 The @code{if-exists} spec function takes one argument, an absolute
25950 pathname to a file. If the file exists, @code{if-exists} returns the
25951 pathname. Here is a small example of its usage:
25952
25953 @smallexample
25954 *startfile:
25955 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
25956 @end smallexample
25957
25958 @item @code{if-exists-else}
25959 The @code{if-exists-else} spec function is similar to the @code{if-exists}
25960 spec function, except that it takes two arguments. The first argument is
25961 an absolute pathname to a file. If the file exists, @code{if-exists-else}
25962 returns the pathname. If it does not exist, it returns the second argument.
25963 This way, @code{if-exists-else} can be used to select one file or another,
25964 based on the existence of the first. Here is a small example of its usage:
25965
25966 @smallexample
25967 *startfile:
25968 crt0%O%s %:if-exists(crti%O%s) \
25969 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
25970 @end smallexample
25971
25972 @item @code{replace-outfile}
25973 The @code{replace-outfile} spec function takes two arguments. It looks for the
25974 first argument in the outfiles array and replaces it with the second argument. Here
25975 is a small example of its usage:
25976
25977 @smallexample
25978 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
25979 @end smallexample
25980
25981 @item @code{remove-outfile}
25982 The @code{remove-outfile} spec function takes one argument. It looks for the
25983 first argument in the outfiles array and removes it. Here is a small example
25984 its usage:
25985
25986 @smallexample
25987 %:remove-outfile(-lm)
25988 @end smallexample
25989
25990 @item @code{pass-through-libs}
25991 The @code{pass-through-libs} spec function takes any number of arguments. It
25992 finds any @option{-l} options and any non-options ending in @file{.a} (which it
25993 assumes are the names of linker input library archive files) and returns a
25994 result containing all the found arguments each prepended by
25995 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
25996 intended to be passed to the LTO linker plugin.
25997
25998 @smallexample
25999 %:pass-through-libs(%G %L %G)
26000 @end smallexample
26001
26002 @item @code{print-asm-header}
26003 The @code{print-asm-header} function takes no arguments and simply
26004 prints a banner like:
26005
26006 @smallexample
26007 Assembler options
26008 =================
26009
26010 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
26011 @end smallexample
26012
26013 It is used to separate compiler options from assembler options
26014 in the @option{--target-help} output.
26015 @end table
26016
26017 @item %@{@code{S}@}
26018 Substitutes the @code{-S} switch, if that switch is given to GCC@.
26019 If that switch is not specified, this substitutes nothing. Note that
26020 the leading dash is omitted when specifying this option, and it is
26021 automatically inserted if the substitution is performed. Thus the spec
26022 string @samp{%@{foo@}} matches the command-line option @option{-foo}
26023 and outputs the command-line option @option{-foo}.
26024
26025 @item %W@{@code{S}@}
26026 Like %@{@code{S}@} but mark last argument supplied within as a file to be
26027 deleted on failure.
26028
26029 @item %@{@code{S}*@}
26030 Substitutes all the switches specified to GCC whose names start
26031 with @code{-S}, but which also take an argument. This is used for
26032 switches like @option{-o}, @option{-D}, @option{-I}, etc.
26033 GCC considers @option{-o foo} as being
26034 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
26035 text, including the space. Thus two arguments are generated.
26036
26037 @item %@{@code{S}*&@code{T}*@}
26038 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
26039 (the order of @code{S} and @code{T} in the spec is not significant).
26040 There can be any number of ampersand-separated variables; for each the
26041 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
26042
26043 @item %@{@code{S}:@code{X}@}
26044 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
26045
26046 @item %@{!@code{S}:@code{X}@}
26047 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
26048
26049 @item %@{@code{S}*:@code{X}@}
26050 Substitutes @code{X} if one or more switches whose names start with
26051 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
26052 once, no matter how many such switches appeared. However, if @code{%*}
26053 appears somewhere in @code{X}, then @code{X} is substituted once
26054 for each matching switch, with the @code{%*} replaced by the part of
26055 that switch matching the @code{*}.
26056
26057 If @code{%*} appears as the last part of a spec sequence then a space
26058 is added after the end of the last substitution. If there is more
26059 text in the sequence, however, then a space is not generated. This
26060 allows the @code{%*} substitution to be used as part of a larger
26061 string. For example, a spec string like this:
26062
26063 @smallexample
26064 %@{mcu=*:--script=%*/memory.ld@}
26065 @end smallexample
26066
26067 @noindent
26068 when matching an option like @option{-mcu=newchip} produces:
26069
26070 @smallexample
26071 --script=newchip/memory.ld
26072 @end smallexample
26073
26074 @item %@{.@code{S}:@code{X}@}
26075 Substitutes @code{X}, if processing a file with suffix @code{S}.
26076
26077 @item %@{!.@code{S}:@code{X}@}
26078 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
26079
26080 @item %@{,@code{S}:@code{X}@}
26081 Substitutes @code{X}, if processing a file for language @code{S}.
26082
26083 @item %@{!,@code{S}:@code{X}@}
26084 Substitutes @code{X}, if not processing a file for language @code{S}.
26085
26086 @item %@{@code{S}|@code{P}:@code{X}@}
26087 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
26088 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
26089 @code{*} sequences as well, although they have a stronger binding than
26090 the @samp{|}. If @code{%*} appears in @code{X}, all of the
26091 alternatives must be starred, and only the first matching alternative
26092 is substituted.
26093
26094 For example, a spec string like this:
26095
26096 @smallexample
26097 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
26098 @end smallexample
26099
26100 @noindent
26101 outputs the following command-line options from the following input
26102 command-line options:
26103
26104 @smallexample
26105 fred.c -foo -baz
26106 jim.d -bar -boggle
26107 -d fred.c -foo -baz -boggle
26108 -d jim.d -bar -baz -boggle
26109 @end smallexample
26110
26111 @item %@{S:X; T:Y; :D@}
26112
26113 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
26114 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
26115 be as many clauses as you need. This may be combined with @code{.},
26116 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
26117
26118
26119 @end table
26120
26121 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
26122 construct may contain other nested @samp{%} constructs or spaces, or
26123 even newlines. They are processed as usual, as described above.
26124 Trailing white space in @code{X} is ignored. White space may also
26125 appear anywhere on the left side of the colon in these constructs,
26126 except between @code{.} or @code{*} and the corresponding word.
26127
26128 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
26129 handled specifically in these constructs. If another value of
26130 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
26131 @option{-W} switch is found later in the command line, the earlier
26132 switch value is ignored, except with @{@code{S}*@} where @code{S} is
26133 just one letter, which passes all matching options.
26134
26135 The character @samp{|} at the beginning of the predicate text is used to
26136 indicate that a command should be piped to the following command, but
26137 only if @option{-pipe} is specified.
26138
26139 It is built into GCC which switches take arguments and which do not.
26140 (You might think it would be useful to generalize this to allow each
26141 compiler's spec to say which switches take arguments. But this cannot
26142 be done in a consistent fashion. GCC cannot even decide which input
26143 files have been specified without knowing which switches take arguments,
26144 and it must know which input files to compile in order to tell which
26145 compilers to run).
26146
26147 GCC also knows implicitly that arguments starting in @option{-l} are to be
26148 treated as compiler output files, and passed to the linker in their
26149 proper position among the other output files.
26150
26151 @node Environment Variables
26152 @section Environment Variables Affecting GCC
26153 @cindex environment variables
26154
26155 @c man begin ENVIRONMENT
26156 This section describes several environment variables that affect how GCC
26157 operates. Some of them work by specifying directories or prefixes to use
26158 when searching for various kinds of files. Some are used to specify other
26159 aspects of the compilation environment.
26160
26161 Note that you can also specify places to search using options such as
26162 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
26163 take precedence over places specified using environment variables, which
26164 in turn take precedence over those specified by the configuration of GCC@.
26165 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
26166 GNU Compiler Collection (GCC) Internals}.
26167
26168 @table @env
26169 @item LANG
26170 @itemx LC_CTYPE
26171 @c @itemx LC_COLLATE
26172 @itemx LC_MESSAGES
26173 @c @itemx LC_MONETARY
26174 @c @itemx LC_NUMERIC
26175 @c @itemx LC_TIME
26176 @itemx LC_ALL
26177 @findex LANG
26178 @findex LC_CTYPE
26179 @c @findex LC_COLLATE
26180 @findex LC_MESSAGES
26181 @c @findex LC_MONETARY
26182 @c @findex LC_NUMERIC
26183 @c @findex LC_TIME
26184 @findex LC_ALL
26185 @cindex locale
26186 These environment variables control the way that GCC uses
26187 localization information which allows GCC to work with different
26188 national conventions. GCC inspects the locale categories
26189 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
26190 so. These locale categories can be set to any value supported by your
26191 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
26192 Kingdom encoded in UTF-8.
26193
26194 The @env{LC_CTYPE} environment variable specifies character
26195 classification. GCC uses it to determine the character boundaries in
26196 a string; this is needed for some multibyte encodings that contain quote
26197 and escape characters that are otherwise interpreted as a string
26198 end or escape.
26199
26200 The @env{LC_MESSAGES} environment variable specifies the language to
26201 use in diagnostic messages.
26202
26203 If the @env{LC_ALL} environment variable is set, it overrides the value
26204 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
26205 and @env{LC_MESSAGES} default to the value of the @env{LANG}
26206 environment variable. If none of these variables are set, GCC
26207 defaults to traditional C English behavior.
26208
26209 @item TMPDIR
26210 @findex TMPDIR
26211 If @env{TMPDIR} is set, it specifies the directory to use for temporary
26212 files. GCC uses temporary files to hold the output of one stage of
26213 compilation which is to be used as input to the next stage: for example,
26214 the output of the preprocessor, which is the input to the compiler
26215 proper.
26216
26217 @item GCC_COMPARE_DEBUG
26218 @findex GCC_COMPARE_DEBUG
26219 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
26220 @option{-fcompare-debug} to the compiler driver. See the documentation
26221 of this option for more details.
26222
26223 @item GCC_EXEC_PREFIX
26224 @findex GCC_EXEC_PREFIX
26225 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
26226 names of the subprograms executed by the compiler. No slash is added
26227 when this prefix is combined with the name of a subprogram, but you can
26228 specify a prefix that ends with a slash if you wish.
26229
26230 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
26231 an appropriate prefix to use based on the pathname it is invoked with.
26232
26233 If GCC cannot find the subprogram using the specified prefix, it
26234 tries looking in the usual places for the subprogram.
26235
26236 The default value of @env{GCC_EXEC_PREFIX} is
26237 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
26238 the installed compiler. In many cases @var{prefix} is the value
26239 of @code{prefix} when you ran the @file{configure} script.
26240
26241 Other prefixes specified with @option{-B} take precedence over this prefix.
26242
26243 This prefix is also used for finding files such as @file{crt0.o} that are
26244 used for linking.
26245
26246 In addition, the prefix is used in an unusual way in finding the
26247 directories to search for header files. For each of the standard
26248 directories whose name normally begins with @samp{/usr/local/lib/gcc}
26249 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
26250 replacing that beginning with the specified prefix to produce an
26251 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
26252 @file{foo/bar} just before it searches the standard directory
26253 @file{/usr/local/lib/bar}.
26254 If a standard directory begins with the configured
26255 @var{prefix} then the value of @var{prefix} is replaced by
26256 @env{GCC_EXEC_PREFIX} when looking for header files.
26257
26258 @item COMPILER_PATH
26259 @findex COMPILER_PATH
26260 The value of @env{COMPILER_PATH} is a colon-separated list of
26261 directories, much like @env{PATH}. GCC tries the directories thus
26262 specified when searching for subprograms, if it can't find the
26263 subprograms using @env{GCC_EXEC_PREFIX}.
26264
26265 @item LIBRARY_PATH
26266 @findex LIBRARY_PATH
26267 The value of @env{LIBRARY_PATH} is a colon-separated list of
26268 directories, much like @env{PATH}. When configured as a native compiler,
26269 GCC tries the directories thus specified when searching for special
26270 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
26271 using GCC also uses these directories when searching for ordinary
26272 libraries for the @option{-l} option (but directories specified with
26273 @option{-L} come first).
26274
26275 @item LANG
26276 @findex LANG
26277 @cindex locale definition
26278 This variable is used to pass locale information to the compiler. One way in
26279 which this information is used is to determine the character set to be used
26280 when character literals, string literals and comments are parsed in C and C++.
26281 When the compiler is configured to allow multibyte characters,
26282 the following values for @env{LANG} are recognized:
26283
26284 @table @samp
26285 @item C-JIS
26286 Recognize JIS characters.
26287 @item C-SJIS
26288 Recognize SJIS characters.
26289 @item C-EUCJP
26290 Recognize EUCJP characters.
26291 @end table
26292
26293 If @env{LANG} is not defined, or if it has some other value, then the
26294 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
26295 recognize and translate multibyte characters.
26296 @end table
26297
26298 @noindent
26299 Some additional environment variables affect the behavior of the
26300 preprocessor.
26301
26302 @include cppenv.texi
26303
26304 @c man end
26305
26306 @node Precompiled Headers
26307 @section Using Precompiled Headers
26308 @cindex precompiled headers
26309 @cindex speed of compilation
26310
26311 Often large projects have many header files that are included in every
26312 source file. The time the compiler takes to process these header files
26313 over and over again can account for nearly all of the time required to
26314 build the project. To make builds faster, GCC allows you to
26315 @dfn{precompile} a header file.
26316
26317 To create a precompiled header file, simply compile it as you would any
26318 other file, if necessary using the @option{-x} option to make the driver
26319 treat it as a C or C++ header file. You may want to use a
26320 tool like @command{make} to keep the precompiled header up-to-date when
26321 the headers it contains change.
26322
26323 A precompiled header file is searched for when @code{#include} is
26324 seen in the compilation. As it searches for the included file
26325 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
26326 compiler looks for a precompiled header in each directory just before it
26327 looks for the include file in that directory. The name searched for is
26328 the name specified in the @code{#include} with @samp{.gch} appended. If
26329 the precompiled header file can't be used, it is ignored.
26330
26331 For instance, if you have @code{#include "all.h"}, and you have
26332 @file{all.h.gch} in the same directory as @file{all.h}, then the
26333 precompiled header file is used if possible, and the original
26334 header is used otherwise.
26335
26336 Alternatively, you might decide to put the precompiled header file in a
26337 directory and use @option{-I} to ensure that directory is searched
26338 before (or instead of) the directory containing the original header.
26339 Then, if you want to check that the precompiled header file is always
26340 used, you can put a file of the same name as the original header in this
26341 directory containing an @code{#error} command.
26342
26343 This also works with @option{-include}. So yet another way to use
26344 precompiled headers, good for projects not designed with precompiled
26345 header files in mind, is to simply take most of the header files used by
26346 a project, include them from another header file, precompile that header
26347 file, and @option{-include} the precompiled header. If the header files
26348 have guards against multiple inclusion, they are skipped because
26349 they've already been included (in the precompiled header).
26350
26351 If you need to precompile the same header file for different
26352 languages, targets, or compiler options, you can instead make a
26353 @emph{directory} named like @file{all.h.gch}, and put each precompiled
26354 header in the directory, perhaps using @option{-o}. It doesn't matter
26355 what you call the files in the directory; every precompiled header in
26356 the directory is considered. The first precompiled header
26357 encountered in the directory that is valid for this compilation is
26358 used; they're searched in no particular order.
26359
26360 There are many other possibilities, limited only by your imagination,
26361 good sense, and the constraints of your build system.
26362
26363 A precompiled header file can be used only when these conditions apply:
26364
26365 @itemize
26366 @item
26367 Only one precompiled header can be used in a particular compilation.
26368
26369 @item
26370 A precompiled header can't be used once the first C token is seen. You
26371 can have preprocessor directives before a precompiled header; you cannot
26372 include a precompiled header from inside another header.
26373
26374 @item
26375 The precompiled header file must be produced for the same language as
26376 the current compilation. You can't use a C precompiled header for a C++
26377 compilation.
26378
26379 @item
26380 The precompiled header file must have been produced by the same compiler
26381 binary as the current compilation is using.
26382
26383 @item
26384 Any macros defined before the precompiled header is included must
26385 either be defined in the same way as when the precompiled header was
26386 generated, or must not affect the precompiled header, which usually
26387 means that they don't appear in the precompiled header at all.
26388
26389 The @option{-D} option is one way to define a macro before a
26390 precompiled header is included; using a @code{#define} can also do it.
26391 There are also some options that define macros implicitly, like
26392 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
26393 defined this way.
26394
26395 @item If debugging information is output when using the precompiled
26396 header, using @option{-g} or similar, the same kind of debugging information
26397 must have been output when building the precompiled header. However,
26398 a precompiled header built using @option{-g} can be used in a compilation
26399 when no debugging information is being output.
26400
26401 @item The same @option{-m} options must generally be used when building
26402 and using the precompiled header. @xref{Submodel Options},
26403 for any cases where this rule is relaxed.
26404
26405 @item Each of the following options must be the same when building and using
26406 the precompiled header:
26407
26408 @gccoptlist{-fexceptions}
26409
26410 @item
26411 Some other command-line options starting with @option{-f},
26412 @option{-p}, or @option{-O} must be defined in the same way as when
26413 the precompiled header was generated. At present, it's not clear
26414 which options are safe to change and which are not; the safest choice
26415 is to use exactly the same options when generating and using the
26416 precompiled header. The following are known to be safe:
26417
26418 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
26419 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
26420 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
26421 -pedantic-errors}
26422
26423 @end itemize
26424
26425 For all of these except the last, the compiler automatically
26426 ignores the precompiled header if the conditions aren't met. If you
26427 find an option combination that doesn't work and doesn't cause the
26428 precompiled header to be ignored, please consider filing a bug report,
26429 see @ref{Bugs}.
26430
26431 If you do use differing options when generating and using the
26432 precompiled header, the actual behavior is a mixture of the
26433 behavior for the options. For instance, if you use @option{-g} to
26434 generate the precompiled header but not when using it, you may or may
26435 not get debugging information for routines in the precompiled header.
This page took 1.057398 seconds and 6 git commands to generate.