]> gcc.gnu.org Git - gcc.git/blob - gcc/doc/invoke.texi
arm-cores.def (cortex-r8): New.
[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 -fcheck-new @gol
193 -fconstexpr-depth=@var{n} -ffriend-injection @gol
194 -fno-elide-constructors @gol
195 -fno-enforce-eh-specs @gol
196 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
197 -fno-implicit-templates @gol
198 -fno-implicit-inline-templates @gol
199 -fno-implement-inlines -fms-extensions @gol
200 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
201 -fno-optional-diags -fpermissive @gol
202 -fno-pretty-templates @gol
203 -frepo -fno-rtti -fsized-deallocation @gol
204 -ftemplate-backtrace-limit=@var{n} @gol
205 -ftemplate-depth=@var{n} @gol
206 -fno-threadsafe-statics -fuse-cxa-atexit @gol
207 -fno-weak -nostdinc++ @gol
208 -fvisibility-inlines-hidden @gol
209 -fvisibility-ms-compat @gol
210 -fext-numeric-literals @gol
211 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
212 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
213 -Wnamespaces -Wnarrowing @gol
214 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
215 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
216 -Wno-non-template-friend -Wold-style-cast @gol
217 -Woverloaded-virtual -Wno-pmf-conversions @gol
218 -Wsign-promo -Wvirtual-inheritance}
219
220 @item Objective-C and Objective-C++ Language Options
221 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
222 Objective-C and Objective-C++ Dialects}.
223 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
224 -fgnu-runtime -fnext-runtime @gol
225 -fno-nil-receivers @gol
226 -fobjc-abi-version=@var{n} @gol
227 -fobjc-call-cxx-cdtors @gol
228 -fobjc-direct-dispatch @gol
229 -fobjc-exceptions @gol
230 -fobjc-gc @gol
231 -fobjc-nilcheck @gol
232 -fobjc-std=objc1 @gol
233 -fno-local-ivars @gol
234 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
235 -freplace-objc-classes @gol
236 -fzero-link @gol
237 -gen-decls @gol
238 -Wassign-intercept @gol
239 -Wno-protocol -Wselector @gol
240 -Wstrict-selector-match @gol
241 -Wundeclared-selector}
242
243 @item Diagnostic Message Formatting Options
244 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
245 @gccoptlist{-fmessage-length=@var{n} @gol
246 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
247 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
248 -fno-diagnostics-show-option -fno-diagnostics-show-caret}
249
250 @item Warning Options
251 @xref{Warning Options,,Options to Request or Suppress Warnings}.
252 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
253 -pedantic-errors @gol
254 -w -Wextra -Wall -Waddress -Waggregate-return @gol
255 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
256 -Wno-attributes -Wbool-compare -Wno-builtin-macro-redefined @gol
257 -Wc90-c99-compat -Wc99-c11-compat @gol
258 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
259 -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
260 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdate-time -Wdelete-incomplete @gol
261 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
262 -Wdisabled-optimization @gol
263 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
264 -Wno-div-by-zero -Wdouble-promotion -Wduplicated-cond @gol
265 -Wempty-body -Wenum-compare -Wno-endif-labels @gol
266 -Werror -Werror=* -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
267 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
268 -Wformat-security -Wformat-signedness -Wformat-y2k -Wframe-address @gol
269 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
270 -Wignored-qualifiers -Wincompatible-pointer-types @gol
271 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
272 -Winit-self -Winline -Wno-int-conversion @gol
273 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
274 -Winvalid-pch -Wlarger-than=@var{len} @gol
275 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
276 -Wmain -Wmaybe-uninitialized -Wmemset-transposed-args @gol
277 -Wmisleading-indentation -Wmissing-braces @gol
278 -Wmissing-field-initializers -Wmissing-include-dirs @gol
279 -Wno-multichar -Wnonnull -Wnonnull-compare @gol
280 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
281 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
282 -Woverride-init-side-effects -Woverlength-strings @gol
283 -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
284 -Wparentheses -Wno-pedantic-ms-format @gol
285 -Wplacement-new -Wplacement-new=@var{n} @gol
286 -Wpointer-arith -Wno-pointer-to-int-cast @gol
287 -Wno-pragmas -Wredundant-decls -Wno-return-local-addr @gol
288 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
289 -Wshift-overflow -Wshift-overflow=@var{n} @gol
290 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
291 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
292 -Wno-scalar-storage-order @gol
293 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
294 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
295 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
296 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
297 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
298 -Wmissing-format-attribute -Wsubobject-linkage @gol
299 -Wswitch -Wswitch-default -Wswitch-enum -Wswitch-bool -Wsync-nand @gol
300 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
301 -Wtype-limits -Wundef @gol
302 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
303 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
304 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
305 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
306 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
307 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
308 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
309 -Wvla -Wvolatile-register-var -Wwrite-strings @gol
310 -Wzero-as-null-pointer-constant -Whsa}
311
312 @item C and Objective-C-only Warning Options
313 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
314 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
315 -Wold-style-declaration -Wold-style-definition @gol
316 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
317 -Wdeclaration-after-statement -Wpointer-sign}
318
319 @item Debugging Options
320 @xref{Debugging Options,,Options for Debugging Your Program}.
321 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
322 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
323 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
324 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
325 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
326 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
327 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
328 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
329 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
330 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
331 -fvar-tracking -fvar-tracking-assignments}
332
333 @item Optimization Options
334 @xref{Optimize Options,,Options that Control Optimization}.
335 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
336 -falign-jumps[=@var{n}] @gol
337 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
338 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
339 -fauto-inc-dec -fbranch-probabilities @gol
340 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
341 -fbtr-bb-exclusive -fcaller-saves @gol
342 -fcombine-stack-adjustments -fconserve-stack @gol
343 -fcompare-elim -fcprop-registers -fcrossjumping @gol
344 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
345 -fcx-limited-range @gol
346 -fdata-sections -fdce -fdelayed-branch @gol
347 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
348 -fdevirtualize-at-ltrans -fdse @gol
349 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
350 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
351 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
352 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
353 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
354 -fif-conversion2 -findirect-inlining @gol
355 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
356 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment @gol
357 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
358 -fira-algorithm=@var{algorithm} @gol
359 -fira-region=@var{region} -fira-hoist-pressure @gol
360 -fira-loop-pressure -fno-ira-share-save-slots @gol
361 -fno-ira-share-spill-slots @gol
362 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
363 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
364 -fkeep-static-consts -flive-range-shrinkage @gol
365 -floop-block -floop-interchange -floop-strip-mine @gol
366 -floop-unroll-and-jam -floop-nest-optimize @gol
367 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
368 -flto-partition=@var{alg} -fmerge-all-constants @gol
369 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
370 -fmove-loop-invariants -fno-branch-count-reg @gol
371 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
372 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
373 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
374 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
375 -fomit-frame-pointer -foptimize-sibling-calls @gol
376 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
377 -fprefetch-loop-arrays @gol
378 -fprofile-correction @gol
379 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
380 -fprofile-reorder-functions @gol
381 -freciprocal-math -free -frename-registers -freorder-blocks @gol
382 -freorder-blocks-algorithm=@var{algorithm} @gol
383 -freorder-blocks-and-partition -freorder-functions @gol
384 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
385 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
386 -fsched-spec-load -fsched-spec-load-dangerous @gol
387 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
388 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
389 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
390 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
391 -fschedule-fusion @gol
392 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
393 -fselective-scheduling -fselective-scheduling2 @gol
394 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
395 -fsemantic-interposition -fshrink-wrap -fsignaling-nans @gol
396 -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
397 -fsplit-paths @gol
398 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
399 -fstdarg-opt -fstrict-aliasing @gol
400 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
401 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
402 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
403 -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
404 -ftree-loop-if-convert-stores -ftree-loop-im @gol
405 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
406 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
407 -ftree-loop-vectorize @gol
408 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
409 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
410 -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
411 -ftree-vectorize -ftree-vrp @gol
412 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
413 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
414 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
415 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
416 --param @var{name}=@var{value}
417 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
418
419 @item Program Instrumentation Options
420 @xref{Instrumentation Options,,Program Instrumentation Options}.
421 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
422 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
423 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
424 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
425 -fsanitize-undefined-trap-on-error -fbounds-check @gol
426 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
427 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
428 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
429 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
430 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
431 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
432 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
433 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
434 -fchkp-use-wrappers @gol
435 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
436 -fstack-protector-explicit -fstack-check @gol
437 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
438 -fno-stack-limit -fsplit-stack @gol
439 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
440 -fvtv-counts -fvtv-debug @gol
441 -finstrument-functions @gol
442 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
443 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
444
445 @item Preprocessor Options
446 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
447 @gccoptlist{-A@var{question}=@var{answer} @gol
448 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
449 -C -dD -dI -dM -dN @gol
450 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
451 -idirafter @var{dir} @gol
452 -include @var{file} -imacros @var{file} @gol
453 -iprefix @var{file} -iwithprefix @var{dir} @gol
454 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
455 -imultilib @var{dir} -isysroot @var{dir} @gol
456 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
457 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
458 -remap -trigraphs -undef -U@var{macro} @gol
459 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
460
461 @item Assembler Option
462 @xref{Assembler Options,,Passing Options to the Assembler}.
463 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
464
465 @item Linker Options
466 @xref{Link Options,,Options for Linking}.
467 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
468 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
469 -s -static -static-libgcc -static-libstdc++ @gol
470 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
471 -static-libmpx -static-libmpxwrappers @gol
472 -shared -shared-libgcc -symbolic @gol
473 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
474 -u @var{symbol} -z @var{keyword}}
475
476 @item Directory Options
477 @xref{Directory Options,,Options for Directory Search}.
478 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
479 -iquote@var{dir} -L@var{dir} -no-canonical-prefixes -I- @gol
480 --sysroot=@var{dir} --no-sysroot-suffix}
481
482 @item Code Generation Options
483 @xref{Code Gen Options,,Options for Code Generation Conventions}.
484 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
485 -ffixed-@var{reg} -fexceptions @gol
486 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
487 -fasynchronous-unwind-tables @gol
488 -fno-gnu-unique @gol
489 -finhibit-size-directive -fno-common -fno-ident @gol
490 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
491 -fno-jump-tables @gol
492 -frecord-gcc-switches @gol
493 -freg-struct-return -fshort-enums -fshort-wchar @gol
494 -fverbose-asm -fpack-struct[=@var{n}] @gol
495 -fleading-underscore -ftls-model=@var{model} @gol
496 -fstack-reuse=@var{reuse_level} @gol
497 -ftrapv -fwrapv @gol
498 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
499 -fstrict-volatile-bitfields -fsync-libcalls}
500
501 @item Developer Options
502 @xref{Developer Options,,GCC Developer Options}.
503 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
504 -fchecking -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
505 -fdisable-ipa-@var{pass_name} @gol
506 -fdisable-rtl-@var{pass_name} @gol
507 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
508 -fdisable-tree-@var{pass_name} @gol
509 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
510 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
511 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
512 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
513 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
514 -fdump-passes @gol
515 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
516 -fdump-statistics @gol
517 -fdump-tree-all @gol
518 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
519 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
520 -fdump-tree-cfg -fdump-tree-alias @gol
521 -fdump-tree-ch @gol
522 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
523 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
524 -fdump-tree-gimple@r{[}-raw@r{]} @gol
525 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
526 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
527 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
528 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
529 -fdump-tree-backprop@r{[}-@var{n}@r{]} @gol
530 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
531 -fdump-tree-nrv -fdump-tree-vect @gol
532 -fdump-tree-sink @gol
533 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
534 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
535 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
536 -fdump-tree-vtable-verify @gol
537 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
538 -fdump-tree-split-paths@r{[}-@var{n}@r{]} @gol
539 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
540 -fdump-final-insns=@var{file} @gol
541 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
542 -fenable-@var{kind}-@var{pass} @gol
543 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
544 -fira-verbose=@var{n} @gol
545 -flto-report -flto-report-wpa -fmem-report-wpa @gol
546 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
547 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
548 -fprofile-report @gol
549 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
550 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
551 -fstats -fstack-usage -ftime-report @gol
552 -fvar-tracking-assignments-toggle -gtoggle @gol
553 -print-file-name=@var{library} -print-libgcc-file-name @gol
554 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
555 -print-prog-name=@var{program} -print-search-dirs -Q @gol
556 -print-sysroot -print-sysroot-headers-suffix @gol
557 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
558
559 @item Machine-Dependent Options
560 @xref{Submodel Options,,Machine-Dependent Options}.
561 @c This list is ordered alphanumerically by subsection name.
562 @c Try and put the significant identifier (CPU or system) first,
563 @c so users have a clue at guessing where the ones they want will be.
564
565 @emph{AArch64 Options}
566 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
567 -mgeneral-regs-only @gol
568 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
569 -mstrict-align @gol
570 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
571 -mtls-dialect=desc -mtls-dialect=traditional @gol
572 -mtls-size=@var{size} @gol
573 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
574 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol
575 -mlow-precision-recip-sqrt -mno-low-precision-recip-sqrt@gol
576 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
577
578 @emph{Adapteva Epiphany Options}
579 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
580 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
581 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
582 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
583 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
584 -msplit-vecmove-early -m1reg-@var{reg}}
585
586 @emph{ARC Options}
587 @gccoptlist{-mbarrel-shifter @gol
588 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
589 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
590 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
591 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
592 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
593 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
594 -mlong-calls -mmedium-calls -msdata @gol
595 -mucb-mcount -mvolatile-cache @gol
596 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
597 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
598 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
599 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
600 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
601 -mtune=@var{cpu} -mmultcost=@var{num} @gol
602 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
603 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
604
605 @emph{ARM Options}
606 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
607 -mabi=@var{name} @gol
608 -mapcs-stack-check -mno-apcs-stack-check @gol
609 -mapcs-float -mno-apcs-float @gol
610 -mapcs-reentrant -mno-apcs-reentrant @gol
611 -msched-prolog -mno-sched-prolog @gol
612 -mlittle-endian -mbig-endian @gol
613 -mfloat-abi=@var{name} @gol
614 -mfp16-format=@var{name}
615 -mthumb-interwork -mno-thumb-interwork @gol
616 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
617 -mtune=@var{name} -mprint-tune-info @gol
618 -mstructure-size-boundary=@var{n} @gol
619 -mabort-on-noreturn @gol
620 -mlong-calls -mno-long-calls @gol
621 -msingle-pic-base -mno-single-pic-base @gol
622 -mpic-register=@var{reg} @gol
623 -mnop-fun-dllimport @gol
624 -mpoke-function-name @gol
625 -mthumb -marm @gol
626 -mtpcs-frame -mtpcs-leaf-frame @gol
627 -mcaller-super-interworking -mcallee-super-interworking @gol
628 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
629 -mword-relocations @gol
630 -mfix-cortex-m3-ldrd @gol
631 -munaligned-access @gol
632 -mneon-for-64bits @gol
633 -mslow-flash-data @gol
634 -masm-syntax-unified @gol
635 -mrestrict-it}
636
637 @emph{AVR Options}
638 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
639 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
640 -mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert}
641
642 @emph{Blackfin Options}
643 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
644 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
645 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
646 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
647 -mno-id-shared-library -mshared-library-id=@var{n} @gol
648 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
649 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
650 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
651 -micplb}
652
653 @emph{C6X Options}
654 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
655 -msim -msdata=@var{sdata-type}}
656
657 @emph{CRIS Options}
658 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
659 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
660 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
661 -mstack-align -mdata-align -mconst-align @gol
662 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
663 -melf -maout -melinux -mlinux -sim -sim2 @gol
664 -mmul-bug-workaround -mno-mul-bug-workaround}
665
666 @emph{CR16 Options}
667 @gccoptlist{-mmac @gol
668 -mcr16cplus -mcr16c @gol
669 -msim -mint32 -mbit-ops
670 -mdata-model=@var{model}}
671
672 @emph{Darwin Options}
673 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
674 -arch_only -bind_at_load -bundle -bundle_loader @gol
675 -client_name -compatibility_version -current_version @gol
676 -dead_strip @gol
677 -dependency-file -dylib_file -dylinker_install_name @gol
678 -dynamic -dynamiclib -exported_symbols_list @gol
679 -filelist -flat_namespace -force_cpusubtype_ALL @gol
680 -force_flat_namespace -headerpad_max_install_names @gol
681 -iframework @gol
682 -image_base -init -install_name -keep_private_externs @gol
683 -multi_module -multiply_defined -multiply_defined_unused @gol
684 -noall_load -no_dead_strip_inits_and_terms @gol
685 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
686 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
687 -private_bundle -read_only_relocs -sectalign @gol
688 -sectobjectsymbols -whyload -seg1addr @gol
689 -sectcreate -sectobjectsymbols -sectorder @gol
690 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
691 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
692 -segprot -segs_read_only_addr -segs_read_write_addr @gol
693 -single_module -static -sub_library -sub_umbrella @gol
694 -twolevel_namespace -umbrella -undefined @gol
695 -unexported_symbols_list -weak_reference_mismatches @gol
696 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
697 -mkernel -mone-byte-bool}
698
699 @emph{DEC Alpha Options}
700 @gccoptlist{-mno-fp-regs -msoft-float @gol
701 -mieee -mieee-with-inexact -mieee-conformant @gol
702 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
703 -mtrap-precision=@var{mode} -mbuild-constants @gol
704 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
705 -mbwx -mmax -mfix -mcix @gol
706 -mfloat-vax -mfloat-ieee @gol
707 -mexplicit-relocs -msmall-data -mlarge-data @gol
708 -msmall-text -mlarge-text @gol
709 -mmemory-latency=@var{time}}
710
711 @emph{FR30 Options}
712 @gccoptlist{-msmall-model -mno-lsim}
713
714 @emph{FT32 Options}
715 @gccoptlist{-msim -mlra}
716
717 @emph{FRV Options}
718 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
719 -mhard-float -msoft-float @gol
720 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
721 -mdouble -mno-double @gol
722 -mmedia -mno-media -mmuladd -mno-muladd @gol
723 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
724 -mlinked-fp -mlong-calls -malign-labels @gol
725 -mlibrary-pic -macc-4 -macc-8 @gol
726 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
727 -moptimize-membar -mno-optimize-membar @gol
728 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
729 -mvliw-branch -mno-vliw-branch @gol
730 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
731 -mno-nested-cond-exec -mtomcat-stats @gol
732 -mTLS -mtls @gol
733 -mcpu=@var{cpu}}
734
735 @emph{GNU/Linux Options}
736 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
737 -tno-android-cc -tno-android-ld}
738
739 @emph{H8/300 Options}
740 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
741
742 @emph{HPPA Options}
743 @gccoptlist{-march=@var{architecture-type} @gol
744 -mdisable-fpregs -mdisable-indexing @gol
745 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
746 -mfixed-range=@var{register-range} @gol
747 -mjump-in-delay -mlinker-opt -mlong-calls @gol
748 -mlong-load-store -mno-disable-fpregs @gol
749 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
750 -mno-jump-in-delay -mno-long-load-store @gol
751 -mno-portable-runtime -mno-soft-float @gol
752 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
753 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
754 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
755 -munix=@var{unix-std} -nolibdld -static -threads}
756
757 @emph{IA-64 Options}
758 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
759 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
760 -mconstant-gp -mauto-pic -mfused-madd @gol
761 -minline-float-divide-min-latency @gol
762 -minline-float-divide-max-throughput @gol
763 -mno-inline-float-divide @gol
764 -minline-int-divide-min-latency @gol
765 -minline-int-divide-max-throughput @gol
766 -mno-inline-int-divide @gol
767 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
768 -mno-inline-sqrt @gol
769 -mdwarf2-asm -mearly-stop-bits @gol
770 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
771 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
772 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
773 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
774 -msched-spec-ldc -msched-spec-control-ldc @gol
775 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
776 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
777 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
778 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
779
780 @emph{LM32 Options}
781 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
782 -msign-extend-enabled -muser-enabled}
783
784 @emph{M32R/D Options}
785 @gccoptlist{-m32r2 -m32rx -m32r @gol
786 -mdebug @gol
787 -malign-loops -mno-align-loops @gol
788 -missue-rate=@var{number} @gol
789 -mbranch-cost=@var{number} @gol
790 -mmodel=@var{code-size-model-type} @gol
791 -msdata=@var{sdata-type} @gol
792 -mno-flush-func -mflush-func=@var{name} @gol
793 -mno-flush-trap -mflush-trap=@var{number} @gol
794 -G @var{num}}
795
796 @emph{M32C Options}
797 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
798
799 @emph{M680x0 Options}
800 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
801 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
802 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
803 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
804 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
805 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
806 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
807 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
808 -mxgot -mno-xgot}
809
810 @emph{MCore Options}
811 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
812 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
813 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
814 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
815 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
816
817 @emph{MeP Options}
818 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
819 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
820 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
821 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
822 -mtiny=@var{n}}
823
824 @emph{MicroBlaze Options}
825 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
826 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
827 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
828 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
829 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
830
831 @emph{MIPS Options}
832 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
833 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
834 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
835 -mips16 -mno-mips16 -mflip-mips16 @gol
836 -minterlink-compressed -mno-interlink-compressed @gol
837 -minterlink-mips16 -mno-interlink-mips16 @gol
838 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
839 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
840 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
841 -mno-float -msingle-float -mdouble-float @gol
842 -modd-spreg -mno-odd-spreg @gol
843 -mabs=@var{mode} -mnan=@var{encoding} @gol
844 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
845 -mmcu -mmno-mcu @gol
846 -meva -mno-eva @gol
847 -mvirt -mno-virt @gol
848 -mxpa -mno-xpa @gol
849 -mmicromips -mno-micromips @gol
850 -mfpu=@var{fpu-type} @gol
851 -msmartmips -mno-smartmips @gol
852 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
853 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
854 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
855 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
856 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
857 -membedded-data -mno-embedded-data @gol
858 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
859 -mcode-readable=@var{setting} @gol
860 -msplit-addresses -mno-split-addresses @gol
861 -mexplicit-relocs -mno-explicit-relocs @gol
862 -mcheck-zero-division -mno-check-zero-division @gol
863 -mdivide-traps -mdivide-breaks @gol
864 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
865 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
866 -mfix-24k -mno-fix-24k @gol
867 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
868 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
869 -mfix-vr4120 -mno-fix-vr4120 @gol
870 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
871 -mflush-func=@var{func} -mno-flush-func @gol
872 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
873 -mcompact-branches=@var{policy} @gol
874 -mfp-exceptions -mno-fp-exceptions @gol
875 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
876 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
877 -mframe-header-opt -mno-frame-header-opt}
878
879 @emph{MMIX Options}
880 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
881 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
882 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
883 -mno-base-addresses -msingle-exit -mno-single-exit}
884
885 @emph{MN10300 Options}
886 @gccoptlist{-mmult-bug -mno-mult-bug @gol
887 -mno-am33 -mam33 -mam33-2 -mam34 @gol
888 -mtune=@var{cpu-type} @gol
889 -mreturn-pointer-on-d0 @gol
890 -mno-crt0 -mrelax -mliw -msetlb}
891
892 @emph{Moxie Options}
893 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
894
895 @emph{MSP430 Options}
896 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
897 -mwarn-mcu @gol
898 -mcode-region= -mdata-region= @gol
899 -msilicon-errata= -msilicon-errata-warn= @gol
900 -mhwmult= -minrt}
901
902 @emph{NDS32 Options}
903 @gccoptlist{-mbig-endian -mlittle-endian @gol
904 -mreduced-regs -mfull-regs @gol
905 -mcmov -mno-cmov @gol
906 -mperf-ext -mno-perf-ext @gol
907 -mv3push -mno-v3push @gol
908 -m16bit -mno-16bit @gol
909 -misr-vector-size=@var{num} @gol
910 -mcache-block-size=@var{num} @gol
911 -march=@var{arch} @gol
912 -mcmodel=@var{code-model} @gol
913 -mctor-dtor -mrelax}
914
915 @emph{Nios II Options}
916 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
917 -mel -meb @gol
918 -mno-bypass-cache -mbypass-cache @gol
919 -mno-cache-volatile -mcache-volatile @gol
920 -mno-fast-sw-div -mfast-sw-div @gol
921 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
922 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
923 -mcustom-fpu-cfg=@var{name} @gol
924 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
925 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
926
927 @emph{Nvidia PTX Options}
928 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
929
930 @emph{PDP-11 Options}
931 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
932 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
933 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
934 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
935 -mbranch-expensive -mbranch-cheap @gol
936 -munix-asm -mdec-asm}
937
938 @emph{picoChip Options}
939 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
940 -msymbol-as-address -mno-inefficient-warnings}
941
942 @emph{PowerPC Options}
943 See RS/6000 and PowerPC Options.
944
945 @emph{RL78 Options}
946 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
947 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
948 -m64bit-doubles -m32bit-doubles}
949
950 @emph{RS/6000 and PowerPC Options}
951 @gccoptlist{-mcpu=@var{cpu-type} @gol
952 -mtune=@var{cpu-type} @gol
953 -mcmodel=@var{code-model} @gol
954 -mpowerpc64 @gol
955 -maltivec -mno-altivec @gol
956 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
957 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
958 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
959 -mfprnd -mno-fprnd @gol
960 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
961 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
962 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
963 -malign-power -malign-natural @gol
964 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
965 -msingle-float -mdouble-float -msimple-fpu @gol
966 -mstring -mno-string -mupdate -mno-update @gol
967 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
968 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
969 -mstrict-align -mno-strict-align -mrelocatable @gol
970 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
971 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
972 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
973 -mprioritize-restricted-insns=@var{priority} @gol
974 -msched-costly-dep=@var{dependence_type} @gol
975 -minsert-sched-nops=@var{scheme} @gol
976 -mcall-sysv -mcall-netbsd @gol
977 -maix-struct-return -msvr4-struct-return @gol
978 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
979 -mblock-move-inline-limit=@var{num} @gol
980 -misel -mno-isel @gol
981 -misel=yes -misel=no @gol
982 -mspe -mno-spe @gol
983 -mspe=yes -mspe=no @gol
984 -mpaired @gol
985 -mgen-cell-microcode -mwarn-cell-microcode @gol
986 -mvrsave -mno-vrsave @gol
987 -mmulhw -mno-mulhw @gol
988 -mdlmzb -mno-dlmzb @gol
989 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
990 -mprototype -mno-prototype @gol
991 -msim -mmvme -mads -myellowknife -memb -msdata @gol
992 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
993 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
994 -mno-recip-precision @gol
995 -mveclibabi=@var{type} -mfriz -mno-friz @gol
996 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
997 -msave-toc-indirect -mno-save-toc-indirect @gol
998 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
999 -mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol
1000 -mquad-memory -mno-quad-memory @gol
1001 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1002 -mcompat-align-parm -mno-compat-align-parm @gol
1003 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
1004 -mupper-regs -mno-upper-regs -mmodulo -mno-modulo @gol
1005 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1006 -mpower9-fusion -mno-mpower9-fusion -mpower9-vector -mno-power9-vector}
1007
1008 @emph{RX Options}
1009 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1010 -mcpu=@gol
1011 -mbig-endian-data -mlittle-endian-data @gol
1012 -msmall-data @gol
1013 -msim -mno-sim@gol
1014 -mas100-syntax -mno-as100-syntax@gol
1015 -mrelax@gol
1016 -mmax-constant-size=@gol
1017 -mint-register=@gol
1018 -mpid@gol
1019 -mallow-string-insns -mno-allow-string-insns@gol
1020 -mjsr@gol
1021 -mno-warn-multiple-fast-interrupts@gol
1022 -msave-acc-in-interrupts}
1023
1024 @emph{S/390 and zSeries Options}
1025 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1026 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1027 -mlong-double-64 -mlong-double-128 @gol
1028 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1029 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1030 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1031 -mhtm -mvx -mzvector @gol
1032 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1033 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1034 -mhotpatch=@var{halfwords},@var{halfwords}}
1035
1036 @emph{Score Options}
1037 @gccoptlist{-meb -mel @gol
1038 -mnhwloop @gol
1039 -muls @gol
1040 -mmac @gol
1041 -mscore5 -mscore5u -mscore7 -mscore7d}
1042
1043 @emph{SH Options}
1044 @gccoptlist{-m1 -m2 -m2e @gol
1045 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1046 -m3 -m3e @gol
1047 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1048 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1049 -mb -ml -mdalign -mrelax @gol
1050 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1051 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1052 -mspace -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1053 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1054 -maccumulate-outgoing-args @gol
1055 -matomic-model=@var{atomic-model} @gol
1056 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1057 -mcbranch-force-delay-slot @gol
1058 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1059 -mpretend-cmove -mtas}
1060
1061 @emph{Solaris 2 Options}
1062 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1063 -pthreads -pthread}
1064
1065 @emph{SPARC Options}
1066 @gccoptlist{-mcpu=@var{cpu-type} @gol
1067 -mtune=@var{cpu-type} @gol
1068 -mcmodel=@var{code-model} @gol
1069 -mmemory-model=@var{mem-model} @gol
1070 -m32 -m64 -mapp-regs -mno-app-regs @gol
1071 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1072 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1073 -mhard-quad-float -msoft-quad-float @gol
1074 -mstack-bias -mno-stack-bias @gol
1075 -mstd-struct-return -mno-std-struct-return @gol
1076 -munaligned-doubles -mno-unaligned-doubles @gol
1077 -muser-mode -mno-user-mode @gol
1078 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1079 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1080 -mcbcond -mno-cbcond @gol
1081 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
1082 -mfix-at697f -mfix-ut699}
1083
1084 @emph{SPU Options}
1085 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1086 -msafe-dma -munsafe-dma @gol
1087 -mbranch-hints @gol
1088 -msmall-mem -mlarge-mem -mstdmain @gol
1089 -mfixed-range=@var{register-range} @gol
1090 -mea32 -mea64 @gol
1091 -maddress-space-conversion -mno-address-space-conversion @gol
1092 -mcache-size=@var{cache-size} @gol
1093 -matomic-updates -mno-atomic-updates}
1094
1095 @emph{System V Options}
1096 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1097
1098 @emph{TILE-Gx Options}
1099 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1100 -mcmodel=@var{code-model}}
1101
1102 @emph{TILEPro Options}
1103 @gccoptlist{-mcpu=@var{cpu} -m32}
1104
1105 @emph{V850 Options}
1106 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1107 -mprolog-function -mno-prolog-function -mspace @gol
1108 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1109 -mapp-regs -mno-app-regs @gol
1110 -mdisable-callt -mno-disable-callt @gol
1111 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1112 -mv850e -mv850 -mv850e3v5 @gol
1113 -mloop @gol
1114 -mrelax @gol
1115 -mlong-jumps @gol
1116 -msoft-float @gol
1117 -mhard-float @gol
1118 -mgcc-abi @gol
1119 -mrh850-abi @gol
1120 -mbig-switch}
1121
1122 @emph{VAX Options}
1123 @gccoptlist{-mg -mgnu -munix}
1124
1125 @emph{Visium Options}
1126 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1127 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1128
1129 @emph{VMS Options}
1130 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1131 -mpointer-size=@var{size}}
1132
1133 @emph{VxWorks Options}
1134 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1135 -Xbind-lazy -Xbind-now}
1136
1137 @emph{x86 Options}
1138 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1139 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1140 -mfpmath=@var{unit} @gol
1141 -masm=@var{dialect} -mno-fancy-math-387 @gol
1142 -mno-fp-ret-in-387 -msoft-float @gol
1143 -mno-wide-multiply -mrtd -malign-double @gol
1144 -mpreferred-stack-boundary=@var{num} @gol
1145 -mincoming-stack-boundary=@var{num} @gol
1146 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1147 -mrecip -mrecip=@var{opt} @gol
1148 -mvzeroupper -mprefer-avx128 @gol
1149 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1150 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1151 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1152 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1153 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1154 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
1155 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mclzero
1156 -mpku -mthreads @gol
1157 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1158 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1159 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1160 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1161 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1162 -mregparm=@var{num} -msseregparm @gol
1163 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1164 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1165 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1166 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1167 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1168 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1169 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1170 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1171 -mmitigate-rop}
1172
1173 @emph{x86 Windows Options}
1174 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1175 -mnop-fun-dllimport -mthread @gol
1176 -municode -mwin32 -mwindows -fno-set-stack-executable}
1177
1178 @emph{Xstormy16 Options}
1179 @gccoptlist{-msim}
1180
1181 @emph{Xtensa Options}
1182 @gccoptlist{-mconst16 -mno-const16 @gol
1183 -mfused-madd -mno-fused-madd @gol
1184 -mforce-no-pic @gol
1185 -mserialize-volatile -mno-serialize-volatile @gol
1186 -mtext-section-literals -mno-text-section-literals @gol
1187 -mauto-litpools -mno-auto-litpools @gol
1188 -mtarget-align -mno-target-align @gol
1189 -mlongcalls -mno-longcalls}
1190
1191 @emph{zSeries Options}
1192 See S/390 and zSeries Options.
1193 @end table
1194
1195
1196 @node Overall Options
1197 @section Options Controlling the Kind of Output
1198
1199 Compilation can involve up to four stages: preprocessing, compilation
1200 proper, assembly and linking, always in that order. GCC is capable of
1201 preprocessing and compiling several files either into several
1202 assembler input files, or into one assembler input file; then each
1203 assembler input file produces an object file, and linking combines all
1204 the object files (those newly compiled, and those specified as input)
1205 into an executable file.
1206
1207 @cindex file name suffix
1208 For any given input file, the file name suffix determines what kind of
1209 compilation is done:
1210
1211 @table @gcctabopt
1212 @item @var{file}.c
1213 C source code that must be preprocessed.
1214
1215 @item @var{file}.i
1216 C source code that should not be preprocessed.
1217
1218 @item @var{file}.ii
1219 C++ source code that should not be preprocessed.
1220
1221 @item @var{file}.m
1222 Objective-C source code. Note that you must link with the @file{libobjc}
1223 library to make an Objective-C program work.
1224
1225 @item @var{file}.mi
1226 Objective-C source code that should not be preprocessed.
1227
1228 @item @var{file}.mm
1229 @itemx @var{file}.M
1230 Objective-C++ source code. Note that you must link with the @file{libobjc}
1231 library to make an Objective-C++ program work. Note that @samp{.M} refers
1232 to a literal capital M@.
1233
1234 @item @var{file}.mii
1235 Objective-C++ source code that should not be preprocessed.
1236
1237 @item @var{file}.h
1238 C, C++, Objective-C or Objective-C++ header file to be turned into a
1239 precompiled header (default), or C, C++ header file to be turned into an
1240 Ada spec (via the @option{-fdump-ada-spec} switch).
1241
1242 @item @var{file}.cc
1243 @itemx @var{file}.cp
1244 @itemx @var{file}.cxx
1245 @itemx @var{file}.cpp
1246 @itemx @var{file}.CPP
1247 @itemx @var{file}.c++
1248 @itemx @var{file}.C
1249 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1250 the last two letters must both be literally @samp{x}. Likewise,
1251 @samp{.C} refers to a literal capital C@.
1252
1253 @item @var{file}.mm
1254 @itemx @var{file}.M
1255 Objective-C++ source code that must be preprocessed.
1256
1257 @item @var{file}.mii
1258 Objective-C++ source code that should not be preprocessed.
1259
1260 @item @var{file}.hh
1261 @itemx @var{file}.H
1262 @itemx @var{file}.hp
1263 @itemx @var{file}.hxx
1264 @itemx @var{file}.hpp
1265 @itemx @var{file}.HPP
1266 @itemx @var{file}.h++
1267 @itemx @var{file}.tcc
1268 C++ header file to be turned into a precompiled header or Ada spec.
1269
1270 @item @var{file}.f
1271 @itemx @var{file}.for
1272 @itemx @var{file}.ftn
1273 Fixed form Fortran source code that should not be preprocessed.
1274
1275 @item @var{file}.F
1276 @itemx @var{file}.FOR
1277 @itemx @var{file}.fpp
1278 @itemx @var{file}.FPP
1279 @itemx @var{file}.FTN
1280 Fixed form Fortran source code that must be preprocessed (with the traditional
1281 preprocessor).
1282
1283 @item @var{file}.f90
1284 @itemx @var{file}.f95
1285 @itemx @var{file}.f03
1286 @itemx @var{file}.f08
1287 Free form Fortran source code that should not be preprocessed.
1288
1289 @item @var{file}.F90
1290 @itemx @var{file}.F95
1291 @itemx @var{file}.F03
1292 @itemx @var{file}.F08
1293 Free form Fortran source code that must be preprocessed (with the
1294 traditional preprocessor).
1295
1296 @item @var{file}.go
1297 Go source code.
1298
1299 @c FIXME: Descriptions of Java file types.
1300 @c @var{file}.java
1301 @c @var{file}.class
1302 @c @var{file}.zip
1303 @c @var{file}.jar
1304
1305 @item @var{file}.ads
1306 Ada source code file that contains a library unit declaration (a
1307 declaration of a package, subprogram, or generic, or a generic
1308 instantiation), or a library unit renaming declaration (a package,
1309 generic, or subprogram renaming declaration). Such files are also
1310 called @dfn{specs}.
1311
1312 @item @var{file}.adb
1313 Ada source code file containing a library unit body (a subprogram or
1314 package body). Such files are also called @dfn{bodies}.
1315
1316 @c GCC also knows about some suffixes for languages not yet included:
1317 @c Pascal:
1318 @c @var{file}.p
1319 @c @var{file}.pas
1320 @c Ratfor:
1321 @c @var{file}.r
1322
1323 @item @var{file}.s
1324 Assembler code.
1325
1326 @item @var{file}.S
1327 @itemx @var{file}.sx
1328 Assembler code that must be preprocessed.
1329
1330 @item @var{other}
1331 An object file to be fed straight into linking.
1332 Any file name with no recognized suffix is treated this way.
1333 @end table
1334
1335 @opindex x
1336 You can specify the input language explicitly with the @option{-x} option:
1337
1338 @table @gcctabopt
1339 @item -x @var{language}
1340 Specify explicitly the @var{language} for the following input files
1341 (rather than letting the compiler choose a default based on the file
1342 name suffix). This option applies to all following input files until
1343 the next @option{-x} option. Possible values for @var{language} are:
1344 @smallexample
1345 c c-header cpp-output
1346 c++ c++-header c++-cpp-output
1347 objective-c objective-c-header objective-c-cpp-output
1348 objective-c++ objective-c++-header objective-c++-cpp-output
1349 assembler assembler-with-cpp
1350 ada
1351 f77 f77-cpp-input f95 f95-cpp-input
1352 go
1353 java
1354 @end smallexample
1355
1356 @item -x none
1357 Turn off any specification of a language, so that subsequent files are
1358 handled according to their file name suffixes (as they are if @option{-x}
1359 has not been used at all).
1360 @end table
1361
1362 If you only want some of the stages of compilation, you can use
1363 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1364 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1365 @command{gcc} is to stop. Note that some combinations (for example,
1366 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1367
1368 @table @gcctabopt
1369 @item -c
1370 @opindex c
1371 Compile or assemble the source files, but do not link. The linking
1372 stage simply is not done. The ultimate output is in the form of an
1373 object file for each source file.
1374
1375 By default, the object file name for a source file is made by replacing
1376 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1377
1378 Unrecognized input files, not requiring compilation or assembly, are
1379 ignored.
1380
1381 @item -S
1382 @opindex S
1383 Stop after the stage of compilation proper; do not assemble. The output
1384 is in the form of an assembler code file for each non-assembler input
1385 file specified.
1386
1387 By default, the assembler file name for a source file is made by
1388 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1389
1390 Input files that don't require compilation are ignored.
1391
1392 @item -E
1393 @opindex E
1394 Stop after the preprocessing stage; do not run the compiler proper. The
1395 output is in the form of preprocessed source code, which is sent to the
1396 standard output.
1397
1398 Input files that don't require preprocessing are ignored.
1399
1400 @cindex output file option
1401 @item -o @var{file}
1402 @opindex o
1403 Place output in file @var{file}. This applies to whatever
1404 sort of output is being produced, whether it be an executable file,
1405 an object file, an assembler file or preprocessed C code.
1406
1407 If @option{-o} is not specified, the default is to put an executable
1408 file in @file{a.out}, the object file for
1409 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1410 assembler file in @file{@var{source}.s}, a precompiled header file in
1411 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1412 standard output.
1413
1414 @item -v
1415 @opindex v
1416 Print (on standard error output) the commands executed to run the stages
1417 of compilation. Also print the version number of the compiler driver
1418 program and of the preprocessor and the compiler proper.
1419
1420 @item -###
1421 @opindex ###
1422 Like @option{-v} except the commands are not executed and arguments
1423 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1424 This is useful for shell scripts to capture the driver-generated command lines.
1425
1426 @item --help
1427 @opindex help
1428 Print (on the standard output) a description of the command-line options
1429 understood by @command{gcc}. If the @option{-v} option is also specified
1430 then @option{--help} is also passed on to the various processes
1431 invoked by @command{gcc}, so that they can display the command-line options
1432 they accept. If the @option{-Wextra} option has also been specified
1433 (prior to the @option{--help} option), then command-line options that
1434 have no documentation associated with them are also displayed.
1435
1436 @item --target-help
1437 @opindex target-help
1438 Print (on the standard output) a description of target-specific command-line
1439 options for each tool. For some targets extra target-specific
1440 information may also be printed.
1441
1442 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1443 Print (on the standard output) a description of the command-line
1444 options understood by the compiler that fit into all specified classes
1445 and qualifiers. These are the supported classes:
1446
1447 @table @asis
1448 @item @samp{optimizers}
1449 Display all of the optimization options supported by the
1450 compiler.
1451
1452 @item @samp{warnings}
1453 Display all of the options controlling warning messages
1454 produced by the compiler.
1455
1456 @item @samp{target}
1457 Display target-specific options. Unlike the
1458 @option{--target-help} option however, target-specific options of the
1459 linker and assembler are not displayed. This is because those
1460 tools do not currently support the extended @option{--help=} syntax.
1461
1462 @item @samp{params}
1463 Display the values recognized by the @option{--param}
1464 option.
1465
1466 @item @var{language}
1467 Display the options supported for @var{language}, where
1468 @var{language} is the name of one of the languages supported in this
1469 version of GCC@.
1470
1471 @item @samp{common}
1472 Display the options that are common to all languages.
1473 @end table
1474
1475 These are the supported qualifiers:
1476
1477 @table @asis
1478 @item @samp{undocumented}
1479 Display only those options that are undocumented.
1480
1481 @item @samp{joined}
1482 Display options taking an argument that appears after an equal
1483 sign in the same continuous piece of text, such as:
1484 @samp{--help=target}.
1485
1486 @item @samp{separate}
1487 Display options taking an argument that appears as a separate word
1488 following the original option, such as: @samp{-o output-file}.
1489 @end table
1490
1491 Thus for example to display all the undocumented target-specific
1492 switches supported by the compiler, use:
1493
1494 @smallexample
1495 --help=target,undocumented
1496 @end smallexample
1497
1498 The sense of a qualifier can be inverted by prefixing it with the
1499 @samp{^} character, so for example to display all binary warning
1500 options (i.e., ones that are either on or off and that do not take an
1501 argument) that have a description, use:
1502
1503 @smallexample
1504 --help=warnings,^joined,^undocumented
1505 @end smallexample
1506
1507 The argument to @option{--help=} should not consist solely of inverted
1508 qualifiers.
1509
1510 Combining several classes is possible, although this usually
1511 restricts the output so much that there is nothing to display. One
1512 case where it does work, however, is when one of the classes is
1513 @var{target}. For example, to display all the target-specific
1514 optimization options, use:
1515
1516 @smallexample
1517 --help=target,optimizers
1518 @end smallexample
1519
1520 The @option{--help=} option can be repeated on the command line. Each
1521 successive use displays its requested class of options, skipping
1522 those that have already been displayed.
1523
1524 If the @option{-Q} option appears on the command line before the
1525 @option{--help=} option, then the descriptive text displayed by
1526 @option{--help=} is changed. Instead of describing the displayed
1527 options, an indication is given as to whether the option is enabled,
1528 disabled or set to a specific value (assuming that the compiler
1529 knows this at the point where the @option{--help=} option is used).
1530
1531 Here is a truncated example from the ARM port of @command{gcc}:
1532
1533 @smallexample
1534 % gcc -Q -mabi=2 --help=target -c
1535 The following options are target specific:
1536 -mabi= 2
1537 -mabort-on-noreturn [disabled]
1538 -mapcs [disabled]
1539 @end smallexample
1540
1541 The output is sensitive to the effects of previous command-line
1542 options, so for example it is possible to find out which optimizations
1543 are enabled at @option{-O2} by using:
1544
1545 @smallexample
1546 -Q -O2 --help=optimizers
1547 @end smallexample
1548
1549 Alternatively you can discover which binary optimizations are enabled
1550 by @option{-O3} by using:
1551
1552 @smallexample
1553 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1554 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1555 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1556 @end smallexample
1557
1558 @item --version
1559 @opindex version
1560 Display the version number and copyrights of the invoked GCC@.
1561
1562 @item -pass-exit-codes
1563 @opindex pass-exit-codes
1564 Normally the @command{gcc} program exits with the code of 1 if any
1565 phase of the compiler returns a non-success return code. If you specify
1566 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1567 the numerically highest error produced by any phase returning an error
1568 indication. The C, C++, and Fortran front ends return 4 if an internal
1569 compiler error is encountered.
1570
1571 @item -pipe
1572 @opindex pipe
1573 Use pipes rather than temporary files for communication between the
1574 various stages of compilation. This fails to work on some systems where
1575 the assembler is unable to read from a pipe; but the GNU assembler has
1576 no trouble.
1577
1578 @item -specs=@var{file}
1579 @opindex specs
1580 Process @var{file} after the compiler reads in the standard @file{specs}
1581 file, in order to override the defaults which the @command{gcc} driver
1582 program uses when determining what switches to pass to @command{cc1},
1583 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1584 @option{-specs=@var{file}} can be specified on the command line, and they
1585 are processed in order, from left to right. @xref{Spec Files}, for
1586 information about the format of the @var{file}.
1587
1588 @item -wrapper
1589 @opindex wrapper
1590 Invoke all subcommands under a wrapper program. The name of the
1591 wrapper program and its parameters are passed as a comma separated
1592 list.
1593
1594 @smallexample
1595 gcc -c t.c -wrapper gdb,--args
1596 @end smallexample
1597
1598 @noindent
1599 This invokes all subprograms of @command{gcc} under
1600 @samp{gdb --args}, thus the invocation of @command{cc1} is
1601 @samp{gdb --args cc1 @dots{}}.
1602
1603 @item -fplugin=@var{name}.so
1604 @opindex fplugin
1605 Load the plugin code in file @var{name}.so, assumed to be a
1606 shared object to be dlopen'd by the compiler. The base name of
1607 the shared object file is used to identify the plugin for the
1608 purposes of argument parsing (See
1609 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1610 Each plugin should define the callback functions specified in the
1611 Plugins API.
1612
1613 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1614 @opindex fplugin-arg
1615 Define an argument called @var{key} with a value of @var{value}
1616 for the plugin called @var{name}.
1617
1618 @item -fdump-ada-spec@r{[}-slim@r{]}
1619 @opindex fdump-ada-spec
1620 For C and C++ source and include files, generate corresponding Ada specs.
1621 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1622 GNAT User's Guide}, which provides detailed documentation on this feature.
1623
1624 @item -fada-spec-parent=@var{unit}
1625 @opindex fada-spec-parent
1626 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1627 Ada specs as child units of parent @var{unit}.
1628
1629 @item -fdump-go-spec=@var{file}
1630 @opindex fdump-go-spec
1631 For input files in any language, generate corresponding Go
1632 declarations in @var{file}. This generates Go @code{const},
1633 @code{type}, @code{var}, and @code{func} declarations which may be a
1634 useful way to start writing a Go interface to code written in some
1635 other language.
1636
1637 @include @value{srcdir}/../libiberty/at-file.texi
1638 @end table
1639
1640 @node Invoking G++
1641 @section Compiling C++ Programs
1642
1643 @cindex suffixes for C++ source
1644 @cindex C++ source file suffixes
1645 C++ source files conventionally use one of the suffixes @samp{.C},
1646 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1647 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1648 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1649 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1650 files with these names and compiles them as C++ programs even if you
1651 call the compiler the same way as for compiling C programs (usually
1652 with the name @command{gcc}).
1653
1654 @findex g++
1655 @findex c++
1656 However, the use of @command{gcc} does not add the C++ library.
1657 @command{g++} is a program that calls GCC and automatically specifies linking
1658 against the C++ library. It treats @samp{.c},
1659 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1660 files unless @option{-x} is used. This program is also useful when
1661 precompiling a C header file with a @samp{.h} extension for use in C++
1662 compilations. On many systems, @command{g++} is also installed with
1663 the name @command{c++}.
1664
1665 @cindex invoking @command{g++}
1666 When you compile C++ programs, you may specify many of the same
1667 command-line options that you use for compiling programs in any
1668 language; or command-line options meaningful for C and related
1669 languages; or options that are meaningful only for C++ programs.
1670 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1671 explanations of options for languages related to C@.
1672 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1673 explanations of options that are meaningful only for C++ programs.
1674
1675 @node C Dialect Options
1676 @section Options Controlling C Dialect
1677 @cindex dialect options
1678 @cindex language dialect options
1679 @cindex options, dialect
1680
1681 The following options control the dialect of C (or languages derived
1682 from C, such as C++, Objective-C and Objective-C++) that the compiler
1683 accepts:
1684
1685 @table @gcctabopt
1686 @cindex ANSI support
1687 @cindex ISO support
1688 @item -ansi
1689 @opindex ansi
1690 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1691 equivalent to @option{-std=c++98}.
1692
1693 This turns off certain features of GCC that are incompatible with ISO
1694 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1695 such as the @code{asm} and @code{typeof} keywords, and
1696 predefined macros such as @code{unix} and @code{vax} that identify the
1697 type of system you are using. It also enables the undesirable and
1698 rarely used ISO trigraph feature. For the C compiler,
1699 it disables recognition of C++ style @samp{//} comments as well as
1700 the @code{inline} keyword.
1701
1702 The alternate keywords @code{__asm__}, @code{__extension__},
1703 @code{__inline__} and @code{__typeof__} continue to work despite
1704 @option{-ansi}. You would not want to use them in an ISO C program, of
1705 course, but it is useful to put them in header files that might be included
1706 in compilations done with @option{-ansi}. Alternate predefined macros
1707 such as @code{__unix__} and @code{__vax__} are also available, with or
1708 without @option{-ansi}.
1709
1710 The @option{-ansi} option does not cause non-ISO programs to be
1711 rejected gratuitously. For that, @option{-Wpedantic} is required in
1712 addition to @option{-ansi}. @xref{Warning Options}.
1713
1714 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1715 option is used. Some header files may notice this macro and refrain
1716 from declaring certain functions or defining certain macros that the
1717 ISO standard doesn't call for; this is to avoid interfering with any
1718 programs that might use these names for other things.
1719
1720 Functions that are normally built in but do not have semantics
1721 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1722 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1723 built-in functions provided by GCC}, for details of the functions
1724 affected.
1725
1726 @item -std=
1727 @opindex std
1728 Determine the language standard. @xref{Standards,,Language Standards
1729 Supported by GCC}, for details of these standard versions. This option
1730 is currently only supported when compiling C or C++.
1731
1732 The compiler can accept several base standards, such as @samp{c90} or
1733 @samp{c++98}, and GNU dialects of those standards, such as
1734 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1735 compiler accepts all programs following that standard plus those
1736 using GNU extensions that do not contradict it. For example,
1737 @option{-std=c90} turns off certain features of GCC that are
1738 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1739 keywords, but not other GNU extensions that do not have a meaning in
1740 ISO C90, such as omitting the middle term of a @code{?:}
1741 expression. On the other hand, when a GNU dialect of a standard is
1742 specified, all features supported by the compiler are enabled, even when
1743 those features change the meaning of the base standard. As a result, some
1744 strict-conforming programs may be rejected. The particular standard
1745 is used by @option{-Wpedantic} to identify which features are GNU
1746 extensions given that version of the standard. For example
1747 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1748 comments, while @option{-std=gnu99 -Wpedantic} does not.
1749
1750 A value for this option must be provided; possible values are
1751
1752 @table @samp
1753 @item c90
1754 @itemx c89
1755 @itemx iso9899:1990
1756 Support all ISO C90 programs (certain GNU extensions that conflict
1757 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1758
1759 @item iso9899:199409
1760 ISO C90 as modified in amendment 1.
1761
1762 @item c99
1763 @itemx c9x
1764 @itemx iso9899:1999
1765 @itemx iso9899:199x
1766 ISO C99. This standard is substantially completely supported, modulo
1767 bugs and floating-point issues
1768 (mainly but not entirely relating to optional C99 features from
1769 Annexes F and G). See
1770 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1771 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1772
1773 @item c11
1774 @itemx c1x
1775 @itemx iso9899:2011
1776 ISO C11, the 2011 revision of the ISO C standard. This standard is
1777 substantially completely supported, modulo bugs, floating-point issues
1778 (mainly but not entirely relating to optional C11 features from
1779 Annexes F and G) and the optional Annexes K (Bounds-checking
1780 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1781
1782 @item gnu90
1783 @itemx gnu89
1784 GNU dialect of ISO C90 (including some C99 features).
1785
1786 @item gnu99
1787 @itemx gnu9x
1788 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1789
1790 @item gnu11
1791 @itemx gnu1x
1792 GNU dialect of ISO C11. This is the default for C code.
1793 The name @samp{gnu1x} is deprecated.
1794
1795 @item c++98
1796 @itemx c++03
1797 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1798 additional defect reports. Same as @option{-ansi} for C++ code.
1799
1800 @item gnu++98
1801 @itemx gnu++03
1802 GNU dialect of @option{-std=c++98}.
1803
1804 @item c++11
1805 @itemx c++0x
1806 The 2011 ISO C++ standard plus amendments.
1807 The name @samp{c++0x} is deprecated.
1808
1809 @item gnu++11
1810 @itemx gnu++0x
1811 GNU dialect of @option{-std=c++11}.
1812 The name @samp{gnu++0x} is deprecated.
1813
1814 @item c++14
1815 @itemx c++1y
1816 The 2014 ISO C++ standard plus amendments.
1817 The name @samp{c++1y} is deprecated.
1818
1819 @item gnu++14
1820 @itemx gnu++1y
1821 GNU dialect of @option{-std=c++14}.
1822 This is the default for C++ code.
1823 The name @samp{gnu++1y} is deprecated.
1824
1825 @item c++1z
1826 The next revision of the ISO C++ standard, tentatively planned for
1827 2017. Support is highly experimental, and will almost certainly
1828 change in incompatible ways in future releases.
1829
1830 @item gnu++1z
1831 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1832 and will almost certainly change in incompatible ways in future
1833 releases.
1834 @end table
1835
1836 @item -fgnu89-inline
1837 @opindex fgnu89-inline
1838 The option @option{-fgnu89-inline} tells GCC to use the traditional
1839 GNU semantics for @code{inline} functions when in C99 mode.
1840 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1841 Using this option is roughly equivalent to adding the
1842 @code{gnu_inline} function attribute to all inline functions
1843 (@pxref{Function Attributes}).
1844
1845 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1846 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1847 specifies the default behavior).
1848 This option is not supported in @option{-std=c90} or
1849 @option{-std=gnu90} mode.
1850
1851 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1852 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1853 in effect for @code{inline} functions. @xref{Common Predefined
1854 Macros,,,cpp,The C Preprocessor}.
1855
1856 @item -aux-info @var{filename}
1857 @opindex aux-info
1858 Output to the given filename prototyped declarations for all functions
1859 declared and/or defined in a translation unit, including those in header
1860 files. This option is silently ignored in any language other than C@.
1861
1862 Besides declarations, the file indicates, in comments, the origin of
1863 each declaration (source file and line), whether the declaration was
1864 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1865 @samp{O} for old, respectively, in the first character after the line
1866 number and the colon), and whether it came from a declaration or a
1867 definition (@samp{C} or @samp{F}, respectively, in the following
1868 character). In the case of function definitions, a K&R-style list of
1869 arguments followed by their declarations is also provided, inside
1870 comments, after the declaration.
1871
1872 @item -fallow-parameterless-variadic-functions
1873 @opindex fallow-parameterless-variadic-functions
1874 Accept variadic functions without named parameters.
1875
1876 Although it is possible to define such a function, this is not very
1877 useful as it is not possible to read the arguments. This is only
1878 supported for C as this construct is allowed by C++.
1879
1880 @item -fno-asm
1881 @opindex fno-asm
1882 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1883 keyword, so that code can use these words as identifiers. You can use
1884 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1885 instead. @option{-ansi} implies @option{-fno-asm}.
1886
1887 In C++, this switch only affects the @code{typeof} keyword, since
1888 @code{asm} and @code{inline} are standard keywords. You may want to
1889 use the @option{-fno-gnu-keywords} flag instead, which has the same
1890 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1891 switch only affects the @code{asm} and @code{typeof} keywords, since
1892 @code{inline} is a standard keyword in ISO C99.
1893
1894 @item -fno-builtin
1895 @itemx -fno-builtin-@var{function}
1896 @opindex fno-builtin
1897 @cindex built-in functions
1898 Don't recognize built-in functions that do not begin with
1899 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1900 functions provided by GCC}, for details of the functions affected,
1901 including those which are not built-in functions when @option{-ansi} or
1902 @option{-std} options for strict ISO C conformance are used because they
1903 do not have an ISO standard meaning.
1904
1905 GCC normally generates special code to handle certain built-in functions
1906 more efficiently; for instance, calls to @code{alloca} may become single
1907 instructions which adjust the stack directly, and calls to @code{memcpy}
1908 may become inline copy loops. The resulting code is often both smaller
1909 and faster, but since the function calls no longer appear as such, you
1910 cannot set a breakpoint on those calls, nor can you change the behavior
1911 of the functions by linking with a different library. In addition,
1912 when a function is recognized as a built-in function, GCC may use
1913 information about that function to warn about problems with calls to
1914 that function, or to generate more efficient code, even if the
1915 resulting code still contains calls to that function. For example,
1916 warnings are given with @option{-Wformat} for bad calls to
1917 @code{printf} when @code{printf} is built in and @code{strlen} is
1918 known not to modify global memory.
1919
1920 With the @option{-fno-builtin-@var{function}} option
1921 only the built-in function @var{function} is
1922 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1923 function is named that is not built-in in this version of GCC, this
1924 option is ignored. There is no corresponding
1925 @option{-fbuiltin-@var{function}} option; if you wish to enable
1926 built-in functions selectively when using @option{-fno-builtin} or
1927 @option{-ffreestanding}, you may define macros such as:
1928
1929 @smallexample
1930 #define abs(n) __builtin_abs ((n))
1931 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1932 @end smallexample
1933
1934 @item -fhosted
1935 @opindex fhosted
1936 @cindex hosted environment
1937
1938 Assert that compilation targets a hosted environment. This implies
1939 @option{-fbuiltin}. A hosted environment is one in which the
1940 entire standard library is available, and in which @code{main} has a return
1941 type of @code{int}. Examples are nearly everything except a kernel.
1942 This is equivalent to @option{-fno-freestanding}.
1943
1944 @item -ffreestanding
1945 @opindex ffreestanding
1946 @cindex hosted environment
1947
1948 Assert that compilation targets a freestanding environment. This
1949 implies @option{-fno-builtin}. A freestanding environment
1950 is one in which the standard library may not exist, and program startup may
1951 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1952 This is equivalent to @option{-fno-hosted}.
1953
1954 @xref{Standards,,Language Standards Supported by GCC}, for details of
1955 freestanding and hosted environments.
1956
1957 @item -fopenacc
1958 @opindex fopenacc
1959 @cindex OpenACC accelerator programming
1960 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
1961 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
1962 compiler generates accelerated code according to the OpenACC Application
1963 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
1964 implies @option{-pthread}, and thus is only supported on targets that
1965 have support for @option{-pthread}.
1966
1967 @item -fopenacc-dim=@var{geom}
1968 @opindex fopenacc-dim
1969 @cindex OpenACC accelerator programming
1970 Specify default compute dimensions for parallel offload regions that do
1971 not explicitly specify. The @var{geom} value is a triple of
1972 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
1973 can be omitted, to use a target-specific default value.
1974
1975 @item -fopenmp
1976 @opindex fopenmp
1977 @cindex OpenMP parallel
1978 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1979 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1980 compiler generates parallel code according to the OpenMP Application
1981 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
1982 implies @option{-pthread}, and thus is only supported on targets that
1983 have support for @option{-pthread}. @option{-fopenmp} implies
1984 @option{-fopenmp-simd}.
1985
1986 @item -fopenmp-simd
1987 @opindex fopenmp-simd
1988 @cindex OpenMP SIMD
1989 @cindex SIMD
1990 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
1991 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
1992 are ignored.
1993
1994 @item -fcilkplus
1995 @opindex fcilkplus
1996 @cindex Enable Cilk Plus
1997 Enable the usage of Cilk Plus language extension features for C/C++.
1998 When the option @option{-fcilkplus} is specified, enable the usage of
1999 the Cilk Plus Language extension features for C/C++. The present
2000 implementation follows ABI version 1.2. This is an experimental
2001 feature that is only partially complete, and whose interface may
2002 change in future versions of GCC as the official specification
2003 changes. Currently, all features but @code{_Cilk_for} have been
2004 implemented.
2005
2006 @item -fgnu-tm
2007 @opindex fgnu-tm
2008 When the option @option{-fgnu-tm} is specified, the compiler
2009 generates code for the Linux variant of Intel's current Transactional
2010 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2011 an experimental feature whose interface may change in future versions
2012 of GCC, as the official specification changes. Please note that not
2013 all architectures are supported for this feature.
2014
2015 For more information on GCC's support for transactional memory,
2016 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2017 Transactional Memory Library}.
2018
2019 Note that the transactional memory feature is not supported with
2020 non-call exceptions (@option{-fnon-call-exceptions}).
2021
2022 @item -fms-extensions
2023 @opindex fms-extensions
2024 Accept some non-standard constructs used in Microsoft header files.
2025
2026 In C++ code, this allows member names in structures to be similar
2027 to previous types declarations.
2028
2029 @smallexample
2030 typedef int UOW;
2031 struct ABC @{
2032 UOW UOW;
2033 @};
2034 @end smallexample
2035
2036 Some cases of unnamed fields in structures and unions are only
2037 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2038 fields within structs/unions}, for details.
2039
2040 Note that this option is off for all targets but x86
2041 targets using ms-abi.
2042
2043 @item -fplan9-extensions
2044 @opindex fplan9-extensions
2045 Accept some non-standard constructs used in Plan 9 code.
2046
2047 This enables @option{-fms-extensions}, permits passing pointers to
2048 structures with anonymous fields to functions that expect pointers to
2049 elements of the type of the field, and permits referring to anonymous
2050 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2051 struct/union fields within structs/unions}, for details. This is only
2052 supported for C, not C++.
2053
2054 @item -trigraphs
2055 @opindex trigraphs
2056 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
2057 options for strict ISO C conformance) implies @option{-trigraphs}.
2058
2059 @cindex traditional C language
2060 @cindex C language, traditional
2061 @item -traditional
2062 @itemx -traditional-cpp
2063 @opindex traditional-cpp
2064 @opindex traditional
2065 Formerly, these options caused GCC to attempt to emulate a pre-standard
2066 C compiler. They are now only supported with the @option{-E} switch.
2067 The preprocessor continues to support a pre-standard mode. See the GNU
2068 CPP manual for details.
2069
2070 @item -fcond-mismatch
2071 @opindex fcond-mismatch
2072 Allow conditional expressions with mismatched types in the second and
2073 third arguments. The value of such an expression is void. This option
2074 is not supported for C++.
2075
2076 @item -flax-vector-conversions
2077 @opindex flax-vector-conversions
2078 Allow implicit conversions between vectors with differing numbers of
2079 elements and/or incompatible element types. This option should not be
2080 used for new code.
2081
2082 @item -funsigned-char
2083 @opindex funsigned-char
2084 Let the type @code{char} be unsigned, like @code{unsigned char}.
2085
2086 Each kind of machine has a default for what @code{char} should
2087 be. It is either like @code{unsigned char} by default or like
2088 @code{signed char} by default.
2089
2090 Ideally, a portable program should always use @code{signed char} or
2091 @code{unsigned char} when it depends on the signedness of an object.
2092 But many programs have been written to use plain @code{char} and
2093 expect it to be signed, or expect it to be unsigned, depending on the
2094 machines they were written for. This option, and its inverse, let you
2095 make such a program work with the opposite default.
2096
2097 The type @code{char} is always a distinct type from each of
2098 @code{signed char} or @code{unsigned char}, even though its behavior
2099 is always just like one of those two.
2100
2101 @item -fsigned-char
2102 @opindex fsigned-char
2103 Let the type @code{char} be signed, like @code{signed char}.
2104
2105 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2106 the negative form of @option{-funsigned-char}. Likewise, the option
2107 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2108
2109 @item -fsigned-bitfields
2110 @itemx -funsigned-bitfields
2111 @itemx -fno-signed-bitfields
2112 @itemx -fno-unsigned-bitfields
2113 @opindex fsigned-bitfields
2114 @opindex funsigned-bitfields
2115 @opindex fno-signed-bitfields
2116 @opindex fno-unsigned-bitfields
2117 These options control whether a bit-field is signed or unsigned, when the
2118 declaration does not use either @code{signed} or @code{unsigned}. By
2119 default, such a bit-field is signed, because this is consistent: the
2120 basic integer types such as @code{int} are signed types.
2121
2122 @item -fsso-struct=@var{endianness}
2123 @opindex fsso-struct
2124 Set the default scalar storage order of structures and unions to the
2125 specified endianness. The accepted values are @samp{big-endian} and
2126 @samp{little-endian}. If the option is not passed, the compiler uses
2127 the native endianness of the target. This option is not supported for C++.
2128
2129 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2130 code that is not binary compatible with code generated without it if the
2131 specified endianness is not the native endianness of the target.
2132 @end table
2133
2134 @node C++ Dialect Options
2135 @section Options Controlling C++ Dialect
2136
2137 @cindex compiler options, C++
2138 @cindex C++ options, command-line
2139 @cindex options, C++
2140 This section describes the command-line options that are only meaningful
2141 for C++ programs. You can also use most of the GNU compiler options
2142 regardless of what language your program is in. For example, you
2143 might compile a file @file{firstClass.C} like this:
2144
2145 @smallexample
2146 g++ -g -fstrict-enums -O -c firstClass.C
2147 @end smallexample
2148
2149 @noindent
2150 In this example, only @option{-fstrict-enums} is an option meant
2151 only for C++ programs; you can use the other options with any
2152 language supported by GCC@.
2153
2154 Some options for compiling C programs, such as @option{-std}, are also
2155 relevant for C++ programs.
2156 @xref{C Dialect Options,,Options Controlling C Dialect}.
2157
2158 Here is a list of options that are @emph{only} for compiling C++ programs:
2159
2160 @table @gcctabopt
2161
2162 @item -fabi-version=@var{n}
2163 @opindex fabi-version
2164 Use version @var{n} of the C++ ABI@. The default is version 0.
2165
2166 Version 0 refers to the version conforming most closely to
2167 the C++ ABI specification. Therefore, the ABI obtained using version 0
2168 will change in different versions of G++ as ABI bugs are fixed.
2169
2170 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2171
2172 Version 2 is the version of the C++ ABI that first appeared in G++
2173 3.4, and was the default through G++ 4.9.
2174
2175 Version 3 corrects an error in mangling a constant address as a
2176 template argument.
2177
2178 Version 4, which first appeared in G++ 4.5, implements a standard
2179 mangling for vector types.
2180
2181 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2182 attribute const/volatile on function pointer types, decltype of a
2183 plain decl, and use of a function parameter in the declaration of
2184 another parameter.
2185
2186 Version 6, which first appeared in G++ 4.7, corrects the promotion
2187 behavior of C++11 scoped enums and the mangling of template argument
2188 packs, const/static_cast, prefix ++ and --, and a class scope function
2189 used as a template argument.
2190
2191 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2192 builtin type and corrects the mangling of lambdas in default argument
2193 scope.
2194
2195 Version 8, which first appeared in G++ 4.9, corrects the substitution
2196 behavior of function types with function-cv-qualifiers.
2197
2198 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2199 @code{nullptr_t}.
2200
2201 Version 10, which first appeared in G++ 6.1, adds mangling of
2202 attributes that affect type identity, such as ia32 calling convention
2203 attributes (e.g. @samp{stdcall}).
2204
2205 See also @option{-Wabi}.
2206
2207 @item -fabi-compat-version=@var{n}
2208 @opindex fabi-compat-version
2209 On targets that support strong aliases, G++
2210 works around mangling changes by creating an alias with the correct
2211 mangled name when defining a symbol with an incorrect mangled name.
2212 This switch specifies which ABI version to use for the alias.
2213
2214 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2215 compatibility). If another ABI version is explicitly selected, this
2216 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2217 use @option{-fabi-compat-version=2}.
2218
2219 If this option is not provided but @option{-Wabi=@var{n}} is, that
2220 version is used for compatibility aliases. If this option is provided
2221 along with @option{-Wabi} (without the version), the version from this
2222 option is used for the warning.
2223
2224 @item -fno-access-control
2225 @opindex fno-access-control
2226 Turn off all access checking. This switch is mainly useful for working
2227 around bugs in the access control code.
2228
2229 @item -fcheck-new
2230 @opindex fcheck-new
2231 Check that the pointer returned by @code{operator new} is non-null
2232 before attempting to modify the storage allocated. This check is
2233 normally unnecessary because the C++ standard specifies that
2234 @code{operator new} only returns @code{0} if it is declared
2235 @code{throw()}, in which case the compiler always checks the
2236 return value even without this option. In all other cases, when
2237 @code{operator new} has a non-empty exception specification, memory
2238 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2239 @samp{new (nothrow)}.
2240
2241 @item -fconstexpr-depth=@var{n}
2242 @opindex fconstexpr-depth
2243 Set the maximum nested evaluation depth for C++11 constexpr functions
2244 to @var{n}. A limit is needed to detect endless recursion during
2245 constant expression evaluation. The minimum specified by the standard
2246 is 512.
2247
2248 @item -fdeduce-init-list
2249 @opindex fdeduce-init-list
2250 Enable deduction of a template type parameter as
2251 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2252
2253 @smallexample
2254 template <class T> auto forward(T t) -> decltype (realfn (t))
2255 @{
2256 return realfn (t);
2257 @}
2258
2259 void f()
2260 @{
2261 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2262 @}
2263 @end smallexample
2264
2265 This deduction was implemented as a possible extension to the
2266 originally proposed semantics for the C++11 standard, but was not part
2267 of the final standard, so it is disabled by default. This option is
2268 deprecated, and may be removed in a future version of G++.
2269
2270 @item -ffriend-injection
2271 @opindex ffriend-injection
2272 Inject friend functions into the enclosing namespace, so that they are
2273 visible outside the scope of the class in which they are declared.
2274 Friend functions were documented to work this way in the old Annotated
2275 C++ Reference Manual.
2276 However, in ISO C++ a friend function that is not declared
2277 in an enclosing scope can only be found using argument dependent
2278 lookup. GCC defaults to the standard behavior.
2279
2280 This option is for compatibility, and may be removed in a future
2281 release of G++.
2282
2283 @item -fno-elide-constructors
2284 @opindex fno-elide-constructors
2285 The C++ standard allows an implementation to omit creating a temporary
2286 that is only used to initialize another object of the same type.
2287 Specifying this option disables that optimization, and forces G++ to
2288 call the copy constructor in all cases.
2289
2290 @item -fno-enforce-eh-specs
2291 @opindex fno-enforce-eh-specs
2292 Don't generate code to check for violation of exception specifications
2293 at run time. This option violates the C++ standard, but may be useful
2294 for reducing code size in production builds, much like defining
2295 @code{NDEBUG}. This does not give user code permission to throw
2296 exceptions in violation of the exception specifications; the compiler
2297 still optimizes based on the specifications, so throwing an
2298 unexpected exception results in undefined behavior at run time.
2299
2300 @item -fextern-tls-init
2301 @itemx -fno-extern-tls-init
2302 @opindex fextern-tls-init
2303 @opindex fno-extern-tls-init
2304 The C++11 and OpenMP standards allow @code{thread_local} and
2305 @code{threadprivate} variables to have dynamic (runtime)
2306 initialization. To support this, any use of such a variable goes
2307 through a wrapper function that performs any necessary initialization.
2308 When the use and definition of the variable are in the same
2309 translation unit, this overhead can be optimized away, but when the
2310 use is in a different translation unit there is significant overhead
2311 even if the variable doesn't actually need dynamic initialization. If
2312 the programmer can be sure that no use of the variable in a
2313 non-defining TU needs to trigger dynamic initialization (either
2314 because the variable is statically initialized, or a use of the
2315 variable in the defining TU will be executed before any uses in
2316 another TU), they can avoid this overhead with the
2317 @option{-fno-extern-tls-init} option.
2318
2319 On targets that support symbol aliases, the default is
2320 @option{-fextern-tls-init}. On targets that do not support symbol
2321 aliases, the default is @option{-fno-extern-tls-init}.
2322
2323 @item -ffor-scope
2324 @itemx -fno-for-scope
2325 @opindex ffor-scope
2326 @opindex fno-for-scope
2327 If @option{-ffor-scope} is specified, the scope of variables declared in
2328 a @i{for-init-statement} is limited to the @code{for} loop itself,
2329 as specified by the C++ standard.
2330 If @option{-fno-for-scope} is specified, the scope of variables declared in
2331 a @i{for-init-statement} extends to the end of the enclosing scope,
2332 as was the case in old versions of G++, and other (traditional)
2333 implementations of C++.
2334
2335 If neither flag is given, the default is to follow the standard,
2336 but to allow and give a warning for old-style code that would
2337 otherwise be invalid, or have different behavior.
2338
2339 @item -fno-gnu-keywords
2340 @opindex fno-gnu-keywords
2341 Do not recognize @code{typeof} as a keyword, so that code can use this
2342 word as an identifier. You can use the keyword @code{__typeof__} instead.
2343 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2344 @option{-std=c++98}, @option{-std=c++11}, etc.
2345
2346 @item -fno-implicit-templates
2347 @opindex fno-implicit-templates
2348 Never emit code for non-inline templates that are instantiated
2349 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2350 @xref{Template Instantiation}, for more information.
2351
2352 @item -fno-implicit-inline-templates
2353 @opindex fno-implicit-inline-templates
2354 Don't emit code for implicit instantiations of inline templates, either.
2355 The default is to handle inlines differently so that compiles with and
2356 without optimization need the same set of explicit instantiations.
2357
2358 @item -fno-implement-inlines
2359 @opindex fno-implement-inlines
2360 To save space, do not emit out-of-line copies of inline functions
2361 controlled by @code{#pragma implementation}. This causes linker
2362 errors if these functions are not inlined everywhere they are called.
2363
2364 @item -fms-extensions
2365 @opindex fms-extensions
2366 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2367 int and getting a pointer to member function via non-standard syntax.
2368
2369 @item -fno-nonansi-builtins
2370 @opindex fno-nonansi-builtins
2371 Disable built-in declarations of functions that are not mandated by
2372 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2373 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2374
2375 @item -fnothrow-opt
2376 @opindex fnothrow-opt
2377 Treat a @code{throw()} exception specification as if it were a
2378 @code{noexcept} specification to reduce or eliminate the text size
2379 overhead relative to a function with no exception specification. If
2380 the function has local variables of types with non-trivial
2381 destructors, the exception specification actually makes the
2382 function smaller because the EH cleanups for those variables can be
2383 optimized away. The semantic effect is that an exception thrown out of
2384 a function with such an exception specification results in a call
2385 to @code{terminate} rather than @code{unexpected}.
2386
2387 @item -fno-operator-names
2388 @opindex fno-operator-names
2389 Do not treat the operator name keywords @code{and}, @code{bitand},
2390 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2391 synonyms as keywords.
2392
2393 @item -fno-optional-diags
2394 @opindex fno-optional-diags
2395 Disable diagnostics that the standard says a compiler does not need to
2396 issue. Currently, the only such diagnostic issued by G++ is the one for
2397 a name having multiple meanings within a class.
2398
2399 @item -fpermissive
2400 @opindex fpermissive
2401 Downgrade some diagnostics about nonconformant code from errors to
2402 warnings. Thus, using @option{-fpermissive} allows some
2403 nonconforming code to compile.
2404
2405 @item -fno-pretty-templates
2406 @opindex fno-pretty-templates
2407 When an error message refers to a specialization of a function
2408 template, the compiler normally prints the signature of the
2409 template followed by the template arguments and any typedefs or
2410 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2411 rather than @code{void f(int)}) so that it's clear which template is
2412 involved. When an error message refers to a specialization of a class
2413 template, the compiler omits any template arguments that match
2414 the default template arguments for that template. If either of these
2415 behaviors make it harder to understand the error message rather than
2416 easier, you can use @option{-fno-pretty-templates} to disable them.
2417
2418 @item -frepo
2419 @opindex frepo
2420 Enable automatic template instantiation at link time. This option also
2421 implies @option{-fno-implicit-templates}. @xref{Template
2422 Instantiation}, for more information.
2423
2424 @item -fno-rtti
2425 @opindex fno-rtti
2426 Disable generation of information about every class with virtual
2427 functions for use by the C++ run-time type identification features
2428 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2429 of the language, you can save some space by using this flag. Note that
2430 exception handling uses the same information, but G++ generates it as
2431 needed. The @code{dynamic_cast} operator can still be used for casts that
2432 do not require run-time type information, i.e.@: casts to @code{void *} or to
2433 unambiguous base classes.
2434
2435 @item -fsized-deallocation
2436 @opindex fsized-deallocation
2437 Enable the built-in global declarations
2438 @smallexample
2439 void operator delete (void *, std::size_t) noexcept;
2440 void operator delete[] (void *, std::size_t) noexcept;
2441 @end smallexample
2442 as introduced in C++14. This is useful for user-defined replacement
2443 deallocation functions that, for example, use the size of the object
2444 to make deallocation faster. Enabled by default under
2445 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2446 warns about places that might want to add a definition.
2447
2448 @item -fstrict-enums
2449 @opindex fstrict-enums
2450 Allow the compiler to optimize using the assumption that a value of
2451 enumerated type can only be one of the values of the enumeration (as
2452 defined in the C++ standard; basically, a value that can be
2453 represented in the minimum number of bits needed to represent all the
2454 enumerators). This assumption may not be valid if the program uses a
2455 cast to convert an arbitrary integer value to the enumerated type.
2456
2457 @item -ftemplate-backtrace-limit=@var{n}
2458 @opindex ftemplate-backtrace-limit
2459 Set the maximum number of template instantiation notes for a single
2460 warning or error to @var{n}. The default value is 10.
2461
2462 @item -ftemplate-depth=@var{n}
2463 @opindex ftemplate-depth
2464 Set the maximum instantiation depth for template classes to @var{n}.
2465 A limit on the template instantiation depth is needed to detect
2466 endless recursions during template class instantiation. ANSI/ISO C++
2467 conforming programs must not rely on a maximum depth greater than 17
2468 (changed to 1024 in C++11). The default value is 900, as the compiler
2469 can run out of stack space before hitting 1024 in some situations.
2470
2471 @item -fno-threadsafe-statics
2472 @opindex fno-threadsafe-statics
2473 Do not emit the extra code to use the routines specified in the C++
2474 ABI for thread-safe initialization of local statics. You can use this
2475 option to reduce code size slightly in code that doesn't need to be
2476 thread-safe.
2477
2478 @item -fuse-cxa-atexit
2479 @opindex fuse-cxa-atexit
2480 Register destructors for objects with static storage duration with the
2481 @code{__cxa_atexit} function rather than the @code{atexit} function.
2482 This option is required for fully standards-compliant handling of static
2483 destructors, but only works if your C library supports
2484 @code{__cxa_atexit}.
2485
2486 @item -fno-use-cxa-get-exception-ptr
2487 @opindex fno-use-cxa-get-exception-ptr
2488 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2489 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2490 if the runtime routine is not available.
2491
2492 @item -fvisibility-inlines-hidden
2493 @opindex fvisibility-inlines-hidden
2494 This switch declares that the user does not attempt to compare
2495 pointers to inline functions or methods where the addresses of the two functions
2496 are taken in different shared objects.
2497
2498 The effect of this is that GCC may, effectively, mark inline methods with
2499 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2500 appear in the export table of a DSO and do not require a PLT indirection
2501 when used within the DSO@. Enabling this option can have a dramatic effect
2502 on load and link times of a DSO as it massively reduces the size of the
2503 dynamic export table when the library makes heavy use of templates.
2504
2505 The behavior of this switch is not quite the same as marking the
2506 methods as hidden directly, because it does not affect static variables
2507 local to the function or cause the compiler to deduce that
2508 the function is defined in only one shared object.
2509
2510 You may mark a method as having a visibility explicitly to negate the
2511 effect of the switch for that method. For example, if you do want to
2512 compare pointers to a particular inline method, you might mark it as
2513 having default visibility. Marking the enclosing class with explicit
2514 visibility has no effect.
2515
2516 Explicitly instantiated inline methods are unaffected by this option
2517 as their linkage might otherwise cross a shared library boundary.
2518 @xref{Template Instantiation}.
2519
2520 @item -fvisibility-ms-compat
2521 @opindex fvisibility-ms-compat
2522 This flag attempts to use visibility settings to make GCC's C++
2523 linkage model compatible with that of Microsoft Visual Studio.
2524
2525 The flag makes these changes to GCC's linkage model:
2526
2527 @enumerate
2528 @item
2529 It sets the default visibility to @code{hidden}, like
2530 @option{-fvisibility=hidden}.
2531
2532 @item
2533 Types, but not their members, are not hidden by default.
2534
2535 @item
2536 The One Definition Rule is relaxed for types without explicit
2537 visibility specifications that are defined in more than one
2538 shared object: those declarations are permitted if they are
2539 permitted when this option is not used.
2540 @end enumerate
2541
2542 In new code it is better to use @option{-fvisibility=hidden} and
2543 export those classes that are intended to be externally visible.
2544 Unfortunately it is possible for code to rely, perhaps accidentally,
2545 on the Visual Studio behavior.
2546
2547 Among the consequences of these changes are that static data members
2548 of the same type with the same name but defined in different shared
2549 objects are different, so changing one does not change the other;
2550 and that pointers to function members defined in different shared
2551 objects may not compare equal. When this flag is given, it is a
2552 violation of the ODR to define types with the same name differently.
2553
2554 @item -fno-weak
2555 @opindex fno-weak
2556 Do not use weak symbol support, even if it is provided by the linker.
2557 By default, G++ uses weak symbols if they are available. This
2558 option exists only for testing, and should not be used by end-users;
2559 it results in inferior code and has no benefits. This option may
2560 be removed in a future release of G++.
2561
2562 @item -nostdinc++
2563 @opindex nostdinc++
2564 Do not search for header files in the standard directories specific to
2565 C++, but do still search the other standard directories. (This option
2566 is used when building the C++ library.)
2567 @end table
2568
2569 In addition, these optimization, warning, and code generation options
2570 have meanings only for C++ programs:
2571
2572 @table @gcctabopt
2573 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2574 @opindex Wabi
2575 @opindex Wno-abi
2576 Warn when G++ it generates code that is probably not compatible with
2577 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2578 ABI with each major release, normally @option{-Wabi} will warn only if
2579 there is a check added later in a release series for an ABI issue
2580 discovered since the initial release. @option{-Wabi} will warn about
2581 more things if an older ABI version is selected (with
2582 @option{-fabi-version=@var{n}}).
2583
2584 @option{-Wabi} can also be used with an explicit version number to
2585 warn about compatibility with a particular @option{-fabi-version}
2586 level, e.g. @option{-Wabi=2} to warn about changes relative to
2587 @option{-fabi-version=2}.
2588
2589 If an explicit version number is provided and
2590 @option{-fabi-compat-version} is not specified, the version number
2591 from this option is used for compatibility aliases. If no explicit
2592 version number is provided with this option, but
2593 @option{-fabi-compat-version} is specified, that version number is
2594 used for ABI warnings.
2595
2596 Although an effort has been made to warn about
2597 all such cases, there are probably some cases that are not warned about,
2598 even though G++ is generating incompatible code. There may also be
2599 cases where warnings are emitted even though the code that is generated
2600 is compatible.
2601
2602 You should rewrite your code to avoid these warnings if you are
2603 concerned about the fact that code generated by G++ may not be binary
2604 compatible with code generated by other compilers.
2605
2606 Known incompatibilities in @option{-fabi-version=2} (which was the
2607 default from GCC 3.4 to 4.9) include:
2608
2609 @itemize @bullet
2610
2611 @item
2612 A template with a non-type template parameter of reference type was
2613 mangled incorrectly:
2614 @smallexample
2615 extern int N;
2616 template <int &> struct S @{@};
2617 void n (S<N>) @{2@}
2618 @end smallexample
2619
2620 This was fixed in @option{-fabi-version=3}.
2621
2622 @item
2623 SIMD vector types declared using @code{__attribute ((vector_size))} were
2624 mangled in a non-standard way that does not allow for overloading of
2625 functions taking vectors of different sizes.
2626
2627 The mangling was changed in @option{-fabi-version=4}.
2628
2629 @item
2630 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2631 qualifiers, and @code{decltype} of a plain declaration was folded away.
2632
2633 These mangling issues were fixed in @option{-fabi-version=5}.
2634
2635 @item
2636 Scoped enumerators passed as arguments to a variadic function are
2637 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2638 On most targets this does not actually affect the parameter passing
2639 ABI, as there is no way to pass an argument smaller than @code{int}.
2640
2641 Also, the ABI changed the mangling of template argument packs,
2642 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2643 a class scope function used as a template argument.
2644
2645 These issues were corrected in @option{-fabi-version=6}.
2646
2647 @item
2648 Lambdas in default argument scope were mangled incorrectly, and the
2649 ABI changed the mangling of @code{nullptr_t}.
2650
2651 These issues were corrected in @option{-fabi-version=7}.
2652
2653 @item
2654 When mangling a function type with function-cv-qualifiers, the
2655 un-qualified function type was incorrectly treated as a substitution
2656 candidate.
2657
2658 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2659
2660 @item
2661 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2662 unaligned accesses. Note that this did not affect the ABI of a
2663 function with a @code{nullptr_t} parameter, as parameters have a
2664 minimum alignment.
2665
2666 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2667
2668 @item
2669 Target-specific attributes that affect the identity of a type, such as
2670 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2671 did not affect the mangled name, leading to name collisions when
2672 function pointers were used as template arguments.
2673
2674 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2675
2676 @end itemize
2677
2678 It also warns about psABI-related changes. The known psABI changes at this
2679 point include:
2680
2681 @itemize @bullet
2682
2683 @item
2684 For SysV/x86-64, unions with @code{long double} members are
2685 passed in memory as specified in psABI. For example:
2686
2687 @smallexample
2688 union U @{
2689 long double ld;
2690 int i;
2691 @};
2692 @end smallexample
2693
2694 @noindent
2695 @code{union U} is always passed in memory.
2696
2697 @end itemize
2698
2699 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2700 @opindex Wabi-tag
2701 @opindex -Wabi-tag
2702 Warn when a type with an ABI tag is used in a context that does not
2703 have that ABI tag. See @ref{C++ Attributes} for more information
2704 about ABI tags.
2705
2706 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2707 @opindex Wctor-dtor-privacy
2708 @opindex Wno-ctor-dtor-privacy
2709 Warn when a class seems unusable because all the constructors or
2710 destructors in that class are private, and it has neither friends nor
2711 public static member functions. Also warn if there are no non-private
2712 methods, and there's at least one private member function that isn't
2713 a constructor or destructor.
2714
2715 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2716 @opindex Wdelete-non-virtual-dtor
2717 @opindex Wno-delete-non-virtual-dtor
2718 Warn when @code{delete} is used to destroy an instance of a class that
2719 has virtual functions and non-virtual destructor. It is unsafe to delete
2720 an instance of a derived class through a pointer to a base class if the
2721 base class does not have a virtual destructor. This warning is enabled
2722 by @option{-Wall}.
2723
2724 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2725 @opindex Wliteral-suffix
2726 @opindex Wno-literal-suffix
2727 Warn when a string or character literal is followed by a ud-suffix which does
2728 not begin with an underscore. As a conforming extension, GCC treats such
2729 suffixes as separate preprocessing tokens in order to maintain backwards
2730 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2731 For example:
2732
2733 @smallexample
2734 #define __STDC_FORMAT_MACROS
2735 #include <inttypes.h>
2736 #include <stdio.h>
2737
2738 int main() @{
2739 int64_t i64 = 123;
2740 printf("My int64: %" PRId64"\n", i64);
2741 @}
2742 @end smallexample
2743
2744 In this case, @code{PRId64} is treated as a separate preprocessing token.
2745
2746 This warning is enabled by default.
2747
2748 @item -Wlto-type-mismatch
2749 @opindex Wlto-type-mismatch
2750 @opindex Wno-lto-type-mismatch
2751
2752 During the link-time optimization warn about type mismatches in
2753 global declarations from different compilation units.
2754 Requires @option{-flto} to be enabled. Enabled by default.
2755
2756 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2757 @opindex Wnarrowing
2758 @opindex Wno-narrowing
2759 With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing
2760 conversion prohibited by C++11 occurs within
2761 @samp{@{ @}}, e.g.
2762
2763 @smallexample
2764 int i = @{ 2.2 @}; // error: narrowing from double to int
2765 @end smallexample
2766
2767 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2768
2769 When a later standard is in effect, e.g. when using @option{-std=c++11},
2770 narrowing conversions are diagnosed by default, as required by the standard.
2771 A narrowing conversion from a constant produces an error,
2772 and a narrowing conversion from a non-constant produces a warning,
2773 but @option{-Wno-narrowing} suppresses the diagnostic.
2774 Note that this does not affect the meaning of well-formed code;
2775 narrowing conversions are still considered ill-formed in SFINAE contexts.
2776
2777 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2778 @opindex Wnoexcept
2779 @opindex Wno-noexcept
2780 Warn when a noexcept-expression evaluates to false because of a call
2781 to a function that does not have a non-throwing exception
2782 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2783 the compiler to never throw an exception.
2784
2785 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2786 @opindex Wnon-virtual-dtor
2787 @opindex Wno-non-virtual-dtor
2788 Warn when a class has virtual functions and an accessible non-virtual
2789 destructor itself or in an accessible polymorphic base class, in which
2790 case it is possible but unsafe to delete an instance of a derived
2791 class through a pointer to the class itself or base class. This
2792 warning is automatically enabled if @option{-Weffc++} is specified.
2793
2794 @item -Wreorder @r{(C++ and Objective-C++ only)}
2795 @opindex Wreorder
2796 @opindex Wno-reorder
2797 @cindex reordering, warning
2798 @cindex warning for reordering of member initializers
2799 Warn when the order of member initializers given in the code does not
2800 match the order in which they must be executed. For instance:
2801
2802 @smallexample
2803 struct A @{
2804 int i;
2805 int j;
2806 A(): j (0), i (1) @{ @}
2807 @};
2808 @end smallexample
2809
2810 @noindent
2811 The compiler rearranges the member initializers for @code{i}
2812 and @code{j} to match the declaration order of the members, emitting
2813 a warning to that effect. This warning is enabled by @option{-Wall}.
2814
2815 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2816 @opindex fext-numeric-literals
2817 @opindex fno-ext-numeric-literals
2818 Accept imaginary, fixed-point, or machine-defined
2819 literal number suffixes as GNU extensions.
2820 When this option is turned off these suffixes are treated
2821 as C++11 user-defined literal numeric suffixes.
2822 This is on by default for all pre-C++11 dialects and all GNU dialects:
2823 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2824 @option{-std=gnu++14}.
2825 This option is off by default
2826 for ISO C++11 onwards (@option{-std=c++11}, ...).
2827 @end table
2828
2829 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2830
2831 @table @gcctabopt
2832 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2833 @opindex Weffc++
2834 @opindex Wno-effc++
2835 Warn about violations of the following style guidelines from Scott Meyers'
2836 @cite{Effective C++} series of books:
2837
2838 @itemize @bullet
2839 @item
2840 Define a copy constructor and an assignment operator for classes
2841 with dynamically-allocated memory.
2842
2843 @item
2844 Prefer initialization to assignment in constructors.
2845
2846 @item
2847 Have @code{operator=} return a reference to @code{*this}.
2848
2849 @item
2850 Don't try to return a reference when you must return an object.
2851
2852 @item
2853 Distinguish between prefix and postfix forms of increment and
2854 decrement operators.
2855
2856 @item
2857 Never overload @code{&&}, @code{||}, or @code{,}.
2858
2859 @end itemize
2860
2861 This option also enables @option{-Wnon-virtual-dtor}, which is also
2862 one of the effective C++ recommendations. However, the check is
2863 extended to warn about the lack of virtual destructor in accessible
2864 non-polymorphic bases classes too.
2865
2866 When selecting this option, be aware that the standard library
2867 headers do not obey all of these guidelines; use @samp{grep -v}
2868 to filter out those warnings.
2869
2870 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2871 @opindex Wstrict-null-sentinel
2872 @opindex Wno-strict-null-sentinel
2873 Warn about the use of an uncasted @code{NULL} as sentinel. When
2874 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2875 to @code{__null}. Although it is a null pointer constant rather than a
2876 null pointer, it is guaranteed to be of the same size as a pointer.
2877 But this use is not portable across different compilers.
2878
2879 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2880 @opindex Wno-non-template-friend
2881 @opindex Wnon-template-friend
2882 Disable warnings when non-templatized friend functions are declared
2883 within a template. Since the advent of explicit template specification
2884 support in G++, if the name of the friend is an unqualified-id (i.e.,
2885 @samp{friend foo(int)}), the C++ language specification demands that the
2886 friend declare or define an ordinary, nontemplate function. (Section
2887 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2888 could be interpreted as a particular specialization of a templatized
2889 function. Because this non-conforming behavior is no longer the default
2890 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2891 check existing code for potential trouble spots and is on by default.
2892 This new compiler behavior can be turned off with
2893 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2894 but disables the helpful warning.
2895
2896 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2897 @opindex Wold-style-cast
2898 @opindex Wno-old-style-cast
2899 Warn if an old-style (C-style) cast to a non-void type is used within
2900 a C++ program. The new-style casts (@code{dynamic_cast},
2901 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
2902 less vulnerable to unintended effects and much easier to search for.
2903
2904 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2905 @opindex Woverloaded-virtual
2906 @opindex Wno-overloaded-virtual
2907 @cindex overloaded virtual function, warning
2908 @cindex warning for overloaded virtual function
2909 Warn when a function declaration hides virtual functions from a
2910 base class. For example, in:
2911
2912 @smallexample
2913 struct A @{
2914 virtual void f();
2915 @};
2916
2917 struct B: public A @{
2918 void f(int);
2919 @};
2920 @end smallexample
2921
2922 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2923 like:
2924
2925 @smallexample
2926 B* b;
2927 b->f();
2928 @end smallexample
2929
2930 @noindent
2931 fails to compile.
2932
2933 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2934 @opindex Wno-pmf-conversions
2935 @opindex Wpmf-conversions
2936 Disable the diagnostic for converting a bound pointer to member function
2937 to a plain pointer.
2938
2939 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2940 @opindex Wsign-promo
2941 @opindex Wno-sign-promo
2942 Warn when overload resolution chooses a promotion from unsigned or
2943 enumerated type to a signed type, over a conversion to an unsigned type of
2944 the same size. Previous versions of G++ tried to preserve
2945 unsignedness, but the standard mandates the current behavior.
2946
2947 @item -Wtemplates @r{(C++ and Objective-C++ only)}
2948 @opindex Wtemplates
2949 Warn when a primary template declaration is encountered. Some coding
2950 rules disallow templates, and this may be used to enforce that rule.
2951 The warning is inactive inside a system header file, such as the STL, so
2952 one can still use the STL. One may also instantiate or specialize
2953 templates.
2954
2955 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
2956 @opindex Wmultiple-inheritance
2957 Warn when a class is defined with multiple direct base classes. Some
2958 coding rules disallow multiple inheritance, and this may be used to
2959 enforce that rule. The warning is inactive inside a system header file,
2960 such as the STL, so one can still use the STL. One may also define
2961 classes that indirectly use multiple inheritance.
2962
2963 @item -Wvirtual-inheritance
2964 @opindex Wvirtual-inheritance
2965 Warn when a class is defined with a virtual direct base classe. Some
2966 coding rules disallow multiple inheritance, and this may be used to
2967 enforce that rule. The warning is inactive inside a system header file,
2968 such as the STL, so one can still use the STL. One may also define
2969 classes that indirectly use virtual inheritance.
2970
2971 @item -Wnamespaces
2972 @opindex Wnamespaces
2973 Warn when a namespace definition is opened. Some coding rules disallow
2974 namespaces, and this may be used to enforce that rule. The warning is
2975 inactive inside a system header file, such as the STL, so one can still
2976 use the STL. One may also use using directives and qualified names.
2977
2978 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
2979 @opindex Wterminate
2980 @opindex Wno-terminate
2981 Disable the warning about a throw-expression that will immediately
2982 result in a call to @code{terminate}.
2983 @end table
2984
2985 @node Objective-C and Objective-C++ Dialect Options
2986 @section Options Controlling Objective-C and Objective-C++ Dialects
2987
2988 @cindex compiler options, Objective-C and Objective-C++
2989 @cindex Objective-C and Objective-C++ options, command-line
2990 @cindex options, Objective-C and Objective-C++
2991 (NOTE: This manual does not describe the Objective-C and Objective-C++
2992 languages themselves. @xref{Standards,,Language Standards
2993 Supported by GCC}, for references.)
2994
2995 This section describes the command-line options that are only meaningful
2996 for Objective-C and Objective-C++ programs. You can also use most of
2997 the language-independent GNU compiler options.
2998 For example, you might compile a file @file{some_class.m} like this:
2999
3000 @smallexample
3001 gcc -g -fgnu-runtime -O -c some_class.m
3002 @end smallexample
3003
3004 @noindent
3005 In this example, @option{-fgnu-runtime} is an option meant only for
3006 Objective-C and Objective-C++ programs; you can use the other options with
3007 any language supported by GCC@.
3008
3009 Note that since Objective-C is an extension of the C language, Objective-C
3010 compilations may also use options specific to the C front-end (e.g.,
3011 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3012 C++-specific options (e.g., @option{-Wabi}).
3013
3014 Here is a list of options that are @emph{only} for compiling Objective-C
3015 and Objective-C++ programs:
3016
3017 @table @gcctabopt
3018 @item -fconstant-string-class=@var{class-name}
3019 @opindex fconstant-string-class
3020 Use @var{class-name} as the name of the class to instantiate for each
3021 literal string specified with the syntax @code{@@"@dots{}"}. The default
3022 class name is @code{NXConstantString} if the GNU runtime is being used, and
3023 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3024 @option{-fconstant-cfstrings} option, if also present, overrides the
3025 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3026 to be laid out as constant CoreFoundation strings.
3027
3028 @item -fgnu-runtime
3029 @opindex fgnu-runtime
3030 Generate object code compatible with the standard GNU Objective-C
3031 runtime. This is the default for most types of systems.
3032
3033 @item -fnext-runtime
3034 @opindex fnext-runtime
3035 Generate output compatible with the NeXT runtime. This is the default
3036 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3037 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3038 used.
3039
3040 @item -fno-nil-receivers
3041 @opindex fno-nil-receivers
3042 Assume that all Objective-C message dispatches (@code{[receiver
3043 message:arg]}) in this translation unit ensure that the receiver is
3044 not @code{nil}. This allows for more efficient entry points in the
3045 runtime to be used. This option is only available in conjunction with
3046 the NeXT runtime and ABI version 0 or 1.
3047
3048 @item -fobjc-abi-version=@var{n}
3049 @opindex fobjc-abi-version
3050 Use version @var{n} of the Objective-C ABI for the selected runtime.
3051 This option is currently supported only for the NeXT runtime. In that
3052 case, Version 0 is the traditional (32-bit) ABI without support for
3053 properties and other Objective-C 2.0 additions. Version 1 is the
3054 traditional (32-bit) ABI with support for properties and other
3055 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3056 nothing is specified, the default is Version 0 on 32-bit target
3057 machines, and Version 2 on 64-bit target machines.
3058
3059 @item -fobjc-call-cxx-cdtors
3060 @opindex fobjc-call-cxx-cdtors
3061 For each Objective-C class, check if any of its instance variables is a
3062 C++ object with a non-trivial default constructor. If so, synthesize a
3063 special @code{- (id) .cxx_construct} instance method which runs
3064 non-trivial default constructors on any such instance variables, in order,
3065 and then return @code{self}. Similarly, check if any instance variable
3066 is a C++ object with a non-trivial destructor, and if so, synthesize a
3067 special @code{- (void) .cxx_destruct} method which runs
3068 all such default destructors, in reverse order.
3069
3070 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3071 methods thusly generated only operate on instance variables
3072 declared in the current Objective-C class, and not those inherited
3073 from superclasses. It is the responsibility of the Objective-C
3074 runtime to invoke all such methods in an object's inheritance
3075 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3076 by the runtime immediately after a new object instance is allocated;
3077 the @code{- (void) .cxx_destruct} methods are invoked immediately
3078 before the runtime deallocates an object instance.
3079
3080 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3081 support for invoking the @code{- (id) .cxx_construct} and
3082 @code{- (void) .cxx_destruct} methods.
3083
3084 @item -fobjc-direct-dispatch
3085 @opindex fobjc-direct-dispatch
3086 Allow fast jumps to the message dispatcher. On Darwin this is
3087 accomplished via the comm page.
3088
3089 @item -fobjc-exceptions
3090 @opindex fobjc-exceptions
3091 Enable syntactic support for structured exception handling in
3092 Objective-C, similar to what is offered by C++ and Java. This option
3093 is required to use the Objective-C keywords @code{@@try},
3094 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3095 @code{@@synchronized}. This option is available with both the GNU
3096 runtime and the NeXT runtime (but not available in conjunction with
3097 the NeXT runtime on Mac OS X 10.2 and earlier).
3098
3099 @item -fobjc-gc
3100 @opindex fobjc-gc
3101 Enable garbage collection (GC) in Objective-C and Objective-C++
3102 programs. This option is only available with the NeXT runtime; the
3103 GNU runtime has a different garbage collection implementation that
3104 does not require special compiler flags.
3105
3106 @item -fobjc-nilcheck
3107 @opindex fobjc-nilcheck
3108 For the NeXT runtime with version 2 of the ABI, check for a nil
3109 receiver in method invocations before doing the actual method call.
3110 This is the default and can be disabled using
3111 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3112 checked for nil in this way no matter what this flag is set to.
3113 Currently this flag does nothing when the GNU runtime, or an older
3114 version of the NeXT runtime ABI, is used.
3115
3116 @item -fobjc-std=objc1
3117 @opindex fobjc-std
3118 Conform to the language syntax of Objective-C 1.0, the language
3119 recognized by GCC 4.0. This only affects the Objective-C additions to
3120 the C/C++ language; it does not affect conformance to C/C++ standards,
3121 which is controlled by the separate C/C++ dialect option flags. When
3122 this option is used with the Objective-C or Objective-C++ compiler,
3123 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3124 This is useful if you need to make sure that your Objective-C code can
3125 be compiled with older versions of GCC@.
3126
3127 @item -freplace-objc-classes
3128 @opindex freplace-objc-classes
3129 Emit a special marker instructing @command{ld(1)} not to statically link in
3130 the resulting object file, and allow @command{dyld(1)} to load it in at
3131 run time instead. This is used in conjunction with the Fix-and-Continue
3132 debugging mode, where the object file in question may be recompiled and
3133 dynamically reloaded in the course of program execution, without the need
3134 to restart the program itself. Currently, Fix-and-Continue functionality
3135 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3136 and later.
3137
3138 @item -fzero-link
3139 @opindex fzero-link
3140 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3141 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3142 compile time) with static class references that get initialized at load time,
3143 which improves run-time performance. Specifying the @option{-fzero-link} flag
3144 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3145 to be retained. This is useful in Zero-Link debugging mode, since it allows
3146 for individual class implementations to be modified during program execution.
3147 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3148 regardless of command-line options.
3149
3150 @item -fno-local-ivars
3151 @opindex fno-local-ivars
3152 @opindex flocal-ivars
3153 By default instance variables in Objective-C can be accessed as if
3154 they were local variables from within the methods of the class they're
3155 declared in. This can lead to shadowing between instance variables
3156 and other variables declared either locally inside a class method or
3157 globally with the same name. Specifying the @option{-fno-local-ivars}
3158 flag disables this behavior thus avoiding variable shadowing issues.
3159
3160 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3161 @opindex fivar-visibility
3162 Set the default instance variable visibility to the specified option
3163 so that instance variables declared outside the scope of any access
3164 modifier directives default to the specified visibility.
3165
3166 @item -gen-decls
3167 @opindex gen-decls
3168 Dump interface declarations for all classes seen in the source file to a
3169 file named @file{@var{sourcename}.decl}.
3170
3171 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3172 @opindex Wassign-intercept
3173 @opindex Wno-assign-intercept
3174 Warn whenever an Objective-C assignment is being intercepted by the
3175 garbage collector.
3176
3177 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3178 @opindex Wno-protocol
3179 @opindex Wprotocol
3180 If a class is declared to implement a protocol, a warning is issued for
3181 every method in the protocol that is not implemented by the class. The
3182 default behavior is to issue a warning for every method not explicitly
3183 implemented in the class, even if a method implementation is inherited
3184 from the superclass. If you use the @option{-Wno-protocol} option, then
3185 methods inherited from the superclass are considered to be implemented,
3186 and no warning is issued for them.
3187
3188 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3189 @opindex Wselector
3190 @opindex Wno-selector
3191 Warn if multiple methods of different types for the same selector are
3192 found during compilation. The check is performed on the list of methods
3193 in the final stage of compilation. Additionally, a check is performed
3194 for each selector appearing in a @code{@@selector(@dots{})}
3195 expression, and a corresponding method for that selector has been found
3196 during compilation. Because these checks scan the method table only at
3197 the end of compilation, these warnings are not produced if the final
3198 stage of compilation is not reached, for example because an error is
3199 found during compilation, or because the @option{-fsyntax-only} option is
3200 being used.
3201
3202 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3203 @opindex Wstrict-selector-match
3204 @opindex Wno-strict-selector-match
3205 Warn if multiple methods with differing argument and/or return types are
3206 found for a given selector when attempting to send a message using this
3207 selector to a receiver of type @code{id} or @code{Class}. When this flag
3208 is off (which is the default behavior), the compiler omits such warnings
3209 if any differences found are confined to types that share the same size
3210 and alignment.
3211
3212 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3213 @opindex Wundeclared-selector
3214 @opindex Wno-undeclared-selector
3215 Warn if a @code{@@selector(@dots{})} expression referring to an
3216 undeclared selector is found. A selector is considered undeclared if no
3217 method with that name has been declared before the
3218 @code{@@selector(@dots{})} expression, either explicitly in an
3219 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3220 an @code{@@implementation} section. This option always performs its
3221 checks as soon as a @code{@@selector(@dots{})} expression is found,
3222 while @option{-Wselector} only performs its checks in the final stage of
3223 compilation. This also enforces the coding style convention
3224 that methods and selectors must be declared before being used.
3225
3226 @item -print-objc-runtime-info
3227 @opindex print-objc-runtime-info
3228 Generate C header describing the largest structure that is passed by
3229 value, if any.
3230
3231 @end table
3232
3233 @node Diagnostic Message Formatting Options
3234 @section Options to Control Diagnostic Messages Formatting
3235 @cindex options to control diagnostics formatting
3236 @cindex diagnostic messages
3237 @cindex message formatting
3238
3239 Traditionally, diagnostic messages have been formatted irrespective of
3240 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3241 options described below
3242 to control the formatting algorithm for diagnostic messages,
3243 e.g.@: how many characters per line, how often source location
3244 information should be reported. Note that some language front ends may not
3245 honor these options.
3246
3247 @table @gcctabopt
3248 @item -fmessage-length=@var{n}
3249 @opindex fmessage-length
3250 Try to format error messages so that they fit on lines of about
3251 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3252 done; each error message appears on a single line. This is the
3253 default for all front ends.
3254
3255 @item -fdiagnostics-show-location=once
3256 @opindex fdiagnostics-show-location
3257 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3258 reporter to emit source location information @emph{once}; that is, in
3259 case the message is too long to fit on a single physical line and has to
3260 be wrapped, the source location won't be emitted (as prefix) again,
3261 over and over, in subsequent continuation lines. This is the default
3262 behavior.
3263
3264 @item -fdiagnostics-show-location=every-line
3265 Only meaningful in line-wrapping mode. Instructs the diagnostic
3266 messages reporter to emit the same source location information (as
3267 prefix) for physical lines that result from the process of breaking
3268 a message which is too long to fit on a single line.
3269
3270 @item -fdiagnostics-color[=@var{WHEN}]
3271 @itemx -fno-diagnostics-color
3272 @opindex fdiagnostics-color
3273 @cindex highlight, color
3274 @vindex GCC_COLORS @r{environment variable}
3275 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3276 or @samp{auto}. The default depends on how the compiler has been configured,
3277 it can be any of the above @var{WHEN} options or also @samp{never}
3278 if @env{GCC_COLORS} environment variable isn't present in the environment,
3279 and @samp{auto} otherwise.
3280 @samp{auto} means to use color only when the standard error is a terminal.
3281 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3282 aliases for @option{-fdiagnostics-color=always} and
3283 @option{-fdiagnostics-color=never}, respectively.
3284
3285 The colors are defined by the environment variable @env{GCC_COLORS}.
3286 Its value is a colon-separated list of capabilities and Select Graphic
3287 Rendition (SGR) substrings. SGR commands are interpreted by the
3288 terminal or terminal emulator. (See the section in the documentation
3289 of your text terminal for permitted values and their meanings as
3290 character attributes.) These substring values are integers in decimal
3291 representation and can be concatenated with semicolons.
3292 Common values to concatenate include
3293 @samp{1} for bold,
3294 @samp{4} for underline,
3295 @samp{5} for blink,
3296 @samp{7} for inverse,
3297 @samp{39} for default foreground color,
3298 @samp{30} to @samp{37} for foreground colors,
3299 @samp{90} to @samp{97} for 16-color mode foreground colors,
3300 @samp{38;5;0} to @samp{38;5;255}
3301 for 88-color and 256-color modes foreground colors,
3302 @samp{49} for default background color,
3303 @samp{40} to @samp{47} for background colors,
3304 @samp{100} to @samp{107} for 16-color mode background colors,
3305 and @samp{48;5;0} to @samp{48;5;255}
3306 for 88-color and 256-color modes background colors.
3307
3308 The default @env{GCC_COLORS} is
3309 @smallexample
3310 error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01
3311 @end smallexample
3312 @noindent
3313 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3314 @samp{01;36} is bold cyan, @samp{01;32} is bold green and
3315 @samp{01} is bold. Setting @env{GCC_COLORS} to the empty
3316 string disables colors.
3317 Supported capabilities are as follows.
3318
3319 @table @code
3320 @item error=
3321 @vindex error GCC_COLORS @r{capability}
3322 SGR substring for error: markers.
3323
3324 @item warning=
3325 @vindex warning GCC_COLORS @r{capability}
3326 SGR substring for warning: markers.
3327
3328 @item note=
3329 @vindex note GCC_COLORS @r{capability}
3330 SGR substring for note: markers.
3331
3332 @item caret=
3333 @vindex caret GCC_COLORS @r{capability}
3334 SGR substring for caret line.
3335
3336 @item locus=
3337 @vindex locus GCC_COLORS @r{capability}
3338 SGR substring for location information, @samp{file:line} or
3339 @samp{file:line:column} etc.
3340
3341 @item quote=
3342 @vindex quote GCC_COLORS @r{capability}
3343 SGR substring for information printed within quotes.
3344 @end table
3345
3346 @item -fno-diagnostics-show-option
3347 @opindex fno-diagnostics-show-option
3348 @opindex fdiagnostics-show-option
3349 By default, each diagnostic emitted includes text indicating the
3350 command-line option that directly controls the diagnostic (if such an
3351 option is known to the diagnostic machinery). Specifying the
3352 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3353
3354 @item -fno-diagnostics-show-caret
3355 @opindex fno-diagnostics-show-caret
3356 @opindex fdiagnostics-show-caret
3357 By default, each diagnostic emitted includes the original source line
3358 and a caret @samp{^} indicating the column. This option suppresses this
3359 information. The source line is truncated to @var{n} characters, if
3360 the @option{-fmessage-length=n} option is given. When the output is done
3361 to the terminal, the width is limited to the width given by the
3362 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3363
3364 @end table
3365
3366 @node Warning Options
3367 @section Options to Request or Suppress Warnings
3368 @cindex options to control warnings
3369 @cindex warning messages
3370 @cindex messages, warning
3371 @cindex suppressing warnings
3372
3373 Warnings are diagnostic messages that report constructions that
3374 are not inherently erroneous but that are risky or suggest there
3375 may have been an error.
3376
3377 The following language-independent options do not enable specific
3378 warnings but control the kinds of diagnostics produced by GCC@.
3379
3380 @table @gcctabopt
3381 @cindex syntax checking
3382 @item -fsyntax-only
3383 @opindex fsyntax-only
3384 Check the code for syntax errors, but don't do anything beyond that.
3385
3386 @item -fmax-errors=@var{n}
3387 @opindex fmax-errors
3388 Limits the maximum number of error messages to @var{n}, at which point
3389 GCC bails out rather than attempting to continue processing the source
3390 code. If @var{n} is 0 (the default), there is no limit on the number
3391 of error messages produced. If @option{-Wfatal-errors} is also
3392 specified, then @option{-Wfatal-errors} takes precedence over this
3393 option.
3394
3395 @item -w
3396 @opindex w
3397 Inhibit all warning messages.
3398
3399 @item -Werror
3400 @opindex Werror
3401 @opindex Wno-error
3402 Make all warnings into errors.
3403
3404 @item -Werror=
3405 @opindex Werror=
3406 @opindex Wno-error=
3407 Make the specified warning into an error. The specifier for a warning
3408 is appended; for example @option{-Werror=switch} turns the warnings
3409 controlled by @option{-Wswitch} into errors. This switch takes a
3410 negative form, to be used to negate @option{-Werror} for specific
3411 warnings; for example @option{-Wno-error=switch} makes
3412 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3413 is in effect.
3414
3415 The warning message for each controllable warning includes the
3416 option that controls the warning. That option can then be used with
3417 @option{-Werror=} and @option{-Wno-error=} as described above.
3418 (Printing of the option in the warning message can be disabled using the
3419 @option{-fno-diagnostics-show-option} flag.)
3420
3421 Note that specifying @option{-Werror=}@var{foo} automatically implies
3422 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3423 imply anything.
3424
3425 @item -Wfatal-errors
3426 @opindex Wfatal-errors
3427 @opindex Wno-fatal-errors
3428 This option causes the compiler to abort compilation on the first error
3429 occurred rather than trying to keep going and printing further error
3430 messages.
3431
3432 @end table
3433
3434 You can request many specific warnings with options beginning with
3435 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3436 implicit declarations. Each of these specific warning options also
3437 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3438 example, @option{-Wno-implicit}. This manual lists only one of the
3439 two forms, whichever is not the default. For further
3440 language-specific options also refer to @ref{C++ Dialect Options} and
3441 @ref{Objective-C and Objective-C++ Dialect Options}.
3442
3443 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3444 options, such as @option{-Wunused}, which may turn on further options,
3445 such as @option{-Wunused-value}. The combined effect of positive and
3446 negative forms is that more specific options have priority over less
3447 specific ones, independently of their position in the command-line. For
3448 options of the same specificity, the last one takes effect. Options
3449 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3450 as if they appeared at the end of the command-line.
3451
3452 When an unrecognized warning option is requested (e.g.,
3453 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3454 that the option is not recognized. However, if the @option{-Wno-} form
3455 is used, the behavior is slightly different: no diagnostic is
3456 produced for @option{-Wno-unknown-warning} unless other diagnostics
3457 are being produced. This allows the use of new @option{-Wno-} options
3458 with old compilers, but if something goes wrong, the compiler
3459 warns that an unrecognized option is present.
3460
3461 @table @gcctabopt
3462 @item -Wpedantic
3463 @itemx -pedantic
3464 @opindex pedantic
3465 @opindex Wpedantic
3466 Issue all the warnings demanded by strict ISO C and ISO C++;
3467 reject all programs that use forbidden extensions, and some other
3468 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3469 version of the ISO C standard specified by any @option{-std} option used.
3470
3471 Valid ISO C and ISO C++ programs should compile properly with or without
3472 this option (though a rare few require @option{-ansi} or a
3473 @option{-std} option specifying the required version of ISO C)@. However,
3474 without this option, certain GNU extensions and traditional C and C++
3475 features are supported as well. With this option, they are rejected.
3476
3477 @option{-Wpedantic} does not cause warning messages for use of the
3478 alternate keywords whose names begin and end with @samp{__}. Pedantic
3479 warnings are also disabled in the expression that follows
3480 @code{__extension__}. However, only system header files should use
3481 these escape routes; application programs should avoid them.
3482 @xref{Alternate Keywords}.
3483
3484 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3485 C conformance. They soon find that it does not do quite what they want:
3486 it finds some non-ISO practices, but not all---only those for which
3487 ISO C @emph{requires} a diagnostic, and some others for which
3488 diagnostics have been added.
3489
3490 A feature to report any failure to conform to ISO C might be useful in
3491 some instances, but would require considerable additional work and would
3492 be quite different from @option{-Wpedantic}. We don't have plans to
3493 support such a feature in the near future.
3494
3495 Where the standard specified with @option{-std} represents a GNU
3496 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3497 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3498 extended dialect is based. Warnings from @option{-Wpedantic} are given
3499 where they are required by the base standard. (It does not make sense
3500 for such warnings to be given only for features not in the specified GNU
3501 C dialect, since by definition the GNU dialects of C include all
3502 features the compiler supports with the given option, and there would be
3503 nothing to warn about.)
3504
3505 @item -pedantic-errors
3506 @opindex pedantic-errors
3507 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3508 requires a diagnostic, in some cases where there is undefined behavior
3509 at compile-time and in some other cases that do not prevent compilation
3510 of programs that are valid according to the standard. This is not
3511 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3512 by this option and not enabled by the latter and vice versa.
3513
3514 @item -Wall
3515 @opindex Wall
3516 @opindex Wno-all
3517 This enables all the warnings about constructions that some users
3518 consider questionable, and that are easy to avoid (or modify to
3519 prevent the warning), even in conjunction with macros. This also
3520 enables some language-specific warnings described in @ref{C++ Dialect
3521 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3522
3523 @option{-Wall} turns on the following warning flags:
3524
3525 @gccoptlist{-Waddress @gol
3526 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3527 -Wbool-compare @gol
3528 -Wc++11-compat -Wc++14-compat@gol
3529 -Wchar-subscripts @gol
3530 -Wcomment @gol
3531 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3532 -Wformat @gol
3533 -Wimplicit @r{(C and Objective-C only)} @gol
3534 -Wimplicit-int @r{(C and Objective-C only)} @gol
3535 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3536 -Winit-self @r{(only for C++)} @gol
3537 -Wlogical-not-parentheses
3538 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3539 -Wmaybe-uninitialized @gol
3540 -Wmemset-transposed-args @gol
3541 -Wmisleading-indentation @r{(only for C/C++)} @gol
3542 -Wmissing-braces @r{(only for C/ObjC)} @gol
3543 -Wnarrowing @r{(only for C++)} @gol
3544 -Wnonnull @gol
3545 -Wnonnull-compare @gol
3546 -Wopenmp-simd @gol
3547 -Wparentheses @gol
3548 -Wpointer-sign @gol
3549 -Wreorder @gol
3550 -Wreturn-type @gol
3551 -Wsequence-point @gol
3552 -Wsign-compare @r{(only in C++)} @gol
3553 -Wsizeof-pointer-memaccess @gol
3554 -Wstrict-aliasing @gol
3555 -Wstrict-overflow=1 @gol
3556 -Wswitch @gol
3557 -Wtautological-compare @gol
3558 -Wtrigraphs @gol
3559 -Wuninitialized @gol
3560 -Wunknown-pragmas @gol
3561 -Wunused-function @gol
3562 -Wunused-label @gol
3563 -Wunused-value @gol
3564 -Wunused-variable @gol
3565 -Wvolatile-register-var @gol
3566 }
3567
3568 Note that some warning flags are not implied by @option{-Wall}. Some of
3569 them warn about constructions that users generally do not consider
3570 questionable, but which occasionally you might wish to check for;
3571 others warn about constructions that are necessary or hard to avoid in
3572 some cases, and there is no simple way to modify the code to suppress
3573 the warning. Some of them are enabled by @option{-Wextra} but many of
3574 them must be enabled individually.
3575
3576 @item -Wextra
3577 @opindex W
3578 @opindex Wextra
3579 @opindex Wno-extra
3580 This enables some extra warning flags that are not enabled by
3581 @option{-Wall}. (This option used to be called @option{-W}. The older
3582 name is still supported, but the newer name is more descriptive.)
3583
3584 @gccoptlist{-Wclobbered @gol
3585 -Wempty-body @gol
3586 -Wignored-qualifiers @gol
3587 -Wmissing-field-initializers @gol
3588 -Wmissing-parameter-type @r{(C only)} @gol
3589 -Wold-style-declaration @r{(C only)} @gol
3590 -Woverride-init @gol
3591 -Wsign-compare @r{(C only)} @gol
3592 -Wtype-limits @gol
3593 -Wuninitialized @gol
3594 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3595 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3596 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3597 }
3598
3599 The option @option{-Wextra} also prints warning messages for the
3600 following cases:
3601
3602 @itemize @bullet
3603
3604 @item
3605 A pointer is compared against integer zero with @code{<}, @code{<=},
3606 @code{>}, or @code{>=}.
3607
3608 @item
3609 (C++ only) An enumerator and a non-enumerator both appear in a
3610 conditional expression.
3611
3612 @item
3613 (C++ only) Ambiguous virtual bases.
3614
3615 @item
3616 (C++ only) Subscripting an array that has been declared @code{register}.
3617
3618 @item
3619 (C++ only) Taking the address of a variable that has been declared
3620 @code{register}.
3621
3622 @item
3623 (C++ only) A base class is not initialized in a derived class's copy
3624 constructor.
3625
3626 @end itemize
3627
3628 @item -Wchar-subscripts
3629 @opindex Wchar-subscripts
3630 @opindex Wno-char-subscripts
3631 Warn if an array subscript has type @code{char}. This is a common cause
3632 of error, as programmers often forget that this type is signed on some
3633 machines.
3634 This warning is enabled by @option{-Wall}.
3635
3636 @item -Wcomment
3637 @opindex Wcomment
3638 @opindex Wno-comment
3639 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3640 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3641 This warning is enabled by @option{-Wall}.
3642
3643 @item -Wno-coverage-mismatch
3644 @opindex Wno-coverage-mismatch
3645 Warn if feedback profiles do not match when using the
3646 @option{-fprofile-use} option.
3647 If a source file is changed between compiling with @option{-fprofile-gen} and
3648 with @option{-fprofile-use}, the files with the profile feedback can fail
3649 to match the source file and GCC cannot use the profile feedback
3650 information. By default, this warning is enabled and is treated as an
3651 error. @option{-Wno-coverage-mismatch} can be used to disable the
3652 warning or @option{-Wno-error=coverage-mismatch} can be used to
3653 disable the error. Disabling the error for this warning can result in
3654 poorly optimized code and is useful only in the
3655 case of very minor changes such as bug fixes to an existing code-base.
3656 Completely disabling the warning is not recommended.
3657
3658 @item -Wno-cpp
3659 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3660
3661 Suppress warning messages emitted by @code{#warning} directives.
3662
3663 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3664 @opindex Wdouble-promotion
3665 @opindex Wno-double-promotion
3666 Give a warning when a value of type @code{float} is implicitly
3667 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3668 floating-point unit implement @code{float} in hardware, but emulate
3669 @code{double} in software. On such a machine, doing computations
3670 using @code{double} values is much more expensive because of the
3671 overhead required for software emulation.
3672
3673 It is easy to accidentally do computations with @code{double} because
3674 floating-point literals are implicitly of type @code{double}. For
3675 example, in:
3676 @smallexample
3677 @group
3678 float area(float radius)
3679 @{
3680 return 3.14159 * radius * radius;
3681 @}
3682 @end group
3683 @end smallexample
3684 the compiler performs the entire computation with @code{double}
3685 because the floating-point literal is a @code{double}.
3686
3687 @item -Wformat
3688 @itemx -Wformat=@var{n}
3689 @opindex Wformat
3690 @opindex Wno-format
3691 @opindex ffreestanding
3692 @opindex fno-builtin
3693 @opindex Wformat=
3694 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3695 the arguments supplied have types appropriate to the format string
3696 specified, and that the conversions specified in the format string make
3697 sense. This includes standard functions, and others specified by format
3698 attributes (@pxref{Function Attributes}), in the @code{printf},
3699 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3700 not in the C standard) families (or other target-specific families).
3701 Which functions are checked without format attributes having been
3702 specified depends on the standard version selected, and such checks of
3703 functions without the attribute specified are disabled by
3704 @option{-ffreestanding} or @option{-fno-builtin}.
3705
3706 The formats are checked against the format features supported by GNU
3707 libc version 2.2. These include all ISO C90 and C99 features, as well
3708 as features from the Single Unix Specification and some BSD and GNU
3709 extensions. Other library implementations may not support all these
3710 features; GCC does not support warning about features that go beyond a
3711 particular library's limitations. However, if @option{-Wpedantic} is used
3712 with @option{-Wformat}, warnings are given about format features not
3713 in the selected standard version (but not for @code{strfmon} formats,
3714 since those are not in any version of the C standard). @xref{C Dialect
3715 Options,,Options Controlling C Dialect}.
3716
3717 @table @gcctabopt
3718 @item -Wformat=1
3719 @itemx -Wformat
3720 @opindex Wformat
3721 @opindex Wformat=1
3722 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3723 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3724 @option{-Wformat} also checks for null format arguments for several
3725 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3726 aspects of this level of format checking can be disabled by the
3727 options: @option{-Wno-format-contains-nul},
3728 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3729 @option{-Wformat} is enabled by @option{-Wall}.
3730
3731 @item -Wno-format-contains-nul
3732 @opindex Wno-format-contains-nul
3733 @opindex Wformat-contains-nul
3734 If @option{-Wformat} is specified, do not warn about format strings that
3735 contain NUL bytes.
3736
3737 @item -Wno-format-extra-args
3738 @opindex Wno-format-extra-args
3739 @opindex Wformat-extra-args
3740 If @option{-Wformat} is specified, do not warn about excess arguments to a
3741 @code{printf} or @code{scanf} format function. The C standard specifies
3742 that such arguments are ignored.
3743
3744 Where the unused arguments lie between used arguments that are
3745 specified with @samp{$} operand number specifications, normally
3746 warnings are still given, since the implementation could not know what
3747 type to pass to @code{va_arg} to skip the unused arguments. However,
3748 in the case of @code{scanf} formats, this option suppresses the
3749 warning if the unused arguments are all pointers, since the Single
3750 Unix Specification says that such unused arguments are allowed.
3751
3752 @item -Wno-format-zero-length
3753 @opindex Wno-format-zero-length
3754 @opindex Wformat-zero-length
3755 If @option{-Wformat} is specified, do not warn about zero-length formats.
3756 The C standard specifies that zero-length formats are allowed.
3757
3758
3759 @item -Wformat=2
3760 @opindex Wformat=2
3761 Enable @option{-Wformat} plus additional format checks. Currently
3762 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3763 -Wformat-y2k}.
3764
3765 @item -Wformat-nonliteral
3766 @opindex Wformat-nonliteral
3767 @opindex Wno-format-nonliteral
3768 If @option{-Wformat} is specified, also warn if the format string is not a
3769 string literal and so cannot be checked, unless the format function
3770 takes its format arguments as a @code{va_list}.
3771
3772 @item -Wformat-security
3773 @opindex Wformat-security
3774 @opindex Wno-format-security
3775 If @option{-Wformat} is specified, also warn about uses of format
3776 functions that represent possible security problems. At present, this
3777 warns about calls to @code{printf} and @code{scanf} functions where the
3778 format string is not a string literal and there are no format arguments,
3779 as in @code{printf (foo);}. This may be a security hole if the format
3780 string came from untrusted input and contains @samp{%n}. (This is
3781 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3782 in future warnings may be added to @option{-Wformat-security} that are not
3783 included in @option{-Wformat-nonliteral}.)
3784
3785 @item -Wformat-signedness
3786 @opindex Wformat-signedness
3787 @opindex Wno-format-signedness
3788 If @option{-Wformat} is specified, also warn if the format string
3789 requires an unsigned argument and the argument is signed and vice versa.
3790
3791 @item -Wformat-y2k
3792 @opindex Wformat-y2k
3793 @opindex Wno-format-y2k
3794 If @option{-Wformat} is specified, also warn about @code{strftime}
3795 formats that may yield only a two-digit year.
3796 @end table
3797
3798 @item -Wnonnull
3799 @opindex Wnonnull
3800 @opindex Wno-nonnull
3801 Warn about passing a null pointer for arguments marked as
3802 requiring a non-null value by the @code{nonnull} function attribute.
3803
3804 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3805 can be disabled with the @option{-Wno-nonnull} option.
3806
3807 @item -Wnonnull-compare
3808 @opindex Wnonnull-compare
3809 @opindex Wno-nonnull-compare
3810 Warn when comparing an argument marked with the @code{nonnull}
3811 function attribute against null inside the function.
3812
3813 @option{-Wnonnull-compare} is included in @option{-Wall}. It
3814 can be disabled with the @option{-Wno-nonnull-compare} option.
3815
3816 @item -Wnull-dereference
3817 @opindex Wnull-dereference
3818 @opindex Wno-null-dereference
3819 Warn if the compiler detects paths that trigger erroneous or
3820 undefined behavior due to dereferencing a null pointer. This option
3821 is only active when @option{-fdelete-null-pointer-checks} is active,
3822 which is enabled by optimizations in most targets. The precision of
3823 the warnings depends on the optimization options used.
3824
3825 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3826 @opindex Winit-self
3827 @opindex Wno-init-self
3828 Warn about uninitialized variables that are initialized with themselves.
3829 Note this option can only be used with the @option{-Wuninitialized} option.
3830
3831 For example, GCC warns about @code{i} being uninitialized in the
3832 following snippet only when @option{-Winit-self} has been specified:
3833 @smallexample
3834 @group
3835 int f()
3836 @{
3837 int i = i;
3838 return i;
3839 @}
3840 @end group
3841 @end smallexample
3842
3843 This warning is enabled by @option{-Wall} in C++.
3844
3845 @item -Wimplicit-int @r{(C and Objective-C only)}
3846 @opindex Wimplicit-int
3847 @opindex Wno-implicit-int
3848 Warn when a declaration does not specify a type.
3849 This warning is enabled by @option{-Wall}.
3850
3851 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3852 @opindex Wimplicit-function-declaration
3853 @opindex Wno-implicit-function-declaration
3854 Give a warning whenever a function is used before being declared. In
3855 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3856 enabled by default and it is made into an error by
3857 @option{-pedantic-errors}. This warning is also enabled by
3858 @option{-Wall}.
3859
3860 @item -Wimplicit @r{(C and Objective-C only)}
3861 @opindex Wimplicit
3862 @opindex Wno-implicit
3863 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3864 This warning is enabled by @option{-Wall}.
3865
3866 @item -Wignored-qualifiers @r{(C and C++ only)}
3867 @opindex Wignored-qualifiers
3868 @opindex Wno-ignored-qualifiers
3869 Warn if the return type of a function has a type qualifier
3870 such as @code{const}. For ISO C such a type qualifier has no effect,
3871 since the value returned by a function is not an lvalue.
3872 For C++, the warning is only emitted for scalar types or @code{void}.
3873 ISO C prohibits qualified @code{void} return types on function
3874 definitions, so such return types always receive a warning
3875 even without this option.
3876
3877 This warning is also enabled by @option{-Wextra}.
3878
3879 @item -Wmain
3880 @opindex Wmain
3881 @opindex Wno-main
3882 Warn if the type of @code{main} is suspicious. @code{main} should be
3883 a function with external linkage, returning int, taking either zero
3884 arguments, two, or three arguments of appropriate types. This warning
3885 is enabled by default in C++ and is enabled by either @option{-Wall}
3886 or @option{-Wpedantic}.
3887
3888 @item -Wmisleading-indentation @r{(C and C++ only)}
3889 @opindex Wmisleading-indentation
3890 @opindex Wno-misleading-indentation
3891 Warn when the indentation of the code does not reflect the block structure.
3892 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
3893 @code{for} clauses with a guarded statement that does not use braces,
3894 followed by an unguarded statement with the same indentation.
3895
3896 In the following example, the call to ``bar'' is misleadingly indented as
3897 if it were guarded by the ``if'' conditional.
3898
3899 @smallexample
3900 if (some_condition ())
3901 foo ();
3902 bar (); /* Gotcha: this is not guarded by the "if". */
3903 @end smallexample
3904
3905 In the case of mixed tabs and spaces, the warning uses the
3906 @option{-ftabstop=} option to determine if the statements line up
3907 (defaulting to 8).
3908
3909 The warning is not issued for code involving multiline preprocessor logic
3910 such as the following example.
3911
3912 @smallexample
3913 if (flagA)
3914 foo (0);
3915 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
3916 if (flagB)
3917 #endif
3918 foo (1);
3919 @end smallexample
3920
3921 The warning is not issued after a @code{#line} directive, since this
3922 typically indicates autogenerated code, and no assumptions can be made
3923 about the layout of the file that the directive references.
3924
3925 This warning is enabled by @option{-Wall} in C and C++.
3926
3927 @item -Wmissing-braces
3928 @opindex Wmissing-braces
3929 @opindex Wno-missing-braces
3930 Warn if an aggregate or union initializer is not fully bracketed. In
3931 the following example, the initializer for @code{a} is not fully
3932 bracketed, but that for @code{b} is fully bracketed. This warning is
3933 enabled by @option{-Wall} in C.
3934
3935 @smallexample
3936 int a[2][2] = @{ 0, 1, 2, 3 @};
3937 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3938 @end smallexample
3939
3940 This warning is enabled by @option{-Wall}.
3941
3942 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3943 @opindex Wmissing-include-dirs
3944 @opindex Wno-missing-include-dirs
3945 Warn if a user-supplied include directory does not exist.
3946
3947 @item -Wparentheses
3948 @opindex Wparentheses
3949 @opindex Wno-parentheses
3950 Warn if parentheses are omitted in certain contexts, such
3951 as when there is an assignment in a context where a truth value
3952 is expected, or when operators are nested whose precedence people
3953 often get confused about.
3954
3955 Also warn if a comparison like @code{x<=y<=z} appears; this is
3956 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
3957 interpretation from that of ordinary mathematical notation.
3958
3959 Also warn about constructions where there may be confusion to which
3960 @code{if} statement an @code{else} branch belongs. Here is an example of
3961 such a case:
3962
3963 @smallexample
3964 @group
3965 @{
3966 if (a)
3967 if (b)
3968 foo ();
3969 else
3970 bar ();
3971 @}
3972 @end group
3973 @end smallexample
3974
3975 In C/C++, every @code{else} branch belongs to the innermost possible
3976 @code{if} statement, which in this example is @code{if (b)}. This is
3977 often not what the programmer expected, as illustrated in the above
3978 example by indentation the programmer chose. When there is the
3979 potential for this confusion, GCC issues a warning when this flag
3980 is specified. To eliminate the warning, add explicit braces around
3981 the innermost @code{if} statement so there is no way the @code{else}
3982 can belong to the enclosing @code{if}. The resulting code
3983 looks like this:
3984
3985 @smallexample
3986 @group
3987 @{
3988 if (a)
3989 @{
3990 if (b)
3991 foo ();
3992 else
3993 bar ();
3994 @}
3995 @}
3996 @end group
3997 @end smallexample
3998
3999 Also warn for dangerous uses of the GNU extension to
4000 @code{?:} with omitted middle operand. When the condition
4001 in the @code{?}: operator is a boolean expression, the omitted value is
4002 always 1. Often programmers expect it to be a value computed
4003 inside the conditional expression instead.
4004
4005 This warning is enabled by @option{-Wall}.
4006
4007 @item -Wsequence-point
4008 @opindex Wsequence-point
4009 @opindex Wno-sequence-point
4010 Warn about code that may have undefined semantics because of violations
4011 of sequence point rules in the C and C++ standards.
4012
4013 The C and C++ standards define the order in which expressions in a C/C++
4014 program are evaluated in terms of @dfn{sequence points}, which represent
4015 a partial ordering between the execution of parts of the program: those
4016 executed before the sequence point, and those executed after it. These
4017 occur after the evaluation of a full expression (one which is not part
4018 of a larger expression), after the evaluation of the first operand of a
4019 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4020 function is called (but after the evaluation of its arguments and the
4021 expression denoting the called function), and in certain other places.
4022 Other than as expressed by the sequence point rules, the order of
4023 evaluation of subexpressions of an expression is not specified. All
4024 these rules describe only a partial order rather than a total order,
4025 since, for example, if two functions are called within one expression
4026 with no sequence point between them, the order in which the functions
4027 are called is not specified. However, the standards committee have
4028 ruled that function calls do not overlap.
4029
4030 It is not specified when between sequence points modifications to the
4031 values of objects take effect. Programs whose behavior depends on this
4032 have undefined behavior; the C and C++ standards specify that ``Between
4033 the previous and next sequence point an object shall have its stored
4034 value modified at most once by the evaluation of an expression.
4035 Furthermore, the prior value shall be read only to determine the value
4036 to be stored.''. If a program breaks these rules, the results on any
4037 particular implementation are entirely unpredictable.
4038
4039 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4040 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4041 diagnosed by this option, and it may give an occasional false positive
4042 result, but in general it has been found fairly effective at detecting
4043 this sort of problem in programs.
4044
4045 The standard is worded confusingly, therefore there is some debate
4046 over the precise meaning of the sequence point rules in subtle cases.
4047 Links to discussions of the problem, including proposed formal
4048 definitions, may be found on the GCC readings page, at
4049 @uref{http://gcc.gnu.org/@/readings.html}.
4050
4051 This warning is enabled by @option{-Wall} for C and C++.
4052
4053 @item -Wno-return-local-addr
4054 @opindex Wno-return-local-addr
4055 @opindex Wreturn-local-addr
4056 Do not warn about returning a pointer (or in C++, a reference) to a
4057 variable that goes out of scope after the function returns.
4058
4059 @item -Wreturn-type
4060 @opindex Wreturn-type
4061 @opindex Wno-return-type
4062 Warn whenever a function is defined with a return type that defaults
4063 to @code{int}. Also warn about any @code{return} statement with no
4064 return value in a function whose return type is not @code{void}
4065 (falling off the end of the function body is considered returning
4066 without a value), and about a @code{return} statement with an
4067 expression in a function whose return type is @code{void}.
4068
4069 For C++, a function without return type always produces a diagnostic
4070 message, even when @option{-Wno-return-type} is specified. The only
4071 exceptions are @code{main} and functions defined in system headers.
4072
4073 This warning is enabled by @option{-Wall}.
4074
4075 @item -Wshift-count-negative
4076 @opindex Wshift-count-negative
4077 @opindex Wno-shift-count-negative
4078 Warn if shift count is negative. This warning is enabled by default.
4079
4080 @item -Wshift-count-overflow
4081 @opindex Wshift-count-overflow
4082 @opindex Wno-shift-count-overflow
4083 Warn if shift count >= width of type. This warning is enabled by default.
4084
4085 @item -Wshift-negative-value
4086 @opindex Wshift-negative-value
4087 @opindex Wno-shift-negative-value
4088 Warn if left shifting a negative value. This warning is enabled by
4089 @option{-Wextra} in C99 and C++11 modes (and newer).
4090
4091 @item -Wshift-overflow
4092 @itemx -Wshift-overflow=@var{n}
4093 @opindex Wshift-overflow
4094 @opindex Wno-shift-overflow
4095 Warn about left shift overflows. This warning is enabled by
4096 default in C99 and C++11 modes (and newer).
4097
4098 @table @gcctabopt
4099 @item -Wshift-overflow=1
4100 This is the warning level of @option{-Wshift-overflow} and is enabled
4101 by default in C99 and C++11 modes (and newer). This warning level does
4102 not warn about left-shifting 1 into the sign bit. (However, in C, such
4103 an overflow is still rejected in contexts where an integer constant expression
4104 is required.)
4105
4106 @item -Wshift-overflow=2
4107 This warning level also warns about left-shifting 1 into the sign bit,
4108 unless C++14 mode is active.
4109 @end table
4110
4111 @item -Wswitch
4112 @opindex Wswitch
4113 @opindex Wno-switch
4114 Warn whenever a @code{switch} statement has an index of enumerated type
4115 and lacks a @code{case} for one or more of the named codes of that
4116 enumeration. (The presence of a @code{default} label prevents this
4117 warning.) @code{case} labels outside the enumeration range also
4118 provoke warnings when this option is used (even if there is a
4119 @code{default} label).
4120 This warning is enabled by @option{-Wall}.
4121
4122 @item -Wswitch-default
4123 @opindex Wswitch-default
4124 @opindex Wno-switch-default
4125 Warn whenever a @code{switch} statement does not have a @code{default}
4126 case.
4127
4128 @item -Wswitch-enum
4129 @opindex Wswitch-enum
4130 @opindex Wno-switch-enum
4131 Warn whenever a @code{switch} statement has an index of enumerated type
4132 and lacks a @code{case} for one or more of the named codes of that
4133 enumeration. @code{case} labels outside the enumeration range also
4134 provoke warnings when this option is used. The only difference
4135 between @option{-Wswitch} and this option is that this option gives a
4136 warning about an omitted enumeration code even if there is a
4137 @code{default} label.
4138
4139 @item -Wswitch-bool
4140 @opindex Wswitch-bool
4141 @opindex Wno-switch-bool
4142 Warn whenever a @code{switch} statement has an index of boolean type
4143 and the case values are outside the range of a boolean type.
4144 It is possible to suppress this warning by casting the controlling
4145 expression to a type other than @code{bool}. For example:
4146 @smallexample
4147 @group
4148 switch ((int) (a == 4))
4149 @{
4150 @dots{}
4151 @}
4152 @end group
4153 @end smallexample
4154 This warning is enabled by default for C and C++ programs.
4155
4156 @item -Wsync-nand @r{(C and C++ only)}
4157 @opindex Wsync-nand
4158 @opindex Wno-sync-nand
4159 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4160 built-in functions are used. These functions changed semantics in GCC 4.4.
4161
4162 @item -Wtrigraphs
4163 @opindex Wtrigraphs
4164 @opindex Wno-trigraphs
4165 Warn if any trigraphs are encountered that might change the meaning of
4166 the program (trigraphs within comments are not warned about).
4167 This warning is enabled by @option{-Wall}.
4168
4169 @item -Wunused-but-set-parameter
4170 @opindex Wunused-but-set-parameter
4171 @opindex Wno-unused-but-set-parameter
4172 Warn whenever a function parameter is assigned to, but otherwise unused
4173 (aside from its declaration).
4174
4175 To suppress this warning use the @code{unused} attribute
4176 (@pxref{Variable Attributes}).
4177
4178 This warning is also enabled by @option{-Wunused} together with
4179 @option{-Wextra}.
4180
4181 @item -Wunused-but-set-variable
4182 @opindex Wunused-but-set-variable
4183 @opindex Wno-unused-but-set-variable
4184 Warn whenever a local variable is assigned to, but otherwise unused
4185 (aside from its declaration).
4186 This warning is enabled by @option{-Wall}.
4187
4188 To suppress this warning use the @code{unused} attribute
4189 (@pxref{Variable Attributes}).
4190
4191 This warning is also enabled by @option{-Wunused}, which is enabled
4192 by @option{-Wall}.
4193
4194 @item -Wunused-function
4195 @opindex Wunused-function
4196 @opindex Wno-unused-function
4197 Warn whenever a static function is declared but not defined or a
4198 non-inline static function is unused.
4199 This warning is enabled by @option{-Wall}.
4200
4201 @item -Wunused-label
4202 @opindex Wunused-label
4203 @opindex Wno-unused-label
4204 Warn whenever a label is declared but not used.
4205 This warning is enabled by @option{-Wall}.
4206
4207 To suppress this warning use the @code{unused} attribute
4208 (@pxref{Variable Attributes}).
4209
4210 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4211 @opindex Wunused-local-typedefs
4212 Warn when a typedef locally defined in a function is not used.
4213 This warning is enabled by @option{-Wall}.
4214
4215 @item -Wunused-parameter
4216 @opindex Wunused-parameter
4217 @opindex Wno-unused-parameter
4218 Warn whenever a function parameter is unused aside from its declaration.
4219
4220 To suppress this warning use the @code{unused} attribute
4221 (@pxref{Variable Attributes}).
4222
4223 @item -Wno-unused-result
4224 @opindex Wunused-result
4225 @opindex Wno-unused-result
4226 Do not warn if a caller of a function marked with attribute
4227 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4228 its return value. The default is @option{-Wunused-result}.
4229
4230 @item -Wunused-variable
4231 @opindex Wunused-variable
4232 @opindex Wno-unused-variable
4233 Warn whenever a local or static variable is unused aside from its
4234 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4235 but not for C++. This warning is enabled by @option{-Wall}.
4236
4237 To suppress this warning use the @code{unused} attribute
4238 (@pxref{Variable Attributes}).
4239
4240 @item -Wunused-const-variable
4241 @itemx -Wunused-const-variable=@var{n}
4242 @opindex Wunused-const-variable
4243 @opindex Wno-unused-const-variable
4244 Warn whenever a constant static variable is unused aside from its declaration.
4245 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4246 for C, but not for C++. In C this declares variable storage, but in C++ this
4247 is not an error since const variables take the place of @code{#define}s.
4248
4249 To suppress this warning use the @code{unused} attribute
4250 (@pxref{Variable Attributes}).
4251
4252 @table @gcctabopt
4253 @item -Wunused-const-variable=1
4254 This is the warning level that is enabled by @option{-Wunused-variable} for
4255 C. It warns only about unused static const variables defined in the main
4256 compilation unit, but not about static const variables declared in any
4257 header included.
4258
4259 @item -Wunused-const-variable=2
4260 This warning level also warns for unused constant static variables in
4261 headers (excluding system headers). This is the warning level of
4262 @option{-Wunused-const-variable} and must be explicitly requested since
4263 in C++ this isn't an error and in C it might be harder to clean up all
4264 headers included.
4265 @end table
4266
4267 @item -Wunused-value
4268 @opindex Wunused-value
4269 @opindex Wno-unused-value
4270 Warn whenever a statement computes a result that is explicitly not
4271 used. To suppress this warning cast the unused expression to
4272 @code{void}. This includes an expression-statement or the left-hand
4273 side of a comma expression that contains no side effects. For example,
4274 an expression such as @code{x[i,j]} causes a warning, while
4275 @code{x[(void)i,j]} does not.
4276
4277 This warning is enabled by @option{-Wall}.
4278
4279 @item -Wunused
4280 @opindex Wunused
4281 @opindex Wno-unused
4282 All the above @option{-Wunused} options combined.
4283
4284 In order to get a warning about an unused function parameter, you must
4285 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4286 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4287
4288 @item -Wuninitialized
4289 @opindex Wuninitialized
4290 @opindex Wno-uninitialized
4291 Warn if an automatic variable is used without first being initialized
4292 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4293 warn if a non-static reference or non-static @code{const} member
4294 appears in a class without constructors.
4295
4296 If you want to warn about code that uses the uninitialized value of the
4297 variable in its own initializer, use the @option{-Winit-self} option.
4298
4299 These warnings occur for individual uninitialized or clobbered
4300 elements of structure, union or array variables as well as for
4301 variables that are uninitialized or clobbered as a whole. They do
4302 not occur for variables or elements declared @code{volatile}. Because
4303 these warnings depend on optimization, the exact variables or elements
4304 for which there are warnings depends on the precise optimization
4305 options and version of GCC used.
4306
4307 Note that there may be no warning about a variable that is used only
4308 to compute a value that itself is never used, because such
4309 computations may be deleted by data flow analysis before the warnings
4310 are printed.
4311
4312 @item -Winvalid-memory-model
4313 @opindex Winvalid-memory-model
4314 @opindex Wno-invalid-memory-model
4315 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4316 and the C11 atomic generic functions with a memory consistency argument
4317 that is either invalid for the operation or outside the range of values
4318 of the @code{memory_order} enumeration. For example, since the
4319 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4320 defined for the relaxed, release, and sequentially consistent memory
4321 orders the following code is diagnosed:
4322
4323 @smallexample
4324 void store (int *i)
4325 @{
4326 __atomic_store_n (i, 0, memory_order_consume);
4327 @}
4328 @end smallexample
4329
4330 @option{-Winvalid-memory-model} is enabled by default.
4331
4332 @item -Wmaybe-uninitialized
4333 @opindex Wmaybe-uninitialized
4334 @opindex Wno-maybe-uninitialized
4335 For an automatic variable, if there exists a path from the function
4336 entry to a use of the variable that is initialized, but there exist
4337 some other paths for which the variable is not initialized, the compiler
4338 emits a warning if it cannot prove the uninitialized paths are not
4339 executed at run time. These warnings are made optional because GCC is
4340 not smart enough to see all the reasons why the code might be correct
4341 in spite of appearing to have an error. Here is one example of how
4342 this can happen:
4343
4344 @smallexample
4345 @group
4346 @{
4347 int x;
4348 switch (y)
4349 @{
4350 case 1: x = 1;
4351 break;
4352 case 2: x = 4;
4353 break;
4354 case 3: x = 5;
4355 @}
4356 foo (x);
4357 @}
4358 @end group
4359 @end smallexample
4360
4361 @noindent
4362 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4363 always initialized, but GCC doesn't know this. To suppress the
4364 warning, you need to provide a default case with assert(0) or
4365 similar code.
4366
4367 @cindex @code{longjmp} warnings
4368 This option also warns when a non-volatile automatic variable might be
4369 changed by a call to @code{longjmp}. These warnings as well are possible
4370 only in optimizing compilation.
4371
4372 The compiler sees only the calls to @code{setjmp}. It cannot know
4373 where @code{longjmp} will be called; in fact, a signal handler could
4374 call it at any point in the code. As a result, you may get a warning
4375 even when there is in fact no problem because @code{longjmp} cannot
4376 in fact be called at the place that would cause a problem.
4377
4378 Some spurious warnings can be avoided if you declare all the functions
4379 you use that never return as @code{noreturn}. @xref{Function
4380 Attributes}.
4381
4382 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4383
4384 @item -Wunknown-pragmas
4385 @opindex Wunknown-pragmas
4386 @opindex Wno-unknown-pragmas
4387 @cindex warning for unknown pragmas
4388 @cindex unknown pragmas, warning
4389 @cindex pragmas, warning of unknown
4390 Warn when a @code{#pragma} directive is encountered that is not understood by
4391 GCC@. If this command-line option is used, warnings are even issued
4392 for unknown pragmas in system header files. This is not the case if
4393 the warnings are only enabled by the @option{-Wall} command-line option.
4394
4395 @item -Wno-pragmas
4396 @opindex Wno-pragmas
4397 @opindex Wpragmas
4398 Do not warn about misuses of pragmas, such as incorrect parameters,
4399 invalid syntax, or conflicts between pragmas. See also
4400 @option{-Wunknown-pragmas}.
4401
4402 @item -Wstrict-aliasing
4403 @opindex Wstrict-aliasing
4404 @opindex Wno-strict-aliasing
4405 This option is only active when @option{-fstrict-aliasing} is active.
4406 It warns about code that might break the strict aliasing rules that the
4407 compiler is using for optimization. The warning does not catch all
4408 cases, but does attempt to catch the more common pitfalls. It is
4409 included in @option{-Wall}.
4410 It is equivalent to @option{-Wstrict-aliasing=3}
4411
4412 @item -Wstrict-aliasing=n
4413 @opindex Wstrict-aliasing=n
4414 This option is only active when @option{-fstrict-aliasing} is active.
4415 It warns about code that might break the strict aliasing rules that the
4416 compiler is using for optimization.
4417 Higher levels correspond to higher accuracy (fewer false positives).
4418 Higher levels also correspond to more effort, similar to the way @option{-O}
4419 works.
4420 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4421
4422 Level 1: Most aggressive, quick, least accurate.
4423 Possibly useful when higher levels
4424 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4425 false negatives. However, it has many false positives.
4426 Warns for all pointer conversions between possibly incompatible types,
4427 even if never dereferenced. Runs in the front end only.
4428
4429 Level 2: Aggressive, quick, not too precise.
4430 May still have many false positives (not as many as level 1 though),
4431 and few false negatives (but possibly more than level 1).
4432 Unlike level 1, it only warns when an address is taken. Warns about
4433 incomplete types. Runs in the front end only.
4434
4435 Level 3 (default for @option{-Wstrict-aliasing}):
4436 Should have very few false positives and few false
4437 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4438 Takes care of the common pun+dereference pattern in the front end:
4439 @code{*(int*)&some_float}.
4440 If optimization is enabled, it also runs in the back end, where it deals
4441 with multiple statement cases using flow-sensitive points-to information.
4442 Only warns when the converted pointer is dereferenced.
4443 Does not warn about incomplete types.
4444
4445 @item -Wstrict-overflow
4446 @itemx -Wstrict-overflow=@var{n}
4447 @opindex Wstrict-overflow
4448 @opindex Wno-strict-overflow
4449 This option is only active when @option{-fstrict-overflow} is active.
4450 It warns about cases where the compiler optimizes based on the
4451 assumption that signed overflow does not occur. Note that it does not
4452 warn about all cases where the code might overflow: it only warns
4453 about cases where the compiler implements some optimization. Thus
4454 this warning depends on the optimization level.
4455
4456 An optimization that assumes that signed overflow does not occur is
4457 perfectly safe if the values of the variables involved are such that
4458 overflow never does, in fact, occur. Therefore this warning can
4459 easily give a false positive: a warning about code that is not
4460 actually a problem. To help focus on important issues, several
4461 warning levels are defined. No warnings are issued for the use of
4462 undefined signed overflow when estimating how many iterations a loop
4463 requires, in particular when determining whether a loop will be
4464 executed at all.
4465
4466 @table @gcctabopt
4467 @item -Wstrict-overflow=1
4468 Warn about cases that are both questionable and easy to avoid. For
4469 example, with @option{-fstrict-overflow}, the compiler simplifies
4470 @code{x + 1 > x} to @code{1}. This level of
4471 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4472 are not, and must be explicitly requested.
4473
4474 @item -Wstrict-overflow=2
4475 Also warn about other cases where a comparison is simplified to a
4476 constant. For example: @code{abs (x) >= 0}. This can only be
4477 simplified when @option{-fstrict-overflow} is in effect, because
4478 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4479 zero. @option{-Wstrict-overflow} (with no level) is the same as
4480 @option{-Wstrict-overflow=2}.
4481
4482 @item -Wstrict-overflow=3
4483 Also warn about other cases where a comparison is simplified. For
4484 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4485
4486 @item -Wstrict-overflow=4
4487 Also warn about other simplifications not covered by the above cases.
4488 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4489
4490 @item -Wstrict-overflow=5
4491 Also warn about cases where the compiler reduces the magnitude of a
4492 constant involved in a comparison. For example: @code{x + 2 > y} is
4493 simplified to @code{x + 1 >= y}. This is reported only at the
4494 highest warning level because this simplification applies to many
4495 comparisons, so this warning level gives a very large number of
4496 false positives.
4497 @end table
4498
4499 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4500 @opindex Wsuggest-attribute=
4501 @opindex Wno-suggest-attribute=
4502 Warn for cases where adding an attribute may be beneficial. The
4503 attributes currently supported are listed below.
4504
4505 @table @gcctabopt
4506 @item -Wsuggest-attribute=pure
4507 @itemx -Wsuggest-attribute=const
4508 @itemx -Wsuggest-attribute=noreturn
4509 @opindex Wsuggest-attribute=pure
4510 @opindex Wno-suggest-attribute=pure
4511 @opindex Wsuggest-attribute=const
4512 @opindex Wno-suggest-attribute=const
4513 @opindex Wsuggest-attribute=noreturn
4514 @opindex Wno-suggest-attribute=noreturn
4515
4516 Warn about functions that might be candidates for attributes
4517 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4518 functions visible in other compilation units or (in the case of @code{pure} and
4519 @code{const}) if it cannot prove that the function returns normally. A function
4520 returns normally if it doesn't contain an infinite loop or return abnormally
4521 by throwing, calling @code{abort} or trapping. This analysis requires option
4522 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4523 higher. Higher optimization levels improve the accuracy of the analysis.
4524
4525 @item -Wsuggest-attribute=format
4526 @itemx -Wmissing-format-attribute
4527 @opindex Wsuggest-attribute=format
4528 @opindex Wmissing-format-attribute
4529 @opindex Wno-suggest-attribute=format
4530 @opindex Wno-missing-format-attribute
4531 @opindex Wformat
4532 @opindex Wno-format
4533
4534 Warn about function pointers that might be candidates for @code{format}
4535 attributes. Note these are only possible candidates, not absolute ones.
4536 GCC guesses that function pointers with @code{format} attributes that
4537 are used in assignment, initialization, parameter passing or return
4538 statements should have a corresponding @code{format} attribute in the
4539 resulting type. I.e.@: the left-hand side of the assignment or
4540 initialization, the type of the parameter variable, or the return type
4541 of the containing function respectively should also have a @code{format}
4542 attribute to avoid the warning.
4543
4544 GCC also warns about function definitions that might be
4545 candidates for @code{format} attributes. Again, these are only
4546 possible candidates. GCC guesses that @code{format} attributes
4547 might be appropriate for any function that calls a function like
4548 @code{vprintf} or @code{vscanf}, but this might not always be the
4549 case, and some functions for which @code{format} attributes are
4550 appropriate may not be detected.
4551 @end table
4552
4553 @item -Wsuggest-final-types
4554 @opindex Wno-suggest-final-types
4555 @opindex Wsuggest-final-types
4556 Warn about types with virtual methods where code quality would be improved
4557 if the type were declared with the C++11 @code{final} specifier,
4558 or, if possible,
4559 declared in an anonymous namespace. This allows GCC to more aggressively
4560 devirtualize the polymorphic calls. This warning is more effective with link
4561 time optimization, where the information about the class hierarchy graph is
4562 more complete.
4563
4564 @item -Wsuggest-final-methods
4565 @opindex Wno-suggest-final-methods
4566 @opindex Wsuggest-final-methods
4567 Warn about virtual methods where code quality would be improved if the method
4568 were declared with the C++11 @code{final} specifier,
4569 or, if possible, its type were
4570 declared in an anonymous namespace or with the @code{final} specifier.
4571 This warning is
4572 more effective with link time optimization, where the information about the
4573 class hierarchy graph is more complete. It is recommended to first consider
4574 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4575 annotations.
4576
4577 @item -Wsuggest-override
4578 Warn about overriding virtual functions that are not marked with the override
4579 keyword.
4580
4581 @item -Warray-bounds
4582 @itemx -Warray-bounds=@var{n}
4583 @opindex Wno-array-bounds
4584 @opindex Warray-bounds
4585 This option is only active when @option{-ftree-vrp} is active
4586 (default for @option{-O2} and above). It warns about subscripts to arrays
4587 that are always out of bounds. This warning is enabled by @option{-Wall}.
4588
4589 @table @gcctabopt
4590 @item -Warray-bounds=1
4591 This is the warning level of @option{-Warray-bounds} and is enabled
4592 by @option{-Wall}; higher levels are not, and must be explicitly requested.
4593
4594 @item -Warray-bounds=2
4595 This warning level also warns about out of bounds access for
4596 arrays at the end of a struct and for arrays accessed through
4597 pointers. This warning level may give a larger number of
4598 false positives and is deactivated by default.
4599 @end table
4600
4601 @item -Wbool-compare
4602 @opindex Wno-bool-compare
4603 @opindex Wbool-compare
4604 Warn about boolean expression compared with an integer value different from
4605 @code{true}/@code{false}. For instance, the following comparison is
4606 always false:
4607 @smallexample
4608 int n = 5;
4609 @dots{}
4610 if ((n > 1) == 2) @{ @dots{} @}
4611 @end smallexample
4612 This warning is enabled by @option{-Wall}.
4613
4614 @item -Wduplicated-cond
4615 @opindex Wno-duplicated-cond
4616 @opindex Wduplicated-cond
4617 Warn about duplicated conditions in an if-else-if chain. For instance,
4618 warn for the following code:
4619 @smallexample
4620 if (p->q != NULL) @{ @dots{} @}
4621 else if (p->q != NULL) @{ @dots{} @}
4622 @end smallexample
4623
4624 @item -Wframe-address
4625 @opindex Wno-frame-address
4626 @opindex Wframe-address
4627 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
4628 is called with an argument greater than 0. Such calls may return indeterminate
4629 values or crash the program. The warning is included in @option{-Wall}.
4630
4631 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
4632 @opindex Wno-discarded-qualifiers
4633 @opindex Wdiscarded-qualifiers
4634 Do not warn if type qualifiers on pointers are being discarded.
4635 Typically, the compiler warns if a @code{const char *} variable is
4636 passed to a function that takes a @code{char *} parameter. This option
4637 can be used to suppress such a warning.
4638
4639 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
4640 @opindex Wno-discarded-array-qualifiers
4641 @opindex Wdiscarded-array-qualifiers
4642 Do not warn if type qualifiers on arrays which are pointer targets
4643 are being discarded. Typically, the compiler warns if a
4644 @code{const int (*)[]} variable is passed to a function that
4645 takes a @code{int (*)[]} parameter. This option can be used to
4646 suppress such a warning.
4647
4648 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
4649 @opindex Wno-incompatible-pointer-types
4650 @opindex Wincompatible-pointer-types
4651 Do not warn when there is a conversion between pointers that have incompatible
4652 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
4653 which warns for pointer argument passing or assignment with different
4654 signedness.
4655
4656 @item -Wno-int-conversion @r{(C and Objective-C only)}
4657 @opindex Wno-int-conversion
4658 @opindex Wint-conversion
4659 Do not warn about incompatible integer to pointer and pointer to integer
4660 conversions. This warning is about implicit conversions; for explicit
4661 conversions the warnings @option{-Wno-int-to-pointer-cast} and
4662 @option{-Wno-pointer-to-int-cast} may be used.
4663
4664 @item -Wno-div-by-zero
4665 @opindex Wno-div-by-zero
4666 @opindex Wdiv-by-zero
4667 Do not warn about compile-time integer division by zero. Floating-point
4668 division by zero is not warned about, as it can be a legitimate way of
4669 obtaining infinities and NaNs.
4670
4671 @item -Wsystem-headers
4672 @opindex Wsystem-headers
4673 @opindex Wno-system-headers
4674 @cindex warnings from system headers
4675 @cindex system headers, warnings from
4676 Print warning messages for constructs found in system header files.
4677 Warnings from system headers are normally suppressed, on the assumption
4678 that they usually do not indicate real problems and would only make the
4679 compiler output harder to read. Using this command-line option tells
4680 GCC to emit warnings from system headers as if they occurred in user
4681 code. However, note that using @option{-Wall} in conjunction with this
4682 option does @emph{not} warn about unknown pragmas in system
4683 headers---for that, @option{-Wunknown-pragmas} must also be used.
4684
4685 @item -Wtautological-compare
4686 @opindex Wtautological-compare
4687 @opindex Wno-tautological-compare
4688 Warn if a self-comparison always evaluates to true or false. This
4689 warning detects various mistakes such as:
4690 @smallexample
4691 int i = 1;
4692 @dots{}
4693 if (i > i) @{ @dots{} @}
4694 @end smallexample
4695 This warning is enabled by @option{-Wall}.
4696
4697 @item -Wtrampolines
4698 @opindex Wtrampolines
4699 @opindex Wno-trampolines
4700 Warn about trampolines generated for pointers to nested functions.
4701 A trampoline is a small piece of data or code that is created at run
4702 time on the stack when the address of a nested function is taken, and is
4703 used to call the nested function indirectly. For some targets, it is
4704 made up of data only and thus requires no special treatment. But, for
4705 most targets, it is made up of code and thus requires the stack to be
4706 made executable in order for the program to work properly.
4707
4708 @item -Wfloat-equal
4709 @opindex Wfloat-equal
4710 @opindex Wno-float-equal
4711 Warn if floating-point values are used in equality comparisons.
4712
4713 The idea behind this is that sometimes it is convenient (for the
4714 programmer) to consider floating-point values as approximations to
4715 infinitely precise real numbers. If you are doing this, then you need
4716 to compute (by analyzing the code, or in some other way) the maximum or
4717 likely maximum error that the computation introduces, and allow for it
4718 when performing comparisons (and when producing output, but that's a
4719 different problem). In particular, instead of testing for equality, you
4720 should check to see whether the two values have ranges that overlap; and
4721 this is done with the relational operators, so equality comparisons are
4722 probably mistaken.
4723
4724 @item -Wtraditional @r{(C and Objective-C only)}
4725 @opindex Wtraditional
4726 @opindex Wno-traditional
4727 Warn about certain constructs that behave differently in traditional and
4728 ISO C@. Also warn about ISO C constructs that have no traditional C
4729 equivalent, and/or problematic constructs that should be avoided.
4730
4731 @itemize @bullet
4732 @item
4733 Macro parameters that appear within string literals in the macro body.
4734 In traditional C macro replacement takes place within string literals,
4735 but in ISO C it does not.
4736
4737 @item
4738 In traditional C, some preprocessor directives did not exist.
4739 Traditional preprocessors only considered a line to be a directive
4740 if the @samp{#} appeared in column 1 on the line. Therefore
4741 @option{-Wtraditional} warns about directives that traditional C
4742 understands but ignores because the @samp{#} does not appear as the
4743 first character on the line. It also suggests you hide directives like
4744 @code{#pragma} not understood by traditional C by indenting them. Some
4745 traditional implementations do not recognize @code{#elif}, so this option
4746 suggests avoiding it altogether.
4747
4748 @item
4749 A function-like macro that appears without arguments.
4750
4751 @item
4752 The unary plus operator.
4753
4754 @item
4755 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4756 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
4757 constants.) Note, these suffixes appear in macros defined in the system
4758 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4759 Use of these macros in user code might normally lead to spurious
4760 warnings, however GCC's integrated preprocessor has enough context to
4761 avoid warning in these cases.
4762
4763 @item
4764 A function declared external in one block and then used after the end of
4765 the block.
4766
4767 @item
4768 A @code{switch} statement has an operand of type @code{long}.
4769
4770 @item
4771 A non-@code{static} function declaration follows a @code{static} one.
4772 This construct is not accepted by some traditional C compilers.
4773
4774 @item
4775 The ISO type of an integer constant has a different width or
4776 signedness from its traditional type. This warning is only issued if
4777 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
4778 typically represent bit patterns, are not warned about.
4779
4780 @item
4781 Usage of ISO string concatenation is detected.
4782
4783 @item
4784 Initialization of automatic aggregates.
4785
4786 @item
4787 Identifier conflicts with labels. Traditional C lacks a separate
4788 namespace for labels.
4789
4790 @item
4791 Initialization of unions. If the initializer is zero, the warning is
4792 omitted. This is done under the assumption that the zero initializer in
4793 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4794 initializer warnings and relies on default initialization to zero in the
4795 traditional C case.
4796
4797 @item
4798 Conversions by prototypes between fixed/floating-point values and vice
4799 versa. The absence of these prototypes when compiling with traditional
4800 C causes serious problems. This is a subset of the possible
4801 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4802
4803 @item
4804 Use of ISO C style function definitions. This warning intentionally is
4805 @emph{not} issued for prototype declarations or variadic functions
4806 because these ISO C features appear in your code when using
4807 libiberty's traditional C compatibility macros, @code{PARAMS} and
4808 @code{VPARAMS}. This warning is also bypassed for nested functions
4809 because that feature is already a GCC extension and thus not relevant to
4810 traditional C compatibility.
4811 @end itemize
4812
4813 @item -Wtraditional-conversion @r{(C and Objective-C only)}
4814 @opindex Wtraditional-conversion
4815 @opindex Wno-traditional-conversion
4816 Warn if a prototype causes a type conversion that is different from what
4817 would happen to the same argument in the absence of a prototype. This
4818 includes conversions of fixed point to floating and vice versa, and
4819 conversions changing the width or signedness of a fixed-point argument
4820 except when the same as the default promotion.
4821
4822 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4823 @opindex Wdeclaration-after-statement
4824 @opindex Wno-declaration-after-statement
4825 Warn when a declaration is found after a statement in a block. This
4826 construct, known from C++, was introduced with ISO C99 and is by default
4827 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
4828
4829 @item -Wundef
4830 @opindex Wundef
4831 @opindex Wno-undef
4832 Warn if an undefined identifier is evaluated in an @code{#if} directive.
4833
4834 @item -Wno-endif-labels
4835 @opindex Wno-endif-labels
4836 @opindex Wendif-labels
4837 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
4838
4839 @item -Wshadow
4840 @opindex Wshadow
4841 @opindex Wno-shadow
4842 Warn whenever a local variable or type declaration shadows another
4843 variable, parameter, type, class member (in C++), or instance variable
4844 (in Objective-C) or whenever a built-in function is shadowed. Note
4845 that in C++, the compiler warns if a local variable shadows an
4846 explicit typedef, but not if it shadows a struct/class/enum.
4847
4848 @item -Wno-shadow-ivar @r{(Objective-C only)}
4849 @opindex Wno-shadow-ivar
4850 @opindex Wshadow-ivar
4851 Do not warn whenever a local variable shadows an instance variable in an
4852 Objective-C method.
4853
4854 @item -Wlarger-than=@var{len}
4855 @opindex Wlarger-than=@var{len}
4856 @opindex Wlarger-than-@var{len}
4857 Warn whenever an object of larger than @var{len} bytes is defined.
4858
4859 @item -Wframe-larger-than=@var{len}
4860 @opindex Wframe-larger-than
4861 Warn if the size of a function frame is larger than @var{len} bytes.
4862 The computation done to determine the stack frame size is approximate
4863 and not conservative.
4864 The actual requirements may be somewhat greater than @var{len}
4865 even if you do not get a warning. In addition, any space allocated
4866 via @code{alloca}, variable-length arrays, or related constructs
4867 is not included by the compiler when determining
4868 whether or not to issue a warning.
4869
4870 @item -Wno-free-nonheap-object
4871 @opindex Wno-free-nonheap-object
4872 @opindex Wfree-nonheap-object
4873 Do not warn when attempting to free an object that was not allocated
4874 on the heap.
4875
4876 @item -Wstack-usage=@var{len}
4877 @opindex Wstack-usage
4878 Warn if the stack usage of a function might be larger than @var{len} bytes.
4879 The computation done to determine the stack usage is conservative.
4880 Any space allocated via @code{alloca}, variable-length arrays, or related
4881 constructs is included by the compiler when determining whether or not to
4882 issue a warning.
4883
4884 The message is in keeping with the output of @option{-fstack-usage}.
4885
4886 @itemize
4887 @item
4888 If the stack usage is fully static but exceeds the specified amount, it's:
4889
4890 @smallexample
4891 warning: stack usage is 1120 bytes
4892 @end smallexample
4893 @item
4894 If the stack usage is (partly) dynamic but bounded, it's:
4895
4896 @smallexample
4897 warning: stack usage might be 1648 bytes
4898 @end smallexample
4899 @item
4900 If the stack usage is (partly) dynamic and not bounded, it's:
4901
4902 @smallexample
4903 warning: stack usage might be unbounded
4904 @end smallexample
4905 @end itemize
4906
4907 @item -Wunsafe-loop-optimizations
4908 @opindex Wunsafe-loop-optimizations
4909 @opindex Wno-unsafe-loop-optimizations
4910 Warn if the loop cannot be optimized because the compiler cannot
4911 assume anything on the bounds of the loop indices. With
4912 @option{-funsafe-loop-optimizations} warn if the compiler makes
4913 such assumptions.
4914
4915 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
4916 @opindex Wno-pedantic-ms-format
4917 @opindex Wpedantic-ms-format
4918 When used in combination with @option{-Wformat}
4919 and @option{-pedantic} without GNU extensions, this option
4920 disables the warnings about non-ISO @code{printf} / @code{scanf} format
4921 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
4922 which depend on the MS runtime.
4923
4924 @item -Wplacement-new
4925 @itemx -Wplacement-new=@var{n}
4926 @opindex Wplacement-new
4927 @opindex Wno-placement-new
4928 Warn about placement new expressions with undefined behavior, such as
4929 constructing an object in a buffer that is smaller than the type of
4930 the object. For example, the placement new expression below is diagnosed
4931 because it attempts to construct an array of 64 integers in a buffer only
4932 64 bytes large.
4933 @smallexample
4934 char buf [64];
4935 new (buf) int[64];
4936 @end smallexample
4937 This warning is enabled by default.
4938
4939 @table @gcctabopt
4940 @item -Wplacement-new=1
4941 This is the default warning level of @option{-Wplacement-new}. At this
4942 level the warning is not issued for some strictly undefined constructs that
4943 GCC allows as extensions for compatibility with legacy code. For example,
4944 the following @code{new} expression is not diagnosed at this level even
4945 though it has undefined behavior according to the C++ standard because
4946 it writes past the end of the one-element array.
4947 @smallexample
4948 struct S @{ int n, a[1]; @};
4949 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4950 new (s->a)int [32]();
4951 @end smallexample
4952
4953 @item -Wplacement-new=2
4954 At this level, in addition to diagnosing all the same constructs as at level
4955 1, a diagnostic is also issued for placement new expressions that construct
4956 an object in the last member of structure whose type is an array of a single
4957 element and whose size is less than the size of the object being constructed.
4958 While the previous example would be diagnosed, the following construct makes
4959 use of the flexible member array extension to avoid the warning at level 2.
4960 @smallexample
4961 struct S @{ int n, a[]; @};
4962 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4963 new (s->a)int [32]();
4964 @end smallexample
4965
4966 @end table
4967
4968 @item -Wpointer-arith
4969 @opindex Wpointer-arith
4970 @opindex Wno-pointer-arith
4971 Warn about anything that depends on the ``size of'' a function type or
4972 of @code{void}. GNU C assigns these types a size of 1, for
4973 convenience in calculations with @code{void *} pointers and pointers
4974 to functions. In C++, warn also when an arithmetic operation involves
4975 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
4976
4977 @item -Wtype-limits
4978 @opindex Wtype-limits
4979 @opindex Wno-type-limits
4980 Warn if a comparison is always true or always false due to the limited
4981 range of the data type, but do not warn for constant expressions. For
4982 example, warn if an unsigned variable is compared against zero with
4983 @code{<} or @code{>=}. This warning is also enabled by
4984 @option{-Wextra}.
4985
4986 @item -Wbad-function-cast @r{(C and Objective-C only)}
4987 @opindex Wbad-function-cast
4988 @opindex Wno-bad-function-cast
4989 Warn when a function call is cast to a non-matching type.
4990 For example, warn if a call to a function returning an integer type
4991 is cast to a pointer type.
4992
4993 @item -Wc90-c99-compat @r{(C and Objective-C only)}
4994 @opindex Wc90-c99-compat
4995 @opindex Wno-c90-c99-compat
4996 Warn about features not present in ISO C90, but present in ISO C99.
4997 For instance, warn about use of variable length arrays, @code{long long}
4998 type, @code{bool} type, compound literals, designated initializers, and so
4999 on. This option is independent of the standards mode. Warnings are disabled
5000 in the expression that follows @code{__extension__}.
5001
5002 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5003 @opindex Wc99-c11-compat
5004 @opindex Wno-c99-c11-compat
5005 Warn about features not present in ISO C99, but present in ISO C11.
5006 For instance, warn about use of anonymous structures and unions,
5007 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5008 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5009 and so on. This option is independent of the standards mode. Warnings are
5010 disabled in the expression that follows @code{__extension__}.
5011
5012 @item -Wc++-compat @r{(C and Objective-C only)}
5013 @opindex Wc++-compat
5014 Warn about ISO C constructs that are outside of the common subset of
5015 ISO C and ISO C++, e.g.@: request for implicit conversion from
5016 @code{void *} to a pointer to non-@code{void} type.
5017
5018 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5019 @opindex Wc++11-compat
5020 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5021 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5022 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5023 enabled by @option{-Wall}.
5024
5025 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5026 @opindex Wc++14-compat
5027 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5028 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5029
5030 @item -Wcast-qual
5031 @opindex Wcast-qual
5032 @opindex Wno-cast-qual
5033 Warn whenever a pointer is cast so as to remove a type qualifier from
5034 the target type. For example, warn if a @code{const char *} is cast
5035 to an ordinary @code{char *}.
5036
5037 Also warn when making a cast that introduces a type qualifier in an
5038 unsafe way. For example, casting @code{char **} to @code{const char **}
5039 is unsafe, as in this example:
5040
5041 @smallexample
5042 /* p is char ** value. */
5043 const char **q = (const char **) p;
5044 /* Assignment of readonly string to const char * is OK. */
5045 *q = "string";
5046 /* Now char** pointer points to read-only memory. */
5047 **p = 'b';
5048 @end smallexample
5049
5050 @item -Wcast-align
5051 @opindex Wcast-align
5052 @opindex Wno-cast-align
5053 Warn whenever a pointer is cast such that the required alignment of the
5054 target is increased. For example, warn if a @code{char *} is cast to
5055 an @code{int *} on machines where integers can only be accessed at
5056 two- or four-byte boundaries.
5057
5058 @item -Wwrite-strings
5059 @opindex Wwrite-strings
5060 @opindex Wno-write-strings
5061 When compiling C, give string constants the type @code{const
5062 char[@var{length}]} so that copying the address of one into a
5063 non-@code{const} @code{char *} pointer produces a warning. These
5064 warnings help you find at compile time code that can try to write
5065 into a string constant, but only if you have been very careful about
5066 using @code{const} in declarations and prototypes. Otherwise, it is
5067 just a nuisance. This is why we did not make @option{-Wall} request
5068 these warnings.
5069
5070 When compiling C++, warn about the deprecated conversion from string
5071 literals to @code{char *}. This warning is enabled by default for C++
5072 programs.
5073
5074 @item -Wclobbered
5075 @opindex Wclobbered
5076 @opindex Wno-clobbered
5077 Warn for variables that might be changed by @code{longjmp} or
5078 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5079
5080 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5081 @opindex Wconditionally-supported
5082 @opindex Wno-conditionally-supported
5083 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5084
5085 @item -Wconversion
5086 @opindex Wconversion
5087 @opindex Wno-conversion
5088 Warn for implicit conversions that may alter a value. This includes
5089 conversions between real and integer, like @code{abs (x)} when
5090 @code{x} is @code{double}; conversions between signed and unsigned,
5091 like @code{unsigned ui = -1}; and conversions to smaller types, like
5092 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5093 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5094 changed by the conversion like in @code{abs (2.0)}. Warnings about
5095 conversions between signed and unsigned integers can be disabled by
5096 using @option{-Wno-sign-conversion}.
5097
5098 For C++, also warn for confusing overload resolution for user-defined
5099 conversions; and conversions that never use a type conversion
5100 operator: conversions to @code{void}, the same type, a base class or a
5101 reference to them. Warnings about conversions between signed and
5102 unsigned integers are disabled by default in C++ unless
5103 @option{-Wsign-conversion} is explicitly enabled.
5104
5105 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5106 @opindex Wconversion-null
5107 @opindex Wno-conversion-null
5108 Do not warn for conversions between @code{NULL} and non-pointer
5109 types. @option{-Wconversion-null} is enabled by default.
5110
5111 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5112 @opindex Wzero-as-null-pointer-constant
5113 @opindex Wno-zero-as-null-pointer-constant
5114 Warn when a literal @samp{0} is used as null pointer constant. This can
5115 be useful to facilitate the conversion to @code{nullptr} in C++11.
5116
5117 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5118 @opindex Wsubobject-linkage
5119 @opindex Wno-subobject-linkage
5120 Warn if a class type has a base or a field whose type uses the anonymous
5121 namespace or depends on a type with no linkage. If a type A depends on
5122 a type B with no or internal linkage, defining it in multiple
5123 translation units would be an ODR violation because the meaning of B
5124 is different in each translation unit. If A only appears in a single
5125 translation unit, the best way to silence the warning is to give it
5126 internal linkage by putting it in an anonymous namespace as well. The
5127 compiler doesn't give this warning for types defined in the main .C
5128 file, as those are unlikely to have multiple definitions.
5129 @option{-Wsubobject-linkage} is enabled by default.
5130
5131 @item -Wdate-time
5132 @opindex Wdate-time
5133 @opindex Wno-date-time
5134 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5135 are encountered as they might prevent bit-wise-identical reproducible
5136 compilations.
5137
5138 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5139 @opindex Wdelete-incomplete
5140 @opindex Wno-delete-incomplete
5141 Warn when deleting a pointer to incomplete type, which may cause
5142 undefined behavior at runtime. This warning is enabled by default.
5143
5144 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5145 @opindex Wuseless-cast
5146 @opindex Wno-useless-cast
5147 Warn when an expression is casted to its own type.
5148
5149 @item -Wempty-body
5150 @opindex Wempty-body
5151 @opindex Wno-empty-body
5152 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5153 while} statement. This warning is also enabled by @option{-Wextra}.
5154
5155 @item -Wenum-compare
5156 @opindex Wenum-compare
5157 @opindex Wno-enum-compare
5158 Warn about a comparison between values of different enumerated types.
5159 In C++ enumeral mismatches in conditional expressions are also
5160 diagnosed and the warning is enabled by default. In C this warning is
5161 enabled by @option{-Wall}.
5162
5163 @item -Wjump-misses-init @r{(C, Objective-C only)}
5164 @opindex Wjump-misses-init
5165 @opindex Wno-jump-misses-init
5166 Warn if a @code{goto} statement or a @code{switch} statement jumps
5167 forward across the initialization of a variable, or jumps backward to a
5168 label after the variable has been initialized. This only warns about
5169 variables that are initialized when they are declared. This warning is
5170 only supported for C and Objective-C; in C++ this sort of branch is an
5171 error in any case.
5172
5173 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5174 can be disabled with the @option{-Wno-jump-misses-init} option.
5175
5176 @item -Wsign-compare
5177 @opindex Wsign-compare
5178 @opindex Wno-sign-compare
5179 @cindex warning for comparison of signed and unsigned values
5180 @cindex comparison of signed and unsigned values, warning
5181 @cindex signed and unsigned values, comparison warning
5182 Warn when a comparison between signed and unsigned values could produce
5183 an incorrect result when the signed value is converted to unsigned.
5184 In C++, this warning is also enabled by @option{-Wall}. In C, it is
5185 also enabled by @option{-Wextra}.
5186
5187 @item -Wsign-conversion
5188 @opindex Wsign-conversion
5189 @opindex Wno-sign-conversion
5190 Warn for implicit conversions that may change the sign of an integer
5191 value, like assigning a signed integer expression to an unsigned
5192 integer variable. An explicit cast silences the warning. In C, this
5193 option is enabled also by @option{-Wconversion}.
5194
5195 @item -Wfloat-conversion
5196 @opindex Wfloat-conversion
5197 @opindex Wno-float-conversion
5198 Warn for implicit conversions that reduce the precision of a real value.
5199 This includes conversions from real to integer, and from higher precision
5200 real to lower precision real values. This option is also enabled by
5201 @option{-Wconversion}.
5202
5203 @item -Wno-scalar-storage-order
5204 @opindex -Wno-scalar-storage-order
5205 @opindex -Wscalar-storage-order
5206 Do not warn on suspicious constructs involving reverse scalar storage order.
5207
5208 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
5209 @opindex Wsized-deallocation
5210 @opindex Wno-sized-deallocation
5211 Warn about a definition of an unsized deallocation function
5212 @smallexample
5213 void operator delete (void *) noexcept;
5214 void operator delete[] (void *) noexcept;
5215 @end smallexample
5216 without a definition of the corresponding sized deallocation function
5217 @smallexample
5218 void operator delete (void *, std::size_t) noexcept;
5219 void operator delete[] (void *, std::size_t) noexcept;
5220 @end smallexample
5221 or vice versa. Enabled by @option{-Wextra} along with
5222 @option{-fsized-deallocation}.
5223
5224 @item -Wsizeof-pointer-memaccess
5225 @opindex Wsizeof-pointer-memaccess
5226 @opindex Wno-sizeof-pointer-memaccess
5227 Warn for suspicious length parameters to certain string and memory built-in
5228 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
5229 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
5230 but a pointer, and suggests a possible fix, or about
5231 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
5232 @option{-Wall}.
5233
5234 @item -Wsizeof-array-argument
5235 @opindex Wsizeof-array-argument
5236 @opindex Wno-sizeof-array-argument
5237 Warn when the @code{sizeof} operator is applied to a parameter that is
5238 declared as an array in a function definition. This warning is enabled by
5239 default for C and C++ programs.
5240
5241 @item -Wmemset-transposed-args
5242 @opindex Wmemset-transposed-args
5243 @opindex Wno-memset-transposed-args
5244 Warn for suspicious calls to the @code{memset} built-in function, if the
5245 second argument is not zero and the third argument is zero. This warns e.g.@
5246 about @code{memset (buf, sizeof buf, 0)} where most probably
5247 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
5248 is only emitted if the third argument is literal zero. If it is some
5249 expression that is folded to zero, a cast of zero to some type, etc.,
5250 it is far less likely that the user has mistakenly exchanged the arguments
5251 and no warning is emitted. This warning is enabled by @option{-Wall}.
5252
5253 @item -Waddress
5254 @opindex Waddress
5255 @opindex Wno-address
5256 Warn about suspicious uses of memory addresses. These include using
5257 the address of a function in a conditional expression, such as
5258 @code{void func(void); if (func)}, and comparisons against the memory
5259 address of a string literal, such as @code{if (x == "abc")}. Such
5260 uses typically indicate a programmer error: the address of a function
5261 always evaluates to true, so their use in a conditional usually
5262 indicate that the programmer forgot the parentheses in a function
5263 call; and comparisons against string literals result in unspecified
5264 behavior and are not portable in C, so they usually indicate that the
5265 programmer intended to use @code{strcmp}. This warning is enabled by
5266 @option{-Wall}.
5267
5268 @item -Wlogical-op
5269 @opindex Wlogical-op
5270 @opindex Wno-logical-op
5271 Warn about suspicious uses of logical operators in expressions.
5272 This includes using logical operators in contexts where a
5273 bit-wise operator is likely to be expected. Also warns when
5274 the operands of a logical operator are the same:
5275 @smallexample
5276 extern int a;
5277 if (a < 0 && a < 0) @{ @dots{} @}
5278 @end smallexample
5279
5280 @item -Wlogical-not-parentheses
5281 @opindex Wlogical-not-parentheses
5282 @opindex Wno-logical-not-parentheses
5283 Warn about logical not used on the left hand side operand of a comparison.
5284 This option does not warn if the RHS operand is of a boolean type. Its
5285 purpose is to detect suspicious code like the following:
5286 @smallexample
5287 int a;
5288 @dots{}
5289 if (!a > 1) @{ @dots{} @}
5290 @end smallexample
5291
5292 It is possible to suppress the warning by wrapping the LHS into
5293 parentheses:
5294 @smallexample
5295 if ((!a) > 1) @{ @dots{} @}
5296 @end smallexample
5297
5298 This warning is enabled by @option{-Wall}.
5299
5300 @item -Waggregate-return
5301 @opindex Waggregate-return
5302 @opindex Wno-aggregate-return
5303 Warn if any functions that return structures or unions are defined or
5304 called. (In languages where you can return an array, this also elicits
5305 a warning.)
5306
5307 @item -Wno-aggressive-loop-optimizations
5308 @opindex Wno-aggressive-loop-optimizations
5309 @opindex Waggressive-loop-optimizations
5310 Warn if in a loop with constant number of iterations the compiler detects
5311 undefined behavior in some statement during one or more of the iterations.
5312
5313 @item -Wno-attributes
5314 @opindex Wno-attributes
5315 @opindex Wattributes
5316 Do not warn if an unexpected @code{__attribute__} is used, such as
5317 unrecognized attributes, function attributes applied to variables,
5318 etc. This does not stop errors for incorrect use of supported
5319 attributes.
5320
5321 @item -Wno-builtin-macro-redefined
5322 @opindex Wno-builtin-macro-redefined
5323 @opindex Wbuiltin-macro-redefined
5324 Do not warn if certain built-in macros are redefined. This suppresses
5325 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
5326 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
5327
5328 @item -Wstrict-prototypes @r{(C and Objective-C only)}
5329 @opindex Wstrict-prototypes
5330 @opindex Wno-strict-prototypes
5331 Warn if a function is declared or defined without specifying the
5332 argument types. (An old-style function definition is permitted without
5333 a warning if preceded by a declaration that specifies the argument
5334 types.)
5335
5336 @item -Wold-style-declaration @r{(C and Objective-C only)}
5337 @opindex Wold-style-declaration
5338 @opindex Wno-old-style-declaration
5339 Warn for obsolescent usages, according to the C Standard, in a
5340 declaration. For example, warn if storage-class specifiers like
5341 @code{static} are not the first things in a declaration. This warning
5342 is also enabled by @option{-Wextra}.
5343
5344 @item -Wold-style-definition @r{(C and Objective-C only)}
5345 @opindex Wold-style-definition
5346 @opindex Wno-old-style-definition
5347 Warn if an old-style function definition is used. A warning is given
5348 even if there is a previous prototype.
5349
5350 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5351 @opindex Wmissing-parameter-type
5352 @opindex Wno-missing-parameter-type
5353 A function parameter is declared without a type specifier in K&R-style
5354 functions:
5355
5356 @smallexample
5357 void foo(bar) @{ @}
5358 @end smallexample
5359
5360 This warning is also enabled by @option{-Wextra}.
5361
5362 @item -Wmissing-prototypes @r{(C and Objective-C only)}
5363 @opindex Wmissing-prototypes
5364 @opindex Wno-missing-prototypes
5365 Warn if a global function is defined without a previous prototype
5366 declaration. This warning is issued even if the definition itself
5367 provides a prototype. Use this option to detect global functions
5368 that do not have a matching prototype declaration in a header file.
5369 This option is not valid for C++ because all function declarations
5370 provide prototypes and a non-matching declaration declares an
5371 overload rather than conflict with an earlier declaration.
5372 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
5373
5374 @item -Wmissing-declarations
5375 @opindex Wmissing-declarations
5376 @opindex Wno-missing-declarations
5377 Warn if a global function is defined without a previous declaration.
5378 Do so even if the definition itself provides a prototype.
5379 Use this option to detect global functions that are not declared in
5380 header files. In C, no warnings are issued for functions with previous
5381 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
5382 missing prototypes. In C++, no warnings are issued for function templates,
5383 or for inline functions, or for functions in anonymous namespaces.
5384
5385 @item -Wmissing-field-initializers
5386 @opindex Wmissing-field-initializers
5387 @opindex Wno-missing-field-initializers
5388 @opindex W
5389 @opindex Wextra
5390 @opindex Wno-extra
5391 Warn if a structure's initializer has some fields missing. For
5392 example, the following code causes such a warning, because
5393 @code{x.h} is implicitly zero:
5394
5395 @smallexample
5396 struct s @{ int f, g, h; @};
5397 struct s x = @{ 3, 4 @};
5398 @end smallexample
5399
5400 This option does not warn about designated initializers, so the following
5401 modification does not trigger a warning:
5402
5403 @smallexample
5404 struct s @{ int f, g, h; @};
5405 struct s x = @{ .f = 3, .g = 4 @};
5406 @end smallexample
5407
5408 In C++ this option does not warn either about the empty @{ @}
5409 initializer, for example:
5410
5411 @smallexample
5412 struct s @{ int f, g, h; @};
5413 s x = @{ @};
5414 @end smallexample
5415
5416 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
5417 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
5418
5419 @item -Wno-multichar
5420 @opindex Wno-multichar
5421 @opindex Wmultichar
5422 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
5423 Usually they indicate a typo in the user's code, as they have
5424 implementation-defined values, and should not be used in portable code.
5425
5426 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
5427 @opindex Wnormalized=
5428 @opindex Wnormalized
5429 @opindex Wno-normalized
5430 @cindex NFC
5431 @cindex NFKC
5432 @cindex character set, input normalization
5433 In ISO C and ISO C++, two identifiers are different if they are
5434 different sequences of characters. However, sometimes when characters
5435 outside the basic ASCII character set are used, you can have two
5436 different character sequences that look the same. To avoid confusion,
5437 the ISO 10646 standard sets out some @dfn{normalization rules} which
5438 when applied ensure that two sequences that look the same are turned into
5439 the same sequence. GCC can warn you if you are using identifiers that
5440 have not been normalized; this option controls that warning.
5441
5442 There are four levels of warning supported by GCC@. The default is
5443 @option{-Wnormalized=nfc}, which warns about any identifier that is
5444 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
5445 recommended form for most uses. It is equivalent to
5446 @option{-Wnormalized}.
5447
5448 Unfortunately, there are some characters allowed in identifiers by
5449 ISO C and ISO C++ that, when turned into NFC, are not allowed in
5450 identifiers. That is, there's no way to use these symbols in portable
5451 ISO C or C++ and have all your identifiers in NFC@.
5452 @option{-Wnormalized=id} suppresses the warning for these characters.
5453 It is hoped that future versions of the standards involved will correct
5454 this, which is why this option is not the default.
5455
5456 You can switch the warning off for all characters by writing
5457 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
5458 only do this if you are using some other normalization scheme (like
5459 ``D''), because otherwise you can easily create bugs that are
5460 literally impossible to see.
5461
5462 Some characters in ISO 10646 have distinct meanings but look identical
5463 in some fonts or display methodologies, especially once formatting has
5464 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
5465 LETTER N'', displays just like a regular @code{n} that has been
5466 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
5467 normalization scheme to convert all these into a standard form as
5468 well, and GCC warns if your code is not in NFKC if you use
5469 @option{-Wnormalized=nfkc}. This warning is comparable to warning
5470 about every identifier that contains the letter O because it might be
5471 confused with the digit 0, and so is not the default, but may be
5472 useful as a local coding convention if the programming environment
5473 cannot be fixed to display these characters distinctly.
5474
5475 @item -Wno-deprecated
5476 @opindex Wno-deprecated
5477 @opindex Wdeprecated
5478 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
5479
5480 @item -Wno-deprecated-declarations
5481 @opindex Wno-deprecated-declarations
5482 @opindex Wdeprecated-declarations
5483 Do not warn about uses of functions (@pxref{Function Attributes}),
5484 variables (@pxref{Variable Attributes}), and types (@pxref{Type
5485 Attributes}) marked as deprecated by using the @code{deprecated}
5486 attribute.
5487
5488 @item -Wno-overflow
5489 @opindex Wno-overflow
5490 @opindex Woverflow
5491 Do not warn about compile-time overflow in constant expressions.
5492
5493 @item -Wno-odr
5494 @opindex Wno-odr
5495 @opindex Wodr
5496 Warn about One Definition Rule violations during link-time optimization.
5497 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
5498
5499 @item -Wopenmp-simd
5500 @opindex Wopenm-simd
5501 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
5502 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
5503 option can be used to relax the cost model.
5504
5505 @item -Woverride-init @r{(C and Objective-C only)}
5506 @opindex Woverride-init
5507 @opindex Wno-override-init
5508 @opindex W
5509 @opindex Wextra
5510 @opindex Wno-extra
5511 Warn if an initialized field without side effects is overridden when
5512 using designated initializers (@pxref{Designated Inits, , Designated
5513 Initializers}).
5514
5515 This warning is included in @option{-Wextra}. To get other
5516 @option{-Wextra} warnings without this one, use @option{-Wextra
5517 -Wno-override-init}.
5518
5519 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
5520 @opindex Woverride-init-side-effects
5521 @opindex Wno-override-init-side-effects
5522 Warn if an initialized field with side effects is overridden when
5523 using designated initializers (@pxref{Designated Inits, , Designated
5524 Initializers}). This warning is enabled by default.
5525
5526 @item -Wpacked
5527 @opindex Wpacked
5528 @opindex Wno-packed
5529 Warn if a structure is given the packed attribute, but the packed
5530 attribute has no effect on the layout or size of the structure.
5531 Such structures may be mis-aligned for little benefit. For
5532 instance, in this code, the variable @code{f.x} in @code{struct bar}
5533 is misaligned even though @code{struct bar} does not itself
5534 have the packed attribute:
5535
5536 @smallexample
5537 @group
5538 struct foo @{
5539 int x;
5540 char a, b, c, d;
5541 @} __attribute__((packed));
5542 struct bar @{
5543 char z;
5544 struct foo f;
5545 @};
5546 @end group
5547 @end smallexample
5548
5549 @item -Wpacked-bitfield-compat
5550 @opindex Wpacked-bitfield-compat
5551 @opindex Wno-packed-bitfield-compat
5552 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
5553 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
5554 the change can lead to differences in the structure layout. GCC
5555 informs you when the offset of such a field has changed in GCC 4.4.
5556 For example there is no longer a 4-bit padding between field @code{a}
5557 and @code{b} in this structure:
5558
5559 @smallexample
5560 struct foo
5561 @{
5562 char a:4;
5563 char b:8;
5564 @} __attribute__ ((packed));
5565 @end smallexample
5566
5567 This warning is enabled by default. Use
5568 @option{-Wno-packed-bitfield-compat} to disable this warning.
5569
5570 @item -Wpadded
5571 @opindex Wpadded
5572 @opindex Wno-padded
5573 Warn if padding is included in a structure, either to align an element
5574 of the structure or to align the whole structure. Sometimes when this
5575 happens it is possible to rearrange the fields of the structure to
5576 reduce the padding and so make the structure smaller.
5577
5578 @item -Wredundant-decls
5579 @opindex Wredundant-decls
5580 @opindex Wno-redundant-decls
5581 Warn if anything is declared more than once in the same scope, even in
5582 cases where multiple declaration is valid and changes nothing.
5583
5584 @item -Wnested-externs @r{(C and Objective-C only)}
5585 @opindex Wnested-externs
5586 @opindex Wno-nested-externs
5587 Warn if an @code{extern} declaration is encountered within a function.
5588
5589 @item -Wno-inherited-variadic-ctor
5590 @opindex Winherited-variadic-ctor
5591 @opindex Wno-inherited-variadic-ctor
5592 Suppress warnings about use of C++11 inheriting constructors when the
5593 base class inherited from has a C variadic constructor; the warning is
5594 on by default because the ellipsis is not inherited.
5595
5596 @item -Winline
5597 @opindex Winline
5598 @opindex Wno-inline
5599 Warn if a function that is declared as inline cannot be inlined.
5600 Even with this option, the compiler does not warn about failures to
5601 inline functions declared in system headers.
5602
5603 The compiler uses a variety of heuristics to determine whether or not
5604 to inline a function. For example, the compiler takes into account
5605 the size of the function being inlined and the amount of inlining
5606 that has already been done in the current function. Therefore,
5607 seemingly insignificant changes in the source program can cause the
5608 warnings produced by @option{-Winline} to appear or disappear.
5609
5610 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
5611 @opindex Wno-invalid-offsetof
5612 @opindex Winvalid-offsetof
5613 Suppress warnings from applying the @code{offsetof} macro to a non-POD
5614 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
5615 to a non-standard-layout type is undefined. In existing C++ implementations,
5616 however, @code{offsetof} typically gives meaningful results.
5617 This flag is for users who are aware that they are
5618 writing nonportable code and who have deliberately chosen to ignore the
5619 warning about it.
5620
5621 The restrictions on @code{offsetof} may be relaxed in a future version
5622 of the C++ standard.
5623
5624 @item -Wno-int-to-pointer-cast
5625 @opindex Wno-int-to-pointer-cast
5626 @opindex Wint-to-pointer-cast
5627 Suppress warnings from casts to pointer type of an integer of a
5628 different size. In C++, casting to a pointer type of smaller size is
5629 an error. @option{Wint-to-pointer-cast} is enabled by default.
5630
5631
5632 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
5633 @opindex Wno-pointer-to-int-cast
5634 @opindex Wpointer-to-int-cast
5635 Suppress warnings from casts from a pointer to an integer type of a
5636 different size.
5637
5638 @item -Winvalid-pch
5639 @opindex Winvalid-pch
5640 @opindex Wno-invalid-pch
5641 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
5642 the search path but can't be used.
5643
5644 @item -Wlong-long
5645 @opindex Wlong-long
5646 @opindex Wno-long-long
5647 Warn if @code{long long} type is used. This is enabled by either
5648 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
5649 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
5650
5651 @item -Wvariadic-macros
5652 @opindex Wvariadic-macros
5653 @opindex Wno-variadic-macros
5654 Warn if variadic macros are used in ISO C90 mode, or if the GNU
5655 alternate syntax is used in ISO C99 mode. This is enabled by either
5656 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
5657 messages, use @option{-Wno-variadic-macros}.
5658
5659 @item -Wvarargs
5660 @opindex Wvarargs
5661 @opindex Wno-varargs
5662 Warn upon questionable usage of the macros used to handle variable
5663 arguments like @code{va_start}. This is default. To inhibit the
5664 warning messages, use @option{-Wno-varargs}.
5665
5666 @item -Wvector-operation-performance
5667 @opindex Wvector-operation-performance
5668 @opindex Wno-vector-operation-performance
5669 Warn if vector operation is not implemented via SIMD capabilities of the
5670 architecture. Mainly useful for the performance tuning.
5671 Vector operation can be implemented @code{piecewise}, which means that the
5672 scalar operation is performed on every vector element;
5673 @code{in parallel}, which means that the vector operation is implemented
5674 using scalars of wider type, which normally is more performance efficient;
5675 and @code{as a single scalar}, which means that vector fits into a
5676 scalar type.
5677
5678 @item -Wno-virtual-move-assign
5679 @opindex Wvirtual-move-assign
5680 @opindex Wno-virtual-move-assign
5681 Suppress warnings about inheriting from a virtual base with a
5682 non-trivial C++11 move assignment operator. This is dangerous because
5683 if the virtual base is reachable along more than one path, it is
5684 moved multiple times, which can mean both objects end up in the
5685 moved-from state. If the move assignment operator is written to avoid
5686 moving from a moved-from object, this warning can be disabled.
5687
5688 @item -Wvla
5689 @opindex Wvla
5690 @opindex Wno-vla
5691 Warn if variable length array is used in the code.
5692 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
5693 the variable length array.
5694
5695 @item -Wvolatile-register-var
5696 @opindex Wvolatile-register-var
5697 @opindex Wno-volatile-register-var
5698 Warn if a register variable is declared volatile. The volatile
5699 modifier does not inhibit all optimizations that may eliminate reads
5700 and/or writes to register variables. This warning is enabled by
5701 @option{-Wall}.
5702
5703 @item -Wdisabled-optimization
5704 @opindex Wdisabled-optimization
5705 @opindex Wno-disabled-optimization
5706 Warn if a requested optimization pass is disabled. This warning does
5707 not generally indicate that there is anything wrong with your code; it
5708 merely indicates that GCC's optimizers are unable to handle the code
5709 effectively. Often, the problem is that your code is too big or too
5710 complex; GCC refuses to optimize programs when the optimization
5711 itself is likely to take inordinate amounts of time.
5712
5713 @item -Wpointer-sign @r{(C and Objective-C only)}
5714 @opindex Wpointer-sign
5715 @opindex Wno-pointer-sign
5716 Warn for pointer argument passing or assignment with different signedness.
5717 This option is only supported for C and Objective-C@. It is implied by
5718 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
5719 @option{-Wno-pointer-sign}.
5720
5721 @item -Wstack-protector
5722 @opindex Wstack-protector
5723 @opindex Wno-stack-protector
5724 This option is only active when @option{-fstack-protector} is active. It
5725 warns about functions that are not protected against stack smashing.
5726
5727 @item -Woverlength-strings
5728 @opindex Woverlength-strings
5729 @opindex Wno-overlength-strings
5730 Warn about string constants that are longer than the ``minimum
5731 maximum'' length specified in the C standard. Modern compilers
5732 generally allow string constants that are much longer than the
5733 standard's minimum limit, but very portable programs should avoid
5734 using longer strings.
5735
5736 The limit applies @emph{after} string constant concatenation, and does
5737 not count the trailing NUL@. In C90, the limit was 509 characters; in
5738 C99, it was raised to 4095. C++98 does not specify a normative
5739 minimum maximum, so we do not diagnose overlength strings in C++@.
5740
5741 This option is implied by @option{-Wpedantic}, and can be disabled with
5742 @option{-Wno-overlength-strings}.
5743
5744 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
5745 @opindex Wunsuffixed-float-constants
5746
5747 Issue a warning for any floating constant that does not have
5748 a suffix. When used together with @option{-Wsystem-headers} it
5749 warns about such constants in system header files. This can be useful
5750 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
5751 from the decimal floating-point extension to C99.
5752
5753 @item -Wno-designated-init @r{(C and Objective-C only)}
5754 Suppress warnings when a positional initializer is used to initialize
5755 a structure that has been marked with the @code{designated_init}
5756 attribute.
5757
5758 @item -Whsa
5759 Issue a warning when HSAIL cannot be emitted for the compiled function or
5760 OpenMP construct.
5761
5762 @end table
5763
5764 @node Debugging Options
5765 @section Options for Debugging Your Program
5766 @cindex options, debugging
5767 @cindex debugging information options
5768
5769 To tell GCC to emit extra information for use by a debugger, in almost
5770 all cases you need only to add @option{-g} to your other options.
5771
5772 GCC allows you to use @option{-g} with
5773 @option{-O}. The shortcuts taken by optimized code may occasionally
5774 be surprising: some variables you declared may not exist
5775 at all; flow of control may briefly move where you did not expect it;
5776 some statements may not be executed because they compute constant
5777 results or their values are already at hand; some statements may
5778 execute in different places because they have been moved out of loops.
5779 Nevertheless it is possible to debug optimized output. This makes
5780 it reasonable to use the optimizer for programs that might have bugs.
5781
5782 If you are not using some other optimization option, consider
5783 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
5784 With no @option{-O} option at all, some compiler passes that collect
5785 information useful for debugging do not run at all, so that
5786 @option{-Og} may result in a better debugging experience.
5787
5788 @table @gcctabopt
5789 @item -g
5790 @opindex g
5791 Produce debugging information in the operating system's native format
5792 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
5793 information.
5794
5795 On most systems that use stabs format, @option{-g} enables use of extra
5796 debugging information that only GDB can use; this extra information
5797 makes debugging work better in GDB but probably makes other debuggers
5798 crash or
5799 refuse to read the program. If you want to control for certain whether
5800 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
5801 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
5802
5803 @item -ggdb
5804 @opindex ggdb
5805 Produce debugging information for use by GDB@. This means to use the
5806 most expressive format available (DWARF, stabs, or the native format
5807 if neither of those are supported), including GDB extensions if at all
5808 possible.
5809
5810 @item -gdwarf
5811 @itemx -gdwarf-@var{version}
5812 @opindex gdwarf
5813 Produce debugging information in DWARF format (if that is supported).
5814 The value of @var{version} may be either 2, 3, 4 or 5; the default version
5815 for most targets is 4. DWARF Version 5 is only experimental.
5816
5817 Note that with DWARF Version 2, some ports require and always
5818 use some non-conflicting DWARF 3 extensions in the unwind tables.
5819
5820 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
5821 for maximum benefit.
5822
5823 GCC no longer supports DWARF Version 1, which is substantially
5824 different than Version 2 and later. For historical reasons, some
5825 other DWARF-related options (including @option{-feliminate-dwarf2-dups}
5826 and @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
5827 in their names, but apply to all currently-supported versions of DWARF.
5828
5829 @item -gstabs
5830 @opindex gstabs
5831 Produce debugging information in stabs format (if that is supported),
5832 without GDB extensions. This is the format used by DBX on most BSD
5833 systems. On MIPS, Alpha and System V Release 4 systems this option
5834 produces stabs debugging output that is not understood by DBX or SDB@.
5835 On System V Release 4 systems this option requires the GNU assembler.
5836
5837 @item -gstabs+
5838 @opindex gstabs+
5839 Produce debugging information in stabs format (if that is supported),
5840 using GNU extensions understood only by the GNU debugger (GDB)@. The
5841 use of these extensions is likely to make other debuggers crash or
5842 refuse to read the program.
5843
5844 @item -gcoff
5845 @opindex gcoff
5846 Produce debugging information in COFF format (if that is supported).
5847 This is the format used by SDB on most System V systems prior to
5848 System V Release 4.
5849
5850 @item -gxcoff
5851 @opindex gxcoff
5852 Produce debugging information in XCOFF format (if that is supported).
5853 This is the format used by the DBX debugger on IBM RS/6000 systems.
5854
5855 @item -gxcoff+
5856 @opindex gxcoff+
5857 Produce debugging information in XCOFF format (if that is supported),
5858 using GNU extensions understood only by the GNU debugger (GDB)@. The
5859 use of these extensions is likely to make other debuggers crash or
5860 refuse to read the program, and may cause assemblers other than the GNU
5861 assembler (GAS) to fail with an error.
5862
5863 @item -gvms
5864 @opindex gvms
5865 Produce debugging information in Alpha/VMS debug format (if that is
5866 supported). This is the format used by DEBUG on Alpha/VMS systems.
5867
5868 @item -g@var{level}
5869 @itemx -ggdb@var{level}
5870 @itemx -gstabs@var{level}
5871 @itemx -gcoff@var{level}
5872 @itemx -gxcoff@var{level}
5873 @itemx -gvms@var{level}
5874 Request debugging information and also use @var{level} to specify how
5875 much information. The default level is 2.
5876
5877 Level 0 produces no debug information at all. Thus, @option{-g0} negates
5878 @option{-g}.
5879
5880 Level 1 produces minimal information, enough for making backtraces in
5881 parts of the program that you don't plan to debug. This includes
5882 descriptions of functions and external variables, and line number
5883 tables, but no information about local variables.
5884
5885 Level 3 includes extra information, such as all the macro definitions
5886 present in the program. Some debuggers support macro expansion when
5887 you use @option{-g3}.
5888
5889 @option{-gdwarf} does not accept a concatenated debug level, to avoid
5890 confusion with @option{-gdwarf-@var{level}}.
5891 Instead use an additional @option{-g@var{level}} option to change the
5892 debug level for DWARF.
5893
5894 @item -feliminate-unused-debug-symbols
5895 @opindex feliminate-unused-debug-symbols
5896 Produce debugging information in stabs format (if that is supported),
5897 for only symbols that are actually used.
5898
5899 @item -femit-class-debug-always
5900 @opindex femit-class-debug-always
5901 Instead of emitting debugging information for a C++ class in only one
5902 object file, emit it in all object files using the class. This option
5903 should be used only with debuggers that are unable to handle the way GCC
5904 normally emits debugging information for classes because using this
5905 option increases the size of debugging information by as much as a
5906 factor of two.
5907
5908 @item -fno-merge-debug-strings
5909 @opindex fmerge-debug-strings
5910 @opindex fno-merge-debug-strings
5911 Direct the linker to not merge together strings in the debugging
5912 information that are identical in different object files. Merging is
5913 not supported by all assemblers or linkers. Merging decreases the size
5914 of the debug information in the output file at the cost of increasing
5915 link processing time. Merging is enabled by default.
5916
5917 @item -fdebug-prefix-map=@var{old}=@var{new}
5918 @opindex fdebug-prefix-map
5919 When compiling files in directory @file{@var{old}}, record debugging
5920 information describing them as in @file{@var{new}} instead.
5921
5922 @item -fvar-tracking
5923 @opindex fvar-tracking
5924 Run variable tracking pass. It computes where variables are stored at each
5925 position in code. Better debugging information is then generated
5926 (if the debugging information format supports this information).
5927
5928 It is enabled by default when compiling with optimization (@option{-Os},
5929 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
5930 the debug info format supports it.
5931
5932 @item -fvar-tracking-assignments
5933 @opindex fvar-tracking-assignments
5934 @opindex fno-var-tracking-assignments
5935 Annotate assignments to user variables early in the compilation and
5936 attempt to carry the annotations over throughout the compilation all the
5937 way to the end, in an attempt to improve debug information while
5938 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
5939
5940 It can be enabled even if var-tracking is disabled, in which case
5941 annotations are created and maintained, but discarded at the end.
5942 By default, this flag is enabled together with @option{-fvar-tracking},
5943 except when selective scheduling is enabled.
5944
5945 @item -gsplit-dwarf
5946 @opindex gsplit-dwarf
5947 Separate as much DWARF debugging information as possible into a
5948 separate output file with the extension @file{.dwo}. This option allows
5949 the build system to avoid linking files with debug information. To
5950 be useful, this option requires a debugger capable of reading @file{.dwo}
5951 files.
5952
5953 @item -gpubnames
5954 @opindex gpubnames
5955 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
5956
5957 @item -ggnu-pubnames
5958 @opindex ggnu-pubnames
5959 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
5960 suitable for conversion into a GDB@ index. This option is only useful
5961 with a linker that can produce GDB@ index version 7.
5962
5963 @item -fdebug-types-section
5964 @opindex fdebug-types-section
5965 @opindex fno-debug-types-section
5966 When using DWARF Version 4 or higher, type DIEs can be put into
5967 their own @code{.debug_types} section instead of making them part of the
5968 @code{.debug_info} section. It is more efficient to put them in a separate
5969 comdat sections since the linker can then remove duplicates.
5970 But not all DWARF consumers support @code{.debug_types} sections yet
5971 and on some objects @code{.debug_types} produces larger instead of smaller
5972 debugging information.
5973
5974 @item -grecord-gcc-switches
5975 @item -gno-record-gcc-switches
5976 @opindex grecord-gcc-switches
5977 @opindex gno-record-gcc-switches
5978 This switch causes the command-line options used to invoke the
5979 compiler that may affect code generation to be appended to the
5980 DW_AT_producer attribute in DWARF debugging information. The options
5981 are concatenated with spaces separating them from each other and from
5982 the compiler version.
5983 It is enabled by default.
5984 See also @option{-frecord-gcc-switches} for another
5985 way of storing compiler options into the object file.
5986
5987 @item -gstrict-dwarf
5988 @opindex gstrict-dwarf
5989 Disallow using extensions of later DWARF standard version than selected
5990 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
5991 DWARF extensions from later standard versions is allowed.
5992
5993 @item -gno-strict-dwarf
5994 @opindex gno-strict-dwarf
5995 Allow using extensions of later DWARF standard version than selected with
5996 @option{-gdwarf-@var{version}}.
5997
5998 @item -gz@r{[}=@var{type}@r{]}
5999 @opindex gz
6000 Produce compressed debug sections in DWARF format, if that is supported.
6001 If @var{type} is not given, the default type depends on the capabilities
6002 of the assembler and linker used. @var{type} may be one of
6003 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
6004 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
6005 compression in traditional GNU format). If the linker doesn't support
6006 writing compressed debug sections, the option is rejected. Otherwise,
6007 if the assembler does not support them, @option{-gz} is silently ignored
6008 when producing object files.
6009
6010 @item -feliminate-dwarf2-dups
6011 @opindex feliminate-dwarf2-dups
6012 Compress DWARF debugging information by eliminating duplicated
6013 information about each symbol. This option only makes sense when
6014 generating DWARF debugging information.
6015
6016 @item -femit-struct-debug-baseonly
6017 @opindex femit-struct-debug-baseonly
6018 Emit debug information for struct-like types
6019 only when the base name of the compilation source file
6020 matches the base name of file in which the struct is defined.
6021
6022 This option substantially reduces the size of debugging information,
6023 but at significant potential loss in type information to the debugger.
6024 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6025 See @option{-femit-struct-debug-detailed} for more detailed control.
6026
6027 This option works only with DWARF debug output.
6028
6029 @item -femit-struct-debug-reduced
6030 @opindex femit-struct-debug-reduced
6031 Emit debug information for struct-like types
6032 only when the base name of the compilation source file
6033 matches the base name of file in which the type is defined,
6034 unless the struct is a template or defined in a system header.
6035
6036 This option significantly reduces the size of debugging information,
6037 with some potential loss in type information to the debugger.
6038 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6039 See @option{-femit-struct-debug-detailed} for more detailed control.
6040
6041 This option works only with DWARF debug output.
6042
6043 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6044 @opindex femit-struct-debug-detailed
6045 Specify the struct-like types
6046 for which the compiler generates debug information.
6047 The intent is to reduce duplicate struct debug information
6048 between different object files within the same program.
6049
6050 This option is a detailed version of
6051 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6052 which serves for most needs.
6053
6054 A specification has the syntax@*
6055 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6056
6057 The optional first word limits the specification to
6058 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6059 A struct type is used directly when it is the type of a variable, member.
6060 Indirect uses arise through pointers to structs.
6061 That is, when use of an incomplete struct is valid, the use is indirect.
6062 An example is
6063 @samp{struct one direct; struct two * indirect;}.
6064
6065 The optional second word limits the specification to
6066 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6067 Generic structs are a bit complicated to explain.
6068 For C++, these are non-explicit specializations of template classes,
6069 or non-template classes within the above.
6070 Other programming languages have generics,
6071 but @option{-femit-struct-debug-detailed} does not yet implement them.
6072
6073 The third word specifies the source files for those
6074 structs for which the compiler should emit debug information.
6075 The values @samp{none} and @samp{any} have the normal meaning.
6076 The value @samp{base} means that
6077 the base of name of the file in which the type declaration appears
6078 must match the base of the name of the main compilation file.
6079 In practice, this means that when compiling @file{foo.c}, debug information
6080 is generated for types declared in that file and @file{foo.h},
6081 but not other header files.
6082 The value @samp{sys} means those types satisfying @samp{base}
6083 or declared in system or compiler headers.
6084
6085 You may need to experiment to determine the best settings for your application.
6086
6087 The default is @option{-femit-struct-debug-detailed=all}.
6088
6089 This option works only with DWARF debug output.
6090
6091 @item -fno-dwarf2-cfi-asm
6092 @opindex fdwarf2-cfi-asm
6093 @opindex fno-dwarf2-cfi-asm
6094 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
6095 instead of using GAS @code{.cfi_*} directives.
6096
6097 @item -fno-eliminate-unused-debug-types
6098 @opindex feliminate-unused-debug-types
6099 @opindex fno-eliminate-unused-debug-types
6100 Normally, when producing DWARF output, GCC avoids producing debug symbol
6101 output for types that are nowhere used in the source file being compiled.
6102 Sometimes it is useful to have GCC emit debugging
6103 information for all types declared in a compilation
6104 unit, regardless of whether or not they are actually used
6105 in that compilation unit, for example
6106 if, in the debugger, you want to cast a value to a type that is
6107 not actually used in your program (but is declared). More often,
6108 however, this results in a significant amount of wasted space.
6109 @end table
6110
6111 @node Optimize Options
6112 @section Options That Control Optimization
6113 @cindex optimize options
6114 @cindex options, optimization
6115
6116 These options control various sorts of optimizations.
6117
6118 Without any optimization option, the compiler's goal is to reduce the
6119 cost of compilation and to make debugging produce the expected
6120 results. Statements are independent: if you stop the program with a
6121 breakpoint between statements, you can then assign a new value to any
6122 variable or change the program counter to any other statement in the
6123 function and get exactly the results you expect from the source
6124 code.
6125
6126 Turning on optimization flags makes the compiler attempt to improve
6127 the performance and/or code size at the expense of compilation time
6128 and possibly the ability to debug the program.
6129
6130 The compiler performs optimization based on the knowledge it has of the
6131 program. Compiling multiple files at once to a single output file mode allows
6132 the compiler to use information gained from all of the files when compiling
6133 each of them.
6134
6135 Not all optimizations are controlled directly by a flag. Only
6136 optimizations that have a flag are listed in this section.
6137
6138 Most optimizations are only enabled if an @option{-O} level is set on
6139 the command line. Otherwise they are disabled, even if individual
6140 optimization flags are specified.
6141
6142 Depending on the target and how GCC was configured, a slightly different
6143 set of optimizations may be enabled at each @option{-O} level than
6144 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6145 to find out the exact set of optimizations that are enabled at each level.
6146 @xref{Overall Options}, for examples.
6147
6148 @table @gcctabopt
6149 @item -O
6150 @itemx -O1
6151 @opindex O
6152 @opindex O1
6153 Optimize. Optimizing compilation takes somewhat more time, and a lot
6154 more memory for a large function.
6155
6156 With @option{-O}, the compiler tries to reduce code size and execution
6157 time, without performing any optimizations that take a great deal of
6158 compilation time.
6159
6160 @option{-O} turns on the following optimization flags:
6161 @gccoptlist{
6162 -fauto-inc-dec @gol
6163 -fbranch-count-reg @gol
6164 -fcombine-stack-adjustments @gol
6165 -fcompare-elim @gol
6166 -fcprop-registers @gol
6167 -fdce @gol
6168 -fdefer-pop @gol
6169 -fdelayed-branch @gol
6170 -fdse @gol
6171 -fforward-propagate @gol
6172 -fguess-branch-probability @gol
6173 -fif-conversion2 @gol
6174 -fif-conversion @gol
6175 -finline-functions-called-once @gol
6176 -fipa-pure-const @gol
6177 -fipa-profile @gol
6178 -fipa-reference @gol
6179 -fmerge-constants @gol
6180 -fmove-loop-invariants @gol
6181 -freorder-blocks @gol
6182 -fshrink-wrap @gol
6183 -fsplit-wide-types @gol
6184 -fssa-backprop @gol
6185 -fssa-phiopt @gol
6186 -ftree-bit-ccp @gol
6187 -ftree-ccp @gol
6188 -ftree-ch @gol
6189 -ftree-coalesce-vars @gol
6190 -ftree-copy-prop @gol
6191 -ftree-dce @gol
6192 -ftree-dominator-opts @gol
6193 -ftree-dse @gol
6194 -ftree-forwprop @gol
6195 -ftree-fre @gol
6196 -ftree-phiprop @gol
6197 -ftree-sink @gol
6198 -ftree-slsr @gol
6199 -ftree-sra @gol
6200 -ftree-pta @gol
6201 -ftree-ter @gol
6202 -funit-at-a-time}
6203
6204 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6205 where doing so does not interfere with debugging.
6206
6207 @item -O2
6208 @opindex O2
6209 Optimize even more. GCC performs nearly all supported optimizations
6210 that do not involve a space-speed tradeoff.
6211 As compared to @option{-O}, this option increases both compilation time
6212 and the performance of the generated code.
6213
6214 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6215 also turns on the following optimization flags:
6216 @gccoptlist{-fthread-jumps @gol
6217 -falign-functions -falign-jumps @gol
6218 -falign-loops -falign-labels @gol
6219 -fcaller-saves @gol
6220 -fcrossjumping @gol
6221 -fcse-follow-jumps -fcse-skip-blocks @gol
6222 -fdelete-null-pointer-checks @gol
6223 -fdevirtualize -fdevirtualize-speculatively @gol
6224 -fexpensive-optimizations @gol
6225 -fgcse -fgcse-lm @gol
6226 -fhoist-adjacent-loads @gol
6227 -finline-small-functions @gol
6228 -findirect-inlining @gol
6229 -fipa-cp @gol
6230 -fipa-cp-alignment @gol
6231 -fipa-sra @gol
6232 -fipa-icf @gol
6233 -fisolate-erroneous-paths-dereference @gol
6234 -flra-remat @gol
6235 -foptimize-sibling-calls @gol
6236 -foptimize-strlen @gol
6237 -fpartial-inlining @gol
6238 -fpeephole2 @gol
6239 -freorder-blocks-algorithm=stc @gol
6240 -freorder-blocks-and-partition -freorder-functions @gol
6241 -frerun-cse-after-loop @gol
6242 -fsched-interblock -fsched-spec @gol
6243 -fschedule-insns -fschedule-insns2 @gol
6244 -fstrict-aliasing -fstrict-overflow @gol
6245 -ftree-builtin-call-dce @gol
6246 -ftree-switch-conversion -ftree-tail-merge @gol
6247 -ftree-pre @gol
6248 -ftree-vrp @gol
6249 -fipa-ra}
6250
6251 Please note the warning under @option{-fgcse} about
6252 invoking @option{-O2} on programs that use computed gotos.
6253
6254 @item -O3
6255 @opindex O3
6256 Optimize yet more. @option{-O3} turns on all optimizations specified
6257 by @option{-O2} and also turns on the @option{-finline-functions},
6258 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6259 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
6260 @option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
6261 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
6262 @option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
6263
6264 @item -O0
6265 @opindex O0
6266 Reduce compilation time and make debugging produce the expected
6267 results. This is the default.
6268
6269 @item -Os
6270 @opindex Os
6271 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6272 do not typically increase code size. It also performs further
6273 optimizations designed to reduce code size.
6274
6275 @option{-Os} disables the following optimization flags:
6276 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6277 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
6278 -freorder-blocks-and-partition -fprefetch-loop-arrays}
6279
6280 @item -Ofast
6281 @opindex Ofast
6282 Disregard strict standards compliance. @option{-Ofast} enables all
6283 @option{-O3} optimizations. It also enables optimizations that are not
6284 valid for all standard-compliant programs.
6285 It turns on @option{-ffast-math} and the Fortran-specific
6286 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6287
6288 @item -Og
6289 @opindex Og
6290 Optimize debugging experience. @option{-Og} enables optimizations
6291 that do not interfere with debugging. It should be the optimization
6292 level of choice for the standard edit-compile-debug cycle, offering
6293 a reasonable level of optimization while maintaining fast compilation
6294 and a good debugging experience.
6295 @end table
6296
6297 If you use multiple @option{-O} options, with or without level numbers,
6298 the last such option is the one that is effective.
6299
6300 Options of the form @option{-f@var{flag}} specify machine-independent
6301 flags. Most flags have both positive and negative forms; the negative
6302 form of @option{-ffoo} is @option{-fno-foo}. In the table
6303 below, only one of the forms is listed---the one you typically
6304 use. You can figure out the other form by either removing @samp{no-}
6305 or adding it.
6306
6307 The following options control specific optimizations. They are either
6308 activated by @option{-O} options or are related to ones that are. You
6309 can use the following flags in the rare cases when ``fine-tuning'' of
6310 optimizations to be performed is desired.
6311
6312 @table @gcctabopt
6313 @item -fno-defer-pop
6314 @opindex fno-defer-pop
6315 Always pop the arguments to each function call as soon as that function
6316 returns. For machines that must pop arguments after a function call,
6317 the compiler normally lets arguments accumulate on the stack for several
6318 function calls and pops them all at once.
6319
6320 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6321
6322 @item -fforward-propagate
6323 @opindex fforward-propagate
6324 Perform a forward propagation pass on RTL@. The pass tries to combine two
6325 instructions and checks if the result can be simplified. If loop unrolling
6326 is active, two passes are performed and the second is scheduled after
6327 loop unrolling.
6328
6329 This option is enabled by default at optimization levels @option{-O},
6330 @option{-O2}, @option{-O3}, @option{-Os}.
6331
6332 @item -ffp-contract=@var{style}
6333 @opindex ffp-contract
6334 @option{-ffp-contract=off} disables floating-point expression contraction.
6335 @option{-ffp-contract=fast} enables floating-point expression contraction
6336 such as forming of fused multiply-add operations if the target has
6337 native support for them.
6338 @option{-ffp-contract=on} enables floating-point expression contraction
6339 if allowed by the language standard. This is currently not implemented
6340 and treated equal to @option{-ffp-contract=off}.
6341
6342 The default is @option{-ffp-contract=fast}.
6343
6344 @item -fomit-frame-pointer
6345 @opindex fomit-frame-pointer
6346 Don't keep the frame pointer in a register for functions that
6347 don't need one. This avoids the instructions to save, set up and
6348 restore frame pointers; it also makes an extra register available
6349 in many functions. @strong{It also makes debugging impossible on
6350 some machines.}
6351
6352 On some machines, such as the VAX, this flag has no effect, because
6353 the standard calling sequence automatically handles the frame pointer
6354 and nothing is saved by pretending it doesn't exist. The
6355 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6356 whether a target machine supports this flag. @xref{Registers,,Register
6357 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6358
6359 The default setting (when not optimizing for
6360 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
6361 @option{-fomit-frame-pointer}. You can configure GCC with the
6362 @option{--enable-frame-pointer} configure option to change the default.
6363
6364 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6365
6366 @item -foptimize-sibling-calls
6367 @opindex foptimize-sibling-calls
6368 Optimize sibling and tail recursive calls.
6369
6370 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6371
6372 @item -foptimize-strlen
6373 @opindex foptimize-strlen
6374 Optimize various standard C string functions (e.g. @code{strlen},
6375 @code{strchr} or @code{strcpy}) and
6376 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
6377
6378 Enabled at levels @option{-O2}, @option{-O3}.
6379
6380 @item -fno-inline
6381 @opindex fno-inline
6382 Do not expand any functions inline apart from those marked with
6383 the @code{always_inline} attribute. This is the default when not
6384 optimizing.
6385
6386 Single functions can be exempted from inlining by marking them
6387 with the @code{noinline} attribute.
6388
6389 @item -finline-small-functions
6390 @opindex finline-small-functions
6391 Integrate functions into their callers when their body is smaller than expected
6392 function call code (so overall size of program gets smaller). The compiler
6393 heuristically decides which functions are simple enough to be worth integrating
6394 in this way. This inlining applies to all functions, even those not declared
6395 inline.
6396
6397 Enabled at level @option{-O2}.
6398
6399 @item -findirect-inlining
6400 @opindex findirect-inlining
6401 Inline also indirect calls that are discovered to be known at compile
6402 time thanks to previous inlining. This option has any effect only
6403 when inlining itself is turned on by the @option{-finline-functions}
6404 or @option{-finline-small-functions} options.
6405
6406 Enabled at level @option{-O2}.
6407
6408 @item -finline-functions
6409 @opindex finline-functions
6410 Consider all functions for inlining, even if they are not declared inline.
6411 The compiler heuristically decides which functions are worth integrating
6412 in this way.
6413
6414 If all calls to a given function are integrated, and the function is
6415 declared @code{static}, then the function is normally not output as
6416 assembler code in its own right.
6417
6418 Enabled at level @option{-O3}.
6419
6420 @item -finline-functions-called-once
6421 @opindex finline-functions-called-once
6422 Consider all @code{static} functions called once for inlining into their
6423 caller even if they are not marked @code{inline}. If a call to a given
6424 function is integrated, then the function is not output as assembler code
6425 in its own right.
6426
6427 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6428
6429 @item -fearly-inlining
6430 @opindex fearly-inlining
6431 Inline functions marked by @code{always_inline} and functions whose body seems
6432 smaller than the function call overhead early before doing
6433 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
6434 makes profiling significantly cheaper and usually inlining faster on programs
6435 having large chains of nested wrapper functions.
6436
6437 Enabled by default.
6438
6439 @item -fipa-sra
6440 @opindex fipa-sra
6441 Perform interprocedural scalar replacement of aggregates, removal of
6442 unused parameters and replacement of parameters passed by reference
6443 by parameters passed by value.
6444
6445 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6446
6447 @item -finline-limit=@var{n}
6448 @opindex finline-limit
6449 By default, GCC limits the size of functions that can be inlined. This flag
6450 allows coarse control of this limit. @var{n} is the size of functions that
6451 can be inlined in number of pseudo instructions.
6452
6453 Inlining is actually controlled by a number of parameters, which may be
6454 specified individually by using @option{--param @var{name}=@var{value}}.
6455 The @option{-finline-limit=@var{n}} option sets some of these parameters
6456 as follows:
6457
6458 @table @gcctabopt
6459 @item max-inline-insns-single
6460 is set to @var{n}/2.
6461 @item max-inline-insns-auto
6462 is set to @var{n}/2.
6463 @end table
6464
6465 See below for a documentation of the individual
6466 parameters controlling inlining and for the defaults of these parameters.
6467
6468 @emph{Note:} there may be no value to @option{-finline-limit} that results
6469 in default behavior.
6470
6471 @emph{Note:} pseudo instruction represents, in this particular context, an
6472 abstract measurement of function's size. In no way does it represent a count
6473 of assembly instructions and as such its exact meaning might change from one
6474 release to an another.
6475
6476 @item -fno-keep-inline-dllexport
6477 @opindex fno-keep-inline-dllexport
6478 This is a more fine-grained version of @option{-fkeep-inline-functions},
6479 which applies only to functions that are declared using the @code{dllexport}
6480 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6481 Functions}.)
6482
6483 @item -fkeep-inline-functions
6484 @opindex fkeep-inline-functions
6485 In C, emit @code{static} functions that are declared @code{inline}
6486 into the object file, even if the function has been inlined into all
6487 of its callers. This switch does not affect functions using the
6488 @code{extern inline} extension in GNU C90@. In C++, emit any and all
6489 inline functions into the object file.
6490
6491 @item -fkeep-static-functions
6492 @opindex fkeep-static-functions
6493 Emit @code{static} functions into the object file, even if the function
6494 is never used.
6495
6496 @item -fkeep-static-consts
6497 @opindex fkeep-static-consts
6498 Emit variables declared @code{static const} when optimization isn't turned
6499 on, even if the variables aren't referenced.
6500
6501 GCC enables this option by default. If you want to force the compiler to
6502 check if a variable is referenced, regardless of whether or not
6503 optimization is turned on, use the @option{-fno-keep-static-consts} option.
6504
6505 @item -fmerge-constants
6506 @opindex fmerge-constants
6507 Attempt to merge identical constants (string constants and floating-point
6508 constants) across compilation units.
6509
6510 This option is the default for optimized compilation if the assembler and
6511 linker support it. Use @option{-fno-merge-constants} to inhibit this
6512 behavior.
6513
6514 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6515
6516 @item -fmerge-all-constants
6517 @opindex fmerge-all-constants
6518 Attempt to merge identical constants and identical variables.
6519
6520 This option implies @option{-fmerge-constants}. In addition to
6521 @option{-fmerge-constants} this considers e.g.@: even constant initialized
6522 arrays or initialized constant variables with integral or floating-point
6523 types. Languages like C or C++ require each variable, including multiple
6524 instances of the same variable in recursive calls, to have distinct locations,
6525 so using this option results in non-conforming
6526 behavior.
6527
6528 @item -fmodulo-sched
6529 @opindex fmodulo-sched
6530 Perform swing modulo scheduling immediately before the first scheduling
6531 pass. This pass looks at innermost loops and reorders their
6532 instructions by overlapping different iterations.
6533
6534 @item -fmodulo-sched-allow-regmoves
6535 @opindex fmodulo-sched-allow-regmoves
6536 Perform more aggressive SMS-based modulo scheduling with register moves
6537 allowed. By setting this flag certain anti-dependences edges are
6538 deleted, which triggers the generation of reg-moves based on the
6539 life-range analysis. This option is effective only with
6540 @option{-fmodulo-sched} enabled.
6541
6542 @item -fno-branch-count-reg
6543 @opindex fno-branch-count-reg
6544 Avoid running a pass scanning for opportunities to use ``decrement and
6545 branch'' instructions on a count register instead of generating sequences
6546 of instructions that decrement a register, compare it against zero, and
6547 then branch based upon the result. This option is only meaningful on
6548 architectures that support such instructions, which include x86, PowerPC,
6549 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
6550 doesn't remove the decrement and branch instructions from the generated
6551 instruction stream introduced by other optimization passes.
6552
6553 Enabled by default at @option{-O1} and higher.
6554
6555 The default is @option{-fbranch-count-reg}.
6556
6557 @item -fno-function-cse
6558 @opindex fno-function-cse
6559 Do not put function addresses in registers; make each instruction that
6560 calls a constant function contain the function's address explicitly.
6561
6562 This option results in less efficient code, but some strange hacks
6563 that alter the assembler output may be confused by the optimizations
6564 performed when this option is not used.
6565
6566 The default is @option{-ffunction-cse}
6567
6568 @item -fno-zero-initialized-in-bss
6569 @opindex fno-zero-initialized-in-bss
6570 If the target supports a BSS section, GCC by default puts variables that
6571 are initialized to zero into BSS@. This can save space in the resulting
6572 code.
6573
6574 This option turns off this behavior because some programs explicitly
6575 rely on variables going to the data section---e.g., so that the
6576 resulting executable can find the beginning of that section and/or make
6577 assumptions based on that.
6578
6579 The default is @option{-fzero-initialized-in-bss}.
6580
6581 @item -fthread-jumps
6582 @opindex fthread-jumps
6583 Perform optimizations that check to see if a jump branches to a
6584 location where another comparison subsumed by the first is found. If
6585 so, the first branch is redirected to either the destination of the
6586 second branch or a point immediately following it, depending on whether
6587 the condition is known to be true or false.
6588
6589 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6590
6591 @item -fsplit-wide-types
6592 @opindex fsplit-wide-types
6593 When using a type that occupies multiple registers, such as @code{long
6594 long} on a 32-bit system, split the registers apart and allocate them
6595 independently. This normally generates better code for those types,
6596 but may make debugging more difficult.
6597
6598 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6599 @option{-Os}.
6600
6601 @item -fcse-follow-jumps
6602 @opindex fcse-follow-jumps
6603 In common subexpression elimination (CSE), scan through jump instructions
6604 when the target of the jump is not reached by any other path. For
6605 example, when CSE encounters an @code{if} statement with an
6606 @code{else} clause, CSE follows the jump when the condition
6607 tested is false.
6608
6609 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6610
6611 @item -fcse-skip-blocks
6612 @opindex fcse-skip-blocks
6613 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6614 follow jumps that conditionally skip over blocks. When CSE
6615 encounters a simple @code{if} statement with no else clause,
6616 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
6617 body of the @code{if}.
6618
6619 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6620
6621 @item -frerun-cse-after-loop
6622 @opindex frerun-cse-after-loop
6623 Re-run common subexpression elimination after loop optimizations are
6624 performed.
6625
6626 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6627
6628 @item -fgcse
6629 @opindex fgcse
6630 Perform a global common subexpression elimination pass.
6631 This pass also performs global constant and copy propagation.
6632
6633 @emph{Note:} When compiling a program using computed gotos, a GCC
6634 extension, you may get better run-time performance if you disable
6635 the global common subexpression elimination pass by adding
6636 @option{-fno-gcse} to the command line.
6637
6638 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6639
6640 @item -fgcse-lm
6641 @opindex fgcse-lm
6642 When @option{-fgcse-lm} is enabled, global common subexpression elimination
6643 attempts to move loads that are only killed by stores into themselves. This
6644 allows a loop containing a load/store sequence to be changed to a load outside
6645 the loop, and a copy/store within the loop.
6646
6647 Enabled by default when @option{-fgcse} is enabled.
6648
6649 @item -fgcse-sm
6650 @opindex fgcse-sm
6651 When @option{-fgcse-sm} is enabled, a store motion pass is run after
6652 global common subexpression elimination. This pass attempts to move
6653 stores out of loops. When used in conjunction with @option{-fgcse-lm},
6654 loops containing a load/store sequence can be changed to a load before
6655 the loop and a store after the loop.
6656
6657 Not enabled at any optimization level.
6658
6659 @item -fgcse-las
6660 @opindex fgcse-las
6661 When @option{-fgcse-las} is enabled, the global common subexpression
6662 elimination pass eliminates redundant loads that come after stores to the
6663 same memory location (both partial and full redundancies).
6664
6665 Not enabled at any optimization level.
6666
6667 @item -fgcse-after-reload
6668 @opindex fgcse-after-reload
6669 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6670 pass is performed after reload. The purpose of this pass is to clean up
6671 redundant spilling.
6672
6673 @item -faggressive-loop-optimizations
6674 @opindex faggressive-loop-optimizations
6675 This option tells the loop optimizer to use language constraints to
6676 derive bounds for the number of iterations of a loop. This assumes that
6677 loop code does not invoke undefined behavior by for example causing signed
6678 integer overflows or out-of-bound array accesses. The bounds for the
6679 number of iterations of a loop are used to guide loop unrolling and peeling
6680 and loop exit test optimizations.
6681 This option is enabled by default.
6682
6683 @item -funsafe-loop-optimizations
6684 @opindex funsafe-loop-optimizations
6685 This option tells the loop optimizer to assume that loop indices do not
6686 overflow, and that loops with nontrivial exit condition are not
6687 infinite. This enables a wider range of loop optimizations even if
6688 the loop optimizer itself cannot prove that these assumptions are valid.
6689 If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you
6690 if it finds this kind of loop.
6691
6692 @item -fcrossjumping
6693 @opindex fcrossjumping
6694 Perform cross-jumping transformation.
6695 This transformation unifies equivalent code and saves code size. The
6696 resulting code may or may not perform better than without cross-jumping.
6697
6698 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6699
6700 @item -fauto-inc-dec
6701 @opindex fauto-inc-dec
6702 Combine increments or decrements of addresses with memory accesses.
6703 This pass is always skipped on architectures that do not have
6704 instructions to support this. Enabled by default at @option{-O} and
6705 higher on architectures that support this.
6706
6707 @item -fdce
6708 @opindex fdce
6709 Perform dead code elimination (DCE) on RTL@.
6710 Enabled by default at @option{-O} and higher.
6711
6712 @item -fdse
6713 @opindex fdse
6714 Perform dead store elimination (DSE) on RTL@.
6715 Enabled by default at @option{-O} and higher.
6716
6717 @item -fif-conversion
6718 @opindex fif-conversion
6719 Attempt to transform conditional jumps into branch-less equivalents. This
6720 includes use of conditional moves, min, max, set flags and abs instructions, and
6721 some tricks doable by standard arithmetics. The use of conditional execution
6722 on chips where it is available is controlled by @option{-fif-conversion2}.
6723
6724 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6725
6726 @item -fif-conversion2
6727 @opindex fif-conversion2
6728 Use conditional execution (where available) to transform conditional jumps into
6729 branch-less equivalents.
6730
6731 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6732
6733 @item -fdeclone-ctor-dtor
6734 @opindex fdeclone-ctor-dtor
6735 The C++ ABI requires multiple entry points for constructors and
6736 destructors: one for a base subobject, one for a complete object, and
6737 one for a virtual destructor that calls operator delete afterwards.
6738 For a hierarchy with virtual bases, the base and complete variants are
6739 clones, which means two copies of the function. With this option, the
6740 base and complete variants are changed to be thunks that call a common
6741 implementation.
6742
6743 Enabled by @option{-Os}.
6744
6745 @item -fdelete-null-pointer-checks
6746 @opindex fdelete-null-pointer-checks
6747 Assume that programs cannot safely dereference null pointers, and that
6748 no code or data element resides at address zero.
6749 This option enables simple constant
6750 folding optimizations at all optimization levels. In addition, other
6751 optimization passes in GCC use this flag to control global dataflow
6752 analyses that eliminate useless checks for null pointers; these assume
6753 that a memory access to address zero always results in a trap, so
6754 that if a pointer is checked after it has already been dereferenced,
6755 it cannot be null.
6756
6757 Note however that in some environments this assumption is not true.
6758 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
6759 for programs that depend on that behavior.
6760
6761 This option is enabled by default on most targets. On Nios II ELF, it
6762 defaults to off. On AVR and CR16, this option is completely disabled.
6763
6764 Passes that use the dataflow information
6765 are enabled independently at different optimization levels.
6766
6767 @item -fdevirtualize
6768 @opindex fdevirtualize
6769 Attempt to convert calls to virtual functions to direct calls. This
6770 is done both within a procedure and interprocedurally as part of
6771 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
6772 propagation (@option{-fipa-cp}).
6773 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6774
6775 @item -fdevirtualize-speculatively
6776 @opindex fdevirtualize-speculatively
6777 Attempt to convert calls to virtual functions to speculative direct calls.
6778 Based on the analysis of the type inheritance graph, determine for a given call
6779 the set of likely targets. If the set is small, preferably of size 1, change
6780 the call into a conditional deciding between direct and indirect calls. The
6781 speculative calls enable more optimizations, such as inlining. When they seem
6782 useless after further optimization, they are converted back into original form.
6783
6784 @item -fdevirtualize-at-ltrans
6785 @opindex fdevirtualize-at-ltrans
6786 Stream extra information needed for aggressive devirtualization when running
6787 the link-time optimizer in local transformation mode.
6788 This option enables more devirtualization but
6789 significantly increases the size of streamed data. For this reason it is
6790 disabled by default.
6791
6792 @item -fexpensive-optimizations
6793 @opindex fexpensive-optimizations
6794 Perform a number of minor optimizations that are relatively expensive.
6795
6796 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6797
6798 @item -free
6799 @opindex free
6800 Attempt to remove redundant extension instructions. This is especially
6801 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
6802 registers after writing to their lower 32-bit half.
6803
6804 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
6805 @option{-O3}, @option{-Os}.
6806
6807 @item -fno-lifetime-dse
6808 @opindex fno-lifetime-dse
6809 In C++ the value of an object is only affected by changes within its
6810 lifetime: when the constructor begins, the object has an indeterminate
6811 value, and any changes during the lifetime of the object are dead when
6812 the object is destroyed. Normally dead store elimination will take
6813 advantage of this; if your code relies on the value of the object
6814 storage persisting beyond the lifetime of the object, you can use this
6815 flag to disable this optimization. To preserve stores before the
6816 constructor starts (e.g. because your operator new clears the object
6817 storage) but still treat the object as dead after the destructor you,
6818 can use @option{-flifetime-dse=1}. The default behavior can be
6819 explicitly selected with @option{-flifetime-dse=2}.
6820 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
6821
6822 @item -flive-range-shrinkage
6823 @opindex flive-range-shrinkage
6824 Attempt to decrease register pressure through register live range
6825 shrinkage. This is helpful for fast processors with small or moderate
6826 size register sets.
6827
6828 @item -fira-algorithm=@var{algorithm}
6829 @opindex fira-algorithm
6830 Use the specified coloring algorithm for the integrated register
6831 allocator. The @var{algorithm} argument can be @samp{priority}, which
6832 specifies Chow's priority coloring, or @samp{CB}, which specifies
6833 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
6834 for all architectures, but for those targets that do support it, it is
6835 the default because it generates better code.
6836
6837 @item -fira-region=@var{region}
6838 @opindex fira-region
6839 Use specified regions for the integrated register allocator. The
6840 @var{region} argument should be one of the following:
6841
6842 @table @samp
6843
6844 @item all
6845 Use all loops as register allocation regions.
6846 This can give the best results for machines with a small and/or
6847 irregular register set.
6848
6849 @item mixed
6850 Use all loops except for loops with small register pressure
6851 as the regions. This value usually gives
6852 the best results in most cases and for most architectures,
6853 and is enabled by default when compiling with optimization for speed
6854 (@option{-O}, @option{-O2}, @dots{}).
6855
6856 @item one
6857 Use all functions as a single region.
6858 This typically results in the smallest code size, and is enabled by default for
6859 @option{-Os} or @option{-O0}.
6860
6861 @end table
6862
6863 @item -fira-hoist-pressure
6864 @opindex fira-hoist-pressure
6865 Use IRA to evaluate register pressure in the code hoisting pass for
6866 decisions to hoist expressions. This option usually results in smaller
6867 code, but it can slow the compiler down.
6868
6869 This option is enabled at level @option{-Os} for all targets.
6870
6871 @item -fira-loop-pressure
6872 @opindex fira-loop-pressure
6873 Use IRA to evaluate register pressure in loops for decisions to move
6874 loop invariants. This option usually results in generation
6875 of faster and smaller code on machines with large register files (>= 32
6876 registers), but it can slow the compiler down.
6877
6878 This option is enabled at level @option{-O3} for some targets.
6879
6880 @item -fno-ira-share-save-slots
6881 @opindex fno-ira-share-save-slots
6882 Disable sharing of stack slots used for saving call-used hard
6883 registers living through a call. Each hard register gets a
6884 separate stack slot, and as a result function stack frames are
6885 larger.
6886
6887 @item -fno-ira-share-spill-slots
6888 @opindex fno-ira-share-spill-slots
6889 Disable sharing of stack slots allocated for pseudo-registers. Each
6890 pseudo-register that does not get a hard register gets a separate
6891 stack slot, and as a result function stack frames are larger.
6892
6893 @item -flra-remat
6894 @opindex flra-remat
6895 Enable CFG-sensitive rematerialization in LRA. Instead of loading
6896 values of spilled pseudos, LRA tries to rematerialize (recalculate)
6897 values if it is profitable.
6898
6899 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6900
6901 @item -fdelayed-branch
6902 @opindex fdelayed-branch
6903 If supported for the target machine, attempt to reorder instructions
6904 to exploit instruction slots available after delayed branch
6905 instructions.
6906
6907 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6908
6909 @item -fschedule-insns
6910 @opindex fschedule-insns
6911 If supported for the target machine, attempt to reorder instructions to
6912 eliminate execution stalls due to required data being unavailable. This
6913 helps machines that have slow floating point or memory load instructions
6914 by allowing other instructions to be issued until the result of the load
6915 or floating-point instruction is required.
6916
6917 Enabled at levels @option{-O2}, @option{-O3}.
6918
6919 @item -fschedule-insns2
6920 @opindex fschedule-insns2
6921 Similar to @option{-fschedule-insns}, but requests an additional pass of
6922 instruction scheduling after register allocation has been done. This is
6923 especially useful on machines with a relatively small number of
6924 registers and where memory load instructions take more than one cycle.
6925
6926 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6927
6928 @item -fno-sched-interblock
6929 @opindex fno-sched-interblock
6930 Don't schedule instructions across basic blocks. This is normally
6931 enabled by default when scheduling before register allocation, i.e.@:
6932 with @option{-fschedule-insns} or at @option{-O2} or higher.
6933
6934 @item -fno-sched-spec
6935 @opindex fno-sched-spec
6936 Don't allow speculative motion of non-load instructions. This is normally
6937 enabled by default when scheduling before register allocation, i.e.@:
6938 with @option{-fschedule-insns} or at @option{-O2} or higher.
6939
6940 @item -fsched-pressure
6941 @opindex fsched-pressure
6942 Enable register pressure sensitive insn scheduling before register
6943 allocation. This only makes sense when scheduling before register
6944 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
6945 @option{-O2} or higher. Usage of this option can improve the
6946 generated code and decrease its size by preventing register pressure
6947 increase above the number of available hard registers and subsequent
6948 spills in register allocation.
6949
6950 @item -fsched-spec-load
6951 @opindex fsched-spec-load
6952 Allow speculative motion of some load instructions. This only makes
6953 sense when scheduling before register allocation, i.e.@: with
6954 @option{-fschedule-insns} or at @option{-O2} or higher.
6955
6956 @item -fsched-spec-load-dangerous
6957 @opindex fsched-spec-load-dangerous
6958 Allow speculative motion of more load instructions. This only makes
6959 sense when scheduling before register allocation, i.e.@: with
6960 @option{-fschedule-insns} or at @option{-O2} or higher.
6961
6962 @item -fsched-stalled-insns
6963 @itemx -fsched-stalled-insns=@var{n}
6964 @opindex fsched-stalled-insns
6965 Define how many insns (if any) can be moved prematurely from the queue
6966 of stalled insns into the ready list during the second scheduling pass.
6967 @option{-fno-sched-stalled-insns} means that no insns are moved
6968 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
6969 on how many queued insns can be moved prematurely.
6970 @option{-fsched-stalled-insns} without a value is equivalent to
6971 @option{-fsched-stalled-insns=1}.
6972
6973 @item -fsched-stalled-insns-dep
6974 @itemx -fsched-stalled-insns-dep=@var{n}
6975 @opindex fsched-stalled-insns-dep
6976 Define how many insn groups (cycles) are examined for a dependency
6977 on a stalled insn that is a candidate for premature removal from the queue
6978 of stalled insns. This has an effect only during the second scheduling pass,
6979 and only if @option{-fsched-stalled-insns} is used.
6980 @option{-fno-sched-stalled-insns-dep} is equivalent to
6981 @option{-fsched-stalled-insns-dep=0}.
6982 @option{-fsched-stalled-insns-dep} without a value is equivalent to
6983 @option{-fsched-stalled-insns-dep=1}.
6984
6985 @item -fsched2-use-superblocks
6986 @opindex fsched2-use-superblocks
6987 When scheduling after register allocation, use superblock scheduling.
6988 This allows motion across basic block boundaries,
6989 resulting in faster schedules. This option is experimental, as not all machine
6990 descriptions used by GCC model the CPU closely enough to avoid unreliable
6991 results from the algorithm.
6992
6993 This only makes sense when scheduling after register allocation, i.e.@: with
6994 @option{-fschedule-insns2} or at @option{-O2} or higher.
6995
6996 @item -fsched-group-heuristic
6997 @opindex fsched-group-heuristic
6998 Enable the group heuristic in the scheduler. This heuristic favors
6999 the instruction that belongs to a schedule group. This is enabled
7000 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7001 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7002
7003 @item -fsched-critical-path-heuristic
7004 @opindex fsched-critical-path-heuristic
7005 Enable the critical-path heuristic in the scheduler. This heuristic favors
7006 instructions on the critical path. This is enabled by default when
7007 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7008 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7009
7010 @item -fsched-spec-insn-heuristic
7011 @opindex fsched-spec-insn-heuristic
7012 Enable the speculative instruction heuristic in the scheduler. This
7013 heuristic favors speculative instructions with greater dependency weakness.
7014 This is enabled by default when scheduling is enabled, i.e.@:
7015 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7016 or at @option{-O2} or higher.
7017
7018 @item -fsched-rank-heuristic
7019 @opindex fsched-rank-heuristic
7020 Enable the rank heuristic in the scheduler. This heuristic favors
7021 the instruction belonging to a basic block with greater size or frequency.
7022 This is enabled by default when scheduling is enabled, i.e.@:
7023 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7024 at @option{-O2} or higher.
7025
7026 @item -fsched-last-insn-heuristic
7027 @opindex fsched-last-insn-heuristic
7028 Enable the last-instruction heuristic in the scheduler. This heuristic
7029 favors the instruction that is less dependent on the last instruction
7030 scheduled. This is enabled by default when scheduling is enabled,
7031 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7032 at @option{-O2} or higher.
7033
7034 @item -fsched-dep-count-heuristic
7035 @opindex fsched-dep-count-heuristic
7036 Enable the dependent-count heuristic in the scheduler. This heuristic
7037 favors the instruction that has more instructions depending on it.
7038 This is enabled by default when scheduling is enabled, i.e.@:
7039 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7040 at @option{-O2} or higher.
7041
7042 @item -freschedule-modulo-scheduled-loops
7043 @opindex freschedule-modulo-scheduled-loops
7044 Modulo scheduling is performed before traditional scheduling. If a loop
7045 is modulo scheduled, later scheduling passes may change its schedule.
7046 Use this option to control that behavior.
7047
7048 @item -fselective-scheduling
7049 @opindex fselective-scheduling
7050 Schedule instructions using selective scheduling algorithm. Selective
7051 scheduling runs instead of the first scheduler pass.
7052
7053 @item -fselective-scheduling2
7054 @opindex fselective-scheduling2
7055 Schedule instructions using selective scheduling algorithm. Selective
7056 scheduling runs instead of the second scheduler pass.
7057
7058 @item -fsel-sched-pipelining
7059 @opindex fsel-sched-pipelining
7060 Enable software pipelining of innermost loops during selective scheduling.
7061 This option has no effect unless one of @option{-fselective-scheduling} or
7062 @option{-fselective-scheduling2} is turned on.
7063
7064 @item -fsel-sched-pipelining-outer-loops
7065 @opindex fsel-sched-pipelining-outer-loops
7066 When pipelining loops during selective scheduling, also pipeline outer loops.
7067 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7068
7069 @item -fsemantic-interposition
7070 @opindex fsemantic-interposition
7071 Some object formats, like ELF, allow interposing of symbols by the
7072 dynamic linker.
7073 This means that for symbols exported from the DSO, the compiler cannot perform
7074 interprocedural propagation, inlining and other optimizations in anticipation
7075 that the function or variable in question may change. While this feature is
7076 useful, for example, to rewrite memory allocation functions by a debugging
7077 implementation, it is expensive in the terms of code quality.
7078 With @option{-fno-semantic-interposition} the compiler assumes that
7079 if interposition happens for functions the overwriting function will have
7080 precisely the same semantics (and side effects).
7081 Similarly if interposition happens
7082 for variables, the constructor of the variable will be the same. The flag
7083 has no effect for functions explicitly declared inline
7084 (where it is never allowed for interposition to change semantics)
7085 and for symbols explicitly declared weak.
7086
7087 @item -fshrink-wrap
7088 @opindex fshrink-wrap
7089 Emit function prologues only before parts of the function that need it,
7090 rather than at the top of the function. This flag is enabled by default at
7091 @option{-O} and higher.
7092
7093 @item -fcaller-saves
7094 @opindex fcaller-saves
7095 Enable allocation of values to registers that are clobbered by
7096 function calls, by emitting extra instructions to save and restore the
7097 registers around such calls. Such allocation is done only when it
7098 seems to result in better code.
7099
7100 This option is always enabled by default on certain machines, usually
7101 those which have no call-preserved registers to use instead.
7102
7103 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7104
7105 @item -fcombine-stack-adjustments
7106 @opindex fcombine-stack-adjustments
7107 Tracks stack adjustments (pushes and pops) and stack memory references
7108 and then tries to find ways to combine them.
7109
7110 Enabled by default at @option{-O1} and higher.
7111
7112 @item -fipa-ra
7113 @opindex fipa-ra
7114 Use caller save registers for allocation if those registers are not used by
7115 any called function. In that case it is not necessary to save and restore
7116 them around calls. This is only possible if called functions are part of
7117 same compilation unit as current function and they are compiled before it.
7118
7119 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7120
7121 @item -fconserve-stack
7122 @opindex fconserve-stack
7123 Attempt to minimize stack usage. The compiler attempts to use less
7124 stack space, even if that makes the program slower. This option
7125 implies setting the @option{large-stack-frame} parameter to 100
7126 and the @option{large-stack-frame-growth} parameter to 400.
7127
7128 @item -ftree-reassoc
7129 @opindex ftree-reassoc
7130 Perform reassociation on trees. This flag is enabled by default
7131 at @option{-O} and higher.
7132
7133 @item -ftree-pre
7134 @opindex ftree-pre
7135 Perform partial redundancy elimination (PRE) on trees. This flag is
7136 enabled by default at @option{-O2} and @option{-O3}.
7137
7138 @item -ftree-partial-pre
7139 @opindex ftree-partial-pre
7140 Make partial redundancy elimination (PRE) more aggressive. This flag is
7141 enabled by default at @option{-O3}.
7142
7143 @item -ftree-forwprop
7144 @opindex ftree-forwprop
7145 Perform forward propagation on trees. This flag is enabled by default
7146 at @option{-O} and higher.
7147
7148 @item -ftree-fre
7149 @opindex ftree-fre
7150 Perform full redundancy elimination (FRE) on trees. The difference
7151 between FRE and PRE is that FRE only considers expressions
7152 that are computed on all paths leading to the redundant computation.
7153 This analysis is faster than PRE, though it exposes fewer redundancies.
7154 This flag is enabled by default at @option{-O} and higher.
7155
7156 @item -ftree-phiprop
7157 @opindex ftree-phiprop
7158 Perform hoisting of loads from conditional pointers on trees. This
7159 pass is enabled by default at @option{-O} and higher.
7160
7161 @item -fhoist-adjacent-loads
7162 @opindex fhoist-adjacent-loads
7163 Speculatively hoist loads from both branches of an if-then-else if the
7164 loads are from adjacent locations in the same structure and the target
7165 architecture has a conditional move instruction. This flag is enabled
7166 by default at @option{-O2} and higher.
7167
7168 @item -ftree-copy-prop
7169 @opindex ftree-copy-prop
7170 Perform copy propagation on trees. This pass eliminates unnecessary
7171 copy operations. This flag is enabled by default at @option{-O} and
7172 higher.
7173
7174 @item -fipa-pure-const
7175 @opindex fipa-pure-const
7176 Discover which functions are pure or constant.
7177 Enabled by default at @option{-O} and higher.
7178
7179 @item -fipa-reference
7180 @opindex fipa-reference
7181 Discover which static variables do not escape the
7182 compilation unit.
7183 Enabled by default at @option{-O} and higher.
7184
7185 @item -fipa-pta
7186 @opindex fipa-pta
7187 Perform interprocedural pointer analysis and interprocedural modification
7188 and reference analysis. This option can cause excessive memory and
7189 compile-time usage on large compilation units. It is not enabled by
7190 default at any optimization level.
7191
7192 @item -fipa-profile
7193 @opindex fipa-profile
7194 Perform interprocedural profile propagation. The functions called only from
7195 cold functions are marked as cold. Also functions executed once (such as
7196 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7197 functions and loop less parts of functions executed once are then optimized for
7198 size.
7199 Enabled by default at @option{-O} and higher.
7200
7201 @item -fipa-cp
7202 @opindex fipa-cp
7203 Perform interprocedural constant propagation.
7204 This optimization analyzes the program to determine when values passed
7205 to functions are constants and then optimizes accordingly.
7206 This optimization can substantially increase performance
7207 if the application has constants passed to functions.
7208 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7209
7210 @item -fipa-cp-clone
7211 @opindex fipa-cp-clone
7212 Perform function cloning to make interprocedural constant propagation stronger.
7213 When enabled, interprocedural constant propagation performs function cloning
7214 when externally visible function can be called with constant arguments.
7215 Because this optimization can create multiple copies of functions,
7216 it may significantly increase code size
7217 (see @option{--param ipcp-unit-growth=@var{value}}).
7218 This flag is enabled by default at @option{-O3}.
7219
7220 @item -fipa-cp-alignment
7221 @opindex -fipa-cp-alignment
7222 When enabled, this optimization propagates alignment of function
7223 parameters to support better vectorization and string operations.
7224
7225 This flag is enabled by default at @option{-O2} and @option{-Os}. It
7226 requires that @option{-fipa-cp} is enabled.
7227
7228 @item -fipa-icf
7229 @opindex fipa-icf
7230 Perform Identical Code Folding for functions and read-only variables.
7231 The optimization reduces code size and may disturb unwind stacks by replacing
7232 a function by equivalent one with a different name. The optimization works
7233 more effectively with link time optimization enabled.
7234
7235 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
7236 works on different levels and thus the optimizations are not same - there are
7237 equivalences that are found only by GCC and equivalences found only by Gold.
7238
7239 This flag is enabled by default at @option{-O2} and @option{-Os}.
7240
7241 @item -fisolate-erroneous-paths-dereference
7242 @opindex fisolate-erroneous-paths-dereference
7243 Detect paths that trigger erroneous or undefined behavior due to
7244 dereferencing a null pointer. Isolate those paths from the main control
7245 flow and turn the statement with erroneous or undefined behavior into a trap.
7246 This flag is enabled by default at @option{-O2} and higher and depends on
7247 @option{-fdelete-null-pointer-checks} also being enabled.
7248
7249 @item -fisolate-erroneous-paths-attribute
7250 @opindex fisolate-erroneous-paths-attribute
7251 Detect paths that trigger erroneous or undefined behavior due a null value
7252 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
7253 attribute. Isolate those paths from the main control flow and turn the
7254 statement with erroneous or undefined behavior into a trap. This is not
7255 currently enabled, but may be enabled by @option{-O2} in the future.
7256
7257 @item -ftree-sink
7258 @opindex ftree-sink
7259 Perform forward store motion on trees. This flag is
7260 enabled by default at @option{-O} and higher.
7261
7262 @item -ftree-bit-ccp
7263 @opindex ftree-bit-ccp
7264 Perform sparse conditional bit constant propagation on trees and propagate
7265 pointer alignment information.
7266 This pass only operates on local scalar variables and is enabled by default
7267 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7268
7269 @item -ftree-ccp
7270 @opindex ftree-ccp
7271 Perform sparse conditional constant propagation (CCP) on trees. This
7272 pass only operates on local scalar variables and is enabled by default
7273 at @option{-O} and higher.
7274
7275 @item -fssa-backprop
7276 @opindex fssa-backprop
7277 Propagate information about uses of a value up the definition chain
7278 in order to simplify the definitions. For example, this pass strips
7279 sign operations if the sign of a value never matters. The flag is
7280 enabled by default at @option{-O} and higher.
7281
7282 @item -fssa-phiopt
7283 @opindex fssa-phiopt
7284 Perform pattern matching on SSA PHI nodes to optimize conditional
7285 code. This pass is enabled by default at @option{-O} and higher.
7286
7287 @item -ftree-switch-conversion
7288 @opindex ftree-switch-conversion
7289 Perform conversion of simple initializations in a switch to
7290 initializations from a scalar array. This flag is enabled by default
7291 at @option{-O2} and higher.
7292
7293 @item -ftree-tail-merge
7294 @opindex ftree-tail-merge
7295 Look for identical code sequences. When found, replace one with a jump to the
7296 other. This optimization is known as tail merging or cross jumping. This flag
7297 is enabled by default at @option{-O2} and higher. The compilation time
7298 in this pass can
7299 be limited using @option{max-tail-merge-comparisons} parameter and
7300 @option{max-tail-merge-iterations} parameter.
7301
7302 @item -ftree-dce
7303 @opindex ftree-dce
7304 Perform dead code elimination (DCE) on trees. This flag is enabled by
7305 default at @option{-O} and higher.
7306
7307 @item -ftree-builtin-call-dce
7308 @opindex ftree-builtin-call-dce
7309 Perform conditional dead code elimination (DCE) for calls to built-in functions
7310 that may set @code{errno} but are otherwise side-effect free. This flag is
7311 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7312 specified.
7313
7314 @item -ftree-dominator-opts
7315 @opindex ftree-dominator-opts
7316 Perform a variety of simple scalar cleanups (constant/copy
7317 propagation, redundancy elimination, range propagation and expression
7318 simplification) based on a dominator tree traversal. This also
7319 performs jump threading (to reduce jumps to jumps). This flag is
7320 enabled by default at @option{-O} and higher.
7321
7322 @item -ftree-dse
7323 @opindex ftree-dse
7324 Perform dead store elimination (DSE) on trees. A dead store is a store into
7325 a memory location that is later overwritten by another store without
7326 any intervening loads. In this case the earlier store can be deleted. This
7327 flag is enabled by default at @option{-O} and higher.
7328
7329 @item -ftree-ch
7330 @opindex ftree-ch
7331 Perform loop header copying on trees. This is beneficial since it increases
7332 effectiveness of code motion optimizations. It also saves one jump. This flag
7333 is enabled by default at @option{-O} and higher. It is not enabled
7334 for @option{-Os}, since it usually increases code size.
7335
7336 @item -ftree-loop-optimize
7337 @opindex ftree-loop-optimize
7338 Perform loop optimizations on trees. This flag is enabled by default
7339 at @option{-O} and higher.
7340
7341 @item -ftree-loop-linear
7342 @itemx -floop-interchange
7343 @itemx -floop-strip-mine
7344 @itemx -floop-block
7345 @itemx -floop-unroll-and-jam
7346 @opindex ftree-loop-linear
7347 @opindex floop-interchange
7348 @opindex floop-strip-mine
7349 @opindex floop-block
7350 @opindex floop-unroll-and-jam
7351 Perform loop nest optimizations. Same as
7352 @option{-floop-nest-optimize}. To use this code transformation, GCC has
7353 to be configured with @option{--with-isl} to enable the Graphite loop
7354 transformation infrastructure.
7355
7356 @item -fgraphite-identity
7357 @opindex fgraphite-identity
7358 Enable the identity transformation for graphite. For every SCoP we generate
7359 the polyhedral representation and transform it back to gimple. Using
7360 @option{-fgraphite-identity} we can check the costs or benefits of the
7361 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
7362 are also performed by the code generator isl, like index splitting and
7363 dead code elimination in loops.
7364
7365 @item -floop-nest-optimize
7366 @opindex floop-nest-optimize
7367 Enable the isl based loop nest optimizer. This is a generic loop nest
7368 optimizer based on the Pluto optimization algorithms. It calculates a loop
7369 structure optimized for data-locality and parallelism. This option
7370 is experimental.
7371
7372 @item -floop-parallelize-all
7373 @opindex floop-parallelize-all
7374 Use the Graphite data dependence analysis to identify loops that can
7375 be parallelized. Parallelize all the loops that can be analyzed to
7376 not contain loop carried dependences without checking that it is
7377 profitable to parallelize the loops.
7378
7379 @item -ftree-coalesce-vars
7380 @opindex ftree-coalesce-vars
7381 While transforming the program out of the SSA representation, attempt to
7382 reduce copying by coalescing versions of different user-defined
7383 variables, instead of just compiler temporaries. This may severely
7384 limit the ability to debug an optimized program compiled with
7385 @option{-fno-var-tracking-assignments}. In the negated form, this flag
7386 prevents SSA coalescing of user variables. This option is enabled by
7387 default if optimization is enabled, and it does very little otherwise.
7388
7389 @item -ftree-loop-if-convert
7390 @opindex ftree-loop-if-convert
7391 Attempt to transform conditional jumps in the innermost loops to
7392 branch-less equivalents. The intent is to remove control-flow from
7393 the innermost loops in order to improve the ability of the
7394 vectorization pass to handle these loops. This is enabled by default
7395 if vectorization is enabled.
7396
7397 @item -ftree-loop-if-convert-stores
7398 @opindex ftree-loop-if-convert-stores
7399 Attempt to also if-convert conditional jumps containing memory writes.
7400 This transformation can be unsafe for multi-threaded programs as it
7401 transforms conditional memory writes into unconditional memory writes.
7402 For example,
7403 @smallexample
7404 for (i = 0; i < N; i++)
7405 if (cond)
7406 A[i] = expr;
7407 @end smallexample
7408 is transformed to
7409 @smallexample
7410 for (i = 0; i < N; i++)
7411 A[i] = cond ? expr : A[i];
7412 @end smallexample
7413 potentially producing data races.
7414
7415 @item -ftree-loop-distribution
7416 @opindex ftree-loop-distribution
7417 Perform loop distribution. This flag can improve cache performance on
7418 big loop bodies and allow further loop optimizations, like
7419 parallelization or vectorization, to take place. For example, the loop
7420 @smallexample
7421 DO I = 1, N
7422 A(I) = B(I) + C
7423 D(I) = E(I) * F
7424 ENDDO
7425 @end smallexample
7426 is transformed to
7427 @smallexample
7428 DO I = 1, N
7429 A(I) = B(I) + C
7430 ENDDO
7431 DO I = 1, N
7432 D(I) = E(I) * F
7433 ENDDO
7434 @end smallexample
7435
7436 @item -ftree-loop-distribute-patterns
7437 @opindex ftree-loop-distribute-patterns
7438 Perform loop distribution of patterns that can be code generated with
7439 calls to a library. This flag is enabled by default at @option{-O3}.
7440
7441 This pass distributes the initialization loops and generates a call to
7442 memset zero. For example, the loop
7443 @smallexample
7444 DO I = 1, N
7445 A(I) = 0
7446 B(I) = A(I) + I
7447 ENDDO
7448 @end smallexample
7449 is transformed to
7450 @smallexample
7451 DO I = 1, N
7452 A(I) = 0
7453 ENDDO
7454 DO I = 1, N
7455 B(I) = A(I) + I
7456 ENDDO
7457 @end smallexample
7458 and the initialization loop is transformed into a call to memset zero.
7459
7460 @item -ftree-loop-im
7461 @opindex ftree-loop-im
7462 Perform loop invariant motion on trees. This pass moves only invariants that
7463 are hard to handle at RTL level (function calls, operations that expand to
7464 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
7465 operands of conditions that are invariant out of the loop, so that we can use
7466 just trivial invariantness analysis in loop unswitching. The pass also includes
7467 store motion.
7468
7469 @item -ftree-loop-ivcanon
7470 @opindex ftree-loop-ivcanon
7471 Create a canonical counter for number of iterations in loops for which
7472 determining number of iterations requires complicated analysis. Later
7473 optimizations then may determine the number easily. Useful especially
7474 in connection with unrolling.
7475
7476 @item -fivopts
7477 @opindex fivopts
7478 Perform induction variable optimizations (strength reduction, induction
7479 variable merging and induction variable elimination) on trees.
7480
7481 @item -ftree-parallelize-loops=n
7482 @opindex ftree-parallelize-loops
7483 Parallelize loops, i.e., split their iteration space to run in n threads.
7484 This is only possible for loops whose iterations are independent
7485 and can be arbitrarily reordered. The optimization is only
7486 profitable on multiprocessor machines, for loops that are CPU-intensive,
7487 rather than constrained e.g.@: by memory bandwidth. This option
7488 implies @option{-pthread}, and thus is only supported on targets
7489 that have support for @option{-pthread}.
7490
7491 @item -ftree-pta
7492 @opindex ftree-pta
7493 Perform function-local points-to analysis on trees. This flag is
7494 enabled by default at @option{-O} and higher.
7495
7496 @item -ftree-sra
7497 @opindex ftree-sra
7498 Perform scalar replacement of aggregates. This pass replaces structure
7499 references with scalars to prevent committing structures to memory too
7500 early. This flag is enabled by default at @option{-O} and higher.
7501
7502 @item -ftree-ter
7503 @opindex ftree-ter
7504 Perform temporary expression replacement during the SSA->normal phase. Single
7505 use/single def temporaries are replaced at their use location with their
7506 defining expression. This results in non-GIMPLE code, but gives the expanders
7507 much more complex trees to work on resulting in better RTL generation. This is
7508 enabled by default at @option{-O} and higher.
7509
7510 @item -ftree-slsr
7511 @opindex ftree-slsr
7512 Perform straight-line strength reduction on trees. This recognizes related
7513 expressions involving multiplications and replaces them by less expensive
7514 calculations when possible. This is enabled by default at @option{-O} and
7515 higher.
7516
7517 @item -ftree-vectorize
7518 @opindex ftree-vectorize
7519 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
7520 and @option{-ftree-slp-vectorize} if not explicitly specified.
7521
7522 @item -ftree-loop-vectorize
7523 @opindex ftree-loop-vectorize
7524 Perform loop vectorization on trees. This flag is enabled by default at
7525 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7526
7527 @item -ftree-slp-vectorize
7528 @opindex ftree-slp-vectorize
7529 Perform basic block vectorization on trees. This flag is enabled by default at
7530 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7531
7532 @item -fvect-cost-model=@var{model}
7533 @opindex fvect-cost-model
7534 Alter the cost model used for vectorization. The @var{model} argument
7535 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
7536 With the @samp{unlimited} model the vectorized code-path is assumed
7537 to be profitable while with the @samp{dynamic} model a runtime check
7538 guards the vectorized code-path to enable it only for iteration
7539 counts that will likely execute faster than when executing the original
7540 scalar loop. The @samp{cheap} model disables vectorization of
7541 loops where doing so would be cost prohibitive for example due to
7542 required runtime checks for data dependence or alignment but otherwise
7543 is equal to the @samp{dynamic} model.
7544 The default cost model depends on other optimization flags and is
7545 either @samp{dynamic} or @samp{cheap}.
7546
7547 @item -fsimd-cost-model=@var{model}
7548 @opindex fsimd-cost-model
7549 Alter the cost model used for vectorization of loops marked with the OpenMP
7550 or Cilk Plus simd directive. The @var{model} argument should be one of
7551 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
7552 have the same meaning as described in @option{-fvect-cost-model} and by
7553 default a cost model defined with @option{-fvect-cost-model} is used.
7554
7555 @item -ftree-vrp
7556 @opindex ftree-vrp
7557 Perform Value Range Propagation on trees. This is similar to the
7558 constant propagation pass, but instead of values, ranges of values are
7559 propagated. This allows the optimizers to remove unnecessary range
7560 checks like array bound checks and null pointer checks. This is
7561 enabled by default at @option{-O2} and higher. Null pointer check
7562 elimination is only done if @option{-fdelete-null-pointer-checks} is
7563 enabled.
7564
7565 @item -fsplit-paths
7566 @opindex fsplit-paths
7567 Split paths leading to loop backedges. This can improve dead code
7568 elimination and common subexpression elimination. This is enabled by
7569 default at @option{-O2} and above.
7570
7571 @item -fsplit-ivs-in-unroller
7572 @opindex fsplit-ivs-in-unroller
7573 Enables expression of values of induction variables in later iterations
7574 of the unrolled loop using the value in the first iteration. This breaks
7575 long dependency chains, thus improving efficiency of the scheduling passes.
7576
7577 A combination of @option{-fweb} and CSE is often sufficient to obtain the
7578 same effect. However, that is not reliable in cases where the loop body
7579 is more complicated than a single basic block. It also does not work at all
7580 on some architectures due to restrictions in the CSE pass.
7581
7582 This optimization is enabled by default.
7583
7584 @item -fvariable-expansion-in-unroller
7585 @opindex fvariable-expansion-in-unroller
7586 With this option, the compiler creates multiple copies of some
7587 local variables when unrolling a loop, which can result in superior code.
7588
7589 @item -fpartial-inlining
7590 @opindex fpartial-inlining
7591 Inline parts of functions. This option has any effect only
7592 when inlining itself is turned on by the @option{-finline-functions}
7593 or @option{-finline-small-functions} options.
7594
7595 Enabled at level @option{-O2}.
7596
7597 @item -fpredictive-commoning
7598 @opindex fpredictive-commoning
7599 Perform predictive commoning optimization, i.e., reusing computations
7600 (especially memory loads and stores) performed in previous
7601 iterations of loops.
7602
7603 This option is enabled at level @option{-O3}.
7604
7605 @item -fprefetch-loop-arrays
7606 @opindex fprefetch-loop-arrays
7607 If supported by the target machine, generate instructions to prefetch
7608 memory to improve the performance of loops that access large arrays.
7609
7610 This option may generate better or worse code; results are highly
7611 dependent on the structure of loops within the source code.
7612
7613 Disabled at level @option{-Os}.
7614
7615 @item -fno-peephole
7616 @itemx -fno-peephole2
7617 @opindex fno-peephole
7618 @opindex fno-peephole2
7619 Disable any machine-specific peephole optimizations. The difference
7620 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
7621 are implemented in the compiler; some targets use one, some use the
7622 other, a few use both.
7623
7624 @option{-fpeephole} is enabled by default.
7625 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7626
7627 @item -fno-guess-branch-probability
7628 @opindex fno-guess-branch-probability
7629 Do not guess branch probabilities using heuristics.
7630
7631 GCC uses heuristics to guess branch probabilities if they are
7632 not provided by profiling feedback (@option{-fprofile-arcs}). These
7633 heuristics are based on the control flow graph. If some branch probabilities
7634 are specified by @code{__builtin_expect}, then the heuristics are
7635 used to guess branch probabilities for the rest of the control flow graph,
7636 taking the @code{__builtin_expect} info into account. The interactions
7637 between the heuristics and @code{__builtin_expect} can be complex, and in
7638 some cases, it may be useful to disable the heuristics so that the effects
7639 of @code{__builtin_expect} are easier to understand.
7640
7641 The default is @option{-fguess-branch-probability} at levels
7642 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7643
7644 @item -freorder-blocks
7645 @opindex freorder-blocks
7646 Reorder basic blocks in the compiled function in order to reduce number of
7647 taken branches and improve code locality.
7648
7649 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7650
7651 @item -freorder-blocks-algorithm=@var{algorithm}
7652 @opindex freorder-blocks-algorithm
7653 Use the specified algorithm for basic block reordering. The
7654 @var{algorithm} argument can be @samp{simple}, which does not increase
7655 code size (except sometimes due to secondary effects like alignment),
7656 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
7657 put all often executed code together, minimizing the number of branches
7658 executed by making extra copies of code.
7659
7660 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
7661 @samp{stc} at levels @option{-O2}, @option{-O3}.
7662
7663 @item -freorder-blocks-and-partition
7664 @opindex freorder-blocks-and-partition
7665 In addition to reordering basic blocks in the compiled function, in order
7666 to reduce number of taken branches, partitions hot and cold basic blocks
7667 into separate sections of the assembly and @file{.o} files, to improve
7668 paging and cache locality performance.
7669
7670 This optimization is automatically turned off in the presence of
7671 exception handling, for linkonce sections, for functions with a user-defined
7672 section attribute and on any architecture that does not support named
7673 sections.
7674
7675 Enabled for x86 at levels @option{-O2}, @option{-O3}.
7676
7677 @item -freorder-functions
7678 @opindex freorder-functions
7679 Reorder functions in the object file in order to
7680 improve code locality. This is implemented by using special
7681 subsections @code{.text.hot} for most frequently executed functions and
7682 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
7683 the linker so object file format must support named sections and linker must
7684 place them in a reasonable way.
7685
7686 Also profile feedback must be available to make this option effective. See
7687 @option{-fprofile-arcs} for details.
7688
7689 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7690
7691 @item -fstrict-aliasing
7692 @opindex fstrict-aliasing
7693 Allow the compiler to assume the strictest aliasing rules applicable to
7694 the language being compiled. For C (and C++), this activates
7695 optimizations based on the type of expressions. In particular, an
7696 object of one type is assumed never to reside at the same address as an
7697 object of a different type, unless the types are almost the same. For
7698 example, an @code{unsigned int} can alias an @code{int}, but not a
7699 @code{void*} or a @code{double}. A character type may alias any other
7700 type.
7701
7702 @anchor{Type-punning}Pay special attention to code like this:
7703 @smallexample
7704 union a_union @{
7705 int i;
7706 double d;
7707 @};
7708
7709 int f() @{
7710 union a_union t;
7711 t.d = 3.0;
7712 return t.i;
7713 @}
7714 @end smallexample
7715 The practice of reading from a different union member than the one most
7716 recently written to (called ``type-punning'') is common. Even with
7717 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
7718 is accessed through the union type. So, the code above works as
7719 expected. @xref{Structures unions enumerations and bit-fields
7720 implementation}. However, this code might not:
7721 @smallexample
7722 int f() @{
7723 union a_union t;
7724 int* ip;
7725 t.d = 3.0;
7726 ip = &t.i;
7727 return *ip;
7728 @}
7729 @end smallexample
7730
7731 Similarly, access by taking the address, casting the resulting pointer
7732 and dereferencing the result has undefined behavior, even if the cast
7733 uses a union type, e.g.:
7734 @smallexample
7735 int f() @{
7736 double d = 3.0;
7737 return ((union a_union *) &d)->i;
7738 @}
7739 @end smallexample
7740
7741 The @option{-fstrict-aliasing} option is enabled at levels
7742 @option{-O2}, @option{-O3}, @option{-Os}.
7743
7744 @item -fstrict-overflow
7745 @opindex fstrict-overflow
7746 Allow the compiler to assume strict signed overflow rules, depending
7747 on the language being compiled. For C (and C++) this means that
7748 overflow when doing arithmetic with signed numbers is undefined, which
7749 means that the compiler may assume that it does not happen. This
7750 permits various optimizations. For example, the compiler assumes
7751 that an expression like @code{i + 10 > i} is always true for
7752 signed @code{i}. This assumption is only valid if signed overflow is
7753 undefined, as the expression is false if @code{i + 10} overflows when
7754 using twos complement arithmetic. When this option is in effect any
7755 attempt to determine whether an operation on signed numbers
7756 overflows must be written carefully to not actually involve overflow.
7757
7758 This option also allows the compiler to assume strict pointer
7759 semantics: given a pointer to an object, if adding an offset to that
7760 pointer does not produce a pointer to the same object, the addition is
7761 undefined. This permits the compiler to conclude that @code{p + u >
7762 p} is always true for a pointer @code{p} and unsigned integer
7763 @code{u}. This assumption is only valid because pointer wraparound is
7764 undefined, as the expression is false if @code{p + u} overflows using
7765 twos complement arithmetic.
7766
7767 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
7768 that integer signed overflow is fully defined: it wraps. When
7769 @option{-fwrapv} is used, there is no difference between
7770 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
7771 integers. With @option{-fwrapv} certain types of overflow are
7772 permitted. For example, if the compiler gets an overflow when doing
7773 arithmetic on constants, the overflowed value can still be used with
7774 @option{-fwrapv}, but not otherwise.
7775
7776 The @option{-fstrict-overflow} option is enabled at levels
7777 @option{-O2}, @option{-O3}, @option{-Os}.
7778
7779 @item -falign-functions
7780 @itemx -falign-functions=@var{n}
7781 @opindex falign-functions
7782 Align the start of functions to the next power-of-two greater than
7783 @var{n}, skipping up to @var{n} bytes. For instance,
7784 @option{-falign-functions=32} aligns functions to the next 32-byte
7785 boundary, but @option{-falign-functions=24} aligns to the next
7786 32-byte boundary only if this can be done by skipping 23 bytes or less.
7787
7788 @option{-fno-align-functions} and @option{-falign-functions=1} are
7789 equivalent and mean that functions are not aligned.
7790
7791 Some assemblers only support this flag when @var{n} is a power of two;
7792 in that case, it is rounded up.
7793
7794 If @var{n} is not specified or is zero, use a machine-dependent default.
7795
7796 Enabled at levels @option{-O2}, @option{-O3}.
7797
7798 @item -falign-labels
7799 @itemx -falign-labels=@var{n}
7800 @opindex falign-labels
7801 Align all branch targets to a power-of-two boundary, skipping up to
7802 @var{n} bytes like @option{-falign-functions}. This option can easily
7803 make code slower, because it must insert dummy operations for when the
7804 branch target is reached in the usual flow of the code.
7805
7806 @option{-fno-align-labels} and @option{-falign-labels=1} are
7807 equivalent and mean that labels are not aligned.
7808
7809 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
7810 are greater than this value, then their values are used instead.
7811
7812 If @var{n} is not specified or is zero, use a machine-dependent default
7813 which is very likely to be @samp{1}, meaning no alignment.
7814
7815 Enabled at levels @option{-O2}, @option{-O3}.
7816
7817 @item -falign-loops
7818 @itemx -falign-loops=@var{n}
7819 @opindex falign-loops
7820 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
7821 like @option{-falign-functions}. If the loops are
7822 executed many times, this makes up for any execution of the dummy
7823 operations.
7824
7825 @option{-fno-align-loops} and @option{-falign-loops=1} are
7826 equivalent and mean that loops are not aligned.
7827
7828 If @var{n} is not specified or is zero, use a machine-dependent default.
7829
7830 Enabled at levels @option{-O2}, @option{-O3}.
7831
7832 @item -falign-jumps
7833 @itemx -falign-jumps=@var{n}
7834 @opindex falign-jumps
7835 Align branch targets to a power-of-two boundary, for branch targets
7836 where the targets can only be reached by jumping, skipping up to @var{n}
7837 bytes like @option{-falign-functions}. In this case, no dummy operations
7838 need be executed.
7839
7840 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
7841 equivalent and mean that loops are not aligned.
7842
7843 If @var{n} is not specified or is zero, use a machine-dependent default.
7844
7845 Enabled at levels @option{-O2}, @option{-O3}.
7846
7847 @item -funit-at-a-time
7848 @opindex funit-at-a-time
7849 This option is left for compatibility reasons. @option{-funit-at-a-time}
7850 has no effect, while @option{-fno-unit-at-a-time} implies
7851 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
7852
7853 Enabled by default.
7854
7855 @item -fno-toplevel-reorder
7856 @opindex fno-toplevel-reorder
7857 Do not reorder top-level functions, variables, and @code{asm}
7858 statements. Output them in the same order that they appear in the
7859 input file. When this option is used, unreferenced static variables
7860 are not removed. This option is intended to support existing code
7861 that relies on a particular ordering. For new code, it is better to
7862 use attributes when possible.
7863
7864 Enabled at level @option{-O0}. When disabled explicitly, it also implies
7865 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
7866 targets.
7867
7868 @item -fweb
7869 @opindex fweb
7870 Constructs webs as commonly used for register allocation purposes and assign
7871 each web individual pseudo register. This allows the register allocation pass
7872 to operate on pseudos directly, but also strengthens several other optimization
7873 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
7874 however, make debugging impossible, since variables no longer stay in a
7875 ``home register''.
7876
7877 Enabled by default with @option{-funroll-loops}.
7878
7879 @item -fwhole-program
7880 @opindex fwhole-program
7881 Assume that the current compilation unit represents the whole program being
7882 compiled. All public functions and variables with the exception of @code{main}
7883 and those merged by attribute @code{externally_visible} become static functions
7884 and in effect are optimized more aggressively by interprocedural optimizers.
7885
7886 This option should not be used in combination with @option{-flto}.
7887 Instead relying on a linker plugin should provide safer and more precise
7888 information.
7889
7890 @item -flto[=@var{n}]
7891 @opindex flto
7892 This option runs the standard link-time optimizer. When invoked
7893 with source code, it generates GIMPLE (one of GCC's internal
7894 representations) and writes it to special ELF sections in the object
7895 file. When the object files are linked together, all the function
7896 bodies are read from these ELF sections and instantiated as if they
7897 had been part of the same translation unit.
7898
7899 To use the link-time optimizer, @option{-flto} and optimization
7900 options should be specified at compile time and during the final link.
7901 It is recommended that you compile all the files participating in the
7902 same link with the same options and also specify those options at
7903 link time.
7904 For example:
7905
7906 @smallexample
7907 gcc -c -O2 -flto foo.c
7908 gcc -c -O2 -flto bar.c
7909 gcc -o myprog -flto -O2 foo.o bar.o
7910 @end smallexample
7911
7912 The first two invocations to GCC save a bytecode representation
7913 of GIMPLE into special ELF sections inside @file{foo.o} and
7914 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
7915 @file{foo.o} and @file{bar.o}, merges the two files into a single
7916 internal image, and compiles the result as usual. Since both
7917 @file{foo.o} and @file{bar.o} are merged into a single image, this
7918 causes all the interprocedural analyses and optimizations in GCC to
7919 work across the two files as if they were a single one. This means,
7920 for example, that the inliner is able to inline functions in
7921 @file{bar.o} into functions in @file{foo.o} and vice-versa.
7922
7923 Another (simpler) way to enable link-time optimization is:
7924
7925 @smallexample
7926 gcc -o myprog -flto -O2 foo.c bar.c
7927 @end smallexample
7928
7929 The above generates bytecode for @file{foo.c} and @file{bar.c},
7930 merges them together into a single GIMPLE representation and optimizes
7931 them as usual to produce @file{myprog}.
7932
7933 The only important thing to keep in mind is that to enable link-time
7934 optimizations you need to use the GCC driver to perform the link step.
7935 GCC then automatically performs link-time optimization if any of the
7936 objects involved were compiled with the @option{-flto} command-line option.
7937 You generally
7938 should specify the optimization options to be used for link-time
7939 optimization though GCC tries to be clever at guessing an
7940 optimization level to use from the options used at compile time
7941 if you fail to specify one at link time. You can always override
7942 the automatic decision to do link-time optimization at link time
7943 by passing @option{-fno-lto} to the link command.
7944
7945 To make whole program optimization effective, it is necessary to make
7946 certain whole program assumptions. The compiler needs to know
7947 what functions and variables can be accessed by libraries and runtime
7948 outside of the link-time optimized unit. When supported by the linker,
7949 the linker plugin (see @option{-fuse-linker-plugin}) passes information
7950 to the compiler about used and externally visible symbols. When
7951 the linker plugin is not available, @option{-fwhole-program} should be
7952 used to allow the compiler to make these assumptions, which leads
7953 to more aggressive optimization decisions.
7954
7955 When @option{-fuse-linker-plugin} is not enabled, when a file is
7956 compiled with @option{-flto}, the generated object file is larger than
7957 a regular object file because it contains GIMPLE bytecodes and the usual
7958 final code (see @option{-ffat-lto-objects}. This means that
7959 object files with LTO information can be linked as normal object
7960 files; if @option{-fno-lto} is passed to the linker, no
7961 interprocedural optimizations are applied. Note that when
7962 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
7963 but you cannot perform a regular, non-LTO link on them.
7964
7965 Additionally, the optimization flags used to compile individual files
7966 are not necessarily related to those used at link time. For instance,
7967
7968 @smallexample
7969 gcc -c -O0 -ffat-lto-objects -flto foo.c
7970 gcc -c -O0 -ffat-lto-objects -flto bar.c
7971 gcc -o myprog -O3 foo.o bar.o
7972 @end smallexample
7973
7974 This produces individual object files with unoptimized assembler
7975 code, but the resulting binary @file{myprog} is optimized at
7976 @option{-O3}. If, instead, the final binary is generated with
7977 @option{-fno-lto}, then @file{myprog} is not optimized.
7978
7979 When producing the final binary, GCC only
7980 applies link-time optimizations to those files that contain bytecode.
7981 Therefore, you can mix and match object files and libraries with
7982 GIMPLE bytecodes and final object code. GCC automatically selects
7983 which files to optimize in LTO mode and which files to link without
7984 further processing.
7985
7986 There are some code generation flags preserved by GCC when
7987 generating bytecodes, as they need to be used during the final link
7988 stage. Generally options specified at link time override those
7989 specified at compile time.
7990
7991 If you do not specify an optimization level option @option{-O} at
7992 link time, then GCC uses the highest optimization level
7993 used when compiling the object files.
7994
7995 Currently, the following options and their settings are taken from
7996 the first object file that explicitly specifies them:
7997 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
7998 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
7999 and all the @option{-m} target flags.
8000
8001 Certain ABI-changing flags are required to match in all compilation units,
8002 and trying to override this at link time with a conflicting value
8003 is ignored. This includes options such as @option{-freg-struct-return}
8004 and @option{-fpcc-struct-return}.
8005
8006 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8007 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8008 are passed through to the link stage and merged conservatively for
8009 conflicting translation units. Specifically
8010 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8011 precedence; and for example @option{-ffp-contract=off} takes precedence
8012 over @option{-ffp-contract=fast}. You can override them at link time.
8013
8014 If LTO encounters objects with C linkage declared with incompatible
8015 types in separate translation units to be linked together (undefined
8016 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8017 issued. The behavior is still undefined at run time. Similar
8018 diagnostics may be raised for other languages.
8019
8020 Another feature of LTO is that it is possible to apply interprocedural
8021 optimizations on files written in different languages:
8022
8023 @smallexample
8024 gcc -c -flto foo.c
8025 g++ -c -flto bar.cc
8026 gfortran -c -flto baz.f90
8027 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8028 @end smallexample
8029
8030 Notice that the final link is done with @command{g++} to get the C++
8031 runtime libraries and @option{-lgfortran} is added to get the Fortran
8032 runtime libraries. In general, when mixing languages in LTO mode, you
8033 should use the same link command options as when mixing languages in a
8034 regular (non-LTO) compilation.
8035
8036 If object files containing GIMPLE bytecode are stored in a library archive, say
8037 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8038 are using a linker with plugin support. To create static libraries suitable
8039 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8040 and @command{ranlib};
8041 to show the symbols of object files with GIMPLE bytecode, use
8042 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8043 and @command{nm} have been compiled with plugin support. At link time, use the the
8044 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8045 the LTO optimization process:
8046
8047 @smallexample
8048 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8049 @end smallexample
8050
8051 With the linker plugin enabled, the linker extracts the needed
8052 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8053 to make them part of the aggregated GIMPLE image to be optimized.
8054
8055 If you are not using a linker with plugin support and/or do not
8056 enable the linker plugin, then the objects inside @file{libfoo.a}
8057 are extracted and linked as usual, but they do not participate
8058 in the LTO optimization process. In order to make a static library suitable
8059 for both LTO optimization and usual linkage, compile its object files with
8060 @option{-flto} @option{-ffat-lto-objects}.
8061
8062 Link-time optimizations do not require the presence of the whole program to
8063 operate. If the program does not require any symbols to be exported, it is
8064 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8065 the interprocedural optimizers to use more aggressive assumptions which may
8066 lead to improved optimization opportunities.
8067 Use of @option{-fwhole-program} is not needed when linker plugin is
8068 active (see @option{-fuse-linker-plugin}).
8069
8070 The current implementation of LTO makes no
8071 attempt to generate bytecode that is portable between different
8072 types of hosts. The bytecode files are versioned and there is a
8073 strict version check, so bytecode files generated in one version of
8074 GCC do not work with an older or newer version of GCC.
8075
8076 Link-time optimization does not work well with generation of debugging
8077 information. Combining @option{-flto} with
8078 @option{-g} is currently experimental and expected to produce unexpected
8079 results.
8080
8081 If you specify the optional @var{n}, the optimization and code
8082 generation done at link time is executed in parallel using @var{n}
8083 parallel jobs by utilizing an installed @command{make} program. The
8084 environment variable @env{MAKE} may be used to override the program
8085 used. The default value for @var{n} is 1.
8086
8087 You can also specify @option{-flto=jobserver} to use GNU make's
8088 job server mode to determine the number of parallel jobs. This
8089 is useful when the Makefile calling GCC is already executing in parallel.
8090 You must prepend a @samp{+} to the command recipe in the parent Makefile
8091 for this to work. This option likely only works if @env{MAKE} is
8092 GNU make.
8093
8094 @item -flto-partition=@var{alg}
8095 @opindex flto-partition
8096 Specify the partitioning algorithm used by the link-time optimizer.
8097 The value is either @samp{1to1} to specify a partitioning mirroring
8098 the original source files or @samp{balanced} to specify partitioning
8099 into equally sized chunks (whenever possible) or @samp{max} to create
8100 new partition for every symbol where possible. Specifying @samp{none}
8101 as an algorithm disables partitioning and streaming completely.
8102 The default value is @samp{balanced}. While @samp{1to1} can be used
8103 as an workaround for various code ordering issues, the @samp{max}
8104 partitioning is intended for internal testing only.
8105 The value @samp{one} specifies that exactly one partition should be
8106 used while the value @samp{none} bypasses partitioning and executes
8107 the link-time optimization step directly from the WPA phase.
8108
8109 @item -flto-odr-type-merging
8110 @opindex flto-odr-type-merging
8111 Enable streaming of mangled types names of C++ types and their unification
8112 at link time. This increases size of LTO object files, but enables
8113 diagnostics about One Definition Rule violations.
8114
8115 @item -flto-compression-level=@var{n}
8116 @opindex flto-compression-level
8117 This option specifies the level of compression used for intermediate
8118 language written to LTO object files, and is only meaningful in
8119 conjunction with LTO mode (@option{-flto}). Valid
8120 values are 0 (no compression) to 9 (maximum compression). Values
8121 outside this range are clamped to either 0 or 9. If the option is not
8122 given, a default balanced compression setting is used.
8123
8124 @item -fuse-linker-plugin
8125 @opindex fuse-linker-plugin
8126 Enables the use of a linker plugin during link-time optimization. This
8127 option relies on plugin support in the linker, which is available in gold
8128 or in GNU ld 2.21 or newer.
8129
8130 This option enables the extraction of object files with GIMPLE bytecode out
8131 of library archives. This improves the quality of optimization by exposing
8132 more code to the link-time optimizer. This information specifies what
8133 symbols can be accessed externally (by non-LTO object or during dynamic
8134 linking). Resulting code quality improvements on binaries (and shared
8135 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
8136 See @option{-flto} for a description of the effect of this flag and how to
8137 use it.
8138
8139 This option is enabled by default when LTO support in GCC is enabled
8140 and GCC was configured for use with
8141 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8142
8143 @item -ffat-lto-objects
8144 @opindex ffat-lto-objects
8145 Fat LTO objects are object files that contain both the intermediate language
8146 and the object code. This makes them usable for both LTO linking and normal
8147 linking. This option is effective only when compiling with @option{-flto}
8148 and is ignored at link time.
8149
8150 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8151 requires the complete toolchain to be aware of LTO. It requires a linker with
8152 linker plugin support for basic functionality. Additionally,
8153 @command{nm}, @command{ar} and @command{ranlib}
8154 need to support linker plugins to allow a full-featured build environment
8155 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
8156 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8157 to these tools. With non fat LTO makefiles need to be modified to use them.
8158
8159 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
8160 support.
8161
8162 @item -fcompare-elim
8163 @opindex fcompare-elim
8164 After register allocation and post-register allocation instruction splitting,
8165 identify arithmetic instructions that compute processor flags similar to a
8166 comparison operation based on that arithmetic. If possible, eliminate the
8167 explicit comparison operation.
8168
8169 This pass only applies to certain targets that cannot explicitly represent
8170 the comparison operation before register allocation is complete.
8171
8172 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8173
8174 @item -fcprop-registers
8175 @opindex fcprop-registers
8176 After register allocation and post-register allocation instruction splitting,
8177 perform a copy-propagation pass to try to reduce scheduling dependencies
8178 and occasionally eliminate the copy.
8179
8180 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8181
8182 @item -fprofile-correction
8183 @opindex fprofile-correction
8184 Profiles collected using an instrumented binary for multi-threaded programs may
8185 be inconsistent due to missed counter updates. When this option is specified,
8186 GCC uses heuristics to correct or smooth out such inconsistencies. By
8187 default, GCC emits an error message when an inconsistent profile is detected.
8188
8189 @item -fprofile-use
8190 @itemx -fprofile-use=@var{path}
8191 @opindex fprofile-use
8192 Enable profile feedback-directed optimizations,
8193 and the following optimizations
8194 which are generally profitable only with profile feedback available:
8195 @option{-fbranch-probabilities}, @option{-fvpt},
8196 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8197 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
8198
8199 Before you can use this option, you must first generate profiling information.
8200 @xref{Optimize Options}, for information about the @option{-fprofile-generate}
8201 option.
8202
8203 By default, GCC emits an error message if the feedback profiles do not
8204 match the source code. This error can be turned into a warning by using
8205 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8206 code.
8207
8208 If @var{path} is specified, GCC looks at the @var{path} to find
8209 the profile feedback data files. See @option{-fprofile-dir}.
8210
8211 @item -fauto-profile
8212 @itemx -fauto-profile=@var{path}
8213 @opindex fauto-profile
8214 Enable sampling-based feedback-directed optimizations,
8215 and the following optimizations
8216 which are generally profitable only with profile feedback available:
8217 @option{-fbranch-probabilities}, @option{-fvpt},
8218 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8219 @option{-ftree-vectorize},
8220 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
8221 @option{-fpredictive-commoning}, @option{-funswitch-loops},
8222 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
8223
8224 @var{path} is the name of a file containing AutoFDO profile information.
8225 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
8226
8227 Producing an AutoFDO profile data file requires running your program
8228 with the @command{perf} utility on a supported GNU/Linux target system.
8229 For more information, see @uref{https://perf.wiki.kernel.org/}.
8230
8231 E.g.
8232 @smallexample
8233 perf record -e br_inst_retired:near_taken -b -o perf.data \
8234 -- your_program
8235 @end smallexample
8236
8237 Then use the @command{create_gcov} tool to convert the raw profile data
8238 to a format that can be used by GCC.@ You must also supply the
8239 unstripped binary for your program to this tool.
8240 See @uref{https://github.com/google/autofdo}.
8241
8242 E.g.
8243 @smallexample
8244 create_gcov --binary=your_program.unstripped --profile=perf.data \
8245 --gcov=profile.afdo
8246 @end smallexample
8247 @end table
8248
8249 The following options control compiler behavior regarding floating-point
8250 arithmetic. These options trade off between speed and
8251 correctness. All must be specifically enabled.
8252
8253 @table @gcctabopt
8254 @item -ffloat-store
8255 @opindex ffloat-store
8256 Do not store floating-point variables in registers, and inhibit other
8257 options that might change whether a floating-point value is taken from a
8258 register or memory.
8259
8260 @cindex floating-point precision
8261 This option prevents undesirable excess precision on machines such as
8262 the 68000 where the floating registers (of the 68881) keep more
8263 precision than a @code{double} is supposed to have. Similarly for the
8264 x86 architecture. For most programs, the excess precision does only
8265 good, but a few programs rely on the precise definition of IEEE floating
8266 point. Use @option{-ffloat-store} for such programs, after modifying
8267 them to store all pertinent intermediate computations into variables.
8268
8269 @item -fexcess-precision=@var{style}
8270 @opindex fexcess-precision
8271 This option allows further control over excess precision on machines
8272 where floating-point registers have more precision than the IEEE
8273 @code{float} and @code{double} types and the processor does not
8274 support operations rounding to those types. By default,
8275 @option{-fexcess-precision=fast} is in effect; this means that
8276 operations are carried out in the precision of the registers and that
8277 it is unpredictable when rounding to the types specified in the source
8278 code takes place. When compiling C, if
8279 @option{-fexcess-precision=standard} is specified then excess
8280 precision follows the rules specified in ISO C99; in particular,
8281 both casts and assignments cause values to be rounded to their
8282 semantic types (whereas @option{-ffloat-store} only affects
8283 assignments). This option is enabled by default for C if a strict
8284 conformance option such as @option{-std=c99} is used.
8285
8286 @opindex mfpmath
8287 @option{-fexcess-precision=standard} is not implemented for languages
8288 other than C, and has no effect if
8289 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8290 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8291 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8292 semantics apply without excess precision, and in the latter, rounding
8293 is unpredictable.
8294
8295 @item -ffast-math
8296 @opindex ffast-math
8297 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8298 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8299 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8300
8301 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8302
8303 This option is not turned on by any @option{-O} option besides
8304 @option{-Ofast} since it can result in incorrect output for programs
8305 that depend on an exact implementation of IEEE or ISO rules/specifications
8306 for math functions. It may, however, yield faster code for programs
8307 that do not require the guarantees of these specifications.
8308
8309 @item -fno-math-errno
8310 @opindex fno-math-errno
8311 Do not set @code{errno} after calling math functions that are executed
8312 with a single instruction, e.g., @code{sqrt}. A program that relies on
8313 IEEE exceptions for math error handling may want to use this flag
8314 for speed while maintaining IEEE arithmetic compatibility.
8315
8316 This option is not turned on by any @option{-O} option since
8317 it can result in incorrect output for programs that depend on
8318 an exact implementation of IEEE or ISO rules/specifications for
8319 math functions. It may, however, yield faster code for programs
8320 that do not require the guarantees of these specifications.
8321
8322 The default is @option{-fmath-errno}.
8323
8324 On Darwin systems, the math library never sets @code{errno}. There is
8325 therefore no reason for the compiler to consider the possibility that
8326 it might, and @option{-fno-math-errno} is the default.
8327
8328 @item -funsafe-math-optimizations
8329 @opindex funsafe-math-optimizations
8330
8331 Allow optimizations for floating-point arithmetic that (a) assume
8332 that arguments and results are valid and (b) may violate IEEE or
8333 ANSI standards. When used at link time, it may include libraries
8334 or startup files that change the default FPU control word or other
8335 similar optimizations.
8336
8337 This option is not turned on by any @option{-O} option since
8338 it can result in incorrect output for programs that depend on
8339 an exact implementation of IEEE or ISO rules/specifications for
8340 math functions. It may, however, yield faster code for programs
8341 that do not require the guarantees of these specifications.
8342 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
8343 @option{-fassociative-math} and @option{-freciprocal-math}.
8344
8345 The default is @option{-fno-unsafe-math-optimizations}.
8346
8347 @item -fassociative-math
8348 @opindex fassociative-math
8349
8350 Allow re-association of operands in series of floating-point operations.
8351 This violates the ISO C and C++ language standard by possibly changing
8352 computation result. NOTE: re-ordering may change the sign of zero as
8353 well as ignore NaNs and inhibit or create underflow or overflow (and
8354 thus cannot be used on code that relies on rounding behavior like
8355 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
8356 and thus may not be used when ordered comparisons are required.
8357 This option requires that both @option{-fno-signed-zeros} and
8358 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
8359 much sense with @option{-frounding-math}. For Fortran the option
8360 is automatically enabled when both @option{-fno-signed-zeros} and
8361 @option{-fno-trapping-math} are in effect.
8362
8363 The default is @option{-fno-associative-math}.
8364
8365 @item -freciprocal-math
8366 @opindex freciprocal-math
8367
8368 Allow the reciprocal of a value to be used instead of dividing by
8369 the value if this enables optimizations. For example @code{x / y}
8370 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
8371 is subject to common subexpression elimination. Note that this loses
8372 precision and increases the number of flops operating on the value.
8373
8374 The default is @option{-fno-reciprocal-math}.
8375
8376 @item -ffinite-math-only
8377 @opindex ffinite-math-only
8378 Allow optimizations for floating-point arithmetic that assume
8379 that arguments and results are not NaNs or +-Infs.
8380
8381 This option is not turned on by any @option{-O} option since
8382 it can result in incorrect output for programs that depend on
8383 an exact implementation of IEEE or ISO rules/specifications for
8384 math functions. It may, however, yield faster code for programs
8385 that do not require the guarantees of these specifications.
8386
8387 The default is @option{-fno-finite-math-only}.
8388
8389 @item -fno-signed-zeros
8390 @opindex fno-signed-zeros
8391 Allow optimizations for floating-point arithmetic that ignore the
8392 signedness of zero. IEEE arithmetic specifies the behavior of
8393 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
8394 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
8395 This option implies that the sign of a zero result isn't significant.
8396
8397 The default is @option{-fsigned-zeros}.
8398
8399 @item -fno-trapping-math
8400 @opindex fno-trapping-math
8401 Compile code assuming that floating-point operations cannot generate
8402 user-visible traps. These traps include division by zero, overflow,
8403 underflow, inexact result and invalid operation. This option requires
8404 that @option{-fno-signaling-nans} be in effect. Setting this option may
8405 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
8406
8407 This option should never be turned on by any @option{-O} option since
8408 it can result in incorrect output for programs that depend on
8409 an exact implementation of IEEE or ISO rules/specifications for
8410 math functions.
8411
8412 The default is @option{-ftrapping-math}.
8413
8414 @item -frounding-math
8415 @opindex frounding-math
8416 Disable transformations and optimizations that assume default floating-point
8417 rounding behavior. This is round-to-zero for all floating point
8418 to integer conversions, and round-to-nearest for all other arithmetic
8419 truncations. This option should be specified for programs that change
8420 the FP rounding mode dynamically, or that may be executed with a
8421 non-default rounding mode. This option disables constant folding of
8422 floating-point expressions at compile time (which may be affected by
8423 rounding mode) and arithmetic transformations that are unsafe in the
8424 presence of sign-dependent rounding modes.
8425
8426 The default is @option{-fno-rounding-math}.
8427
8428 This option is experimental and does not currently guarantee to
8429 disable all GCC optimizations that are affected by rounding mode.
8430 Future versions of GCC may provide finer control of this setting
8431 using C99's @code{FENV_ACCESS} pragma. This command-line option
8432 will be used to specify the default state for @code{FENV_ACCESS}.
8433
8434 @item -fsignaling-nans
8435 @opindex fsignaling-nans
8436 Compile code assuming that IEEE signaling NaNs may generate user-visible
8437 traps during floating-point operations. Setting this option disables
8438 optimizations that may change the number of exceptions visible with
8439 signaling NaNs. This option implies @option{-ftrapping-math}.
8440
8441 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
8442 be defined.
8443
8444 The default is @option{-fno-signaling-nans}.
8445
8446 This option is experimental and does not currently guarantee to
8447 disable all GCC optimizations that affect signaling NaN behavior.
8448
8449 @item -fsingle-precision-constant
8450 @opindex fsingle-precision-constant
8451 Treat floating-point constants as single precision instead of
8452 implicitly converting them to double-precision constants.
8453
8454 @item -fcx-limited-range
8455 @opindex fcx-limited-range
8456 When enabled, this option states that a range reduction step is not
8457 needed when performing complex division. Also, there is no checking
8458 whether the result of a complex multiplication or division is @code{NaN
8459 + I*NaN}, with an attempt to rescue the situation in that case. The
8460 default is @option{-fno-cx-limited-range}, but is enabled by
8461 @option{-ffast-math}.
8462
8463 This option controls the default setting of the ISO C99
8464 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
8465 all languages.
8466
8467 @item -fcx-fortran-rules
8468 @opindex fcx-fortran-rules
8469 Complex multiplication and division follow Fortran rules. Range
8470 reduction is done as part of complex division, but there is no checking
8471 whether the result of a complex multiplication or division is @code{NaN
8472 + I*NaN}, with an attempt to rescue the situation in that case.
8473
8474 The default is @option{-fno-cx-fortran-rules}.
8475
8476 @end table
8477
8478 The following options control optimizations that may improve
8479 performance, but are not enabled by any @option{-O} options. This
8480 section includes experimental options that may produce broken code.
8481
8482 @table @gcctabopt
8483 @item -fbranch-probabilities
8484 @opindex fbranch-probabilities
8485 After running a program compiled with @option{-fprofile-arcs}
8486 (@pxref{Instrumentation Options}),
8487 you can compile it a second time using
8488 @option{-fbranch-probabilities}, to improve optimizations based on
8489 the number of times each branch was taken. When a program
8490 compiled with @option{-fprofile-arcs} exits, it saves arc execution
8491 counts to a file called @file{@var{sourcename}.gcda} for each source
8492 file. The information in this data file is very dependent on the
8493 structure of the generated code, so you must use the same source code
8494 and the same optimization options for both compilations.
8495
8496 With @option{-fbranch-probabilities}, GCC puts a
8497 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8498 These can be used to improve optimization. Currently, they are only
8499 used in one place: in @file{reorg.c}, instead of guessing which path a
8500 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8501 exactly determine which path is taken more often.
8502
8503 @item -fprofile-values
8504 @opindex fprofile-values
8505 If combined with @option{-fprofile-arcs}, it adds code so that some
8506 data about values of expressions in the program is gathered.
8507
8508 With @option{-fbranch-probabilities}, it reads back the data gathered
8509 from profiling values of expressions for usage in optimizations.
8510
8511 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8512
8513 @item -fprofile-reorder-functions
8514 @opindex fprofile-reorder-functions
8515 Function reordering based on profile instrumentation collects
8516 first time of execution of a function and orders these functions
8517 in ascending order.
8518
8519 Enabled with @option{-fprofile-use}.
8520
8521 @item -fvpt
8522 @opindex fvpt
8523 If combined with @option{-fprofile-arcs}, this option instructs the compiler
8524 to add code to gather information about values of expressions.
8525
8526 With @option{-fbranch-probabilities}, it reads back the data gathered
8527 and actually performs the optimizations based on them.
8528 Currently the optimizations include specialization of division operations
8529 using the knowledge about the value of the denominator.
8530
8531 @item -frename-registers
8532 @opindex frename-registers
8533 Attempt to avoid false dependencies in scheduled code by making use
8534 of registers left over after register allocation. This optimization
8535 most benefits processors with lots of registers. Depending on the
8536 debug information format adopted by the target, however, it can
8537 make debugging impossible, since variables no longer stay in
8538 a ``home register''.
8539
8540 Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
8541
8542 @item -fschedule-fusion
8543 @opindex fschedule-fusion
8544 Performs a target dependent pass over the instruction stream to schedule
8545 instructions of same type together because target machine can execute them
8546 more efficiently if they are adjacent to each other in the instruction flow.
8547
8548 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8549
8550 @item -ftracer
8551 @opindex ftracer
8552 Perform tail duplication to enlarge superblock size. This transformation
8553 simplifies the control flow of the function allowing other optimizations to do
8554 a better job.
8555
8556 Enabled with @option{-fprofile-use}.
8557
8558 @item -funroll-loops
8559 @opindex funroll-loops
8560 Unroll loops whose number of iterations can be determined at compile time or
8561 upon entry to the loop. @option{-funroll-loops} implies
8562 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
8563 It also turns on complete loop peeling (i.e.@: complete removal of loops with
8564 a small constant number of iterations). This option makes code larger, and may
8565 or may not make it run faster.
8566
8567 Enabled with @option{-fprofile-use}.
8568
8569 @item -funroll-all-loops
8570 @opindex funroll-all-loops
8571 Unroll all loops, even if their number of iterations is uncertain when
8572 the loop is entered. This usually makes programs run more slowly.
8573 @option{-funroll-all-loops} implies the same options as
8574 @option{-funroll-loops}.
8575
8576 @item -fpeel-loops
8577 @opindex fpeel-loops
8578 Peels loops for which there is enough information that they do not
8579 roll much (from profile feedback). It also turns on complete loop peeling
8580 (i.e.@: complete removal of loops with small constant number of iterations).
8581
8582 Enabled with @option{-fprofile-use}.
8583
8584 @item -fmove-loop-invariants
8585 @opindex fmove-loop-invariants
8586 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
8587 at level @option{-O1}
8588
8589 @item -funswitch-loops
8590 @opindex funswitch-loops
8591 Move branches with loop invariant conditions out of the loop, with duplicates
8592 of the loop on both branches (modified according to result of the condition).
8593
8594 @item -ffunction-sections
8595 @itemx -fdata-sections
8596 @opindex ffunction-sections
8597 @opindex fdata-sections
8598 Place each function or data item into its own section in the output
8599 file if the target supports arbitrary sections. The name of the
8600 function or the name of the data item determines the section's name
8601 in the output file.
8602
8603 Use these options on systems where the linker can perform optimizations
8604 to improve locality of reference in the instruction space. Most systems
8605 using the ELF object format and SPARC processors running Solaris 2 have
8606 linkers with such optimizations. AIX may have these optimizations in
8607 the future.
8608
8609 Only use these options when there are significant benefits from doing
8610 so. When you specify these options, the assembler and linker
8611 create larger object and executable files and are also slower.
8612 You cannot use @command{gprof} on all systems if you
8613 specify this option, and you may have problems with debugging if
8614 you specify both this option and @option{-g}.
8615
8616 @item -fbranch-target-load-optimize
8617 @opindex fbranch-target-load-optimize
8618 Perform branch target register load optimization before prologue / epilogue
8619 threading.
8620 The use of target registers can typically be exposed only during reload,
8621 thus hoisting loads out of loops and doing inter-block scheduling needs
8622 a separate optimization pass.
8623
8624 @item -fbranch-target-load-optimize2
8625 @opindex fbranch-target-load-optimize2
8626 Perform branch target register load optimization after prologue / epilogue
8627 threading.
8628
8629 @item -fbtr-bb-exclusive
8630 @opindex fbtr-bb-exclusive
8631 When performing branch target register load optimization, don't reuse
8632 branch target registers within any basic block.
8633
8634 @item -fstdarg-opt
8635 @opindex fstdarg-opt
8636 Optimize the prologue of variadic argument functions with respect to usage of
8637 those arguments.
8638
8639 @item -fsection-anchors
8640 @opindex fsection-anchors
8641 Try to reduce the number of symbolic address calculations by using
8642 shared ``anchor'' symbols to address nearby objects. This transformation
8643 can help to reduce the number of GOT entries and GOT accesses on some
8644 targets.
8645
8646 For example, the implementation of the following function @code{foo}:
8647
8648 @smallexample
8649 static int a, b, c;
8650 int foo (void) @{ return a + b + c; @}
8651 @end smallexample
8652
8653 @noindent
8654 usually calculates the addresses of all three variables, but if you
8655 compile it with @option{-fsection-anchors}, it accesses the variables
8656 from a common anchor point instead. The effect is similar to the
8657 following pseudocode (which isn't valid C):
8658
8659 @smallexample
8660 int foo (void)
8661 @{
8662 register int *xr = &x;
8663 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8664 @}
8665 @end smallexample
8666
8667 Not all targets support this option.
8668
8669 @item --param @var{name}=@var{value}
8670 @opindex param
8671 In some places, GCC uses various constants to control the amount of
8672 optimization that is done. For example, GCC does not inline functions
8673 that contain more than a certain number of instructions. You can
8674 control some of these constants on the command line using the
8675 @option{--param} option.
8676
8677 The names of specific parameters, and the meaning of the values, are
8678 tied to the internals of the compiler, and are subject to change
8679 without notice in future releases.
8680
8681 In each case, the @var{value} is an integer. The allowable choices for
8682 @var{name} are:
8683
8684 @table @gcctabopt
8685 @item predictable-branch-outcome
8686 When branch is predicted to be taken with probability lower than this threshold
8687 (in percent), then it is considered well predictable. The default is 10.
8688
8689 @item max-rtl-if-conversion-insns
8690 RTL if-conversion tries to remove conditional branches around a block and
8691 replace them with conditionally executed instructions. This parameter
8692 gives the maximum number of instructions in a block which should be
8693 considered for if-conversion. The default is 10, though the compiler will
8694 also use other heuristics to decide whether if-conversion is likely to be
8695 profitable.
8696
8697 @item max-crossjump-edges
8698 The maximum number of incoming edges to consider for cross-jumping.
8699 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
8700 the number of edges incoming to each block. Increasing values mean
8701 more aggressive optimization, making the compilation time increase with
8702 probably small improvement in executable size.
8703
8704 @item min-crossjump-insns
8705 The minimum number of instructions that must be matched at the end
8706 of two blocks before cross-jumping is performed on them. This
8707 value is ignored in the case where all instructions in the block being
8708 cross-jumped from are matched. The default value is 5.
8709
8710 @item max-grow-copy-bb-insns
8711 The maximum code size expansion factor when copying basic blocks
8712 instead of jumping. The expansion is relative to a jump instruction.
8713 The default value is 8.
8714
8715 @item max-goto-duplication-insns
8716 The maximum number of instructions to duplicate to a block that jumps
8717 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
8718 passes, GCC factors computed gotos early in the compilation process,
8719 and unfactors them as late as possible. Only computed jumps at the
8720 end of a basic blocks with no more than max-goto-duplication-insns are
8721 unfactored. The default value is 8.
8722
8723 @item max-delay-slot-insn-search
8724 The maximum number of instructions to consider when looking for an
8725 instruction to fill a delay slot. If more than this arbitrary number of
8726 instructions are searched, the time savings from filling the delay slot
8727 are minimal, so stop searching. Increasing values mean more
8728 aggressive optimization, making the compilation time increase with probably
8729 small improvement in execution time.
8730
8731 @item max-delay-slot-live-search
8732 When trying to fill delay slots, the maximum number of instructions to
8733 consider when searching for a block with valid live register
8734 information. Increasing this arbitrarily chosen value means more
8735 aggressive optimization, increasing the compilation time. This parameter
8736 should be removed when the delay slot code is rewritten to maintain the
8737 control-flow graph.
8738
8739 @item max-gcse-memory
8740 The approximate maximum amount of memory that can be allocated in
8741 order to perform the global common subexpression elimination
8742 optimization. If more memory than specified is required, the
8743 optimization is not done.
8744
8745 @item max-gcse-insertion-ratio
8746 If the ratio of expression insertions to deletions is larger than this value
8747 for any expression, then RTL PRE inserts or removes the expression and thus
8748 leaves partially redundant computations in the instruction stream. The default value is 20.
8749
8750 @item max-pending-list-length
8751 The maximum number of pending dependencies scheduling allows
8752 before flushing the current state and starting over. Large functions
8753 with few branches or calls can create excessively large lists which
8754 needlessly consume memory and resources.
8755
8756 @item max-modulo-backtrack-attempts
8757 The maximum number of backtrack attempts the scheduler should make
8758 when modulo scheduling a loop. Larger values can exponentially increase
8759 compilation time.
8760
8761 @item max-inline-insns-single
8762 Several parameters control the tree inliner used in GCC@.
8763 This number sets the maximum number of instructions (counted in GCC's
8764 internal representation) in a single function that the tree inliner
8765 considers for inlining. This only affects functions declared
8766 inline and methods implemented in a class declaration (C++).
8767 The default value is 400.
8768
8769 @item max-inline-insns-auto
8770 When you use @option{-finline-functions} (included in @option{-O3}),
8771 a lot of functions that would otherwise not be considered for inlining
8772 by the compiler are investigated. To those functions, a different
8773 (more restrictive) limit compared to functions declared inline can
8774 be applied.
8775 The default value is 40.
8776
8777 @item inline-min-speedup
8778 When estimated performance improvement of caller + callee runtime exceeds this
8779 threshold (in precent), the function can be inlined regardless the limit on
8780 @option{--param max-inline-insns-single} and @option{--param
8781 max-inline-insns-auto}.
8782
8783 @item large-function-insns
8784 The limit specifying really large functions. For functions larger than this
8785 limit after inlining, inlining is constrained by
8786 @option{--param large-function-growth}. This parameter is useful primarily
8787 to avoid extreme compilation time caused by non-linear algorithms used by the
8788 back end.
8789 The default value is 2700.
8790
8791 @item large-function-growth
8792 Specifies maximal growth of large function caused by inlining in percents.
8793 The default value is 100 which limits large function growth to 2.0 times
8794 the original size.
8795
8796 @item large-unit-insns
8797 The limit specifying large translation unit. Growth caused by inlining of
8798 units larger than this limit is limited by @option{--param inline-unit-growth}.
8799 For small units this might be too tight.
8800 For example, consider a unit consisting of function A
8801 that is inline and B that just calls A three times. If B is small relative to
8802 A, the growth of unit is 300\% and yet such inlining is very sane. For very
8803 large units consisting of small inlineable functions, however, the overall unit
8804 growth limit is needed to avoid exponential explosion of code size. Thus for
8805 smaller units, the size is increased to @option{--param large-unit-insns}
8806 before applying @option{--param inline-unit-growth}. The default is 10000.
8807
8808 @item inline-unit-growth
8809 Specifies maximal overall growth of the compilation unit caused by inlining.
8810 The default value is 20 which limits unit growth to 1.2 times the original
8811 size. Cold functions (either marked cold via an attribute or by profile
8812 feedback) are not accounted into the unit size.
8813
8814 @item ipcp-unit-growth
8815 Specifies maximal overall growth of the compilation unit caused by
8816 interprocedural constant propagation. The default value is 10 which limits
8817 unit growth to 1.1 times the original size.
8818
8819 @item large-stack-frame
8820 The limit specifying large stack frames. While inlining the algorithm is trying
8821 to not grow past this limit too much. The default value is 256 bytes.
8822
8823 @item large-stack-frame-growth
8824 Specifies maximal growth of large stack frames caused by inlining in percents.
8825 The default value is 1000 which limits large stack frame growth to 11 times
8826 the original size.
8827
8828 @item max-inline-insns-recursive
8829 @itemx max-inline-insns-recursive-auto
8830 Specifies the maximum number of instructions an out-of-line copy of a
8831 self-recursive inline
8832 function can grow into by performing recursive inlining.
8833
8834 @option{--param max-inline-insns-recursive} applies to functions
8835 declared inline.
8836 For functions not declared inline, recursive inlining
8837 happens only when @option{-finline-functions} (included in @option{-O3}) is
8838 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
8839 default value is 450.
8840
8841 @item max-inline-recursive-depth
8842 @itemx max-inline-recursive-depth-auto
8843 Specifies the maximum recursion depth used for recursive inlining.
8844
8845 @option{--param max-inline-recursive-depth} applies to functions
8846 declared inline. For functions not declared inline, recursive inlining
8847 happens only when @option{-finline-functions} (included in @option{-O3}) is
8848 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
8849 default value is 8.
8850
8851 @item min-inline-recursive-probability
8852 Recursive inlining is profitable only for function having deep recursion
8853 in average and can hurt for function having little recursion depth by
8854 increasing the prologue size or complexity of function body to other
8855 optimizers.
8856
8857 When profile feedback is available (see @option{-fprofile-generate}) the actual
8858 recursion depth can be guessed from probability that function recurses via a
8859 given call expression. This parameter limits inlining only to call expressions
8860 whose probability exceeds the given threshold (in percents).
8861 The default value is 10.
8862
8863 @item early-inlining-insns
8864 Specify growth that the early inliner can make. In effect it increases
8865 the amount of inlining for code having a large abstraction penalty.
8866 The default value is 14.
8867
8868 @item max-early-inliner-iterations
8869 Limit of iterations of the early inliner. This basically bounds
8870 the number of nested indirect calls the early inliner can resolve.
8871 Deeper chains are still handled by late inlining.
8872
8873 @item comdat-sharing-probability
8874 Probability (in percent) that C++ inline function with comdat visibility
8875 are shared across multiple compilation units. The default value is 20.
8876
8877 @item profile-func-internal-id
8878 A parameter to control whether to use function internal id in profile
8879 database lookup. If the value is 0, the compiler uses an id that
8880 is based on function assembler name and filename, which makes old profile
8881 data more tolerant to source changes such as function reordering etc.
8882 The default value is 0.
8883
8884 @item min-vect-loop-bound
8885 The minimum number of iterations under which loops are not vectorized
8886 when @option{-ftree-vectorize} is used. The number of iterations after
8887 vectorization needs to be greater than the value specified by this option
8888 to allow vectorization. The default value is 0.
8889
8890 @item gcse-cost-distance-ratio
8891 Scaling factor in calculation of maximum distance an expression
8892 can be moved by GCSE optimizations. This is currently supported only in the
8893 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
8894 is with simple expressions, i.e., the expressions that have cost
8895 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
8896 hoisting of simple expressions. The default value is 10.
8897
8898 @item gcse-unrestricted-cost
8899 Cost, roughly measured as the cost of a single typical machine
8900 instruction, at which GCSE optimizations do not constrain
8901 the distance an expression can travel. This is currently
8902 supported only in the code hoisting pass. The lesser the cost,
8903 the more aggressive code hoisting is. Specifying 0
8904 allows all expressions to travel unrestricted distances.
8905 The default value is 3.
8906
8907 @item max-hoist-depth
8908 The depth of search in the dominator tree for expressions to hoist.
8909 This is used to avoid quadratic behavior in hoisting algorithm.
8910 The value of 0 does not limit on the search, but may slow down compilation
8911 of huge functions. The default value is 30.
8912
8913 @item max-tail-merge-comparisons
8914 The maximum amount of similar bbs to compare a bb with. This is used to
8915 avoid quadratic behavior in tree tail merging. The default value is 10.
8916
8917 @item max-tail-merge-iterations
8918 The maximum amount of iterations of the pass over the function. This is used to
8919 limit compilation time in tree tail merging. The default value is 2.
8920
8921 @item max-unrolled-insns
8922 The maximum number of instructions that a loop may have to be unrolled.
8923 If a loop is unrolled, this parameter also determines how many times
8924 the loop code is unrolled.
8925
8926 @item max-average-unrolled-insns
8927 The maximum number of instructions biased by probabilities of their execution
8928 that a loop may have to be unrolled. If a loop is unrolled,
8929 this parameter also determines how many times the loop code is unrolled.
8930
8931 @item max-unroll-times
8932 The maximum number of unrollings of a single loop.
8933
8934 @item max-peeled-insns
8935 The maximum number of instructions that a loop may have to be peeled.
8936 If a loop is peeled, this parameter also determines how many times
8937 the loop code is peeled.
8938
8939 @item max-peel-times
8940 The maximum number of peelings of a single loop.
8941
8942 @item max-peel-branches
8943 The maximum number of branches on the hot path through the peeled sequence.
8944
8945 @item max-completely-peeled-insns
8946 The maximum number of insns of a completely peeled loop.
8947
8948 @item max-completely-peel-times
8949 The maximum number of iterations of a loop to be suitable for complete peeling.
8950
8951 @item max-completely-peel-loop-nest-depth
8952 The maximum depth of a loop nest suitable for complete peeling.
8953
8954 @item max-unswitch-insns
8955 The maximum number of insns of an unswitched loop.
8956
8957 @item max-unswitch-level
8958 The maximum number of branches unswitched in a single loop.
8959
8960 @item lim-expensive
8961 The minimum cost of an expensive expression in the loop invariant motion.
8962
8963 @item iv-consider-all-candidates-bound
8964 Bound on number of candidates for induction variables, below which
8965 all candidates are considered for each use in induction variable
8966 optimizations. If there are more candidates than this,
8967 only the most relevant ones are considered to avoid quadratic time complexity.
8968
8969 @item iv-max-considered-uses
8970 The induction variable optimizations give up on loops that contain more
8971 induction variable uses.
8972
8973 @item iv-always-prune-cand-set-bound
8974 If the number of candidates in the set is smaller than this value,
8975 always try to remove unnecessary ivs from the set
8976 when adding a new one.
8977
8978 @item scev-max-expr-size
8979 Bound on size of expressions used in the scalar evolutions analyzer.
8980 Large expressions slow the analyzer.
8981
8982 @item scev-max-expr-complexity
8983 Bound on the complexity of the expressions in the scalar evolutions analyzer.
8984 Complex expressions slow the analyzer.
8985
8986 @item vect-max-version-for-alignment-checks
8987 The maximum number of run-time checks that can be performed when
8988 doing loop versioning for alignment in the vectorizer.
8989
8990 @item vect-max-version-for-alias-checks
8991 The maximum number of run-time checks that can be performed when
8992 doing loop versioning for alias in the vectorizer.
8993
8994 @item vect-max-peeling-for-alignment
8995 The maximum number of loop peels to enhance access alignment
8996 for vectorizer. Value -1 means no limit.
8997
8998 @item max-iterations-to-track
8999 The maximum number of iterations of a loop the brute-force algorithm
9000 for analysis of the number of iterations of the loop tries to evaluate.
9001
9002 @item hot-bb-count-ws-permille
9003 A basic block profile count is considered hot if it contributes to
9004 the given permillage (i.e. 0...1000) of the entire profiled execution.
9005
9006 @item hot-bb-frequency-fraction
9007 Select fraction of the entry block frequency of executions of basic block in
9008 function given basic block needs to have to be considered hot.
9009
9010 @item max-predicted-iterations
9011 The maximum number of loop iterations we predict statically. This is useful
9012 in cases where a function contains a single loop with known bound and
9013 another loop with unknown bound.
9014 The known number of iterations is predicted correctly, while
9015 the unknown number of iterations average to roughly 10. This means that the
9016 loop without bounds appears artificially cold relative to the other one.
9017
9018 @item builtin-expect-probability
9019 Control the probability of the expression having the specified value. This
9020 parameter takes a percentage (i.e. 0 ... 100) as input.
9021 The default probability of 90 is obtained empirically.
9022
9023 @item align-threshold
9024
9025 Select fraction of the maximal frequency of executions of a basic block in
9026 a function to align the basic block.
9027
9028 @item align-loop-iterations
9029
9030 A loop expected to iterate at least the selected number of iterations is
9031 aligned.
9032
9033 @item tracer-dynamic-coverage
9034 @itemx tracer-dynamic-coverage-feedback
9035
9036 This value is used to limit superblock formation once the given percentage of
9037 executed instructions is covered. This limits unnecessary code size
9038 expansion.
9039
9040 The @option{tracer-dynamic-coverage-feedback} parameter
9041 is used only when profile
9042 feedback is available. The real profiles (as opposed to statically estimated
9043 ones) are much less balanced allowing the threshold to be larger value.
9044
9045 @item tracer-max-code-growth
9046 Stop tail duplication once code growth has reached given percentage. This is
9047 a rather artificial limit, as most of the duplicates are eliminated later in
9048 cross jumping, so it may be set to much higher values than is the desired code
9049 growth.
9050
9051 @item tracer-min-branch-ratio
9052
9053 Stop reverse growth when the reverse probability of best edge is less than this
9054 threshold (in percent).
9055
9056 @item tracer-min-branch-probability
9057 @itemx tracer-min-branch-probability-feedback
9058
9059 Stop forward growth if the best edge has probability lower than this
9060 threshold.
9061
9062 Similarly to @option{tracer-dynamic-coverage} two parameters are
9063 provided. @option{tracer-min-branch-probability-feedback} is used for
9064 compilation with profile feedback and @option{tracer-min-branch-probability}
9065 compilation without. The value for compilation with profile feedback
9066 needs to be more conservative (higher) in order to make tracer
9067 effective.
9068
9069 @item max-cse-path-length
9070
9071 The maximum number of basic blocks on path that CSE considers.
9072 The default is 10.
9073
9074 @item max-cse-insns
9075 The maximum number of instructions CSE processes before flushing.
9076 The default is 1000.
9077
9078 @item ggc-min-expand
9079
9080 GCC uses a garbage collector to manage its own memory allocation. This
9081 parameter specifies the minimum percentage by which the garbage
9082 collector's heap should be allowed to expand between collections.
9083 Tuning this may improve compilation speed; it has no effect on code
9084 generation.
9085
9086 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9087 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9088 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9089 GCC is not able to calculate RAM on a particular platform, the lower
9090 bound of 30% is used. Setting this parameter and
9091 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9092 every opportunity. This is extremely slow, but can be useful for
9093 debugging.
9094
9095 @item ggc-min-heapsize
9096
9097 Minimum size of the garbage collector's heap before it begins bothering
9098 to collect garbage. The first collection occurs after the heap expands
9099 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9100 tuning this may improve compilation speed, and has no effect on code
9101 generation.
9102
9103 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9104 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9105 with a lower bound of 4096 (four megabytes) and an upper bound of
9106 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9107 particular platform, the lower bound is used. Setting this parameter
9108 very large effectively disables garbage collection. Setting this
9109 parameter and @option{ggc-min-expand} to zero causes a full collection
9110 to occur at every opportunity.
9111
9112 @item max-reload-search-insns
9113 The maximum number of instruction reload should look backward for equivalent
9114 register. Increasing values mean more aggressive optimization, making the
9115 compilation time increase with probably slightly better performance.
9116 The default value is 100.
9117
9118 @item max-cselib-memory-locations
9119 The maximum number of memory locations cselib should take into account.
9120 Increasing values mean more aggressive optimization, making the compilation time
9121 increase with probably slightly better performance. The default value is 500.
9122
9123 @item max-sched-ready-insns
9124 The maximum number of instructions ready to be issued the scheduler should
9125 consider at any given time during the first scheduling pass. Increasing
9126 values mean more thorough searches, making the compilation time increase
9127 with probably little benefit. The default value is 100.
9128
9129 @item max-sched-region-blocks
9130 The maximum number of blocks in a region to be considered for
9131 interblock scheduling. The default value is 10.
9132
9133 @item max-pipeline-region-blocks
9134 The maximum number of blocks in a region to be considered for
9135 pipelining in the selective scheduler. The default value is 15.
9136
9137 @item max-sched-region-insns
9138 The maximum number of insns in a region to be considered for
9139 interblock scheduling. The default value is 100.
9140
9141 @item max-pipeline-region-insns
9142 The maximum number of insns in a region to be considered for
9143 pipelining in the selective scheduler. The default value is 200.
9144
9145 @item min-spec-prob
9146 The minimum probability (in percents) of reaching a source block
9147 for interblock speculative scheduling. The default value is 40.
9148
9149 @item max-sched-extend-regions-iters
9150 The maximum number of iterations through CFG to extend regions.
9151 A value of 0 (the default) disables region extensions.
9152
9153 @item max-sched-insn-conflict-delay
9154 The maximum conflict delay for an insn to be considered for speculative motion.
9155 The default value is 3.
9156
9157 @item sched-spec-prob-cutoff
9158 The minimal probability of speculation success (in percents), so that
9159 speculative insns are scheduled.
9160 The default value is 40.
9161
9162 @item sched-state-edge-prob-cutoff
9163 The minimum probability an edge must have for the scheduler to save its
9164 state across it.
9165 The default value is 10.
9166
9167 @item sched-mem-true-dep-cost
9168 Minimal distance (in CPU cycles) between store and load targeting same
9169 memory locations. The default value is 1.
9170
9171 @item selsched-max-lookahead
9172 The maximum size of the lookahead window of selective scheduling. It is a
9173 depth of search for available instructions.
9174 The default value is 50.
9175
9176 @item selsched-max-sched-times
9177 The maximum number of times that an instruction is scheduled during
9178 selective scheduling. This is the limit on the number of iterations
9179 through which the instruction may be pipelined. The default value is 2.
9180
9181 @item selsched-insns-to-rename
9182 The maximum number of best instructions in the ready list that are considered
9183 for renaming in the selective scheduler. The default value is 2.
9184
9185 @item sms-min-sc
9186 The minimum value of stage count that swing modulo scheduler
9187 generates. The default value is 2.
9188
9189 @item max-last-value-rtl
9190 The maximum size measured as number of RTLs that can be recorded in an expression
9191 in combiner for a pseudo register as last known value of that register. The default
9192 is 10000.
9193
9194 @item max-combine-insns
9195 The maximum number of instructions the RTL combiner tries to combine.
9196 The default value is 2 at @option{-Og} and 4 otherwise.
9197
9198 @item integer-share-limit
9199 Small integer constants can use a shared data structure, reducing the
9200 compiler's memory usage and increasing its speed. This sets the maximum
9201 value of a shared integer constant. The default value is 256.
9202
9203 @item ssp-buffer-size
9204 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9205 protection when @option{-fstack-protection} is used.
9206
9207 @item min-size-for-stack-sharing
9208 The minimum size of variables taking part in stack slot sharing when not
9209 optimizing. The default value is 32.
9210
9211 @item max-jump-thread-duplication-stmts
9212 Maximum number of statements allowed in a block that needs to be
9213 duplicated when threading jumps.
9214
9215 @item max-fields-for-field-sensitive
9216 Maximum number of fields in a structure treated in
9217 a field sensitive manner during pointer analysis. The default is zero
9218 for @option{-O0} and @option{-O1},
9219 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9220
9221 @item prefetch-latency
9222 Estimate on average number of instructions that are executed before
9223 prefetch finishes. The distance prefetched ahead is proportional
9224 to this constant. Increasing this number may also lead to less
9225 streams being prefetched (see @option{simultaneous-prefetches}).
9226
9227 @item simultaneous-prefetches
9228 Maximum number of prefetches that can run at the same time.
9229
9230 @item l1-cache-line-size
9231 The size of cache line in L1 cache, in bytes.
9232
9233 @item l1-cache-size
9234 The size of L1 cache, in kilobytes.
9235
9236 @item l2-cache-size
9237 The size of L2 cache, in kilobytes.
9238
9239 @item min-insn-to-prefetch-ratio
9240 The minimum ratio between the number of instructions and the
9241 number of prefetches to enable prefetching in a loop.
9242
9243 @item prefetch-min-insn-to-mem-ratio
9244 The minimum ratio between the number of instructions and the
9245 number of memory references to enable prefetching in a loop.
9246
9247 @item use-canonical-types
9248 Whether the compiler should use the ``canonical'' type system. By
9249 default, this should always be 1, which uses a more efficient internal
9250 mechanism for comparing types in C++ and Objective-C++. However, if
9251 bugs in the canonical type system are causing compilation failures,
9252 set this value to 0 to disable canonical types.
9253
9254 @item switch-conversion-max-branch-ratio
9255 Switch initialization conversion refuses to create arrays that are
9256 bigger than @option{switch-conversion-max-branch-ratio} times the number of
9257 branches in the switch.
9258
9259 @item max-partial-antic-length
9260 Maximum length of the partial antic set computed during the tree
9261 partial redundancy elimination optimization (@option{-ftree-pre}) when
9262 optimizing at @option{-O3} and above. For some sorts of source code
9263 the enhanced partial redundancy elimination optimization can run away,
9264 consuming all of the memory available on the host machine. This
9265 parameter sets a limit on the length of the sets that are computed,
9266 which prevents the runaway behavior. Setting a value of 0 for
9267 this parameter allows an unlimited set length.
9268
9269 @item sccvn-max-scc-size
9270 Maximum size of a strongly connected component (SCC) during SCCVN
9271 processing. If this limit is hit, SCCVN processing for the whole
9272 function is not done and optimizations depending on it are
9273 disabled. The default maximum SCC size is 10000.
9274
9275 @item sccvn-max-alias-queries-per-access
9276 Maximum number of alias-oracle queries we perform when looking for
9277 redundancies for loads and stores. If this limit is hit the search
9278 is aborted and the load or store is not considered redundant. The
9279 number of queries is algorithmically limited to the number of
9280 stores on all paths from the load to the function entry.
9281 The default maximum number of queries is 1000.
9282
9283 @item ira-max-loops-num
9284 IRA uses regional register allocation by default. If a function
9285 contains more loops than the number given by this parameter, only at most
9286 the given number of the most frequently-executed loops form regions
9287 for regional register allocation. The default value of the
9288 parameter is 100.
9289
9290 @item ira-max-conflict-table-size
9291 Although IRA uses a sophisticated algorithm to compress the conflict
9292 table, the table can still require excessive amounts of memory for
9293 huge functions. If the conflict table for a function could be more
9294 than the size in MB given by this parameter, the register allocator
9295 instead uses a faster, simpler, and lower-quality
9296 algorithm that does not require building a pseudo-register conflict table.
9297 The default value of the parameter is 2000.
9298
9299 @item ira-loop-reserved-regs
9300 IRA can be used to evaluate more accurate register pressure in loops
9301 for decisions to move loop invariants (see @option{-O3}). The number
9302 of available registers reserved for some other purposes is given
9303 by this parameter. The default value of the parameter is 2, which is
9304 the minimal number of registers needed by typical instructions.
9305 This value is the best found from numerous experiments.
9306
9307 @item lra-inheritance-ebb-probability-cutoff
9308 LRA tries to reuse values reloaded in registers in subsequent insns.
9309 This optimization is called inheritance. EBB is used as a region to
9310 do this optimization. The parameter defines a minimal fall-through
9311 edge probability in percentage used to add BB to inheritance EBB in
9312 LRA. The default value of the parameter is 40. The value was chosen
9313 from numerous runs of SPEC2000 on x86-64.
9314
9315 @item loop-invariant-max-bbs-in-loop
9316 Loop invariant motion can be very expensive, both in compilation time and
9317 in amount of needed compile-time memory, with very large loops. Loops
9318 with more basic blocks than this parameter won't have loop invariant
9319 motion optimization performed on them. The default value of the
9320 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
9321
9322 @item loop-max-datarefs-for-datadeps
9323 Building data dependencies is expensive for very large loops. This
9324 parameter limits the number of data references in loops that are
9325 considered for data dependence analysis. These large loops are no
9326 handled by the optimizations using loop data dependencies.
9327 The default value is 1000.
9328
9329 @item max-vartrack-size
9330 Sets a maximum number of hash table slots to use during variable
9331 tracking dataflow analysis of any function. If this limit is exceeded
9332 with variable tracking at assignments enabled, analysis for that
9333 function is retried without it, after removing all debug insns from
9334 the function. If the limit is exceeded even without debug insns, var
9335 tracking analysis is completely disabled for the function. Setting
9336 the parameter to zero makes it unlimited.
9337
9338 @item max-vartrack-expr-depth
9339 Sets a maximum number of recursion levels when attempting to map
9340 variable names or debug temporaries to value expressions. This trades
9341 compilation time for more complete debug information. If this is set too
9342 low, value expressions that are available and could be represented in
9343 debug information may end up not being used; setting this higher may
9344 enable the compiler to find more complex debug expressions, but compile
9345 time and memory use may grow. The default is 12.
9346
9347 @item min-nondebug-insn-uid
9348 Use uids starting at this parameter for nondebug insns. The range below
9349 the parameter is reserved exclusively for debug insns created by
9350 @option{-fvar-tracking-assignments}, but debug insns may get
9351 (non-overlapping) uids above it if the reserved range is exhausted.
9352
9353 @item ipa-sra-ptr-growth-factor
9354 IPA-SRA replaces a pointer to an aggregate with one or more new
9355 parameters only when their cumulative size is less or equal to
9356 @option{ipa-sra-ptr-growth-factor} times the size of the original
9357 pointer parameter.
9358
9359 @item sra-max-scalarization-size-Ospeed
9360 @item sra-max-scalarization-size-Osize
9361 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
9362 replace scalar parts of aggregates with uses of independent scalar
9363 variables. These parameters control the maximum size, in storage units,
9364 of aggregate which is considered for replacement when compiling for
9365 speed
9366 (@option{sra-max-scalarization-size-Ospeed}) or size
9367 (@option{sra-max-scalarization-size-Osize}) respectively.
9368
9369 @item tm-max-aggregate-size
9370 When making copies of thread-local variables in a transaction, this
9371 parameter specifies the size in bytes after which variables are
9372 saved with the logging functions as opposed to save/restore code
9373 sequence pairs. This option only applies when using
9374 @option{-fgnu-tm}.
9375
9376 @item graphite-max-nb-scop-params
9377 To avoid exponential effects in the Graphite loop transforms, the
9378 number of parameters in a Static Control Part (SCoP) is bounded. The
9379 default value is 10 parameters. A variable whose value is unknown at
9380 compilation time and defined outside a SCoP is a parameter of the SCoP.
9381
9382 @item graphite-max-bbs-per-function
9383 To avoid exponential effects in the detection of SCoPs, the size of
9384 the functions analyzed by Graphite is bounded. The default value is
9385 100 basic blocks.
9386
9387 @item loop-block-tile-size
9388 Loop blocking or strip mining transforms, enabled with
9389 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
9390 loop in the loop nest by a given number of iterations. The strip
9391 length can be changed using the @option{loop-block-tile-size}
9392 parameter. The default value is 51 iterations.
9393
9394 @item loop-unroll-jam-size
9395 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
9396 default value is 4.
9397
9398 @item loop-unroll-jam-depth
9399 Specify the dimension to be unrolled (counting from the most inner loop)
9400 for the @option{-floop-unroll-and-jam}. The default value is 2.
9401
9402 @item ipa-cp-value-list-size
9403 IPA-CP attempts to track all possible values and types passed to a function's
9404 parameter in order to propagate them and perform devirtualization.
9405 @option{ipa-cp-value-list-size} is the maximum number of values and types it
9406 stores per one formal parameter of a function.
9407
9408 @item ipa-cp-eval-threshold
9409 IPA-CP calculates its own score of cloning profitability heuristics
9410 and performs those cloning opportunities with scores that exceed
9411 @option{ipa-cp-eval-threshold}.
9412
9413 @item ipa-cp-recursion-penalty
9414 Percentage penalty the recursive functions will receive when they
9415 are evaluated for cloning.
9416
9417 @item ipa-cp-single-call-penalty
9418 Percentage penalty functions containg a single call to another
9419 function will receive when they are evaluated for cloning.
9420
9421
9422 @item ipa-max-agg-items
9423 IPA-CP is also capable to propagate a number of scalar values passed
9424 in an aggregate. @option{ipa-max-agg-items} controls the maximum
9425 number of such values per one parameter.
9426
9427 @item ipa-cp-loop-hint-bonus
9428 When IPA-CP determines that a cloning candidate would make the number
9429 of iterations of a loop known, it adds a bonus of
9430 @option{ipa-cp-loop-hint-bonus} to the profitability score of
9431 the candidate.
9432
9433 @item ipa-cp-array-index-hint-bonus
9434 When IPA-CP determines that a cloning candidate would make the index of
9435 an array access known, it adds a bonus of
9436 @option{ipa-cp-array-index-hint-bonus} to the profitability
9437 score of the candidate.
9438
9439 @item ipa-max-aa-steps
9440 During its analysis of function bodies, IPA-CP employs alias analysis
9441 in order to track values pointed to by function parameters. In order
9442 not spend too much time analyzing huge functions, it gives up and
9443 consider all memory clobbered after examining
9444 @option{ipa-max-aa-steps} statements modifying memory.
9445
9446 @item lto-partitions
9447 Specify desired number of partitions produced during WHOPR compilation.
9448 The number of partitions should exceed the number of CPUs used for compilation.
9449 The default value is 32.
9450
9451 @item lto-min-partition
9452 Size of minimal partition for WHOPR (in estimated instructions).
9453 This prevents expenses of splitting very small programs into too many
9454 partitions.
9455
9456 @item cxx-max-namespaces-for-diagnostic-help
9457 The maximum number of namespaces to consult for suggestions when C++
9458 name lookup fails for an identifier. The default is 1000.
9459
9460 @item sink-frequency-threshold
9461 The maximum relative execution frequency (in percents) of the target block
9462 relative to a statement's original block to allow statement sinking of a
9463 statement. Larger numbers result in more aggressive statement sinking.
9464 The default value is 75. A small positive adjustment is applied for
9465 statements with memory operands as those are even more profitable so sink.
9466
9467 @item max-stores-to-sink
9468 The maximum number of conditional store pairs that can be sunk. Set to 0
9469 if either vectorization (@option{-ftree-vectorize}) or if-conversion
9470 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
9471
9472 @item allow-store-data-races
9473 Allow optimizers to introduce new data races on stores.
9474 Set to 1 to allow, otherwise to 0. This option is enabled by default
9475 at optimization level @option{-Ofast}.
9476
9477 @item case-values-threshold
9478 The smallest number of different values for which it is best to use a
9479 jump-table instead of a tree of conditional branches. If the value is
9480 0, use the default for the machine. The default is 0.
9481
9482 @item tree-reassoc-width
9483 Set the maximum number of instructions executed in parallel in
9484 reassociated tree. This parameter overrides target dependent
9485 heuristics used by default if has non zero value.
9486
9487 @item sched-pressure-algorithm
9488 Choose between the two available implementations of
9489 @option{-fsched-pressure}. Algorithm 1 is the original implementation
9490 and is the more likely to prevent instructions from being reordered.
9491 Algorithm 2 was designed to be a compromise between the relatively
9492 conservative approach taken by algorithm 1 and the rather aggressive
9493 approach taken by the default scheduler. It relies more heavily on
9494 having a regular register file and accurate register pressure classes.
9495 See @file{haifa-sched.c} in the GCC sources for more details.
9496
9497 The default choice depends on the target.
9498
9499 @item max-slsr-cand-scan
9500 Set the maximum number of existing candidates that are considered when
9501 seeking a basis for a new straight-line strength reduction candidate.
9502
9503 @item asan-globals
9504 Enable buffer overflow detection for global objects. This kind
9505 of protection is enabled by default if you are using
9506 @option{-fsanitize=address} option.
9507 To disable global objects protection use @option{--param asan-globals=0}.
9508
9509 @item asan-stack
9510 Enable buffer overflow detection for stack objects. This kind of
9511 protection is enabled by default when using @option{-fsanitize=address}.
9512 To disable stack protection use @option{--param asan-stack=0} option.
9513
9514 @item asan-instrument-reads
9515 Enable buffer overflow detection for memory reads. This kind of
9516 protection is enabled by default when using @option{-fsanitize=address}.
9517 To disable memory reads protection use
9518 @option{--param asan-instrument-reads=0}.
9519
9520 @item asan-instrument-writes
9521 Enable buffer overflow detection for memory writes. This kind of
9522 protection is enabled by default when using @option{-fsanitize=address}.
9523 To disable memory writes protection use
9524 @option{--param asan-instrument-writes=0} option.
9525
9526 @item asan-memintrin
9527 Enable detection for built-in functions. This kind of protection
9528 is enabled by default when using @option{-fsanitize=address}.
9529 To disable built-in functions protection use
9530 @option{--param asan-memintrin=0}.
9531
9532 @item asan-use-after-return
9533 Enable detection of use-after-return. This kind of protection
9534 is enabled by default when using @option{-fsanitize=address} option.
9535 To disable use-after-return detection use
9536 @option{--param asan-use-after-return=0}.
9537
9538 @item asan-instrumentation-with-call-threshold
9539 If number of memory accesses in function being instrumented
9540 is greater or equal to this number, use callbacks instead of inline checks.
9541 E.g. to disable inline code use
9542 @option{--param asan-instrumentation-with-call-threshold=0}.
9543
9544 @item chkp-max-ctor-size
9545 Static constructors generated by Pointer Bounds Checker may become very
9546 large and significantly increase compile time at optimization level
9547 @option{-O1} and higher. This parameter is a maximum nubmer of statements
9548 in a single generated constructor. Default value is 5000.
9549
9550 @item max-fsm-thread-path-insns
9551 Maximum number of instructions to copy when duplicating blocks on a
9552 finite state automaton jump thread path. The default is 100.
9553
9554 @item max-fsm-thread-length
9555 Maximum number of basic blocks on a finite state automaton jump thread
9556 path. The default is 10.
9557
9558 @item max-fsm-thread-paths
9559 Maximum number of new jump thread paths to create for a finite state
9560 automaton. The default is 50.
9561
9562 @item parloops-chunk-size
9563 Chunk size of omp schedule for loops parallelized by parloops. The default
9564 is 0.
9565
9566 @item parloops-schedule
9567 Schedule type of omp schedule for loops parallelized by parloops (static,
9568 dynamic, guided, auto, runtime). The default is static.
9569
9570 @item max-ssa-name-query-depth
9571 Maximum depth of recursion when querying properties of SSA names in things
9572 like fold routines. One level of recursion corresponds to following a
9573 use-def chain.
9574
9575 @item hsa-gen-debug-stores
9576 Enable emission of special debug stores within HSA kernels which are
9577 then read and reported by libgomp plugin. Generation of these stores
9578 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
9579 enable it.
9580 @end table
9581 @end table
9582
9583 @node Instrumentation Options
9584 @section Program Instrumentation Options
9585 @cindex instrumentation options
9586 @cindex program instrumentation options
9587 @cindex run-time error checking options
9588 @cindex profiling options
9589 @cindex options, program instrumentation
9590 @cindex options, run-time error checking
9591 @cindex options, profiling
9592
9593 GCC supports a number of command-line options that control adding
9594 run-time instrumentation to the code it normally generates.
9595 For example, one purpose of instrumentation is collect profiling
9596 statistics for use in finding program hot spots, code coverage
9597 analysis, or profile-guided optimizations.
9598 Another class of program instrumentation is adding run-time checking
9599 to detect programming errors like invalid pointer
9600 dereferences or out-of-bounds array accesses, as well as deliberately
9601 hostile attacks such as stack smashing or C++ vtable hijacking.
9602 There is also a general hook which can be used to implement other
9603 forms of tracing or function-level instrumentation for debug or
9604 program analysis purposes.
9605
9606 @table @gcctabopt
9607 @cindex @command{prof}
9608 @item -p
9609 @opindex p
9610 Generate extra code to write profile information suitable for the
9611 analysis program @command{prof}. You must use this option when compiling
9612 the source files you want data about, and you must also use it when
9613 linking.
9614
9615 @cindex @command{gprof}
9616 @item -pg
9617 @opindex pg
9618 Generate extra code to write profile information suitable for the
9619 analysis program @command{gprof}. You must use this option when compiling
9620 the source files you want data about, and you must also use it when
9621 linking.
9622
9623 @item -fprofile-arcs
9624 @opindex fprofile-arcs
9625 Add code so that program flow @dfn{arcs} are instrumented. During
9626 execution the program records how many times each branch and call is
9627 executed and how many times it is taken or returns. When the compiled
9628 program exits it saves this data to a file called
9629 @file{@var{auxname}.gcda} for each source file. The data may be used for
9630 profile-directed optimizations (@option{-fbranch-probabilities}), or for
9631 test coverage analysis (@option{-ftest-coverage}). Each object file's
9632 @var{auxname} is generated from the name of the output file, if
9633 explicitly specified and it is not the final executable, otherwise it is
9634 the basename of the source file. In both cases any suffix is removed
9635 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
9636 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
9637 @xref{Cross-profiling}.
9638
9639 @cindex @command{gcov}
9640 @item --coverage
9641 @opindex coverage
9642
9643 This option is used to compile and link code instrumented for coverage
9644 analysis. The option is a synonym for @option{-fprofile-arcs}
9645 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
9646 linking). See the documentation for those options for more details.
9647
9648 @itemize
9649
9650 @item
9651 Compile the source files with @option{-fprofile-arcs} plus optimization
9652 and code generation options. For test coverage analysis, use the
9653 additional @option{-ftest-coverage} option. You do not need to profile
9654 every source file in a program.
9655
9656 @item
9657 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
9658 (the latter implies the former).
9659
9660 @item
9661 Run the program on a representative workload to generate the arc profile
9662 information. This may be repeated any number of times. You can run
9663 concurrent instances of your program, and provided that the file system
9664 supports locking, the data files will be correctly updated. Also
9665 @code{fork} calls are detected and correctly handled (double counting
9666 will not happen).
9667
9668 @item
9669 For profile-directed optimizations, compile the source files again with
9670 the same optimization and code generation options plus
9671 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
9672 Control Optimization}).
9673
9674 @item
9675 For test coverage analysis, use @command{gcov} to produce human readable
9676 information from the @file{.gcno} and @file{.gcda} files. Refer to the
9677 @command{gcov} documentation for further information.
9678
9679 @end itemize
9680
9681 With @option{-fprofile-arcs}, for each function of your program GCC
9682 creates a program flow graph, then finds a spanning tree for the graph.
9683 Only arcs that are not on the spanning tree have to be instrumented: the
9684 compiler adds code to count the number of times that these arcs are
9685 executed. When an arc is the only exit or only entrance to a block, the
9686 instrumentation code can be added to the block; otherwise, a new basic
9687 block must be created to hold the instrumentation code.
9688
9689 @need 2000
9690 @item -ftest-coverage
9691 @opindex ftest-coverage
9692 Produce a notes file that the @command{gcov} code-coverage utility
9693 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
9694 show program coverage. Each source file's note file is called
9695 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
9696 above for a description of @var{auxname} and instructions on how to
9697 generate test coverage data. Coverage data matches the source files
9698 more closely if you do not optimize.
9699
9700 @item -fprofile-dir=@var{path}
9701 @opindex fprofile-dir
9702
9703 Set the directory to search for the profile data files in to @var{path}.
9704 This option affects only the profile data generated by
9705 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
9706 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
9707 and its related options. Both absolute and relative paths can be used.
9708 By default, GCC uses the current directory as @var{path}, thus the
9709 profile data file appears in the same directory as the object file.
9710
9711 @item -fprofile-generate
9712 @itemx -fprofile-generate=@var{path}
9713 @opindex fprofile-generate
9714
9715 Enable options usually used for instrumenting application to produce
9716 profile useful for later recompilation with profile feedback based
9717 optimization. You must use @option{-fprofile-generate} both when
9718 compiling and when linking your program.
9719
9720 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
9721
9722 If @var{path} is specified, GCC looks at the @var{path} to find
9723 the profile feedback data files. See @option{-fprofile-dir}.
9724
9725 To optimize the program based on the collected profile information, use
9726 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
9727
9728 @item -fsanitize=address
9729 @opindex fsanitize=address
9730 Enable AddressSanitizer, a fast memory error detector.
9731 Memory access instructions are instrumented to detect
9732 out-of-bounds and use-after-free bugs.
9733 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
9734 more details. The run-time behavior can be influenced using the
9735 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
9736 the available options are shown at startup of the instrumented program. See
9737 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
9738 for a list of supported options.
9739
9740 @item -fsanitize=kernel-address
9741 @opindex fsanitize=kernel-address
9742 Enable AddressSanitizer for Linux kernel.
9743 See @uref{https://github.com/google/kasan/wiki} for more details.
9744
9745 @item -fsanitize=thread
9746 @opindex fsanitize=thread
9747 Enable ThreadSanitizer, a fast data race detector.
9748 Memory access instructions are instrumented to detect
9749 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
9750 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
9751 environment variable; see
9752 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
9753 supported options.
9754
9755 @item -fsanitize=leak
9756 @opindex fsanitize=leak
9757 Enable LeakSanitizer, a memory leak detector.
9758 This option only matters for linking of executables and if neither
9759 @option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that
9760 case the executable is linked against a library that overrides @code{malloc}
9761 and other allocator functions. See
9762 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
9763 details. The run-time behavior can be influenced using the
9764 @env{LSAN_OPTIONS} environment variable.
9765
9766 @item -fsanitize=undefined
9767 @opindex fsanitize=undefined
9768 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
9769 Various computations are instrumented to detect undefined behavior
9770 at runtime. Current suboptions are:
9771
9772 @table @gcctabopt
9773
9774 @item -fsanitize=shift
9775 @opindex fsanitize=shift
9776 This option enables checking that the result of a shift operation is
9777 not undefined. Note that what exactly is considered undefined differs
9778 slightly between C and C++, as well as between ISO C90 and C99, etc.
9779
9780 @item -fsanitize=integer-divide-by-zero
9781 @opindex fsanitize=integer-divide-by-zero
9782 Detect integer division by zero as well as @code{INT_MIN / -1} division.
9783
9784 @item -fsanitize=unreachable
9785 @opindex fsanitize=unreachable
9786 With this option, the compiler turns the @code{__builtin_unreachable}
9787 call into a diagnostics message call instead. When reaching the
9788 @code{__builtin_unreachable} call, the behavior is undefined.
9789
9790 @item -fsanitize=vla-bound
9791 @opindex fsanitize=vla-bound
9792 This option instructs the compiler to check that the size of a variable
9793 length array is positive.
9794
9795 @item -fsanitize=null
9796 @opindex fsanitize=null
9797 This option enables pointer checking. Particularly, the application
9798 built with this option turned on will issue an error message when it
9799 tries to dereference a NULL pointer, or if a reference (possibly an
9800 rvalue reference) is bound to a NULL pointer, or if a method is invoked
9801 on an object pointed by a NULL pointer.
9802
9803 @item -fsanitize=return
9804 @opindex fsanitize=return
9805 This option enables return statement checking. Programs
9806 built with this option turned on will issue an error message
9807 when the end of a non-void function is reached without actually
9808 returning a value. This option works in C++ only.
9809
9810 @item -fsanitize=signed-integer-overflow
9811 @opindex fsanitize=signed-integer-overflow
9812 This option enables signed integer overflow checking. We check that
9813 the result of @code{+}, @code{*}, and both unary and binary @code{-}
9814 does not overflow in the signed arithmetics. Note, integer promotion
9815 rules must be taken into account. That is, the following is not an
9816 overflow:
9817 @smallexample
9818 signed char a = SCHAR_MAX;
9819 a++;
9820 @end smallexample
9821
9822 @item -fsanitize=bounds
9823 @opindex fsanitize=bounds
9824 This option enables instrumentation of array bounds. Various out of bounds
9825 accesses are detected. Flexible array members, flexible array member-like
9826 arrays, and initializers of variables with static storage are not instrumented.
9827
9828 @item -fsanitize=bounds-strict
9829 @opindex fsanitize=bounds-strict
9830 This option enables strict instrumentation of array bounds. Most out of bounds
9831 accesses are detected, including flexible array members and flexible array
9832 member-like arrays. Initializers of variables with static storage are not
9833 instrumented.
9834
9835 @item -fsanitize=alignment
9836 @opindex fsanitize=alignment
9837
9838 This option enables checking of alignment of pointers when they are
9839 dereferenced, or when a reference is bound to insufficiently aligned target,
9840 or when a method or constructor is invoked on insufficiently aligned object.
9841
9842 @item -fsanitize=object-size
9843 @opindex fsanitize=object-size
9844 This option enables instrumentation of memory references using the
9845 @code{__builtin_object_size} function. Various out of bounds pointer
9846 accesses are detected.
9847
9848 @item -fsanitize=float-divide-by-zero
9849 @opindex fsanitize=float-divide-by-zero
9850 Detect floating-point division by zero. Unlike other similar options,
9851 @option{-fsanitize=float-divide-by-zero} is not enabled by
9852 @option{-fsanitize=undefined}, since floating-point division by zero can
9853 be a legitimate way of obtaining infinities and NaNs.
9854
9855 @item -fsanitize=float-cast-overflow
9856 @opindex fsanitize=float-cast-overflow
9857 This option enables floating-point type to integer conversion checking.
9858 We check that the result of the conversion does not overflow.
9859 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
9860 not enabled by @option{-fsanitize=undefined}.
9861 This option does not work well with @code{FE_INVALID} exceptions enabled.
9862
9863 @item -fsanitize=nonnull-attribute
9864 @opindex fsanitize=nonnull-attribute
9865
9866 This option enables instrumentation of calls, checking whether null values
9867 are not passed to arguments marked as requiring a non-null value by the
9868 @code{nonnull} function attribute.
9869
9870 @item -fsanitize=returns-nonnull-attribute
9871 @opindex fsanitize=returns-nonnull-attribute
9872
9873 This option enables instrumentation of return statements in functions
9874 marked with @code{returns_nonnull} function attribute, to detect returning
9875 of null values from such functions.
9876
9877 @item -fsanitize=bool
9878 @opindex fsanitize=bool
9879
9880 This option enables instrumentation of loads from bool. If a value other
9881 than 0/1 is loaded, a run-time error is issued.
9882
9883 @item -fsanitize=enum
9884 @opindex fsanitize=enum
9885
9886 This option enables instrumentation of loads from an enum type. If
9887 a value outside the range of values for the enum type is loaded,
9888 a run-time error is issued.
9889
9890 @item -fsanitize=vptr
9891 @opindex fsanitize=vptr
9892
9893 This option enables instrumentation of C++ member function calls, member
9894 accesses and some conversions between pointers to base and derived classes,
9895 to verify the referenced object has the correct dynamic type.
9896
9897 @end table
9898
9899 While @option{-ftrapv} causes traps for signed overflows to be emitted,
9900 @option{-fsanitize=undefined} gives a diagnostic message.
9901 This currently works only for the C family of languages.
9902
9903 @item -fno-sanitize=all
9904 @opindex fno-sanitize=all
9905
9906 This option disables all previously enabled sanitizers.
9907 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
9908 together.
9909
9910 @item -fasan-shadow-offset=@var{number}
9911 @opindex fasan-shadow-offset
9912 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
9913 It is useful for experimenting with different shadow memory layouts in
9914 Kernel AddressSanitizer.
9915
9916 @item -fsanitize-sections=@var{s1},@var{s2},...
9917 @opindex fsanitize-sections
9918 Sanitize global variables in selected user-defined sections. @var{si} may
9919 contain wildcards.
9920
9921 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
9922 @opindex fsanitize-recover
9923 @opindex fno-sanitize-recover
9924 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
9925 mentioned in comma-separated list of @var{opts}. Enabling this option
9926 for a sanitizer component causes it to attempt to continue
9927 running the program as if no error happened. This means multiple
9928 runtime errors can be reported in a single program run, and the exit
9929 code of the program may indicate success even when errors
9930 have been reported. The @option{-fno-sanitize-recover=} option
9931 can be used to alter
9932 this behavior: only the first detected error is reported
9933 and program then exits with a non-zero exit code.
9934
9935 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
9936 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
9937 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
9938 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
9939 For these sanitizers error recovery is turned on by default, except @option{-fsanitize=address},
9940 for which this feature is experimental.
9941 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
9942 accepted, the former enables recovery for all sanitizers that support it,
9943 the latter disables recovery for all sanitizers that support it.
9944
9945 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
9946 @smallexample
9947 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
9948 @end smallexample
9949 @noindent
9950 Similarly @option{-fno-sanitize-recover} is equivalent to
9951 @smallexample
9952 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
9953 @end smallexample
9954
9955 @item -fsanitize-undefined-trap-on-error
9956 @opindex fsanitize-undefined-trap-on-error
9957 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
9958 report undefined behavior using @code{__builtin_trap} rather than
9959 a @code{libubsan} library routine. The advantage of this is that the
9960 @code{libubsan} library is not needed and is not linked in, so this
9961 is usable even in freestanding environments.
9962
9963 @item -fsanitize-coverage=trace-pc
9964 @opindex fsanitize-coverage=trace-pc
9965 Enable coverage-guided fuzzing code instrumentation.
9966 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
9967
9968 @item -fbounds-check
9969 @opindex fbounds-check
9970 For front ends that support it, generate additional code to check that
9971 indices used to access arrays are within the declared range. This is
9972 currently only supported by the Java and Fortran front ends, where
9973 this option defaults to true and false respectively.
9974
9975 @item -fcheck-pointer-bounds
9976 @opindex fcheck-pointer-bounds
9977 @opindex fno-check-pointer-bounds
9978 @cindex Pointer Bounds Checker options
9979 Enable Pointer Bounds Checker instrumentation. Each memory reference
9980 is instrumented with checks of the pointer used for memory access against
9981 bounds associated with that pointer.
9982
9983 Currently there
9984 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
9985 and @option{-mmpx} are required to enable this feature.
9986 MPX-based instrumentation requires
9987 a runtime library to enable MPX in hardware and handle bounds
9988 violation signals. By default when @option{-fcheck-pointer-bounds}
9989 and @option{-mmpx} options are used to link a program, the GCC driver
9990 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
9991 Bounds checking on calls to dynamic libraries requires a linker
9992 with @option{-z bndplt} support; if GCC was configured with a linker
9993 without support for this option (including the Gold linker and older
9994 versions of ld), a warning is given if you link with @option{-mmpx}
9995 without also specifying @option{-static}, since the overall effectiveness
9996 of the bounds checking protection is reduced.
9997 See also @option{-static-libmpxwrappers}.
9998
9999 MPX-based instrumentation
10000 may be used for debugging and also may be included in production code
10001 to increase program security. Depending on usage, you may
10002 have different requirements for the runtime library. The current version
10003 of the MPX runtime library is more oriented for use as a debugging
10004 tool. MPX runtime library usage implies @option{-lpthread}. See
10005 also @option{-static-libmpx}. The runtime library behavior can be
10006 influenced using various @env{CHKP_RT_*} environment variables. See
10007 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
10008 for more details.
10009
10010 Generated instrumentation may be controlled by various
10011 @option{-fchkp-*} options and by the @code{bnd_variable_size}
10012 structure field attribute (@pxref{Type Attributes}) and
10013 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
10014 (@pxref{Function Attributes}). GCC also provides a number of built-in
10015 functions for controlling the Pointer Bounds Checker. @xref{Pointer
10016 Bounds Checker builtins}, for more information.
10017
10018 @item -fchkp-check-incomplete-type
10019 @opindex fchkp-check-incomplete-type
10020 @opindex fno-chkp-check-incomplete-type
10021 Generate pointer bounds checks for variables with incomplete type.
10022 Enabled by default.
10023
10024 @item -fchkp-narrow-bounds
10025 @opindex fchkp-narrow-bounds
10026 @opindex fno-chkp-narrow-bounds
10027 Controls bounds used by Pointer Bounds Checker for pointers to object
10028 fields. If narrowing is enabled then field bounds are used. Otherwise
10029 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
10030 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
10031
10032 @item -fchkp-first-field-has-own-bounds
10033 @opindex fchkp-first-field-has-own-bounds
10034 @opindex fno-chkp-first-field-has-own-bounds
10035 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
10036 first field in the structure. By default a pointer to the first field has
10037 the same bounds as a pointer to the whole structure.
10038
10039 @item -fchkp-narrow-to-innermost-array
10040 @opindex fchkp-narrow-to-innermost-array
10041 @opindex fno-chkp-narrow-to-innermost-array
10042 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
10043 case of nested static array access. By default this option is disabled and
10044 bounds of the outermost array are used.
10045
10046 @item -fchkp-optimize
10047 @opindex fchkp-optimize
10048 @opindex fno-chkp-optimize
10049 Enables Pointer Bounds Checker optimizations. Enabled by default at
10050 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
10051
10052 @item -fchkp-use-fast-string-functions
10053 @opindex fchkp-use-fast-string-functions
10054 @opindex fno-chkp-use-fast-string-functions
10055 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
10056 by Pointer Bounds Checker. Disabled by default.
10057
10058 @item -fchkp-use-nochk-string-functions
10059 @opindex fchkp-use-nochk-string-functions
10060 @opindex fno-chkp-use-nochk-string-functions
10061 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
10062 by Pointer Bounds Checker. Disabled by default.
10063
10064 @item -fchkp-use-static-bounds
10065 @opindex fchkp-use-static-bounds
10066 @opindex fno-chkp-use-static-bounds
10067 Allow Pointer Bounds Checker to generate static bounds holding
10068 bounds of static variables. Enabled by default.
10069
10070 @item -fchkp-use-static-const-bounds
10071 @opindex fchkp-use-static-const-bounds
10072 @opindex fno-chkp-use-static-const-bounds
10073 Use statically-initialized bounds for constant bounds instead of
10074 generating them each time they are required. By default enabled when
10075 @option{-fchkp-use-static-bounds} is enabled.
10076
10077 @item -fchkp-treat-zero-dynamic-size-as-infinite
10078 @opindex fchkp-treat-zero-dynamic-size-as-infinite
10079 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
10080 With this option, objects with incomplete type whose
10081 dynamically-obtained size is zero are treated as having infinite size
10082 instead by Pointer Bounds
10083 Checker. This option may be helpful if a program is linked with a library
10084 missing size information for some symbols. Disabled by default.
10085
10086 @item -fchkp-check-read
10087 @opindex fchkp-check-read
10088 @opindex fno-chkp-check-read
10089 Instructs Pointer Bounds Checker to generate checks for all read
10090 accesses to memory. Enabled by default.
10091
10092 @item -fchkp-check-write
10093 @opindex fchkp-check-write
10094 @opindex fno-chkp-check-write
10095 Instructs Pointer Bounds Checker to generate checks for all write
10096 accesses to memory. Enabled by default.
10097
10098 @item -fchkp-store-bounds
10099 @opindex fchkp-store-bounds
10100 @opindex fno-chkp-store-bounds
10101 Instructs Pointer Bounds Checker to generate bounds stores for
10102 pointer writes. Enabled by default.
10103
10104 @item -fchkp-instrument-calls
10105 @opindex fchkp-instrument-calls
10106 @opindex fno-chkp-instrument-calls
10107 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
10108 Enabled by default.
10109
10110 @item -fchkp-instrument-marked-only
10111 @opindex fchkp-instrument-marked-only
10112 @opindex fno-chkp-instrument-marked-only
10113 Instructs Pointer Bounds Checker to instrument only functions
10114 marked with the @code{bnd_instrument} attribute
10115 (@pxref{Function Attributes}). Disabled by default.
10116
10117 @item -fchkp-use-wrappers
10118 @opindex fchkp-use-wrappers
10119 @opindex fno-chkp-use-wrappers
10120 Allows Pointer Bounds Checker to replace calls to built-in functions
10121 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
10122 is used to link a program, the GCC driver automatically links
10123 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
10124 Enabled by default.
10125
10126 @item -fstack-protector
10127 @opindex fstack-protector
10128 Emit extra code to check for buffer overflows, such as stack smashing
10129 attacks. This is done by adding a guard variable to functions with
10130 vulnerable objects. This includes functions that call @code{alloca}, and
10131 functions with buffers larger than 8 bytes. The guards are initialized
10132 when a function is entered and then checked when the function exits.
10133 If a guard check fails, an error message is printed and the program exits.
10134
10135 @item -fstack-protector-all
10136 @opindex fstack-protector-all
10137 Like @option{-fstack-protector} except that all functions are protected.
10138
10139 @item -fstack-protector-strong
10140 @opindex fstack-protector-strong
10141 Like @option{-fstack-protector} but includes additional functions to
10142 be protected --- those that have local array definitions, or have
10143 references to local frame addresses.
10144
10145 @item -fstack-protector-explicit
10146 @opindex fstack-protector-explicit
10147 Like @option{-fstack-protector} but only protects those functions which
10148 have the @code{stack_protect} attribute.
10149
10150 @item -fstack-check
10151 @opindex fstack-check
10152 Generate code to verify that you do not go beyond the boundary of the
10153 stack. You should specify this flag if you are running in an
10154 environment with multiple threads, but you only rarely need to specify it in
10155 a single-threaded environment since stack overflow is automatically
10156 detected on nearly all systems if there is only one stack.
10157
10158 Note that this switch does not actually cause checking to be done; the
10159 operating system or the language runtime must do that. The switch causes
10160 generation of code to ensure that they see the stack being extended.
10161
10162 You can additionally specify a string parameter: @samp{no} means no
10163 checking, @samp{generic} means force the use of old-style checking,
10164 @samp{specific} means use the best checking method and is equivalent
10165 to bare @option{-fstack-check}.
10166
10167 Old-style checking is a generic mechanism that requires no specific
10168 target support in the compiler but comes with the following drawbacks:
10169
10170 @enumerate
10171 @item
10172 Modified allocation strategy for large objects: they are always
10173 allocated dynamically if their size exceeds a fixed threshold.
10174
10175 @item
10176 Fixed limit on the size of the static frame of functions: when it is
10177 topped by a particular function, stack checking is not reliable and
10178 a warning is issued by the compiler.
10179
10180 @item
10181 Inefficiency: because of both the modified allocation strategy and the
10182 generic implementation, code performance is hampered.
10183 @end enumerate
10184
10185 Note that old-style stack checking is also the fallback method for
10186 @samp{specific} if no target support has been added in the compiler.
10187
10188 @item -fstack-limit-register=@var{reg}
10189 @itemx -fstack-limit-symbol=@var{sym}
10190 @itemx -fno-stack-limit
10191 @opindex fstack-limit-register
10192 @opindex fstack-limit-symbol
10193 @opindex fno-stack-limit
10194 Generate code to ensure that the stack does not grow beyond a certain value,
10195 either the value of a register or the address of a symbol. If a larger
10196 stack is required, a signal is raised at run time. For most targets,
10197 the signal is raised before the stack overruns the boundary, so
10198 it is possible to catch the signal without taking special precautions.
10199
10200 For instance, if the stack starts at absolute address @samp{0x80000000}
10201 and grows downwards, you can use the flags
10202 @option{-fstack-limit-symbol=__stack_limit} and
10203 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10204 of 128KB@. Note that this may only work with the GNU linker.
10205
10206 You can locally override stack limit checking by using the
10207 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
10208
10209 @item -fsplit-stack
10210 @opindex fsplit-stack
10211 Generate code to automatically split the stack before it overflows.
10212 The resulting program has a discontiguous stack which can only
10213 overflow if the program is unable to allocate any more memory. This
10214 is most useful when running threaded programs, as it is no longer
10215 necessary to calculate a good stack size to use for each thread. This
10216 is currently only implemented for the x86 targets running
10217 GNU/Linux.
10218
10219 When code compiled with @option{-fsplit-stack} calls code compiled
10220 without @option{-fsplit-stack}, there may not be much stack space
10221 available for the latter code to run. If compiling all code,
10222 including library code, with @option{-fsplit-stack} is not an option,
10223 then the linker can fix up these calls so that the code compiled
10224 without @option{-fsplit-stack} always has a large stack. Support for
10225 this is implemented in the gold linker in GNU binutils release 2.21
10226 and later.
10227
10228 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
10229 @opindex fvtable-verify
10230 This option is only available when compiling C++ code.
10231 It turns on (or off, if using @option{-fvtable-verify=none}) the security
10232 feature that verifies at run time, for every virtual call, that
10233 the vtable pointer through which the call is made is valid for the type of
10234 the object, and has not been corrupted or overwritten. If an invalid vtable
10235 pointer is detected at run time, an error is reported and execution of the
10236 program is immediately halted.
10237
10238 This option causes run-time data structures to be built at program startup,
10239 which are used for verifying the vtable pointers.
10240 The options @samp{std} and @samp{preinit}
10241 control the timing of when these data structures are built. In both cases the
10242 data structures are built before execution reaches @code{main}. Using
10243 @option{-fvtable-verify=std} causes the data structures to be built after
10244 shared libraries have been loaded and initialized.
10245 @option{-fvtable-verify=preinit} causes them to be built before shared
10246 libraries have been loaded and initialized.
10247
10248 If this option appears multiple times in the command line with different
10249 values specified, @samp{none} takes highest priority over both @samp{std} and
10250 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
10251
10252 @item -fvtv-debug
10253 @opindex fvtv-debug
10254 When used in conjunction with @option{-fvtable-verify=std} or
10255 @option{-fvtable-verify=preinit}, causes debug versions of the
10256 runtime functions for the vtable verification feature to be called.
10257 This flag also causes the compiler to log information about which
10258 vtable pointers it finds for each class.
10259 This information is written to a file named @file{vtv_set_ptr_data.log}
10260 in the directory named by the environment variable @env{VTV_LOGS_DIR}
10261 if that is defined or the current working directory otherwise.
10262
10263 Note: This feature @emph{appends} data to the log file. If you want a fresh log
10264 file, be sure to delete any existing one.
10265
10266 @item -fvtv-counts
10267 @opindex fvtv-counts
10268 This is a debugging flag. When used in conjunction with
10269 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
10270 causes the compiler to keep track of the total number of virtual calls
10271 it encounters and the number of verifications it inserts. It also
10272 counts the number of calls to certain run-time library functions
10273 that it inserts and logs this information for each compilation unit.
10274 The compiler writes this information to a file named
10275 @file{vtv_count_data.log} in the directory named by the environment
10276 variable @env{VTV_LOGS_DIR} if that is defined or the current working
10277 directory otherwise. It also counts the size of the vtable pointer sets
10278 for each class, and writes this information to @file{vtv_class_set_sizes.log}
10279 in the same directory.
10280
10281 Note: This feature @emph{appends} data to the log files. To get fresh log
10282 files, be sure to delete any existing ones.
10283
10284 @item -finstrument-functions
10285 @opindex finstrument-functions
10286 Generate instrumentation calls for entry and exit to functions. Just
10287 after function entry and just before function exit, the following
10288 profiling functions are called with the address of the current
10289 function and its call site. (On some platforms,
10290 @code{__builtin_return_address} does not work beyond the current
10291 function, so the call site information may not be available to the
10292 profiling functions otherwise.)
10293
10294 @smallexample
10295 void __cyg_profile_func_enter (void *this_fn,
10296 void *call_site);
10297 void __cyg_profile_func_exit (void *this_fn,
10298 void *call_site);
10299 @end smallexample
10300
10301 The first argument is the address of the start of the current function,
10302 which may be looked up exactly in the symbol table.
10303
10304 This instrumentation is also done for functions expanded inline in other
10305 functions. The profiling calls indicate where, conceptually, the
10306 inline function is entered and exited. This means that addressable
10307 versions of such functions must be available. If all your uses of a
10308 function are expanded inline, this may mean an additional expansion of
10309 code size. If you use @code{extern inline} in your C code, an
10310 addressable version of such functions must be provided. (This is
10311 normally the case anyway, but if you get lucky and the optimizer always
10312 expands the functions inline, you might have gotten away without
10313 providing static copies.)
10314
10315 A function may be given the attribute @code{no_instrument_function}, in
10316 which case this instrumentation is not done. This can be used, for
10317 example, for the profiling functions listed above, high-priority
10318 interrupt routines, and any functions from which the profiling functions
10319 cannot safely be called (perhaps signal handlers, if the profiling
10320 routines generate output or allocate memory).
10321
10322 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
10323 @opindex finstrument-functions-exclude-file-list
10324
10325 Set the list of functions that are excluded from instrumentation (see
10326 the description of @option{-finstrument-functions}). If the file that
10327 contains a function definition matches with one of @var{file}, then
10328 that function is not instrumented. The match is done on substrings:
10329 if the @var{file} parameter is a substring of the file name, it is
10330 considered to be a match.
10331
10332 For example:
10333
10334 @smallexample
10335 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
10336 @end smallexample
10337
10338 @noindent
10339 excludes any inline function defined in files whose pathnames
10340 contain @file{/bits/stl} or @file{include/sys}.
10341
10342 If, for some reason, you want to include letter @samp{,} in one of
10343 @var{sym}, write @samp{\,}. For example,
10344 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
10345 (note the single quote surrounding the option).
10346
10347 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
10348 @opindex finstrument-functions-exclude-function-list
10349
10350 This is similar to @option{-finstrument-functions-exclude-file-list},
10351 but this option sets the list of function names to be excluded from
10352 instrumentation. The function name to be matched is its user-visible
10353 name, such as @code{vector<int> blah(const vector<int> &)}, not the
10354 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
10355 match is done on substrings: if the @var{sym} parameter is a substring
10356 of the function name, it is considered to be a match. For C99 and C++
10357 extended identifiers, the function name must be given in UTF-8, not
10358 using universal character names.
10359
10360 @end table
10361
10362
10363 @node Preprocessor Options
10364 @section Options Controlling the Preprocessor
10365 @cindex preprocessor options
10366 @cindex options, preprocessor
10367
10368 These options control the C preprocessor, which is run on each C source
10369 file before actual compilation.
10370
10371 If you use the @option{-E} option, nothing is done except preprocessing.
10372 Some of these options make sense only together with @option{-E} because
10373 they cause the preprocessor output to be unsuitable for actual
10374 compilation.
10375
10376 @table @gcctabopt
10377 @item -Wp,@var{option}
10378 @opindex Wp
10379 You can use @option{-Wp,@var{option}} to bypass the compiler driver
10380 and pass @var{option} directly through to the preprocessor. If
10381 @var{option} contains commas, it is split into multiple options at the
10382 commas. However, many options are modified, translated or interpreted
10383 by the compiler driver before being passed to the preprocessor, and
10384 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
10385 interface is undocumented and subject to change, so whenever possible
10386 you should avoid using @option{-Wp} and let the driver handle the
10387 options instead.
10388
10389 @item -Xpreprocessor @var{option}
10390 @opindex Xpreprocessor
10391 Pass @var{option} as an option to the preprocessor. You can use this to
10392 supply system-specific preprocessor options that GCC does not
10393 recognize.
10394
10395 If you want to pass an option that takes an argument, you must use
10396 @option{-Xpreprocessor} twice, once for the option and once for the argument.
10397
10398 @item -no-integrated-cpp
10399 @opindex no-integrated-cpp
10400 Perform preprocessing as a separate pass before compilation.
10401 By default, GCC performs preprocessing as an integrated part of
10402 input tokenization and parsing.
10403 If this option is provided, the appropriate language front end
10404 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
10405 and Objective-C, respectively) is instead invoked twice,
10406 once for preprocessing only and once for actual compilation
10407 of the preprocessed input.
10408 This option may be useful in conjunction with the @option{-B} or
10409 @option{-wrapper} options to specify an alternate preprocessor or
10410 perform additional processing of the program source between
10411 normal preprocessing and compilation.
10412 @end table
10413
10414 @include cppopts.texi
10415
10416 @node Assembler Options
10417 @section Passing Options to the Assembler
10418
10419 @c prevent bad page break with this line
10420 You can pass options to the assembler.
10421
10422 @table @gcctabopt
10423 @item -Wa,@var{option}
10424 @opindex Wa
10425 Pass @var{option} as an option to the assembler. If @var{option}
10426 contains commas, it is split into multiple options at the commas.
10427
10428 @item -Xassembler @var{option}
10429 @opindex Xassembler
10430 Pass @var{option} as an option to the assembler. You can use this to
10431 supply system-specific assembler options that GCC does not
10432 recognize.
10433
10434 If you want to pass an option that takes an argument, you must use
10435 @option{-Xassembler} twice, once for the option and once for the argument.
10436
10437 @end table
10438
10439 @node Link Options
10440 @section Options for Linking
10441 @cindex link options
10442 @cindex options, linking
10443
10444 These options come into play when the compiler links object files into
10445 an executable output file. They are meaningless if the compiler is
10446 not doing a link step.
10447
10448 @table @gcctabopt
10449 @cindex file names
10450 @item @var{object-file-name}
10451 A file name that does not end in a special recognized suffix is
10452 considered to name an object file or library. (Object files are
10453 distinguished from libraries by the linker according to the file
10454 contents.) If linking is done, these object files are used as input
10455 to the linker.
10456
10457 @item -c
10458 @itemx -S
10459 @itemx -E
10460 @opindex c
10461 @opindex S
10462 @opindex E
10463 If any of these options is used, then the linker is not run, and
10464 object file names should not be used as arguments. @xref{Overall
10465 Options}.
10466
10467 @item -fuse-ld=bfd
10468 @opindex fuse-ld=bfd
10469 Use the @command{bfd} linker instead of the default linker.
10470
10471 @item -fuse-ld=gold
10472 @opindex fuse-ld=gold
10473 Use the @command{gold} linker instead of the default linker.
10474
10475 @cindex Libraries
10476 @item -l@var{library}
10477 @itemx -l @var{library}
10478 @opindex l
10479 Search the library named @var{library} when linking. (The second
10480 alternative with the library as a separate argument is only for
10481 POSIX compliance and is not recommended.)
10482
10483 It makes a difference where in the command you write this option; the
10484 linker searches and processes libraries and object files in the order they
10485 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
10486 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
10487 to functions in @samp{z}, those functions may not be loaded.
10488
10489 The linker searches a standard list of directories for the library,
10490 which is actually a file named @file{lib@var{library}.a}. The linker
10491 then uses this file as if it had been specified precisely by name.
10492
10493 The directories searched include several standard system directories
10494 plus any that you specify with @option{-L}.
10495
10496 Normally the files found this way are library files---archive files
10497 whose members are object files. The linker handles an archive file by
10498 scanning through it for members which define symbols that have so far
10499 been referenced but not defined. But if the file that is found is an
10500 ordinary object file, it is linked in the usual fashion. The only
10501 difference between using an @option{-l} option and specifying a file name
10502 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
10503 and searches several directories.
10504
10505 @item -lobjc
10506 @opindex lobjc
10507 You need this special case of the @option{-l} option in order to
10508 link an Objective-C or Objective-C++ program.
10509
10510 @item -nostartfiles
10511 @opindex nostartfiles
10512 Do not use the standard system startup files when linking.
10513 The standard system libraries are used normally, unless @option{-nostdlib}
10514 or @option{-nodefaultlibs} is used.
10515
10516 @item -nodefaultlibs
10517 @opindex nodefaultlibs
10518 Do not use the standard system libraries when linking.
10519 Only the libraries you specify are passed to the linker, and options
10520 specifying linkage of the system libraries, such as @option{-static-libgcc}
10521 or @option{-shared-libgcc}, are ignored.
10522 The standard startup files are used normally, unless @option{-nostartfiles}
10523 is used.
10524
10525 The compiler may generate calls to @code{memcmp},
10526 @code{memset}, @code{memcpy} and @code{memmove}.
10527 These entries are usually resolved by entries in
10528 libc. These entry points should be supplied through some other
10529 mechanism when this option is specified.
10530
10531 @item -nostdlib
10532 @opindex nostdlib
10533 Do not use the standard system startup files or libraries when linking.
10534 No startup files and only the libraries you specify are passed to
10535 the linker, and options specifying linkage of the system libraries, such as
10536 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
10537
10538 The compiler may generate calls to @code{memcmp}, @code{memset},
10539 @code{memcpy} and @code{memmove}.
10540 These entries are usually resolved by entries in
10541 libc. These entry points should be supplied through some other
10542 mechanism when this option is specified.
10543
10544 @cindex @option{-lgcc}, use with @option{-nostdlib}
10545 @cindex @option{-nostdlib} and unresolved references
10546 @cindex unresolved references and @option{-nostdlib}
10547 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
10548 @cindex @option{-nodefaultlibs} and unresolved references
10549 @cindex unresolved references and @option{-nodefaultlibs}
10550 One of the standard libraries bypassed by @option{-nostdlib} and
10551 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
10552 which GCC uses to overcome shortcomings of particular machines, or special
10553 needs for some languages.
10554 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
10555 Collection (GCC) Internals},
10556 for more discussion of @file{libgcc.a}.)
10557 In most cases, you need @file{libgcc.a} even when you want to avoid
10558 other standard libraries. In other words, when you specify @option{-nostdlib}
10559 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
10560 This ensures that you have no unresolved references to internal GCC
10561 library subroutines.
10562 (An example of such an internal subroutine is @code{__main}, used to ensure C++
10563 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
10564 GNU Compiler Collection (GCC) Internals}.)
10565
10566 @item -pie
10567 @opindex pie
10568 Produce a position independent executable on targets that support it.
10569 For predictable results, you must also specify the same set of options
10570 used for compilation (@option{-fpie}, @option{-fPIE},
10571 or model suboptions) when you specify this linker option.
10572
10573 @item -no-pie
10574 @opindex no-pie
10575 Don't produce a position independent executable.
10576
10577 @item -rdynamic
10578 @opindex rdynamic
10579 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
10580 that support it. This instructs the linker to add all symbols, not
10581 only used ones, to the dynamic symbol table. This option is needed
10582 for some uses of @code{dlopen} or to allow obtaining backtraces
10583 from within a program.
10584
10585 @item -s
10586 @opindex s
10587 Remove all symbol table and relocation information from the executable.
10588
10589 @item -static
10590 @opindex static
10591 On systems that support dynamic linking, this prevents linking with the shared
10592 libraries. On other systems, this option has no effect.
10593
10594 @item -shared
10595 @opindex shared
10596 Produce a shared object which can then be linked with other objects to
10597 form an executable. Not all systems support this option. For predictable
10598 results, you must also specify the same set of options used for compilation
10599 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
10600 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
10601 needs to build supplementary stub code for constructors to work. On
10602 multi-libbed systems, @samp{gcc -shared} must select the correct support
10603 libraries to link against. Failing to supply the correct flags may lead
10604 to subtle defects. Supplying them in cases where they are not necessary
10605 is innocuous.}
10606
10607 @item -shared-libgcc
10608 @itemx -static-libgcc
10609 @opindex shared-libgcc
10610 @opindex static-libgcc
10611 On systems that provide @file{libgcc} as a shared library, these options
10612 force the use of either the shared or static version, respectively.
10613 If no shared version of @file{libgcc} was built when the compiler was
10614 configured, these options have no effect.
10615
10616 There are several situations in which an application should use the
10617 shared @file{libgcc} instead of the static version. The most common
10618 of these is when the application wishes to throw and catch exceptions
10619 across different shared libraries. In that case, each of the libraries
10620 as well as the application itself should use the shared @file{libgcc}.
10621
10622 Therefore, the G++ and GCJ drivers automatically add
10623 @option{-shared-libgcc} whenever you build a shared library or a main
10624 executable, because C++ and Java programs typically use exceptions, so
10625 this is the right thing to do.
10626
10627 If, instead, you use the GCC driver to create shared libraries, you may
10628 find that they are not always linked with the shared @file{libgcc}.
10629 If GCC finds, at its configuration time, that you have a non-GNU linker
10630 or a GNU linker that does not support option @option{--eh-frame-hdr},
10631 it links the shared version of @file{libgcc} into shared libraries
10632 by default. Otherwise, it takes advantage of the linker and optimizes
10633 away the linking with the shared version of @file{libgcc}, linking with
10634 the static version of libgcc by default. This allows exceptions to
10635 propagate through such shared libraries, without incurring relocation
10636 costs at library load time.
10637
10638 However, if a library or main executable is supposed to throw or catch
10639 exceptions, you must link it using the G++ or GCJ driver, as appropriate
10640 for the languages used in the program, or using the option
10641 @option{-shared-libgcc}, such that it is linked with the shared
10642 @file{libgcc}.
10643
10644 @item -static-libasan
10645 @opindex static-libasan
10646 When the @option{-fsanitize=address} option is used to link a program,
10647 the GCC driver automatically links against @option{libasan}. If
10648 @file{libasan} is available as a shared library, and the @option{-static}
10649 option is not used, then this links against the shared version of
10650 @file{libasan}. The @option{-static-libasan} option directs the GCC
10651 driver to link @file{libasan} statically, without necessarily linking
10652 other libraries statically.
10653
10654 @item -static-libtsan
10655 @opindex static-libtsan
10656 When the @option{-fsanitize=thread} option is used to link a program,
10657 the GCC driver automatically links against @option{libtsan}. If
10658 @file{libtsan} is available as a shared library, and the @option{-static}
10659 option is not used, then this links against the shared version of
10660 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
10661 driver to link @file{libtsan} statically, without necessarily linking
10662 other libraries statically.
10663
10664 @item -static-liblsan
10665 @opindex static-liblsan
10666 When the @option{-fsanitize=leak} option is used to link a program,
10667 the GCC driver automatically links against @option{liblsan}. If
10668 @file{liblsan} is available as a shared library, and the @option{-static}
10669 option is not used, then this links against the shared version of
10670 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
10671 driver to link @file{liblsan} statically, without necessarily linking
10672 other libraries statically.
10673
10674 @item -static-libubsan
10675 @opindex static-libubsan
10676 When the @option{-fsanitize=undefined} option is used to link a program,
10677 the GCC driver automatically links against @option{libubsan}. If
10678 @file{libubsan} is available as a shared library, and the @option{-static}
10679 option is not used, then this links against the shared version of
10680 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
10681 driver to link @file{libubsan} statically, without necessarily linking
10682 other libraries statically.
10683
10684 @item -static-libmpx
10685 @opindex static-libmpx
10686 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
10687 used to link a program, the GCC driver automatically links against
10688 @file{libmpx}. If @file{libmpx} is available as a shared library,
10689 and the @option{-static} option is not used, then this links against
10690 the shared version of @file{libmpx}. The @option{-static-libmpx}
10691 option directs the GCC driver to link @file{libmpx} statically,
10692 without necessarily linking other libraries statically.
10693
10694 @item -static-libmpxwrappers
10695 @opindex static-libmpxwrappers
10696 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
10697 to link a program without also using @option{-fno-chkp-use-wrappers}, the
10698 GCC driver automatically links against @file{libmpxwrappers}. If
10699 @file{libmpxwrappers} is available as a shared library, and the
10700 @option{-static} option is not used, then this links against the shared
10701 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
10702 option directs the GCC driver to link @file{libmpxwrappers} statically,
10703 without necessarily linking other libraries statically.
10704
10705 @item -static-libstdc++
10706 @opindex static-libstdc++
10707 When the @command{g++} program is used to link a C++ program, it
10708 normally automatically links against @option{libstdc++}. If
10709 @file{libstdc++} is available as a shared library, and the
10710 @option{-static} option is not used, then this links against the
10711 shared version of @file{libstdc++}. That is normally fine. However, it
10712 is sometimes useful to freeze the version of @file{libstdc++} used by
10713 the program without going all the way to a fully static link. The
10714 @option{-static-libstdc++} option directs the @command{g++} driver to
10715 link @file{libstdc++} statically, without necessarily linking other
10716 libraries statically.
10717
10718 @item -symbolic
10719 @opindex symbolic
10720 Bind references to global symbols when building a shared object. Warn
10721 about any unresolved references (unless overridden by the link editor
10722 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
10723 this option.
10724
10725 @item -T @var{script}
10726 @opindex T
10727 @cindex linker script
10728 Use @var{script} as the linker script. This option is supported by most
10729 systems using the GNU linker. On some targets, such as bare-board
10730 targets without an operating system, the @option{-T} option may be required
10731 when linking to avoid references to undefined symbols.
10732
10733 @item -Xlinker @var{option}
10734 @opindex Xlinker
10735 Pass @var{option} as an option to the linker. You can use this to
10736 supply system-specific linker options that GCC does not recognize.
10737
10738 If you want to pass an option that takes a separate argument, you must use
10739 @option{-Xlinker} twice, once for the option and once for the argument.
10740 For example, to pass @option{-assert definitions}, you must write
10741 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
10742 @option{-Xlinker "-assert definitions"}, because this passes the entire
10743 string as a single argument, which is not what the linker expects.
10744
10745 When using the GNU linker, it is usually more convenient to pass
10746 arguments to linker options using the @option{@var{option}=@var{value}}
10747 syntax than as separate arguments. For example, you can specify
10748 @option{-Xlinker -Map=output.map} rather than
10749 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
10750 this syntax for command-line options.
10751
10752 @item -Wl,@var{option}
10753 @opindex Wl
10754 Pass @var{option} as an option to the linker. If @var{option} contains
10755 commas, it is split into multiple options at the commas. You can use this
10756 syntax to pass an argument to the option.
10757 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
10758 linker. When using the GNU linker, you can also get the same effect with
10759 @option{-Wl,-Map=output.map}.
10760
10761 @item -u @var{symbol}
10762 @opindex u
10763 Pretend the symbol @var{symbol} is undefined, to force linking of
10764 library modules to define it. You can use @option{-u} multiple times with
10765 different symbols to force loading of additional library modules.
10766
10767 @item -z @var{keyword}
10768 @opindex z
10769 @option{-z} is passed directly on to the linker along with the keyword
10770 @var{keyword}. See the section in the documentation of your linker for
10771 permitted values and their meanings.
10772 @end table
10773
10774 @node Directory Options
10775 @section Options for Directory Search
10776 @cindex directory options
10777 @cindex options, directory search
10778 @cindex search path
10779
10780 These options specify directories to search for header files, for
10781 libraries and for parts of the compiler:
10782
10783 @table @gcctabopt
10784 @item -I@var{dir}
10785 @opindex I
10786 Add the directory @var{dir} to the head of the list of directories to be
10787 searched for header files. This can be used to override a system header
10788 file, substituting your own version, since these directories are
10789 searched before the system header file directories. However, you should
10790 not use this option to add directories that contain vendor-supplied
10791 system header files (use @option{-isystem} for that). If you use more than
10792 one @option{-I} option, the directories are scanned in left-to-right
10793 order; the standard system directories come after.
10794
10795 If a standard system include directory, or a directory specified with
10796 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
10797 option is ignored. The directory is still searched but as a
10798 system directory at its normal position in the system include chain.
10799 This is to ensure that GCC's procedure to fix buggy system headers and
10800 the ordering for the @code{include_next} directive are not inadvertently changed.
10801 If you really need to change the search order for system directories,
10802 use the @option{-nostdinc} and/or @option{-isystem} options.
10803
10804 @item -iplugindir=@var{dir}
10805 @opindex iplugindir=
10806 Set the directory to search for plugins that are passed
10807 by @option{-fplugin=@var{name}} instead of
10808 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
10809 to be used by the user, but only passed by the driver.
10810
10811 @item -iquote@var{dir}
10812 @opindex iquote
10813 Add the directory @var{dir} to the head of the list of directories to
10814 be searched for header files only for the case of @code{#include
10815 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
10816 otherwise just like @option{-I}.
10817
10818 @item -L@var{dir}
10819 @opindex L
10820 Add directory @var{dir} to the list of directories to be searched
10821 for @option{-l}.
10822
10823 @item -B@var{prefix}
10824 @opindex B
10825 This option specifies where to find the executables, libraries,
10826 include files, and data files of the compiler itself.
10827
10828 The compiler driver program runs one or more of the subprograms
10829 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
10830 @var{prefix} as a prefix for each program it tries to run, both with and
10831 without @samp{@var{machine}/@var{version}/} for the corresponding target
10832 machine and compiler version.
10833
10834 For each subprogram to be run, the compiler driver first tries the
10835 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
10836 is not specified, the driver tries two standard prefixes,
10837 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
10838 those results in a file name that is found, the unmodified program
10839 name is searched for using the directories specified in your
10840 @env{PATH} environment variable.
10841
10842 The compiler checks to see if the path provided by @option{-B}
10843 refers to a directory, and if necessary it adds a directory
10844 separator character at the end of the path.
10845
10846 @option{-B} prefixes that effectively specify directory names also apply
10847 to libraries in the linker, because the compiler translates these
10848 options into @option{-L} options for the linker. They also apply to
10849 include files in the preprocessor, because the compiler translates these
10850 options into @option{-isystem} options for the preprocessor. In this case,
10851 the compiler appends @samp{include} to the prefix.
10852
10853 The runtime support file @file{libgcc.a} can also be searched for using
10854 the @option{-B} prefix, if needed. If it is not found there, the two
10855 standard prefixes above are tried, and that is all. The file is left
10856 out of the link if it is not found by those means.
10857
10858 Another way to specify a prefix much like the @option{-B} prefix is to use
10859 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
10860 Variables}.
10861
10862 As a special kludge, if the path provided by @option{-B} is
10863 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
10864 9, then it is replaced by @file{[dir/]include}. This is to help
10865 with boot-strapping the compiler.
10866
10867 @item -no-canonical-prefixes
10868 @opindex no-canonical-prefixes
10869 Do not expand any symbolic links, resolve references to @samp{/../}
10870 or @samp{/./}, or make the path absolute when generating a relative
10871 prefix.
10872
10873 @item --sysroot=@var{dir}
10874 @opindex sysroot
10875 Use @var{dir} as the logical root directory for headers and libraries.
10876 For example, if the compiler normally searches for headers in
10877 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
10878 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
10879
10880 If you use both this option and the @option{-isysroot} option, then
10881 the @option{--sysroot} option applies to libraries, but the
10882 @option{-isysroot} option applies to header files.
10883
10884 The GNU linker (beginning with version 2.16) has the necessary support
10885 for this option. If your linker does not support this option, the
10886 header file aspect of @option{--sysroot} still works, but the
10887 library aspect does not.
10888
10889 @item --no-sysroot-suffix
10890 @opindex no-sysroot-suffix
10891 For some targets, a suffix is added to the root directory specified
10892 with @option{--sysroot}, depending on the other options used, so that
10893 headers may for example be found in
10894 @file{@var{dir}/@var{suffix}/usr/include} instead of
10895 @file{@var{dir}/usr/include}. This option disables the addition of
10896 such a suffix.
10897
10898 @item -I-
10899 @opindex I-
10900 This option has been deprecated. Please use @option{-iquote} instead for
10901 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
10902 option.
10903 Any directories you specify with @option{-I} options before the @option{-I-}
10904 option are searched only for the case of @code{#include "@var{file}"};
10905 they are not searched for @code{#include <@var{file}>}.
10906
10907 If additional directories are specified with @option{-I} options after
10908 the @option{-I-} option, these directories are searched for all @code{#include}
10909 directives. (Ordinarily @emph{all} @option{-I} directories are used
10910 this way.)
10911
10912 In addition, the @option{-I-} option inhibits the use of the current
10913 directory (where the current input file came from) as the first search
10914 directory for @code{#include "@var{file}"}. There is no way to
10915 override this effect of @option{-I-}. With @option{-I.} you can specify
10916 searching the directory that is current when the compiler is
10917 invoked. That is not exactly the same as what the preprocessor does
10918 by default, but it is often satisfactory.
10919
10920 @option{-I-} does not inhibit the use of the standard system directories
10921 for header files. Thus, @option{-I-} and @option{-nostdinc} are
10922 independent.
10923 @end table
10924
10925 @node Code Gen Options
10926 @section Options for Code Generation Conventions
10927 @cindex code generation conventions
10928 @cindex options, code generation
10929 @cindex run-time options
10930
10931 These machine-independent options control the interface conventions
10932 used in code generation.
10933
10934 Most of them have both positive and negative forms; the negative form
10935 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
10936 one of the forms is listed---the one that is not the default. You
10937 can figure out the other form by either removing @samp{no-} or adding
10938 it.
10939
10940 @table @gcctabopt
10941 @item -fstack-reuse=@var{reuse-level}
10942 @opindex fstack_reuse
10943 This option controls stack space reuse for user declared local/auto variables
10944 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
10945 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
10946 local variables and temporaries, @samp{named_vars} enables the reuse only for
10947 user defined local variables with names, and @samp{none} disables stack reuse
10948 completely. The default value is @samp{all}. The option is needed when the
10949 program extends the lifetime of a scoped local variable or a compiler generated
10950 temporary beyond the end point defined by the language. When a lifetime of
10951 a variable ends, and if the variable lives in memory, the optimizing compiler
10952 has the freedom to reuse its stack space with other temporaries or scoped
10953 local variables whose live range does not overlap with it. Legacy code extending
10954 local lifetime is likely to break with the stack reuse optimization.
10955
10956 For example,
10957
10958 @smallexample
10959 int *p;
10960 @{
10961 int local1;
10962
10963 p = &local1;
10964 local1 = 10;
10965 ....
10966 @}
10967 @{
10968 int local2;
10969 local2 = 20;
10970 ...
10971 @}
10972
10973 if (*p == 10) // out of scope use of local1
10974 @{
10975
10976 @}
10977 @end smallexample
10978
10979 Another example:
10980 @smallexample
10981
10982 struct A
10983 @{
10984 A(int k) : i(k), j(k) @{ @}
10985 int i;
10986 int j;
10987 @};
10988
10989 A *ap;
10990
10991 void foo(const A& ar)
10992 @{
10993 ap = &ar;
10994 @}
10995
10996 void bar()
10997 @{
10998 foo(A(10)); // temp object's lifetime ends when foo returns
10999
11000 @{
11001 A a(20);
11002 ....
11003 @}
11004 ap->i+= 10; // ap references out of scope temp whose space
11005 // is reused with a. What is the value of ap->i?
11006 @}
11007
11008 @end smallexample
11009
11010 The lifetime of a compiler generated temporary is well defined by the C++
11011 standard. When a lifetime of a temporary ends, and if the temporary lives
11012 in memory, the optimizing compiler has the freedom to reuse its stack
11013 space with other temporaries or scoped local variables whose live range
11014 does not overlap with it. However some of the legacy code relies on
11015 the behavior of older compilers in which temporaries' stack space is
11016 not reused, the aggressive stack reuse can lead to runtime errors. This
11017 option is used to control the temporary stack reuse optimization.
11018
11019 @item -ftrapv
11020 @opindex ftrapv
11021 This option generates traps for signed overflow on addition, subtraction,
11022 multiplication operations.
11023 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11024 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11025 @option{-fwrapv} being effective. Note that only active options override, so
11026 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11027 results in @option{-ftrapv} being effective.
11028
11029 @item -fwrapv
11030 @opindex fwrapv
11031 This option instructs the compiler to assume that signed arithmetic
11032 overflow of addition, subtraction and multiplication wraps around
11033 using twos-complement representation. This flag enables some optimizations
11034 and disables others. This option is enabled by default for the Java
11035 front end, as required by the Java language specification.
11036 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11037 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11038 @option{-fwrapv} being effective. Note that only active options override, so
11039 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11040 results in @option{-ftrapv} being effective.
11041
11042 @item -fexceptions
11043 @opindex fexceptions
11044 Enable exception handling. Generates extra code needed to propagate
11045 exceptions. For some targets, this implies GCC generates frame
11046 unwind information for all functions, which can produce significant data
11047 size overhead, although it does not affect execution. If you do not
11048 specify this option, GCC enables it by default for languages like
11049 C++ that normally require exception handling, and disables it for
11050 languages like C that do not normally require it. However, you may need
11051 to enable this option when compiling C code that needs to interoperate
11052 properly with exception handlers written in C++. You may also wish to
11053 disable this option if you are compiling older C++ programs that don't
11054 use exception handling.
11055
11056 @item -fnon-call-exceptions
11057 @opindex fnon-call-exceptions
11058 Generate code that allows trapping instructions to throw exceptions.
11059 Note that this requires platform-specific runtime support that does
11060 not exist everywhere. Moreover, it only allows @emph{trapping}
11061 instructions to throw exceptions, i.e.@: memory references or floating-point
11062 instructions. It does not allow exceptions to be thrown from
11063 arbitrary signal handlers such as @code{SIGALRM}.
11064
11065 @item -fdelete-dead-exceptions
11066 @opindex fdelete-dead-exceptions
11067 Consider that instructions that may throw exceptions but don't otherwise
11068 contribute to the execution of the program can be optimized away.
11069 This option is enabled by default for the Ada front end, as permitted by
11070 the Ada language specification.
11071 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
11072
11073 @item -funwind-tables
11074 @opindex funwind-tables
11075 Similar to @option{-fexceptions}, except that it just generates any needed
11076 static data, but does not affect the generated code in any other way.
11077 You normally do not need to enable this option; instead, a language processor
11078 that needs this handling enables it on your behalf.
11079
11080 @item -fasynchronous-unwind-tables
11081 @opindex fasynchronous-unwind-tables
11082 Generate unwind table in DWARF format, if supported by target machine. The
11083 table is exact at each instruction boundary, so it can be used for stack
11084 unwinding from asynchronous events (such as debugger or garbage collector).
11085
11086 @item -fno-gnu-unique
11087 @opindex fno-gnu-unique
11088 On systems with recent GNU assembler and C library, the C++ compiler
11089 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
11090 of template static data members and static local variables in inline
11091 functions are unique even in the presence of @code{RTLD_LOCAL}; this
11092 is necessary to avoid problems with a library used by two different
11093 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
11094 therefore disagreeing with the other one about the binding of the
11095 symbol. But this causes @code{dlclose} to be ignored for affected
11096 DSOs; if your program relies on reinitialization of a DSO via
11097 @code{dlclose} and @code{dlopen}, you can use
11098 @option{-fno-gnu-unique}.
11099
11100 @item -fpcc-struct-return
11101 @opindex fpcc-struct-return
11102 Return ``short'' @code{struct} and @code{union} values in memory like
11103 longer ones, rather than in registers. This convention is less
11104 efficient, but it has the advantage of allowing intercallability between
11105 GCC-compiled files and files compiled with other compilers, particularly
11106 the Portable C Compiler (pcc).
11107
11108 The precise convention for returning structures in memory depends
11109 on the target configuration macros.
11110
11111 Short structures and unions are those whose size and alignment match
11112 that of some integer type.
11113
11114 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11115 switch is not binary compatible with code compiled with the
11116 @option{-freg-struct-return} switch.
11117 Use it to conform to a non-default application binary interface.
11118
11119 @item -freg-struct-return
11120 @opindex freg-struct-return
11121 Return @code{struct} and @code{union} values in registers when possible.
11122 This is more efficient for small structures than
11123 @option{-fpcc-struct-return}.
11124
11125 If you specify neither @option{-fpcc-struct-return} nor
11126 @option{-freg-struct-return}, GCC defaults to whichever convention is
11127 standard for the target. If there is no standard convention, GCC
11128 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11129 the principal compiler. In those cases, we can choose the standard, and
11130 we chose the more efficient register return alternative.
11131
11132 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11133 switch is not binary compatible with code compiled with the
11134 @option{-fpcc-struct-return} switch.
11135 Use it to conform to a non-default application binary interface.
11136
11137 @item -fshort-enums
11138 @opindex fshort-enums
11139 Allocate to an @code{enum} type only as many bytes as it needs for the
11140 declared range of possible values. Specifically, the @code{enum} type
11141 is equivalent to the smallest integer type that has enough room.
11142
11143 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11144 code that is not binary compatible with code generated without that switch.
11145 Use it to conform to a non-default application binary interface.
11146
11147 @item -fshort-wchar
11148 @opindex fshort-wchar
11149 Override the underlying type for @code{wchar_t} to be @code{short
11150 unsigned int} instead of the default for the target. This option is
11151 useful for building programs to run under WINE@.
11152
11153 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11154 code that is not binary compatible with code generated without that switch.
11155 Use it to conform to a non-default application binary interface.
11156
11157 @item -fno-common
11158 @opindex fno-common
11159 In C code, controls the placement of uninitialized global variables.
11160 Unix C compilers have traditionally permitted multiple definitions of
11161 such variables in different compilation units by placing the variables
11162 in a common block.
11163 This is the behavior specified by @option{-fcommon}, and is the default
11164 for GCC on most targets.
11165 On the other hand, this behavior is not required by ISO C, and on some
11166 targets may carry a speed or code size penalty on variable references.
11167 The @option{-fno-common} option specifies that the compiler should place
11168 uninitialized global variables in the data section of the object file,
11169 rather than generating them as common blocks.
11170 This has the effect that if the same variable is declared
11171 (without @code{extern}) in two different compilations,
11172 you get a multiple-definition error when you link them.
11173 In this case, you must compile with @option{-fcommon} instead.
11174 Compiling with @option{-fno-common} is useful on targets for which
11175 it provides better performance, or if you wish to verify that the
11176 program will work on other systems that always treat uninitialized
11177 variable declarations this way.
11178
11179 @item -fno-ident
11180 @opindex fno-ident
11181 Ignore the @code{#ident} directive.
11182
11183 @item -finhibit-size-directive
11184 @opindex finhibit-size-directive
11185 Don't output a @code{.size} assembler directive, or anything else that
11186 would cause trouble if the function is split in the middle, and the
11187 two halves are placed at locations far apart in memory. This option is
11188 used when compiling @file{crtstuff.c}; you should not need to use it
11189 for anything else.
11190
11191 @item -fverbose-asm
11192 @opindex fverbose-asm
11193 Put extra commentary information in the generated assembly code to
11194 make it more readable. This option is generally only of use to those
11195 who actually need to read the generated assembly code (perhaps while
11196 debugging the compiler itself).
11197
11198 @option{-fno-verbose-asm}, the default, causes the
11199 extra information to be omitted and is useful when comparing two assembler
11200 files.
11201
11202 @item -frecord-gcc-switches
11203 @opindex frecord-gcc-switches
11204 This switch causes the command line used to invoke the
11205 compiler to be recorded into the object file that is being created.
11206 This switch is only implemented on some targets and the exact format
11207 of the recording is target and binary file format dependent, but it
11208 usually takes the form of a section containing ASCII text. This
11209 switch is related to the @option{-fverbose-asm} switch, but that
11210 switch only records information in the assembler output file as
11211 comments, so it never reaches the object file.
11212 See also @option{-grecord-gcc-switches} for another
11213 way of storing compiler options into the object file.
11214
11215 @item -fpic
11216 @opindex fpic
11217 @cindex global offset table
11218 @cindex PIC
11219 Generate position-independent code (PIC) suitable for use in a shared
11220 library, if supported for the target machine. Such code accesses all
11221 constant addresses through a global offset table (GOT)@. The dynamic
11222 loader resolves the GOT entries when the program starts (the dynamic
11223 loader is not part of GCC; it is part of the operating system). If
11224 the GOT size for the linked executable exceeds a machine-specific
11225 maximum size, you get an error message from the linker indicating that
11226 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
11227 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
11228 on the m68k and RS/6000. The x86 has no such limit.)
11229
11230 Position-independent code requires special support, and therefore works
11231 only on certain machines. For the x86, GCC supports PIC for System V
11232 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
11233 position-independent.
11234
11235 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11236 are defined to 1.
11237
11238 @item -fPIC
11239 @opindex fPIC
11240 If supported for the target machine, emit position-independent code,
11241 suitable for dynamic linking and avoiding any limit on the size of the
11242 global offset table. This option makes a difference on AArch64, m68k,
11243 PowerPC and SPARC@.
11244
11245 Position-independent code requires special support, and therefore works
11246 only on certain machines.
11247
11248 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11249 are defined to 2.
11250
11251 @item -fpie
11252 @itemx -fPIE
11253 @opindex fpie
11254 @opindex fPIE
11255 These options are similar to @option{-fpic} and @option{-fPIC}, but
11256 generated position independent code can be only linked into executables.
11257 Usually these options are used when @option{-pie} GCC option is
11258 used during linking.
11259
11260 @option{-fpie} and @option{-fPIE} both define the macros
11261 @code{__pie__} and @code{__PIE__}. The macros have the value 1
11262 for @option{-fpie} and 2 for @option{-fPIE}.
11263
11264 @item -fno-plt
11265 @opindex fno-plt
11266 Do not use the PLT for external function calls in position-independent code.
11267 Instead, load the callee address at call sites from the GOT and branch to it.
11268 This leads to more efficient code by eliminating PLT stubs and exposing
11269 GOT loads to optimizations. On architectures such as 32-bit x86 where
11270 PLT stubs expect the GOT pointer in a specific register, this gives more
11271 register allocation freedom to the compiler.
11272 Lazy binding requires use of the PLT;
11273 with @option{-fno-plt} all external symbols are resolved at load time.
11274
11275 Alternatively, the function attribute @code{noplt} can be used to avoid calls
11276 through the PLT for specific external functions.
11277
11278 In position-dependent code, a few targets also convert calls to
11279 functions that are marked to not use the PLT to use the GOT instead.
11280
11281 @item -fno-jump-tables
11282 @opindex fno-jump-tables
11283 Do not use jump tables for switch statements even where it would be
11284 more efficient than other code generation strategies. This option is
11285 of use in conjunction with @option{-fpic} or @option{-fPIC} for
11286 building code that forms part of a dynamic linker and cannot
11287 reference the address of a jump table. On some targets, jump tables
11288 do not require a GOT and this option is not needed.
11289
11290 @item -ffixed-@var{reg}
11291 @opindex ffixed
11292 Treat the register named @var{reg} as a fixed register; generated code
11293 should never refer to it (except perhaps as a stack pointer, frame
11294 pointer or in some other fixed role).
11295
11296 @var{reg} must be the name of a register. The register names accepted
11297 are machine-specific and are defined in the @code{REGISTER_NAMES}
11298 macro in the machine description macro file.
11299
11300 This flag does not have a negative form, because it specifies a
11301 three-way choice.
11302
11303 @item -fcall-used-@var{reg}
11304 @opindex fcall-used
11305 Treat the register named @var{reg} as an allocable register that is
11306 clobbered by function calls. It may be allocated for temporaries or
11307 variables that do not live across a call. Functions compiled this way
11308 do not save and restore the register @var{reg}.
11309
11310 It is an error to use this flag with the frame pointer or stack pointer.
11311 Use of this flag for other registers that have fixed pervasive roles in
11312 the machine's execution model produces disastrous results.
11313
11314 This flag does not have a negative form, because it specifies a
11315 three-way choice.
11316
11317 @item -fcall-saved-@var{reg}
11318 @opindex fcall-saved
11319 Treat the register named @var{reg} as an allocable register saved by
11320 functions. It may be allocated even for temporaries or variables that
11321 live across a call. Functions compiled this way save and restore
11322 the register @var{reg} if they use it.
11323
11324 It is an error to use this flag with the frame pointer or stack pointer.
11325 Use of this flag for other registers that have fixed pervasive roles in
11326 the machine's execution model produces disastrous results.
11327
11328 A different sort of disaster results from the use of this flag for
11329 a register in which function values may be returned.
11330
11331 This flag does not have a negative form, because it specifies a
11332 three-way choice.
11333
11334 @item -fpack-struct[=@var{n}]
11335 @opindex fpack-struct
11336 Without a value specified, pack all structure members together without
11337 holes. When a value is specified (which must be a small power of two), pack
11338 structure members according to this value, representing the maximum
11339 alignment (that is, objects with default alignment requirements larger than
11340 this are output potentially unaligned at the next fitting location.
11341
11342 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11343 code that is not binary compatible with code generated without that switch.
11344 Additionally, it makes the code suboptimal.
11345 Use it to conform to a non-default application binary interface.
11346
11347 @item -fleading-underscore
11348 @opindex fleading-underscore
11349 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11350 change the way C symbols are represented in the object file. One use
11351 is to help link with legacy assembly code.
11352
11353 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11354 generate code that is not binary compatible with code generated without that
11355 switch. Use it to conform to a non-default application binary interface.
11356 Not all targets provide complete support for this switch.
11357
11358 @item -ftls-model=@var{model}
11359 @opindex ftls-model
11360 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11361 The @var{model} argument should be one of @samp{global-dynamic},
11362 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
11363 Note that the choice is subject to optimization: the compiler may use
11364 a more efficient model for symbols not visible outside of the translation
11365 unit, or if @option{-fpic} is not given on the command line.
11366
11367 The default without @option{-fpic} is @samp{initial-exec}; with
11368 @option{-fpic} the default is @samp{global-dynamic}.
11369
11370 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
11371 @opindex fvisibility
11372 Set the default ELF image symbol visibility to the specified option---all
11373 symbols are marked with this unless overridden within the code.
11374 Using this feature can very substantially improve linking and
11375 load times of shared object libraries, produce more optimized
11376 code, provide near-perfect API export and prevent symbol clashes.
11377 It is @strong{strongly} recommended that you use this in any shared objects
11378 you distribute.
11379
11380 Despite the nomenclature, @samp{default} always means public; i.e.,
11381 available to be linked against from outside the shared object.
11382 @samp{protected} and @samp{internal} are pretty useless in real-world
11383 usage so the only other commonly used option is @samp{hidden}.
11384 The default if @option{-fvisibility} isn't specified is
11385 @samp{default}, i.e., make every symbol public.
11386
11387 A good explanation of the benefits offered by ensuring ELF
11388 symbols have the correct visibility is given by ``How To Write
11389 Shared Libraries'' by Ulrich Drepper (which can be found at
11390 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
11391 solution made possible by this option to marking things hidden when
11392 the default is public is to make the default hidden and mark things
11393 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
11394 and @code{__attribute__ ((visibility("default")))} instead of
11395 @code{__declspec(dllexport)} you get almost identical semantics with
11396 identical syntax. This is a great boon to those working with
11397 cross-platform projects.
11398
11399 For those adding visibility support to existing code, you may find
11400 @code{#pragma GCC visibility} of use. This works by you enclosing
11401 the declarations you wish to set visibility for with (for example)
11402 @code{#pragma GCC visibility push(hidden)} and
11403 @code{#pragma GCC visibility pop}.
11404 Bear in mind that symbol visibility should be viewed @strong{as
11405 part of the API interface contract} and thus all new code should
11406 always specify visibility when it is not the default; i.e., declarations
11407 only for use within the local DSO should @strong{always} be marked explicitly
11408 as hidden as so to avoid PLT indirection overheads---making this
11409 abundantly clear also aids readability and self-documentation of the code.
11410 Note that due to ISO C++ specification requirements, @code{operator new} and
11411 @code{operator delete} must always be of default visibility.
11412
11413 Be aware that headers from outside your project, in particular system
11414 headers and headers from any other library you use, may not be
11415 expecting to be compiled with visibility other than the default. You
11416 may need to explicitly say @code{#pragma GCC visibility push(default)}
11417 before including any such headers.
11418
11419 @code{extern} declarations are not affected by @option{-fvisibility}, so
11420 a lot of code can be recompiled with @option{-fvisibility=hidden} with
11421 no modifications. However, this means that calls to @code{extern}
11422 functions with no explicit visibility use the PLT, so it is more
11423 effective to use @code{__attribute ((visibility))} and/or
11424 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
11425 declarations should be treated as hidden.
11426
11427 Note that @option{-fvisibility} does affect C++ vague linkage
11428 entities. This means that, for instance, an exception class that is
11429 be thrown between DSOs must be explicitly marked with default
11430 visibility so that the @samp{type_info} nodes are unified between
11431 the DSOs.
11432
11433 An overview of these techniques, their benefits and how to use them
11434 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
11435
11436 @item -fstrict-volatile-bitfields
11437 @opindex fstrict-volatile-bitfields
11438 This option should be used if accesses to volatile bit-fields (or other
11439 structure fields, although the compiler usually honors those types
11440 anyway) should use a single access of the width of the
11441 field's type, aligned to a natural alignment if possible. For
11442 example, targets with memory-mapped peripheral registers might require
11443 all such accesses to be 16 bits wide; with this flag you can
11444 declare all peripheral bit-fields as @code{unsigned short} (assuming short
11445 is 16 bits on these targets) to force GCC to use 16-bit accesses
11446 instead of, perhaps, a more efficient 32-bit access.
11447
11448 If this option is disabled, the compiler uses the most efficient
11449 instruction. In the previous example, that might be a 32-bit load
11450 instruction, even though that accesses bytes that do not contain
11451 any portion of the bit-field, or memory-mapped registers unrelated to
11452 the one being updated.
11453
11454 In some cases, such as when the @code{packed} attribute is applied to a
11455 structure field, it may not be possible to access the field with a single
11456 read or write that is correctly aligned for the target machine. In this
11457 case GCC falls back to generating multiple accesses rather than code that
11458 will fault or truncate the result at run time.
11459
11460 Note: Due to restrictions of the C/C++11 memory model, write accesses are
11461 not allowed to touch non bit-field members. It is therefore recommended
11462 to define all bits of the field's type as bit-field members.
11463
11464 The default value of this option is determined by the application binary
11465 interface for the target processor.
11466
11467 @item -fsync-libcalls
11468 @opindex fsync-libcalls
11469 This option controls whether any out-of-line instance of the @code{__sync}
11470 family of functions may be used to implement the C++11 @code{__atomic}
11471 family of functions.
11472
11473 The default value of this option is enabled, thus the only useful form
11474 of the option is @option{-fno-sync-libcalls}. This option is used in
11475 the implementation of the @file{libatomic} runtime library.
11476
11477 @end table
11478
11479 @node Developer Options
11480 @section GCC Developer Options
11481 @cindex developer options
11482 @cindex debugging GCC
11483 @cindex debug dump options
11484 @cindex dump options
11485 @cindex compilation statistics
11486
11487 This section describes command-line options that are primarily of
11488 interest to GCC developers, including options to support compiler
11489 testing and investigation of compiler bugs and compile-time
11490 performance problems. This includes options that produce debug dumps
11491 at various points in the compilation; that print statistics such as
11492 memory use and execution time; and that print information about GCC's
11493 configuration, such as where it searches for libraries. You should
11494 rarely need to use any of these options for ordinary compilation and
11495 linking tasks.
11496
11497 @table @gcctabopt
11498
11499 @item -d@var{letters}
11500 @itemx -fdump-rtl-@var{pass}
11501 @itemx -fdump-rtl-@var{pass}=@var{filename}
11502 @opindex d
11503 @opindex fdump-rtl-@var{pass}
11504 Says to make debugging dumps during compilation at times specified by
11505 @var{letters}. This is used for debugging the RTL-based passes of the
11506 compiler. The file names for most of the dumps are made by appending
11507 a pass number and a word to the @var{dumpname}, and the files are
11508 created in the directory of the output file. In case of
11509 @option{=@var{filename}} option, the dump is output on the given file
11510 instead of the pass numbered dump files. Note that the pass number is
11511 assigned as passes are registered into the pass manager. Most passes
11512 are registered in the order that they will execute and for these passes
11513 the number corresponds to the pass execution order. However, passes
11514 registered by plugins, passes specific to compilation targets, or
11515 passes that are otherwise registered after all the other passes are
11516 numbered higher than a pass named "final", even if they are executed
11517 earlier. @var{dumpname} is generated from the name of the output
11518 file if explicitly specified and not an executable, otherwise it is
11519 the basename of the source file. These switches may have different
11520 effects when @option{-E} is used for preprocessing.
11521
11522 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
11523 @option{-d} option @var{letters}. Here are the possible
11524 letters for use in @var{pass} and @var{letters}, and their meanings:
11525
11526 @table @gcctabopt
11527
11528 @item -fdump-rtl-alignments
11529 @opindex fdump-rtl-alignments
11530 Dump after branch alignments have been computed.
11531
11532 @item -fdump-rtl-asmcons
11533 @opindex fdump-rtl-asmcons
11534 Dump after fixing rtl statements that have unsatisfied in/out constraints.
11535
11536 @item -fdump-rtl-auto_inc_dec
11537 @opindex fdump-rtl-auto_inc_dec
11538 Dump after auto-inc-dec discovery. This pass is only run on
11539 architectures that have auto inc or auto dec instructions.
11540
11541 @item -fdump-rtl-barriers
11542 @opindex fdump-rtl-barriers
11543 Dump after cleaning up the barrier instructions.
11544
11545 @item -fdump-rtl-bbpart
11546 @opindex fdump-rtl-bbpart
11547 Dump after partitioning hot and cold basic blocks.
11548
11549 @item -fdump-rtl-bbro
11550 @opindex fdump-rtl-bbro
11551 Dump after block reordering.
11552
11553 @item -fdump-rtl-btl1
11554 @itemx -fdump-rtl-btl2
11555 @opindex fdump-rtl-btl2
11556 @opindex fdump-rtl-btl2
11557 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
11558 after the two branch
11559 target load optimization passes.
11560
11561 @item -fdump-rtl-bypass
11562 @opindex fdump-rtl-bypass
11563 Dump after jump bypassing and control flow optimizations.
11564
11565 @item -fdump-rtl-combine
11566 @opindex fdump-rtl-combine
11567 Dump after the RTL instruction combination pass.
11568
11569 @item -fdump-rtl-compgotos
11570 @opindex fdump-rtl-compgotos
11571 Dump after duplicating the computed gotos.
11572
11573 @item -fdump-rtl-ce1
11574 @itemx -fdump-rtl-ce2
11575 @itemx -fdump-rtl-ce3
11576 @opindex fdump-rtl-ce1
11577 @opindex fdump-rtl-ce2
11578 @opindex fdump-rtl-ce3
11579 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
11580 @option{-fdump-rtl-ce3} enable dumping after the three
11581 if conversion passes.
11582
11583 @item -fdump-rtl-cprop_hardreg
11584 @opindex fdump-rtl-cprop_hardreg
11585 Dump after hard register copy propagation.
11586
11587 @item -fdump-rtl-csa
11588 @opindex fdump-rtl-csa
11589 Dump after combining stack adjustments.
11590
11591 @item -fdump-rtl-cse1
11592 @itemx -fdump-rtl-cse2
11593 @opindex fdump-rtl-cse1
11594 @opindex fdump-rtl-cse2
11595 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
11596 the two common subexpression elimination passes.
11597
11598 @item -fdump-rtl-dce
11599 @opindex fdump-rtl-dce
11600 Dump after the standalone dead code elimination passes.
11601
11602 @item -fdump-rtl-dbr
11603 @opindex fdump-rtl-dbr
11604 Dump after delayed branch scheduling.
11605
11606 @item -fdump-rtl-dce1
11607 @itemx -fdump-rtl-dce2
11608 @opindex fdump-rtl-dce1
11609 @opindex fdump-rtl-dce2
11610 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
11611 the two dead store elimination passes.
11612
11613 @item -fdump-rtl-eh
11614 @opindex fdump-rtl-eh
11615 Dump after finalization of EH handling code.
11616
11617 @item -fdump-rtl-eh_ranges
11618 @opindex fdump-rtl-eh_ranges
11619 Dump after conversion of EH handling range regions.
11620
11621 @item -fdump-rtl-expand
11622 @opindex fdump-rtl-expand
11623 Dump after RTL generation.
11624
11625 @item -fdump-rtl-fwprop1
11626 @itemx -fdump-rtl-fwprop2
11627 @opindex fdump-rtl-fwprop1
11628 @opindex fdump-rtl-fwprop2
11629 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
11630 dumping after the two forward propagation passes.
11631
11632 @item -fdump-rtl-gcse1
11633 @itemx -fdump-rtl-gcse2
11634 @opindex fdump-rtl-gcse1
11635 @opindex fdump-rtl-gcse2
11636 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
11637 after global common subexpression elimination.
11638
11639 @item -fdump-rtl-init-regs
11640 @opindex fdump-rtl-init-regs
11641 Dump after the initialization of the registers.
11642
11643 @item -fdump-rtl-initvals
11644 @opindex fdump-rtl-initvals
11645 Dump after the computation of the initial value sets.
11646
11647 @item -fdump-rtl-into_cfglayout
11648 @opindex fdump-rtl-into_cfglayout
11649 Dump after converting to cfglayout mode.
11650
11651 @item -fdump-rtl-ira
11652 @opindex fdump-rtl-ira
11653 Dump after iterated register allocation.
11654
11655 @item -fdump-rtl-jump
11656 @opindex fdump-rtl-jump
11657 Dump after the second jump optimization.
11658
11659 @item -fdump-rtl-loop2
11660 @opindex fdump-rtl-loop2
11661 @option{-fdump-rtl-loop2} enables dumping after the rtl
11662 loop optimization passes.
11663
11664 @item -fdump-rtl-mach
11665 @opindex fdump-rtl-mach
11666 Dump after performing the machine dependent reorganization pass, if that
11667 pass exists.
11668
11669 @item -fdump-rtl-mode_sw
11670 @opindex fdump-rtl-mode_sw
11671 Dump after removing redundant mode switches.
11672
11673 @item -fdump-rtl-rnreg
11674 @opindex fdump-rtl-rnreg
11675 Dump after register renumbering.
11676
11677 @item -fdump-rtl-outof_cfglayout
11678 @opindex fdump-rtl-outof_cfglayout
11679 Dump after converting from cfglayout mode.
11680
11681 @item -fdump-rtl-peephole2
11682 @opindex fdump-rtl-peephole2
11683 Dump after the peephole pass.
11684
11685 @item -fdump-rtl-postreload
11686 @opindex fdump-rtl-postreload
11687 Dump after post-reload optimizations.
11688
11689 @item -fdump-rtl-pro_and_epilogue
11690 @opindex fdump-rtl-pro_and_epilogue
11691 Dump after generating the function prologues and epilogues.
11692
11693 @item -fdump-rtl-sched1
11694 @itemx -fdump-rtl-sched2
11695 @opindex fdump-rtl-sched1
11696 @opindex fdump-rtl-sched2
11697 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
11698 after the basic block scheduling passes.
11699
11700 @item -fdump-rtl-ree
11701 @opindex fdump-rtl-ree
11702 Dump after sign/zero extension elimination.
11703
11704 @item -fdump-rtl-seqabstr
11705 @opindex fdump-rtl-seqabstr
11706 Dump after common sequence discovery.
11707
11708 @item -fdump-rtl-shorten
11709 @opindex fdump-rtl-shorten
11710 Dump after shortening branches.
11711
11712 @item -fdump-rtl-sibling
11713 @opindex fdump-rtl-sibling
11714 Dump after sibling call optimizations.
11715
11716 @item -fdump-rtl-split1
11717 @itemx -fdump-rtl-split2
11718 @itemx -fdump-rtl-split3
11719 @itemx -fdump-rtl-split4
11720 @itemx -fdump-rtl-split5
11721 @opindex fdump-rtl-split1
11722 @opindex fdump-rtl-split2
11723 @opindex fdump-rtl-split3
11724 @opindex fdump-rtl-split4
11725 @opindex fdump-rtl-split5
11726 These options enable dumping after five rounds of
11727 instruction splitting.
11728
11729 @item -fdump-rtl-sms
11730 @opindex fdump-rtl-sms
11731 Dump after modulo scheduling. This pass is only run on some
11732 architectures.
11733
11734 @item -fdump-rtl-stack
11735 @opindex fdump-rtl-stack
11736 Dump after conversion from GCC's ``flat register file'' registers to the
11737 x87's stack-like registers. This pass is only run on x86 variants.
11738
11739 @item -fdump-rtl-subreg1
11740 @itemx -fdump-rtl-subreg2
11741 @opindex fdump-rtl-subreg1
11742 @opindex fdump-rtl-subreg2
11743 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
11744 the two subreg expansion passes.
11745
11746 @item -fdump-rtl-unshare
11747 @opindex fdump-rtl-unshare
11748 Dump after all rtl has been unshared.
11749
11750 @item -fdump-rtl-vartrack
11751 @opindex fdump-rtl-vartrack
11752 Dump after variable tracking.
11753
11754 @item -fdump-rtl-vregs
11755 @opindex fdump-rtl-vregs
11756 Dump after converting virtual registers to hard registers.
11757
11758 @item -fdump-rtl-web
11759 @opindex fdump-rtl-web
11760 Dump after live range splitting.
11761
11762 @item -fdump-rtl-regclass
11763 @itemx -fdump-rtl-subregs_of_mode_init
11764 @itemx -fdump-rtl-subregs_of_mode_finish
11765 @itemx -fdump-rtl-dfinit
11766 @itemx -fdump-rtl-dfinish
11767 @opindex fdump-rtl-regclass
11768 @opindex fdump-rtl-subregs_of_mode_init
11769 @opindex fdump-rtl-subregs_of_mode_finish
11770 @opindex fdump-rtl-dfinit
11771 @opindex fdump-rtl-dfinish
11772 These dumps are defined but always produce empty files.
11773
11774 @item -da
11775 @itemx -fdump-rtl-all
11776 @opindex da
11777 @opindex fdump-rtl-all
11778 Produce all the dumps listed above.
11779
11780 @item -dA
11781 @opindex dA
11782 Annotate the assembler output with miscellaneous debugging information.
11783
11784 @item -dD
11785 @opindex dD
11786 Dump all macro definitions, at the end of preprocessing, in addition to
11787 normal output.
11788
11789 @item -dH
11790 @opindex dH
11791 Produce a core dump whenever an error occurs.
11792
11793 @item -dp
11794 @opindex dp
11795 Annotate the assembler output with a comment indicating which
11796 pattern and alternative is used. The length of each instruction is
11797 also printed.
11798
11799 @item -dP
11800 @opindex dP
11801 Dump the RTL in the assembler output as a comment before each instruction.
11802 Also turns on @option{-dp} annotation.
11803
11804 @item -dx
11805 @opindex dx
11806 Just generate RTL for a function instead of compiling it. Usually used
11807 with @option{-fdump-rtl-expand}.
11808 @end table
11809
11810 @item -fdump-noaddr
11811 @opindex fdump-noaddr
11812 When doing debugging dumps, suppress address output. This makes it more
11813 feasible to use diff on debugging dumps for compiler invocations with
11814 different compiler binaries and/or different
11815 text / bss / data / heap / stack / dso start locations.
11816
11817 @item -freport-bug
11818 @opindex freport-bug
11819 Collect and dump debug information into a temporary file if an
11820 internal compiler error (ICE) occurs.
11821
11822 @item -fdump-unnumbered
11823 @opindex fdump-unnumbered
11824 When doing debugging dumps, suppress instruction numbers and address output.
11825 This makes it more feasible to use diff on debugging dumps for compiler
11826 invocations with different options, in particular with and without
11827 @option{-g}.
11828
11829 @item -fdump-unnumbered-links
11830 @opindex fdump-unnumbered-links
11831 When doing debugging dumps (see @option{-d} option above), suppress
11832 instruction numbers for the links to the previous and next instructions
11833 in a sequence.
11834
11835 @item -fdump-translation-unit @r{(C++ only)}
11836 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
11837 @opindex fdump-translation-unit
11838 Dump a representation of the tree structure for the entire translation
11839 unit to a file. The file name is made by appending @file{.tu} to the
11840 source file name, and the file is created in the same directory as the
11841 output file. If the @samp{-@var{options}} form is used, @var{options}
11842 controls the details of the dump as described for the
11843 @option{-fdump-tree} options.
11844
11845 @item -fdump-class-hierarchy @r{(C++ only)}
11846 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
11847 @opindex fdump-class-hierarchy
11848 Dump a representation of each class's hierarchy and virtual function
11849 table layout to a file. The file name is made by appending
11850 @file{.class} to the source file name, and the file is created in the
11851 same directory as the output file. If the @samp{-@var{options}} form
11852 is used, @var{options} controls the details of the dump as described
11853 for the @option{-fdump-tree} options.
11854
11855 @item -fdump-ipa-@var{switch}
11856 @opindex fdump-ipa
11857 Control the dumping at various stages of inter-procedural analysis
11858 language tree to a file. The file name is generated by appending a
11859 switch specific suffix to the source file name, and the file is created
11860 in the same directory as the output file. The following dumps are
11861 possible:
11862
11863 @table @samp
11864 @item all
11865 Enables all inter-procedural analysis dumps.
11866
11867 @item cgraph
11868 Dumps information about call-graph optimization, unused function removal,
11869 and inlining decisions.
11870
11871 @item inline
11872 Dump after function inlining.
11873
11874 @end table
11875
11876 @item -fdump-passes
11877 @opindex fdump-passes
11878 Dump the list of optimization passes that are turned on and off by
11879 the current command-line options.
11880
11881 @item -fdump-statistics-@var{option}
11882 @opindex fdump-statistics
11883 Enable and control dumping of pass statistics in a separate file. The
11884 file name is generated by appending a suffix ending in
11885 @samp{.statistics} to the source file name, and the file is created in
11886 the same directory as the output file. If the @samp{-@var{option}}
11887 form is used, @samp{-stats} causes counters to be summed over the
11888 whole compilation unit while @samp{-details} dumps every event as
11889 the passes generate them. The default with no option is to sum
11890 counters for each function compiled.
11891
11892 @item -fdump-tree-@var{switch}
11893 @itemx -fdump-tree-@var{switch}-@var{options}
11894 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
11895 @opindex fdump-tree
11896 Control the dumping at various stages of processing the intermediate
11897 language tree to a file. The file name is generated by appending a
11898 switch-specific suffix to the source file name, and the file is
11899 created in the same directory as the output file. In case of
11900 @option{=@var{filename}} option, the dump is output on the given file
11901 instead of the auto named dump files. If the @samp{-@var{options}}
11902 form is used, @var{options} is a list of @samp{-} separated options
11903 which control the details of the dump. Not all options are applicable
11904 to all dumps; those that are not meaningful are ignored. The
11905 following options are available
11906
11907 @table @samp
11908 @item address
11909 Print the address of each node. Usually this is not meaningful as it
11910 changes according to the environment and source file. Its primary use
11911 is for tying up a dump file with a debug environment.
11912 @item asmname
11913 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
11914 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
11915 use working backward from mangled names in the assembly file.
11916 @item slim
11917 When dumping front-end intermediate representations, inhibit dumping
11918 of members of a scope or body of a function merely because that scope
11919 has been reached. Only dump such items when they are directly reachable
11920 by some other path.
11921
11922 When dumping pretty-printed trees, this option inhibits dumping the
11923 bodies of control structures.
11924
11925 When dumping RTL, print the RTL in slim (condensed) form instead of
11926 the default LISP-like representation.
11927 @item raw
11928 Print a raw representation of the tree. By default, trees are
11929 pretty-printed into a C-like representation.
11930 @item details
11931 Enable more detailed dumps (not honored by every dump option). Also
11932 include information from the optimization passes.
11933 @item stats
11934 Enable dumping various statistics about the pass (not honored by every dump
11935 option).
11936 @item blocks
11937 Enable showing basic block boundaries (disabled in raw dumps).
11938 @item graph
11939 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
11940 dump a representation of the control flow graph suitable for viewing with
11941 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
11942 the file is pretty-printed as a subgraph, so that GraphViz can render them
11943 all in a single plot.
11944
11945 This option currently only works for RTL dumps, and the RTL is always
11946 dumped in slim form.
11947 @item vops
11948 Enable showing virtual operands for every statement.
11949 @item lineno
11950 Enable showing line numbers for statements.
11951 @item uid
11952 Enable showing the unique ID (@code{DECL_UID}) for each variable.
11953 @item verbose
11954 Enable showing the tree dump for each statement.
11955 @item eh
11956 Enable showing the EH region number holding each statement.
11957 @item scev
11958 Enable showing scalar evolution analysis details.
11959 @item optimized
11960 Enable showing optimization information (only available in certain
11961 passes).
11962 @item missed
11963 Enable showing missed optimization information (only available in certain
11964 passes).
11965 @item note
11966 Enable other detailed optimization information (only available in
11967 certain passes).
11968 @item =@var{filename}
11969 Instead of an auto named dump file, output into the given file
11970 name. The file names @file{stdout} and @file{stderr} are treated
11971 specially and are considered already open standard streams. For
11972 example,
11973
11974 @smallexample
11975 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
11976 -fdump-tree-pre=stderr file.c
11977 @end smallexample
11978
11979 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
11980 output on to @file{stderr}. If two conflicting dump filenames are
11981 given for the same pass, then the latter option overrides the earlier
11982 one.
11983
11984 @item split-paths
11985 @opindex fdump-tree-split-paths
11986 Dump each function after splitting paths to loop backedges. The file
11987 name is made by appending @file{.split-paths} to the source file name.
11988
11989 @item all
11990 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
11991 and @option{lineno}.
11992
11993 @item optall
11994 Turn on all optimization options, i.e., @option{optimized},
11995 @option{missed}, and @option{note}.
11996 @end table
11997
11998 The following tree dumps are possible:
11999 @table @samp
12000
12001 @item original
12002 @opindex fdump-tree-original
12003 Dump before any tree based optimization, to @file{@var{file}.original}.
12004
12005 @item optimized
12006 @opindex fdump-tree-optimized
12007 Dump after all tree based optimization, to @file{@var{file}.optimized}.
12008
12009 @item gimple
12010 @opindex fdump-tree-gimple
12011 Dump each function before and after the gimplification pass to a file. The
12012 file name is made by appending @file{.gimple} to the source file name.
12013
12014 @item cfg
12015 @opindex fdump-tree-cfg
12016 Dump the control flow graph of each function to a file. The file name is
12017 made by appending @file{.cfg} to the source file name.
12018
12019 @item ch
12020 @opindex fdump-tree-ch
12021 Dump each function after copying loop headers. The file name is made by
12022 appending @file{.ch} to the source file name.
12023
12024 @item ssa
12025 @opindex fdump-tree-ssa
12026 Dump SSA related information to a file. The file name is made by appending
12027 @file{.ssa} to the source file name.
12028
12029 @item alias
12030 @opindex fdump-tree-alias
12031 Dump aliasing information for each function. The file name is made by
12032 appending @file{.alias} to the source file name.
12033
12034 @item ccp
12035 @opindex fdump-tree-ccp
12036 Dump each function after CCP@. The file name is made by appending
12037 @file{.ccp} to the source file name.
12038
12039 @item storeccp
12040 @opindex fdump-tree-storeccp
12041 Dump each function after STORE-CCP@. The file name is made by appending
12042 @file{.storeccp} to the source file name.
12043
12044 @item pre
12045 @opindex fdump-tree-pre
12046 Dump trees after partial redundancy elimination. The file name is made
12047 by appending @file{.pre} to the source file name.
12048
12049 @item fre
12050 @opindex fdump-tree-fre
12051 Dump trees after full redundancy elimination. The file name is made
12052 by appending @file{.fre} to the source file name.
12053
12054 @item copyprop
12055 @opindex fdump-tree-copyprop
12056 Dump trees after copy propagation. The file name is made
12057 by appending @file{.copyprop} to the source file name.
12058
12059 @item store_copyprop
12060 @opindex fdump-tree-store_copyprop
12061 Dump trees after store copy-propagation. The file name is made
12062 by appending @file{.store_copyprop} to the source file name.
12063
12064 @item dce
12065 @opindex fdump-tree-dce
12066 Dump each function after dead code elimination. The file name is made by
12067 appending @file{.dce} to the source file name.
12068
12069 @item sra
12070 @opindex fdump-tree-sra
12071 Dump each function after performing scalar replacement of aggregates. The
12072 file name is made by appending @file{.sra} to the source file name.
12073
12074 @item sink
12075 @opindex fdump-tree-sink
12076 Dump each function after performing code sinking. The file name is made
12077 by appending @file{.sink} to the source file name.
12078
12079 @item dom
12080 @opindex fdump-tree-dom
12081 Dump each function after applying dominator tree optimizations. The file
12082 name is made by appending @file{.dom} to the source file name.
12083
12084 @item dse
12085 @opindex fdump-tree-dse
12086 Dump each function after applying dead store elimination. The file
12087 name is made by appending @file{.dse} to the source file name.
12088
12089 @item phiopt
12090 @opindex fdump-tree-phiopt
12091 Dump each function after optimizing PHI nodes into straightline code. The file
12092 name is made by appending @file{.phiopt} to the source file name.
12093
12094 @item backprop
12095 @opindex fdump-tree-backprop
12096 Dump each function after back-propagating use information up the definition
12097 chain. The file name is made by appending @file{.backprop} to the
12098 source file name.
12099
12100 @item forwprop
12101 @opindex fdump-tree-forwprop
12102 Dump each function after forward propagating single use variables. The file
12103 name is made by appending @file{.forwprop} to the source file name.
12104
12105 @item nrv
12106 @opindex fdump-tree-nrv
12107 Dump each function after applying the named return value optimization on
12108 generic trees. The file name is made by appending @file{.nrv} to the source
12109 file name.
12110
12111 @item vect
12112 @opindex fdump-tree-vect
12113 Dump each function after applying vectorization of loops. The file name is
12114 made by appending @file{.vect} to the source file name.
12115
12116 @item slp
12117 @opindex fdump-tree-slp
12118 Dump each function after applying vectorization of basic blocks. The file name
12119 is made by appending @file{.slp} to the source file name.
12120
12121 @item vrp
12122 @opindex fdump-tree-vrp
12123 Dump each function after Value Range Propagation (VRP). The file name
12124 is made by appending @file{.vrp} to the source file name.
12125
12126 @item oaccdevlow
12127 @opindex fdump-tree-oaccdevlow
12128 Dump each function after applying device-specific OpenACC transformations.
12129 The file name is made by appending @file{.oaccdevlow} to the source file name.
12130
12131 @item all
12132 @opindex fdump-tree-all
12133 Enable all the available tree dumps with the flags provided in this option.
12134 @end table
12135
12136 @item -fopt-info
12137 @itemx -fopt-info-@var{options}
12138 @itemx -fopt-info-@var{options}=@var{filename}
12139 @opindex fopt-info
12140 Controls optimization dumps from various optimization passes. If the
12141 @samp{-@var{options}} form is used, @var{options} is a list of
12142 @samp{-} separated option keywords to select the dump details and
12143 optimizations.
12144
12145 The @var{options} can be divided into two groups: options describing the
12146 verbosity of the dump, and options describing which optimizations
12147 should be included. The options from both the groups can be freely
12148 mixed as they are non-overlapping. However, in case of any conflicts,
12149 the later options override the earlier options on the command
12150 line.
12151
12152 The following options control the dump verbosity:
12153
12154 @table @samp
12155 @item optimized
12156 Print information when an optimization is successfully applied. It is
12157 up to a pass to decide which information is relevant. For example, the
12158 vectorizer passes print the source location of loops which are
12159 successfully vectorized.
12160 @item missed
12161 Print information about missed optimizations. Individual passes
12162 control which information to include in the output.
12163 @item note
12164 Print verbose information about optimizations, such as certain
12165 transformations, more detailed messages about decisions etc.
12166 @item all
12167 Print detailed optimization information. This includes
12168 @samp{optimized}, @samp{missed}, and @samp{note}.
12169 @end table
12170
12171 One or more of the following option keywords can be used to describe a
12172 group of optimizations:
12173
12174 @table @samp
12175 @item ipa
12176 Enable dumps from all interprocedural optimizations.
12177 @item loop
12178 Enable dumps from all loop optimizations.
12179 @item inline
12180 Enable dumps from all inlining optimizations.
12181 @item vec
12182 Enable dumps from all vectorization optimizations.
12183 @item optall
12184 Enable dumps from all optimizations. This is a superset of
12185 the optimization groups listed above.
12186 @end table
12187
12188 If @var{options} is
12189 omitted, it defaults to @samp{optimized-optall}, which means to dump all
12190 info about successful optimizations from all the passes.
12191
12192 If the @var{filename} is provided, then the dumps from all the
12193 applicable optimizations are concatenated into the @var{filename}.
12194 Otherwise the dump is output onto @file{stderr}. Though multiple
12195 @option{-fopt-info} options are accepted, only one of them can include
12196 a @var{filename}. If other filenames are provided then all but the
12197 first such option are ignored.
12198
12199 Note that the output @var{filename} is overwritten
12200 in case of multiple translation units. If a combined output from
12201 multiple translation units is desired, @file{stderr} should be used
12202 instead.
12203
12204 In the following example, the optimization info is output to
12205 @file{stderr}:
12206
12207 @smallexample
12208 gcc -O3 -fopt-info
12209 @end smallexample
12210
12211 This example:
12212 @smallexample
12213 gcc -O3 -fopt-info-missed=missed.all
12214 @end smallexample
12215
12216 @noindent
12217 outputs missed optimization report from all the passes into
12218 @file{missed.all}, and this one:
12219
12220 @smallexample
12221 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
12222 @end smallexample
12223
12224 @noindent
12225 prints information about missed optimization opportunities from
12226 vectorization passes on @file{stderr}.
12227 Note that @option{-fopt-info-vec-missed} is equivalent to
12228 @option{-fopt-info-missed-vec}.
12229
12230 As another example,
12231 @smallexample
12232 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
12233 @end smallexample
12234
12235 @noindent
12236 outputs information about missed optimizations as well as
12237 optimized locations from all the inlining passes into
12238 @file{inline.txt}.
12239
12240 Finally, consider:
12241
12242 @smallexample
12243 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
12244 @end smallexample
12245
12246 @noindent
12247 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
12248 in conflict since only one output file is allowed. In this case, only
12249 the first option takes effect and the subsequent options are
12250 ignored. Thus only @file{vec.miss} is produced which contains
12251 dumps from the vectorizer about missed opportunities.
12252
12253 @item -fsched-verbose=@var{n}
12254 @opindex fsched-verbose
12255 On targets that use instruction scheduling, this option controls the
12256 amount of debugging output the scheduler prints to the dump files.
12257
12258 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
12259 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
12260 For @var{n} greater than one, it also output basic block probabilities,
12261 detailed ready list information and unit/insn info. For @var{n} greater
12262 than two, it includes RTL at abort point, control-flow and regions info.
12263 And for @var{n} over four, @option{-fsched-verbose} also includes
12264 dependence info.
12265
12266
12267
12268 @item -fenable-@var{kind}-@var{pass}
12269 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
12270 @opindex fdisable-
12271 @opindex fenable-
12272
12273 This is a set of options that are used to explicitly disable/enable
12274 optimization passes. These options are intended for use for debugging GCC.
12275 Compiler users should use regular options for enabling/disabling
12276 passes instead.
12277
12278 @table @gcctabopt
12279
12280 @item -fdisable-ipa-@var{pass}
12281 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12282 statically invoked in the compiler multiple times, the pass name should be
12283 appended with a sequential number starting from 1.
12284
12285 @item -fdisable-rtl-@var{pass}
12286 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
12287 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
12288 statically invoked in the compiler multiple times, the pass name should be
12289 appended with a sequential number starting from 1. @var{range-list} is a
12290 comma-separated list of function ranges or assembler names. Each range is a number
12291 pair separated by a colon. The range is inclusive in both ends. If the range
12292 is trivial, the number pair can be simplified as a single number. If the
12293 function's call graph node's @var{uid} falls within one of the specified ranges,
12294 the @var{pass} is disabled for that function. The @var{uid} is shown in the
12295 function header of a dump file, and the pass names can be dumped by using
12296 option @option{-fdump-passes}.
12297
12298 @item -fdisable-tree-@var{pass}
12299 @itemx -fdisable-tree-@var{pass}=@var{range-list}
12300 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
12301 option arguments.
12302
12303 @item -fenable-ipa-@var{pass}
12304 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12305 statically invoked in the compiler multiple times, the pass name should be
12306 appended with a sequential number starting from 1.
12307
12308 @item -fenable-rtl-@var{pass}
12309 @itemx -fenable-rtl-@var{pass}=@var{range-list}
12310 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
12311 description and examples.
12312
12313 @item -fenable-tree-@var{pass}
12314 @itemx -fenable-tree-@var{pass}=@var{range-list}
12315 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
12316 of option arguments.
12317
12318 @end table
12319
12320 Here are some examples showing uses of these options.
12321
12322 @smallexample
12323
12324 # disable ccp1 for all functions
12325 -fdisable-tree-ccp1
12326 # disable complete unroll for function whose cgraph node uid is 1
12327 -fenable-tree-cunroll=1
12328 # disable gcse2 for functions at the following ranges [1,1],
12329 # [300,400], and [400,1000]
12330 # disable gcse2 for functions foo and foo2
12331 -fdisable-rtl-gcse2=foo,foo2
12332 # disable early inlining
12333 -fdisable-tree-einline
12334 # disable ipa inlining
12335 -fdisable-ipa-inline
12336 # enable tree full unroll
12337 -fenable-tree-unroll
12338
12339 @end smallexample
12340
12341 @item -fchecking
12342 @opindex fchecking
12343 @opindex fno-checking
12344 Enable internal consistency checking. The default depends on
12345 the compiler configuration.
12346
12347 @item -frandom-seed=@var{string}
12348 @opindex frandom-seed
12349 This option provides a seed that GCC uses in place of
12350 random numbers in generating certain symbol names
12351 that have to be different in every compiled file. It is also used to
12352 place unique stamps in coverage data files and the object files that
12353 produce them. You can use the @option{-frandom-seed} option to produce
12354 reproducibly identical object files.
12355
12356 The @var{string} can either be a number (decimal, octal or hex) or an
12357 arbitrary string (in which case it's converted to a number by
12358 computing CRC32).
12359
12360 The @var{string} should be different for every file you compile.
12361
12362 @item -save-temps
12363 @itemx -save-temps=cwd
12364 @opindex save-temps
12365 Store the usual ``temporary'' intermediate files permanently; place them
12366 in the current directory and name them based on the source file. Thus,
12367 compiling @file{foo.c} with @option{-c -save-temps} produces files
12368 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
12369 preprocessed @file{foo.i} output file even though the compiler now
12370 normally uses an integrated preprocessor.
12371
12372 When used in combination with the @option{-x} command-line option,
12373 @option{-save-temps} is sensible enough to avoid over writing an
12374 input source file with the same extension as an intermediate file.
12375 The corresponding intermediate file may be obtained by renaming the
12376 source file before using @option{-save-temps}.
12377
12378 If you invoke GCC in parallel, compiling several different source
12379 files that share a common base name in different subdirectories or the
12380 same source file compiled for multiple output destinations, it is
12381 likely that the different parallel compilers will interfere with each
12382 other, and overwrite the temporary files. For instance:
12383
12384 @smallexample
12385 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
12386 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
12387 @end smallexample
12388
12389 may result in @file{foo.i} and @file{foo.o} being written to
12390 simultaneously by both compilers.
12391
12392 @item -save-temps=obj
12393 @opindex save-temps=obj
12394 Store the usual ``temporary'' intermediate files permanently. If the
12395 @option{-o} option is used, the temporary files are based on the
12396 object file. If the @option{-o} option is not used, the
12397 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
12398
12399 For example:
12400
12401 @smallexample
12402 gcc -save-temps=obj -c foo.c
12403 gcc -save-temps=obj -c bar.c -o dir/xbar.o
12404 gcc -save-temps=obj foobar.c -o dir2/yfoobar
12405 @end smallexample
12406
12407 @noindent
12408 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
12409 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
12410 @file{dir2/yfoobar.o}.
12411
12412 @item -time@r{[}=@var{file}@r{]}
12413 @opindex time
12414 Report the CPU time taken by each subprocess in the compilation
12415 sequence. For C source files, this is the compiler proper and assembler
12416 (plus the linker if linking is done).
12417
12418 Without the specification of an output file, the output looks like this:
12419
12420 @smallexample
12421 # cc1 0.12 0.01
12422 # as 0.00 0.01
12423 @end smallexample
12424
12425 The first number on each line is the ``user time'', that is time spent
12426 executing the program itself. The second number is ``system time'',
12427 time spent executing operating system routines on behalf of the program.
12428 Both numbers are in seconds.
12429
12430 With the specification of an output file, the output is appended to the
12431 named file, and it looks like this:
12432
12433 @smallexample
12434 0.12 0.01 cc1 @var{options}
12435 0.00 0.01 as @var{options}
12436 @end smallexample
12437
12438 The ``user time'' and the ``system time'' are moved before the program
12439 name, and the options passed to the program are displayed, so that one
12440 can later tell what file was being compiled, and with which options.
12441
12442 @item -fdump-final-insns@r{[}=@var{file}@r{]}
12443 @opindex fdump-final-insns
12444 Dump the final internal representation (RTL) to @var{file}. If the
12445 optional argument is omitted (or if @var{file} is @code{.}), the name
12446 of the dump file is determined by appending @code{.gkd} to the
12447 compilation output file name.
12448
12449 @item -fcompare-debug@r{[}=@var{opts}@r{]}
12450 @opindex fcompare-debug
12451 @opindex fno-compare-debug
12452 If no error occurs during compilation, run the compiler a second time,
12453 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
12454 passed to the second compilation. Dump the final internal
12455 representation in both compilations, and print an error if they differ.
12456
12457 If the equal sign is omitted, the default @option{-gtoggle} is used.
12458
12459 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
12460 and nonzero, implicitly enables @option{-fcompare-debug}. If
12461 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
12462 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
12463 is used.
12464
12465 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
12466 is equivalent to @option{-fno-compare-debug}, which disables the dumping
12467 of the final representation and the second compilation, preventing even
12468 @env{GCC_COMPARE_DEBUG} from taking effect.
12469
12470 To verify full coverage during @option{-fcompare-debug} testing, set
12471 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
12472 which GCC rejects as an invalid option in any actual compilation
12473 (rather than preprocessing, assembly or linking). To get just a
12474 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
12475 not overridden} will do.
12476
12477 @item -fcompare-debug-second
12478 @opindex fcompare-debug-second
12479 This option is implicitly passed to the compiler for the second
12480 compilation requested by @option{-fcompare-debug}, along with options to
12481 silence warnings, and omitting other options that would cause
12482 side-effect compiler outputs to files or to the standard output. Dump
12483 files and preserved temporary files are renamed so as to contain the
12484 @code{.gk} additional extension during the second compilation, to avoid
12485 overwriting those generated by the first.
12486
12487 When this option is passed to the compiler driver, it causes the
12488 @emph{first} compilation to be skipped, which makes it useful for little
12489 other than debugging the compiler proper.
12490
12491 @item -gtoggle
12492 @opindex gtoggle
12493 Turn off generation of debug info, if leaving out this option
12494 generates it, or turn it on at level 2 otherwise. The position of this
12495 argument in the command line does not matter; it takes effect after all
12496 other options are processed, and it does so only once, no matter how
12497 many times it is given. This is mainly intended to be used with
12498 @option{-fcompare-debug}.
12499
12500 @item -fvar-tracking-assignments-toggle
12501 @opindex fvar-tracking-assignments-toggle
12502 @opindex fno-var-tracking-assignments-toggle
12503 Toggle @option{-fvar-tracking-assignments}, in the same way that
12504 @option{-gtoggle} toggles @option{-g}.
12505
12506 @item -Q
12507 @opindex Q
12508 Makes the compiler print out each function name as it is compiled, and
12509 print some statistics about each pass when it finishes.
12510
12511 @item -ftime-report
12512 @opindex ftime-report
12513 Makes the compiler print some statistics about the time consumed by each
12514 pass when it finishes.
12515
12516 @item -fira-verbose=@var{n}
12517 @opindex fira-verbose
12518 Control the verbosity of the dump file for the integrated register allocator.
12519 The default value is 5. If the value @var{n} is greater or equal to 10,
12520 the dump output is sent to stderr using the same format as @var{n} minus 10.
12521
12522 @item -flto-report
12523 @opindex flto-report
12524 Prints a report with internal details on the workings of the link-time
12525 optimizer. The contents of this report vary from version to version.
12526 It is meant to be useful to GCC developers when processing object
12527 files in LTO mode (via @option{-flto}).
12528
12529 Disabled by default.
12530
12531 @item -flto-report-wpa
12532 @opindex flto-report-wpa
12533 Like @option{-flto-report}, but only print for the WPA phase of Link
12534 Time Optimization.
12535
12536 @item -fmem-report
12537 @opindex fmem-report
12538 Makes the compiler print some statistics about permanent memory
12539 allocation when it finishes.
12540
12541 @item -fmem-report-wpa
12542 @opindex fmem-report-wpa
12543 Makes the compiler print some statistics about permanent memory
12544 allocation for the WPA phase only.
12545
12546 @item -fpre-ipa-mem-report
12547 @opindex fpre-ipa-mem-report
12548 @item -fpost-ipa-mem-report
12549 @opindex fpost-ipa-mem-report
12550 Makes the compiler print some statistics about permanent memory
12551 allocation before or after interprocedural optimization.
12552
12553 @item -fprofile-report
12554 @opindex fprofile-report
12555 Makes the compiler print some statistics about consistency of the
12556 (estimated) profile and effect of individual passes.
12557
12558 @item -fstack-usage
12559 @opindex fstack-usage
12560 Makes the compiler output stack usage information for the program, on a
12561 per-function basis. The filename for the dump is made by appending
12562 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
12563 the output file, if explicitly specified and it is not an executable,
12564 otherwise it is the basename of the source file. An entry is made up
12565 of three fields:
12566
12567 @itemize
12568 @item
12569 The name of the function.
12570 @item
12571 A number of bytes.
12572 @item
12573 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
12574 @end itemize
12575
12576 The qualifier @code{static} means that the function manipulates the stack
12577 statically: a fixed number of bytes are allocated for the frame on function
12578 entry and released on function exit; no stack adjustments are otherwise made
12579 in the function. The second field is this fixed number of bytes.
12580
12581 The qualifier @code{dynamic} means that the function manipulates the stack
12582 dynamically: in addition to the static allocation described above, stack
12583 adjustments are made in the body of the function, for example to push/pop
12584 arguments around function calls. If the qualifier @code{bounded} is also
12585 present, the amount of these adjustments is bounded at compile time and
12586 the second field is an upper bound of the total amount of stack used by
12587 the function. If it is not present, the amount of these adjustments is
12588 not bounded at compile time and the second field only represents the
12589 bounded part.
12590
12591 @item -fstats
12592 @opindex fstats
12593 Emit statistics about front-end processing at the end of the compilation.
12594 This option is supported only by the C++ front end, and
12595 the information is generally only useful to the G++ development team.
12596
12597 @item -fdbg-cnt-list
12598 @opindex fdbg-cnt-list
12599 Print the name and the counter upper bound for all debug counters.
12600
12601
12602 @item -fdbg-cnt=@var{counter-value-list}
12603 @opindex fdbg-cnt
12604 Set the internal debug counter upper bound. @var{counter-value-list}
12605 is a comma-separated list of @var{name}:@var{value} pairs
12606 which sets the upper bound of each debug counter @var{name} to @var{value}.
12607 All debug counters have the initial upper bound of @code{UINT_MAX};
12608 thus @code{dbg_cnt} returns true always unless the upper bound
12609 is set by this option.
12610 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
12611 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
12612
12613 @item -print-file-name=@var{library}
12614 @opindex print-file-name
12615 Print the full absolute name of the library file @var{library} that
12616 would be used when linking---and don't do anything else. With this
12617 option, GCC does not compile or link anything; it just prints the
12618 file name.
12619
12620 @item -print-multi-directory
12621 @opindex print-multi-directory
12622 Print the directory name corresponding to the multilib selected by any
12623 other switches present in the command line. This directory is supposed
12624 to exist in @env{GCC_EXEC_PREFIX}.
12625
12626 @item -print-multi-lib
12627 @opindex print-multi-lib
12628 Print the mapping from multilib directory names to compiler switches
12629 that enable them. The directory name is separated from the switches by
12630 @samp{;}, and each switch starts with an @samp{@@} instead of the
12631 @samp{-}, without spaces between multiple switches. This is supposed to
12632 ease shell processing.
12633
12634 @item -print-multi-os-directory
12635 @opindex print-multi-os-directory
12636 Print the path to OS libraries for the selected
12637 multilib, relative to some @file{lib} subdirectory. If OS libraries are
12638 present in the @file{lib} subdirectory and no multilibs are used, this is
12639 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
12640 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
12641 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
12642 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
12643
12644 @item -print-multiarch
12645 @opindex print-multiarch
12646 Print the path to OS libraries for the selected multiarch,
12647 relative to some @file{lib} subdirectory.
12648
12649 @item -print-prog-name=@var{program}
12650 @opindex print-prog-name
12651 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
12652
12653 @item -print-libgcc-file-name
12654 @opindex print-libgcc-file-name
12655 Same as @option{-print-file-name=libgcc.a}.
12656
12657 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
12658 but you do want to link with @file{libgcc.a}. You can do:
12659
12660 @smallexample
12661 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
12662 @end smallexample
12663
12664 @item -print-search-dirs
12665 @opindex print-search-dirs
12666 Print the name of the configured installation directory and a list of
12667 program and library directories @command{gcc} searches---and don't do anything else.
12668
12669 This is useful when @command{gcc} prints the error message
12670 @samp{installation problem, cannot exec cpp0: No such file or directory}.
12671 To resolve this you either need to put @file{cpp0} and the other compiler
12672 components where @command{gcc} expects to find them, or you can set the environment
12673 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
12674 Don't forget the trailing @samp{/}.
12675 @xref{Environment Variables}.
12676
12677 @item -print-sysroot
12678 @opindex print-sysroot
12679 Print the target sysroot directory that is used during
12680 compilation. This is the target sysroot specified either at configure
12681 time or using the @option{--sysroot} option, possibly with an extra
12682 suffix that depends on compilation options. If no target sysroot is
12683 specified, the option prints nothing.
12684
12685 @item -print-sysroot-headers-suffix
12686 @opindex print-sysroot-headers-suffix
12687 Print the suffix added to the target sysroot when searching for
12688 headers, or give an error if the compiler is not configured with such
12689 a suffix---and don't do anything else.
12690
12691 @item -dumpmachine
12692 @opindex dumpmachine
12693 Print the compiler's target machine (for example,
12694 @samp{i686-pc-linux-gnu})---and don't do anything else.
12695
12696 @item -dumpversion
12697 @opindex dumpversion
12698 Print the compiler version (for example, @code{3.0})---and don't do
12699 anything else.
12700
12701 @item -dumpspecs
12702 @opindex dumpspecs
12703 Print the compiler's built-in specs---and don't do anything else. (This
12704 is used when GCC itself is being built.) @xref{Spec Files}.
12705 @end table
12706
12707 @node Submodel Options
12708 @section Machine-Dependent Options
12709 @cindex submodel options
12710 @cindex specifying hardware config
12711 @cindex hardware models and configurations, specifying
12712 @cindex target-dependent options
12713 @cindex machine-dependent options
12714
12715 Each target machine supported by GCC can have its own options---for
12716 example, to allow you to compile for a particular processor variant or
12717 ABI, or to control optimizations specific to that machine. By
12718 convention, the names of machine-specific options start with
12719 @samp{-m}.
12720
12721 Some configurations of the compiler also support additional target-specific
12722 options, usually for compatibility with other compilers on the same
12723 platform.
12724
12725 @c This list is ordered alphanumerically by subsection name.
12726 @c It should be the same order and spelling as these options are listed
12727 @c in Machine Dependent Options
12728
12729 @menu
12730 * AArch64 Options::
12731 * Adapteva Epiphany Options::
12732 * ARC Options::
12733 * ARM Options::
12734 * AVR Options::
12735 * Blackfin Options::
12736 * C6X Options::
12737 * CRIS Options::
12738 * CR16 Options::
12739 * Darwin Options::
12740 * DEC Alpha Options::
12741 * FR30 Options::
12742 * FT32 Options::
12743 * FRV Options::
12744 * GNU/Linux Options::
12745 * H8/300 Options::
12746 * HPPA Options::
12747 * IA-64 Options::
12748 * LM32 Options::
12749 * M32C Options::
12750 * M32R/D Options::
12751 * M680x0 Options::
12752 * MCore Options::
12753 * MeP Options::
12754 * MicroBlaze Options::
12755 * MIPS Options::
12756 * MMIX Options::
12757 * MN10300 Options::
12758 * Moxie Options::
12759 * MSP430 Options::
12760 * NDS32 Options::
12761 * Nios II Options::
12762 * Nvidia PTX Options::
12763 * PDP-11 Options::
12764 * picoChip Options::
12765 * PowerPC Options::
12766 * RL78 Options::
12767 * RS/6000 and PowerPC Options::
12768 * RX Options::
12769 * S/390 and zSeries Options::
12770 * Score Options::
12771 * SH Options::
12772 * Solaris 2 Options::
12773 * SPARC Options::
12774 * SPU Options::
12775 * System V Options::
12776 * TILE-Gx Options::
12777 * TILEPro Options::
12778 * V850 Options::
12779 * VAX Options::
12780 * Visium Options::
12781 * VMS Options::
12782 * VxWorks Options::
12783 * x86 Options::
12784 * x86 Windows Options::
12785 * Xstormy16 Options::
12786 * Xtensa Options::
12787 * zSeries Options::
12788 @end menu
12789
12790 @node AArch64 Options
12791 @subsection AArch64 Options
12792 @cindex AArch64 Options
12793
12794 These options are defined for AArch64 implementations:
12795
12796 @table @gcctabopt
12797
12798 @item -mabi=@var{name}
12799 @opindex mabi
12800 Generate code for the specified data model. Permissible values
12801 are @samp{ilp32} for SysV-like data model where int, long int and pointer
12802 are 32-bit, and @samp{lp64} for SysV-like data model where int is 32-bit,
12803 but long int and pointer are 64-bit.
12804
12805 The default depends on the specific target configuration. Note that
12806 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
12807 entire program with the same ABI, and link with a compatible set of libraries.
12808
12809 @item -mbig-endian
12810 @opindex mbig-endian
12811 Generate big-endian code. This is the default when GCC is configured for an
12812 @samp{aarch64_be-*-*} target.
12813
12814 @item -mgeneral-regs-only
12815 @opindex mgeneral-regs-only
12816 Generate code which uses only the general-purpose registers. This will prevent
12817 the compiler from using floating-point and Advanced SIMD registers but will not
12818 impose any restrictions on the assembler.
12819
12820 @item -mlittle-endian
12821 @opindex mlittle-endian
12822 Generate little-endian code. This is the default when GCC is configured for an
12823 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
12824
12825 @item -mcmodel=tiny
12826 @opindex mcmodel=tiny
12827 Generate code for the tiny code model. The program and its statically defined
12828 symbols must be within 1GB of each other. Pointers are 64 bits. Programs can
12829 be statically or dynamically linked. This model is not fully implemented and
12830 mostly treated as @samp{small}.
12831
12832 @item -mcmodel=small
12833 @opindex mcmodel=small
12834 Generate code for the small code model. The program and its statically defined
12835 symbols must be within 4GB of each other. Pointers are 64 bits. Programs can
12836 be statically or dynamically linked. This is the default code model.
12837
12838 @item -mcmodel=large
12839 @opindex mcmodel=large
12840 Generate code for the large code model. This makes no assumptions about
12841 addresses and sizes of sections. Pointers are 64 bits. Programs can be
12842 statically linked only.
12843
12844 @item -mstrict-align
12845 @opindex mstrict-align
12846 Do not assume that unaligned memory references are handled by the system.
12847
12848 @item -momit-leaf-frame-pointer
12849 @itemx -mno-omit-leaf-frame-pointer
12850 @opindex momit-leaf-frame-pointer
12851 @opindex mno-omit-leaf-frame-pointer
12852 Omit or keep the frame pointer in leaf functions. The former behavior is the
12853 default.
12854
12855 @item -mtls-dialect=desc
12856 @opindex mtls-dialect=desc
12857 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
12858 of TLS variables. This is the default.
12859
12860 @item -mtls-dialect=traditional
12861 @opindex mtls-dialect=traditional
12862 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
12863 of TLS variables.
12864
12865 @item -mtls-size=@var{size}
12866 @opindex mtls-size
12867 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
12868 This option depends on binutils higher than 2.25.
12869
12870 @item -mfix-cortex-a53-835769
12871 @itemx -mno-fix-cortex-a53-835769
12872 @opindex mfix-cortex-a53-835769
12873 @opindex mno-fix-cortex-a53-835769
12874 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
12875 This involves inserting a NOP instruction between memory instructions and
12876 64-bit integer multiply-accumulate instructions.
12877
12878 @item -mfix-cortex-a53-843419
12879 @itemx -mno-fix-cortex-a53-843419
12880 @opindex mfix-cortex-a53-843419
12881 @opindex mno-fix-cortex-a53-843419
12882 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
12883 This erratum workaround is made at link time and this will only pass the
12884 corresponding flag to the linker.
12885
12886 @item -mlow-precision-recip-sqrt
12887 @item -mno-low-precision-recip-sqrt
12888 @opindex -mlow-precision-recip-sqrt
12889 @opindex -mno-low-precision-recip-sqrt
12890 When calculating the reciprocal square root approximation,
12891 uses one less step than otherwise, thus reducing latency and precision.
12892 This is only relevant if @option{-ffast-math} enables the reciprocal square root
12893 approximation, which in turn depends on the target processor.
12894
12895 @item -march=@var{name}
12896 @opindex march
12897 Specify the name of the target architecture and, optionally, one or
12898 more feature modifiers. This option has the form
12899 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
12900
12901 The permissible values for @var{arch} are @samp{armv8-a},
12902 @samp{armv8.1-a} or @var{native}.
12903
12904 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
12905 support for the ARMv8.1 architecture extension. In particular, it
12906 enables the @samp{+crc} and @samp{+lse} features.
12907
12908 The value @samp{native} is available on native AArch64 GNU/Linux and
12909 causes the compiler to pick the architecture of the host system. This
12910 option has no effect if the compiler is unable to recognize the
12911 architecture of the host system,
12912
12913 The permissible values for @var{feature} are listed in the sub-section
12914 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
12915 Feature Modifiers}. Where conflicting feature modifiers are
12916 specified, the right-most feature is used.
12917
12918 GCC uses @var{name} to determine what kind of instructions it can emit
12919 when generating assembly code. If @option{-march} is specified
12920 without either of @option{-mtune} or @option{-mcpu} also being
12921 specified, the code is tuned to perform well across a range of target
12922 processors implementing the target architecture.
12923
12924 @item -mtune=@var{name}
12925 @opindex mtune
12926 Specify the name of the target processor for which GCC should tune the
12927 performance of the code. Permissible values for this option are:
12928 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
12929 @samp{cortex-a72}, @samp{exynos-m1}, @samp{qdf24xx}, @samp{thunderx},
12930 @samp{xgene1}.
12931
12932 Additionally, this option can specify that GCC should tune the performance
12933 of the code for a big.LITTLE system. Permissible values for this
12934 option are: @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}.
12935
12936 Additionally on native AArch64 GNU/Linux systems the value
12937 @samp{native} is available. This option causes the compiler to pick
12938 the architecture of and tune the performance of the code for the
12939 processor of the host system. This option has no effect if the
12940 compiler is unable to recognize the architecture of the host system.
12941
12942 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
12943 are specified, the code is tuned to perform well across a range
12944 of target processors.
12945
12946 This option cannot be suffixed by feature modifiers.
12947
12948 @item -mcpu=@var{name}
12949 @opindex mcpu
12950 Specify the name of the target processor, optionally suffixed by one
12951 or more feature modifiers. This option has the form
12952 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
12953 the permissible values for @var{cpu} are the same as those available
12954 for @option{-mtune}. The permissible values for @var{feature} are
12955 documented in the sub-section on
12956 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
12957 Feature Modifiers}. Where conflicting feature modifiers are
12958 specified, the right-most feature is used.
12959
12960 Additionally on native AArch64 GNU/Linux systems the value
12961 @samp{native} is available. This option causes the compiler to tune
12962 the performance of the code for the processor of the host system.
12963 This option has no effect if the compiler is unable to recognize the
12964 architecture of the host system.
12965
12966 GCC uses @var{name} to determine what kind of instructions it can emit when
12967 generating assembly code (as if by @option{-march}) and to determine
12968 the target processor for which to tune for performance (as if
12969 by @option{-mtune}). Where this option is used in conjunction
12970 with @option{-march} or @option{-mtune}, those options take precedence
12971 over the appropriate part of this option.
12972
12973 @item -moverride=@var{string}
12974 @opindex moverride
12975 Override tuning decisions made by the back-end in response to a
12976 @option{-mtune=} switch. The syntax, semantics, and accepted values
12977 for @var{string} in this option are not guaranteed to be consistent
12978 across releases.
12979
12980 This option is only intended to be useful when developing GCC.
12981
12982 @item -mpc-relative-literal-loads
12983 @opindex mpcrelativeliteralloads
12984 Enable PC relative literal loads. If this option is used, literal
12985 pools are assumed to have a range of up to 1MiB and an appropriate
12986 instruction sequence is used. This option has no impact when used
12987 with @option{-mcmodel=tiny}.
12988
12989 @end table
12990
12991 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
12992 @anchor{aarch64-feature-modifiers}
12993 @cindex @option{-march} feature modifiers
12994 @cindex @option{-mcpu} feature modifiers
12995 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
12996 the following and their inverses @option{no@var{feature}}:
12997
12998 @table @samp
12999 @item crc
13000 Enable CRC extension. This is on by default for
13001 @option{-march=armv8.1-a}.
13002 @item crypto
13003 Enable Crypto extension. This also enables Advanced SIMD and floating-point
13004 instructions.
13005 @item fp
13006 Enable floating-point instructions. This is on by default for all possible
13007 values for options @option{-march} and @option{-mcpu}.
13008 @item simd
13009 Enable Advanced SIMD instructions. This also enables floating-point
13010 instructions. This is on by default for all possible values for options
13011 @option{-march} and @option{-mcpu}.
13012 @item lse
13013 Enable Large System Extension instructions. This is on by default for
13014 @option{-march=armv8.1-a}.
13015
13016 @end table
13017
13018 That is, @option{crypto} implies @option{simd} implies @option{fp}.
13019 Conversely, @option{nofp} (or equivalently, @option{-mgeneral-regs-only})
13020 implies @option{nosimd} implies @option{nocrypto}.
13021
13022 @node Adapteva Epiphany Options
13023 @subsection Adapteva Epiphany Options
13024
13025 These @samp{-m} options are defined for Adapteva Epiphany:
13026
13027 @table @gcctabopt
13028 @item -mhalf-reg-file
13029 @opindex mhalf-reg-file
13030 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
13031 That allows code to run on hardware variants that lack these registers.
13032
13033 @item -mprefer-short-insn-regs
13034 @opindex mprefer-short-insn-regs
13035 Preferentially allocate registers that allow short instruction generation.
13036 This can result in increased instruction count, so this may either reduce or
13037 increase overall code size.
13038
13039 @item -mbranch-cost=@var{num}
13040 @opindex mbranch-cost
13041 Set the cost of branches to roughly @var{num} ``simple'' instructions.
13042 This cost is only a heuristic and is not guaranteed to produce
13043 consistent results across releases.
13044
13045 @item -mcmove
13046 @opindex mcmove
13047 Enable the generation of conditional moves.
13048
13049 @item -mnops=@var{num}
13050 @opindex mnops
13051 Emit @var{num} NOPs before every other generated instruction.
13052
13053 @item -mno-soft-cmpsf
13054 @opindex mno-soft-cmpsf
13055 For single-precision floating-point comparisons, emit an @code{fsub} instruction
13056 and test the flags. This is faster than a software comparison, but can
13057 get incorrect results in the presence of NaNs, or when two different small
13058 numbers are compared such that their difference is calculated as zero.
13059 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
13060 software comparisons.
13061
13062 @item -mstack-offset=@var{num}
13063 @opindex mstack-offset
13064 Set the offset between the top of the stack and the stack pointer.
13065 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
13066 can be used by leaf functions without stack allocation.
13067 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
13068 Note also that this option changes the ABI; compiling a program with a
13069 different stack offset than the libraries have been compiled with
13070 generally does not work.
13071 This option can be useful if you want to evaluate if a different stack
13072 offset would give you better code, but to actually use a different stack
13073 offset to build working programs, it is recommended to configure the
13074 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
13075
13076 @item -mno-round-nearest
13077 @opindex mno-round-nearest
13078 Make the scheduler assume that the rounding mode has been set to
13079 truncating. The default is @option{-mround-nearest}.
13080
13081 @item -mlong-calls
13082 @opindex mlong-calls
13083 If not otherwise specified by an attribute, assume all calls might be beyond
13084 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
13085 function address into a register before performing a (otherwise direct) call.
13086 This is the default.
13087
13088 @item -mshort-calls
13089 @opindex short-calls
13090 If not otherwise specified by an attribute, assume all direct calls are
13091 in the range of the @code{b} / @code{bl} instructions, so use these instructions
13092 for direct calls. The default is @option{-mlong-calls}.
13093
13094 @item -msmall16
13095 @opindex msmall16
13096 Assume addresses can be loaded as 16-bit unsigned values. This does not
13097 apply to function addresses for which @option{-mlong-calls} semantics
13098 are in effect.
13099
13100 @item -mfp-mode=@var{mode}
13101 @opindex mfp-mode
13102 Set the prevailing mode of the floating-point unit.
13103 This determines the floating-point mode that is provided and expected
13104 at function call and return time. Making this mode match the mode you
13105 predominantly need at function start can make your programs smaller and
13106 faster by avoiding unnecessary mode switches.
13107
13108 @var{mode} can be set to one the following values:
13109
13110 @table @samp
13111 @item caller
13112 Any mode at function entry is valid, and retained or restored when
13113 the function returns, and when it calls other functions.
13114 This mode is useful for compiling libraries or other compilation units
13115 you might want to incorporate into different programs with different
13116 prevailing FPU modes, and the convenience of being able to use a single
13117 object file outweighs the size and speed overhead for any extra
13118 mode switching that might be needed, compared with what would be needed
13119 with a more specific choice of prevailing FPU mode.
13120
13121 @item truncate
13122 This is the mode used for floating-point calculations with
13123 truncating (i.e.@: round towards zero) rounding mode. That includes
13124 conversion from floating point to integer.
13125
13126 @item round-nearest
13127 This is the mode used for floating-point calculations with
13128 round-to-nearest-or-even rounding mode.
13129
13130 @item int
13131 This is the mode used to perform integer calculations in the FPU, e.g.@:
13132 integer multiply, or integer multiply-and-accumulate.
13133 @end table
13134
13135 The default is @option{-mfp-mode=caller}
13136
13137 @item -mnosplit-lohi
13138 @itemx -mno-postinc
13139 @itemx -mno-postmodify
13140 @opindex mnosplit-lohi
13141 @opindex mno-postinc
13142 @opindex mno-postmodify
13143 Code generation tweaks that disable, respectively, splitting of 32-bit
13144 loads, generation of post-increment addresses, and generation of
13145 post-modify addresses. The defaults are @option{msplit-lohi},
13146 @option{-mpost-inc}, and @option{-mpost-modify}.
13147
13148 @item -mnovect-double
13149 @opindex mno-vect-double
13150 Change the preferred SIMD mode to SImode. The default is
13151 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
13152
13153 @item -max-vect-align=@var{num}
13154 @opindex max-vect-align
13155 The maximum alignment for SIMD vector mode types.
13156 @var{num} may be 4 or 8. The default is 8.
13157 Note that this is an ABI change, even though many library function
13158 interfaces are unaffected if they don't use SIMD vector modes
13159 in places that affect size and/or alignment of relevant types.
13160
13161 @item -msplit-vecmove-early
13162 @opindex msplit-vecmove-early
13163 Split vector moves into single word moves before reload. In theory this
13164 can give better register allocation, but so far the reverse seems to be
13165 generally the case.
13166
13167 @item -m1reg-@var{reg}
13168 @opindex m1reg-
13169 Specify a register to hold the constant @minus{}1, which makes loading small negative
13170 constants and certain bitmasks faster.
13171 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
13172 which specify use of that register as a fixed register,
13173 and @samp{none}, which means that no register is used for this
13174 purpose. The default is @option{-m1reg-none}.
13175
13176 @end table
13177
13178 @node ARC Options
13179 @subsection ARC Options
13180 @cindex ARC options
13181
13182 The following options control the architecture variant for which code
13183 is being compiled:
13184
13185 @c architecture variants
13186 @table @gcctabopt
13187
13188 @item -mbarrel-shifter
13189 @opindex mbarrel-shifter
13190 Generate instructions supported by barrel shifter. This is the default
13191 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
13192
13193 @item -mcpu=@var{cpu}
13194 @opindex mcpu
13195 Set architecture type, register usage, and instruction scheduling
13196 parameters for @var{cpu}. There are also shortcut alias options
13197 available for backward compatibility and convenience. Supported
13198 values for @var{cpu} are
13199
13200 @table @samp
13201 @opindex mA6
13202 @opindex mARC600
13203 @item ARC600
13204 @item arc600
13205 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
13206
13207 @item ARC601
13208 @item arc601
13209 @opindex mARC601
13210 Compile for ARC601. Alias: @option{-mARC601}.
13211
13212 @item ARC700
13213 @item arc700
13214 @opindex mA7
13215 @opindex mARC700
13216 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
13217 This is the default when configured with @option{--with-cpu=arc700}@.
13218
13219 @item ARCEM
13220 @item arcem
13221 Compile for ARC EM.
13222
13223 @item ARCHS
13224 @item archs
13225 Compile for ARC HS.
13226 @end table
13227
13228 @item -mdpfp
13229 @opindex mdpfp
13230 @itemx -mdpfp-compact
13231 @opindex mdpfp-compact
13232 FPX: Generate Double Precision FPX instructions, tuned for the compact
13233 implementation.
13234
13235 @item -mdpfp-fast
13236 @opindex mdpfp-fast
13237 FPX: Generate Double Precision FPX instructions, tuned for the fast
13238 implementation.
13239
13240 @item -mno-dpfp-lrsr
13241 @opindex mno-dpfp-lrsr
13242 Disable LR and SR instructions from using FPX extension aux registers.
13243
13244 @item -mea
13245 @opindex mea
13246 Generate Extended arithmetic instructions. Currently only
13247 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
13248 supported. This is always enabled for @option{-mcpu=ARC700}.
13249
13250 @item -mno-mpy
13251 @opindex mno-mpy
13252 Do not generate mpy instructions for ARC700.
13253
13254 @item -mmul32x16
13255 @opindex mmul32x16
13256 Generate 32x16 bit multiply and mac instructions.
13257
13258 @item -mmul64
13259 @opindex mmul64
13260 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
13261
13262 @item -mnorm
13263 @opindex mnorm
13264 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
13265 is in effect.
13266
13267 @item -mspfp
13268 @opindex mspfp
13269 @itemx -mspfp-compact
13270 @opindex mspfp-compact
13271 FPX: Generate Single Precision FPX instructions, tuned for the compact
13272 implementation.
13273
13274 @item -mspfp-fast
13275 @opindex mspfp-fast
13276 FPX: Generate Single Precision FPX instructions, tuned for the fast
13277 implementation.
13278
13279 @item -msimd
13280 @opindex msimd
13281 Enable generation of ARC SIMD instructions via target-specific
13282 builtins. Only valid for @option{-mcpu=ARC700}.
13283
13284 @item -msoft-float
13285 @opindex msoft-float
13286 This option ignored; it is provided for compatibility purposes only.
13287 Software floating point code is emitted by default, and this default
13288 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
13289 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
13290 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
13291
13292 @item -mswap
13293 @opindex mswap
13294 Generate swap instructions.
13295
13296 @item -matomic
13297 @opindex matomic
13298 This enables Locked Load/Store Conditional extension to implement
13299 atomic memopry built-in functions. Not available for ARC 6xx or ARC
13300 EM cores.
13301
13302 @item -mdiv-rem
13303 @opindex mdiv-rem
13304 Enable DIV/REM instructions for ARCv2 cores.
13305
13306 @item -mcode-density
13307 @opindex mcode-density
13308 Enable code density instructions for ARC EM, default on for ARC HS.
13309
13310 @item -mll64
13311 @opindex mll64
13312 Enable double load/store operations for ARC HS cores.
13313
13314 @item -mmpy-option=@var{multo}
13315 @opindex mmpy-option
13316 Compile ARCv2 code with a multiplier design option. @samp{wlh1} is
13317 the default value. The recognized values for @var{multo} are:
13318
13319 @table @samp
13320 @item 0
13321 No multiplier available.
13322
13323 @item 1
13324 @opindex w
13325 The multiply option is set to w: 16x16 multiplier, fully pipelined.
13326 The following instructions are enabled: MPYW, and MPYUW.
13327
13328 @item 2
13329 @opindex wlh1
13330 The multiply option is set to wlh1: 32x32 multiplier, fully
13331 pipelined (1 stage). The following instructions are additionally
13332 enabled: MPY, MPYU, MPYM, MPYMU, and MPY_S.
13333
13334 @item 3
13335 @opindex wlh2
13336 The multiply option is set to wlh2: 32x32 multiplier, fully pipelined
13337 (2 stages). The following instructions are additionally enabled: MPY,
13338 MPYU, MPYM, MPYMU, and MPY_S.
13339
13340 @item 4
13341 @opindex wlh3
13342 The multiply option is set to wlh3: Two 16x16 multiplier, blocking,
13343 sequential. The following instructions are additionally enabled: MPY,
13344 MPYU, MPYM, MPYMU, and MPY_S.
13345
13346 @item 5
13347 @opindex wlh4
13348 The multiply option is set to wlh4: One 16x16 multiplier, blocking,
13349 sequential. The following instructions are additionally enabled: MPY,
13350 MPYU, MPYM, MPYMU, and MPY_S.
13351
13352 @item 6
13353 @opindex wlh5
13354 The multiply option is set to wlh5: One 32x4 multiplier, blocking,
13355 sequential. The following instructions are additionally enabled: MPY,
13356 MPYU, MPYM, MPYMU, and MPY_S.
13357
13358 @end table
13359
13360 This option is only available for ARCv2 cores@.
13361
13362 @item -mfpu=@var{fpu}
13363 @opindex mfpu
13364 Enables specific floating-point hardware extension for ARCv2
13365 core. Supported values for @var{fpu} are:
13366
13367 @table @samp
13368
13369 @item fpus
13370 @opindex fpus
13371 Enables support for single precision floating point hardware
13372 extensions@.
13373
13374 @item fpud
13375 @opindex fpud
13376 Enables support for double precision floating point hardware
13377 extensions. The single precision floating point extension is also
13378 enabled. Not available for ARC EM@.
13379
13380 @item fpuda
13381 @opindex fpuda
13382 Enables support for double precision floating point hardware
13383 extensions using double precision assist instructions. The single
13384 precision floating point extension is also enabled. This option is
13385 only available for ARC EM@.
13386
13387 @item fpuda_div
13388 @opindex fpuda_div
13389 Enables support for double precision floating point hardware
13390 extensions using double precision assist instructions, and simple
13391 precision square-root and divide hardware extensions. The single
13392 precision floating point extension is also enabled. This option is
13393 only available for ARC EM@.
13394
13395 @item fpuda_fma
13396 @opindex fpuda_fma
13397 Enables support for double precision floating point hardware
13398 extensions using double precision assist instructions, and simple
13399 precision fused multiple and add hardware extension. The single
13400 precision floating point extension is also enabled. This option is
13401 only available for ARC EM@.
13402
13403 @item fpuda_all
13404 @opindex fpuda_all
13405 Enables support for double precision floating point hardware
13406 extensions using double precision assist instructions, and all simple
13407 precision hardware extensions. The single precision floating point
13408 extension is also enabled. This option is only available for ARC EM@.
13409
13410 @item fpus_div
13411 @opindex fpus_div
13412 Enables support for single precision floating point, and single
13413 precision square-root and divide hardware extensions@.
13414
13415 @item fpud_div
13416 @opindex fpud_div
13417 Enables support for double precision floating point, and double
13418 precision square-root and divide hardware extensions. This option
13419 includes option @samp{fpus_div}. Not available for ARC EM@.
13420
13421 @item fpus_fma
13422 @opindex fpus_fma
13423 Enables support for single precision floating point, and single
13424 precision fused multiple and add hardware extensions@.
13425
13426 @item fpud_fma
13427 @opindex fpud_fma
13428 Enables support for double precision floating point, and double
13429 precision fused multiple and add hardware extensions. This option
13430 includes option @samp{fpus_fma}. Not available for ARC EM@.
13431
13432 @item fpus_all
13433 @opindex fpus_all
13434 Enables support for all single precision floating point hardware
13435 extensions@.
13436
13437 @item fpud_all
13438 @opindex fpud_all
13439 Enables support for all single and double precision floating point
13440 hardware extensions. Not available for ARC EM@.
13441
13442 @end table
13443
13444 @end table
13445
13446 The following options are passed through to the assembler, and also
13447 define preprocessor macro symbols.
13448
13449 @c Flags used by the assembler, but for which we define preprocessor
13450 @c macro symbols as well.
13451 @table @gcctabopt
13452 @item -mdsp-packa
13453 @opindex mdsp-packa
13454 Passed down to the assembler to enable the DSP Pack A extensions.
13455 Also sets the preprocessor symbol @code{__Xdsp_packa}.
13456
13457 @item -mdvbf
13458 @opindex mdvbf
13459 Passed down to the assembler to enable the dual viterbi butterfly
13460 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
13461
13462 @c ARC700 4.10 extension instruction
13463 @item -mlock
13464 @opindex mlock
13465 Passed down to the assembler to enable the Locked Load/Store
13466 Conditional extension. Also sets the preprocessor symbol
13467 @code{__Xlock}.
13468
13469 @item -mmac-d16
13470 @opindex mmac-d16
13471 Passed down to the assembler. Also sets the preprocessor symbol
13472 @code{__Xxmac_d16}.
13473
13474 @item -mmac-24
13475 @opindex mmac-24
13476 Passed down to the assembler. Also sets the preprocessor symbol
13477 @code{__Xxmac_24}.
13478
13479 @c ARC700 4.10 extension instruction
13480 @item -mrtsc
13481 @opindex mrtsc
13482 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
13483 extension instruction. Also sets the preprocessor symbol
13484 @code{__Xrtsc}.
13485
13486 @c ARC700 4.10 extension instruction
13487 @item -mswape
13488 @opindex mswape
13489 Passed down to the assembler to enable the swap byte ordering
13490 extension instruction. Also sets the preprocessor symbol
13491 @code{__Xswape}.
13492
13493 @item -mtelephony
13494 @opindex mtelephony
13495 Passed down to the assembler to enable dual and single operand
13496 instructions for telephony. Also sets the preprocessor symbol
13497 @code{__Xtelephony}.
13498
13499 @item -mxy
13500 @opindex mxy
13501 Passed down to the assembler to enable the XY Memory extension. Also
13502 sets the preprocessor symbol @code{__Xxy}.
13503
13504 @end table
13505
13506 The following options control how the assembly code is annotated:
13507
13508 @c Assembly annotation options
13509 @table @gcctabopt
13510 @item -misize
13511 @opindex misize
13512 Annotate assembler instructions with estimated addresses.
13513
13514 @item -mannotate-align
13515 @opindex mannotate-align
13516 Explain what alignment considerations lead to the decision to make an
13517 instruction short or long.
13518
13519 @end table
13520
13521 The following options are passed through to the linker:
13522
13523 @c options passed through to the linker
13524 @table @gcctabopt
13525 @item -marclinux
13526 @opindex marclinux
13527 Passed through to the linker, to specify use of the @code{arclinux} emulation.
13528 This option is enabled by default in tool chains built for
13529 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
13530 when profiling is not requested.
13531
13532 @item -marclinux_prof
13533 @opindex marclinux_prof
13534 Passed through to the linker, to specify use of the
13535 @code{arclinux_prof} emulation. This option is enabled by default in
13536 tool chains built for @w{@code{arc-linux-uclibc}} and
13537 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
13538
13539 @end table
13540
13541 The following options control the semantics of generated code:
13542
13543 @c semantically relevant code generation options
13544 @table @gcctabopt
13545 @item -mlong-calls
13546 @opindex mlong-calls
13547 Generate call insns as register indirect calls, thus providing access
13548 to the full 32-bit address range.
13549
13550 @item -mmedium-calls
13551 @opindex mmedium-calls
13552 Don't use less than 25 bit addressing range for calls, which is the
13553 offset available for an unconditional branch-and-link
13554 instruction. Conditional execution of function calls is suppressed, to
13555 allow use of the 25-bit range, rather than the 21-bit range with
13556 conditional branch-and-link. This is the default for tool chains built
13557 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
13558
13559 @item -mno-sdata
13560 @opindex mno-sdata
13561 Do not generate sdata references. This is the default for tool chains
13562 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
13563 targets.
13564
13565 @item -mucb-mcount
13566 @opindex mucb-mcount
13567 Instrument with mcount calls as used in UCB code. I.e. do the
13568 counting in the callee, not the caller. By default ARC instrumentation
13569 counts in the caller.
13570
13571 @item -mvolatile-cache
13572 @opindex mvolatile-cache
13573 Use ordinarily cached memory accesses for volatile references. This is the
13574 default.
13575
13576 @item -mno-volatile-cache
13577 @opindex mno-volatile-cache
13578 Enable cache bypass for volatile references.
13579
13580 @end table
13581
13582 The following options fine tune code generation:
13583 @c code generation tuning options
13584 @table @gcctabopt
13585 @item -malign-call
13586 @opindex malign-call
13587 Do alignment optimizations for call instructions.
13588
13589 @item -mauto-modify-reg
13590 @opindex mauto-modify-reg
13591 Enable the use of pre/post modify with register displacement.
13592
13593 @item -mbbit-peephole
13594 @opindex mbbit-peephole
13595 Enable bbit peephole2.
13596
13597 @item -mno-brcc
13598 @opindex mno-brcc
13599 This option disables a target-specific pass in @file{arc_reorg} to
13600 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
13601 generation driven by the combiner pass.
13602
13603 @item -mcase-vector-pcrel
13604 @opindex mcase-vector-pcrel
13605 Use pc-relative switch case tables - this enables case table shortening.
13606 This is the default for @option{-Os}.
13607
13608 @item -mcompact-casesi
13609 @opindex mcompact-casesi
13610 Enable compact casesi pattern.
13611 This is the default for @option{-Os}.
13612
13613 @item -mno-cond-exec
13614 @opindex mno-cond-exec
13615 Disable ARCompact specific pass to generate conditional execution instructions.
13616 Due to delay slot scheduling and interactions between operand numbers,
13617 literal sizes, instruction lengths, and the support for conditional execution,
13618 the target-independent pass to generate conditional execution is often lacking,
13619 so the ARC port has kept a special pass around that tries to find more
13620 conditional execution generating opportunities after register allocation,
13621 branch shortening, and delay slot scheduling have been done. This pass
13622 generally, but not always, improves performance and code size, at the cost of
13623 extra compilation time, which is why there is an option to switch it off.
13624 If you have a problem with call instructions exceeding their allowable
13625 offset range because they are conditionalized, you should consider using
13626 @option{-mmedium-calls} instead.
13627
13628 @item -mearly-cbranchsi
13629 @opindex mearly-cbranchsi
13630 Enable pre-reload use of the cbranchsi pattern.
13631
13632 @item -mexpand-adddi
13633 @opindex mexpand-adddi
13634 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
13635 @code{add.f}, @code{adc} etc.
13636
13637 @item -mindexed-loads
13638 @opindex mindexed-loads
13639 Enable the use of indexed loads. This can be problematic because some
13640 optimizers then assume that indexed stores exist, which is not
13641 the case.
13642
13643 @item -mlra
13644 @opindex mlra
13645 Enable Local Register Allocation. This is still experimental for ARC,
13646 so by default the compiler uses standard reload
13647 (i.e. @option{-mno-lra}).
13648
13649 @item -mlra-priority-none
13650 @opindex mlra-priority-none
13651 Don't indicate any priority for target registers.
13652
13653 @item -mlra-priority-compact
13654 @opindex mlra-priority-compact
13655 Indicate target register priority for r0..r3 / r12..r15.
13656
13657 @item -mlra-priority-noncompact
13658 @opindex mlra-priority-noncompact
13659 Reduce target register priority for r0..r3 / r12..r15.
13660
13661 @item -mno-millicode
13662 @opindex mno-millicode
13663 When optimizing for size (using @option{-Os}), prologues and epilogues
13664 that have to save or restore a large number of registers are often
13665 shortened by using call to a special function in libgcc; this is
13666 referred to as a @emph{millicode} call. As these calls can pose
13667 performance issues, and/or cause linking issues when linking in a
13668 nonstandard way, this option is provided to turn off millicode call
13669 generation.
13670
13671 @item -mmixed-code
13672 @opindex mmixed-code
13673 Tweak register allocation to help 16-bit instruction generation.
13674 This generally has the effect of decreasing the average instruction size
13675 while increasing the instruction count.
13676
13677 @item -mq-class
13678 @opindex mq-class
13679 Enable 'q' instruction alternatives.
13680 This is the default for @option{-Os}.
13681
13682 @item -mRcq
13683 @opindex mRcq
13684 Enable Rcq constraint handling - most short code generation depends on this.
13685 This is the default.
13686
13687 @item -mRcw
13688 @opindex mRcw
13689 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
13690 This is the default.
13691
13692 @item -msize-level=@var{level}
13693 @opindex msize-level
13694 Fine-tune size optimization with regards to instruction lengths and alignment.
13695 The recognized values for @var{level} are:
13696 @table @samp
13697 @item 0
13698 No size optimization. This level is deprecated and treated like @samp{1}.
13699
13700 @item 1
13701 Short instructions are used opportunistically.
13702
13703 @item 2
13704 In addition, alignment of loops and of code after barriers are dropped.
13705
13706 @item 3
13707 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
13708
13709 @end table
13710
13711 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
13712 the behavior when this is not set is equivalent to level @samp{1}.
13713
13714 @item -mtune=@var{cpu}
13715 @opindex mtune
13716 Set instruction scheduling parameters for @var{cpu}, overriding any implied
13717 by @option{-mcpu=}.
13718
13719 Supported values for @var{cpu} are
13720
13721 @table @samp
13722 @item ARC600
13723 Tune for ARC600 cpu.
13724
13725 @item ARC601
13726 Tune for ARC601 cpu.
13727
13728 @item ARC700
13729 Tune for ARC700 cpu with standard multiplier block.
13730
13731 @item ARC700-xmac
13732 Tune for ARC700 cpu with XMAC block.
13733
13734 @item ARC725D
13735 Tune for ARC725D cpu.
13736
13737 @item ARC750D
13738 Tune for ARC750D cpu.
13739
13740 @end table
13741
13742 @item -mmultcost=@var{num}
13743 @opindex mmultcost
13744 Cost to assume for a multiply instruction, with @samp{4} being equal to a
13745 normal instruction.
13746
13747 @item -munalign-prob-threshold=@var{probability}
13748 @opindex munalign-prob-threshold
13749 Set probability threshold for unaligning branches.
13750 When tuning for @samp{ARC700} and optimizing for speed, branches without
13751 filled delay slot are preferably emitted unaligned and long, unless
13752 profiling indicates that the probability for the branch to be taken
13753 is below @var{probability}. @xref{Cross-profiling}.
13754 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
13755
13756 @end table
13757
13758 The following options are maintained for backward compatibility, but
13759 are now deprecated and will be removed in a future release:
13760
13761 @c Deprecated options
13762 @table @gcctabopt
13763
13764 @item -margonaut
13765 @opindex margonaut
13766 Obsolete FPX.
13767
13768 @item -mbig-endian
13769 @opindex mbig-endian
13770 @itemx -EB
13771 @opindex EB
13772 Compile code for big endian targets. Use of these options is now
13773 deprecated. Users wanting big-endian code, should use the
13774 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
13775 building the tool chain, for which big-endian is the default.
13776
13777 @item -mlittle-endian
13778 @opindex mlittle-endian
13779 @itemx -EL
13780 @opindex EL
13781 Compile code for little endian targets. Use of these options is now
13782 deprecated. Users wanting little-endian code should use the
13783 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
13784 building the tool chain, for which little-endian is the default.
13785
13786 @item -mbarrel_shifter
13787 @opindex mbarrel_shifter
13788 Replaced by @option{-mbarrel-shifter}.
13789
13790 @item -mdpfp_compact
13791 @opindex mdpfp_compact
13792 Replaced by @option{-mdpfp-compact}.
13793
13794 @item -mdpfp_fast
13795 @opindex mdpfp_fast
13796 Replaced by @option{-mdpfp-fast}.
13797
13798 @item -mdsp_packa
13799 @opindex mdsp_packa
13800 Replaced by @option{-mdsp-packa}.
13801
13802 @item -mEA
13803 @opindex mEA
13804 Replaced by @option{-mea}.
13805
13806 @item -mmac_24
13807 @opindex mmac_24
13808 Replaced by @option{-mmac-24}.
13809
13810 @item -mmac_d16
13811 @opindex mmac_d16
13812 Replaced by @option{-mmac-d16}.
13813
13814 @item -mspfp_compact
13815 @opindex mspfp_compact
13816 Replaced by @option{-mspfp-compact}.
13817
13818 @item -mspfp_fast
13819 @opindex mspfp_fast
13820 Replaced by @option{-mspfp-fast}.
13821
13822 @item -mtune=@var{cpu}
13823 @opindex mtune
13824 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
13825 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
13826 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
13827
13828 @item -multcost=@var{num}
13829 @opindex multcost
13830 Replaced by @option{-mmultcost}.
13831
13832 @end table
13833
13834 @node ARM Options
13835 @subsection ARM Options
13836 @cindex ARM options
13837
13838 These @samp{-m} options are defined for the ARM port:
13839
13840 @table @gcctabopt
13841 @item -mabi=@var{name}
13842 @opindex mabi
13843 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
13844 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
13845
13846 @item -mapcs-frame
13847 @opindex mapcs-frame
13848 Generate a stack frame that is compliant with the ARM Procedure Call
13849 Standard for all functions, even if this is not strictly necessary for
13850 correct execution of the code. Specifying @option{-fomit-frame-pointer}
13851 with this option causes the stack frames not to be generated for
13852 leaf functions. The default is @option{-mno-apcs-frame}.
13853 This option is deprecated.
13854
13855 @item -mapcs
13856 @opindex mapcs
13857 This is a synonym for @option{-mapcs-frame} and is deprecated.
13858
13859 @ignore
13860 @c not currently implemented
13861 @item -mapcs-stack-check
13862 @opindex mapcs-stack-check
13863 Generate code to check the amount of stack space available upon entry to
13864 every function (that actually uses some stack space). If there is
13865 insufficient space available then either the function
13866 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
13867 called, depending upon the amount of stack space required. The runtime
13868 system is required to provide these functions. The default is
13869 @option{-mno-apcs-stack-check}, since this produces smaller code.
13870
13871 @c not currently implemented
13872 @item -mapcs-float
13873 @opindex mapcs-float
13874 Pass floating-point arguments using the floating-point registers. This is
13875 one of the variants of the APCS@. This option is recommended if the
13876 target hardware has a floating-point unit or if a lot of floating-point
13877 arithmetic is going to be performed by the code. The default is
13878 @option{-mno-apcs-float}, since the size of integer-only code is
13879 slightly increased if @option{-mapcs-float} is used.
13880
13881 @c not currently implemented
13882 @item -mapcs-reentrant
13883 @opindex mapcs-reentrant
13884 Generate reentrant, position-independent code. The default is
13885 @option{-mno-apcs-reentrant}.
13886 @end ignore
13887
13888 @item -mthumb-interwork
13889 @opindex mthumb-interwork
13890 Generate code that supports calling between the ARM and Thumb
13891 instruction sets. Without this option, on pre-v5 architectures, the
13892 two instruction sets cannot be reliably used inside one program. The
13893 default is @option{-mno-thumb-interwork}, since slightly larger code
13894 is generated when @option{-mthumb-interwork} is specified. In AAPCS
13895 configurations this option is meaningless.
13896
13897 @item -mno-sched-prolog
13898 @opindex mno-sched-prolog
13899 Prevent the reordering of instructions in the function prologue, or the
13900 merging of those instruction with the instructions in the function's
13901 body. This means that all functions start with a recognizable set
13902 of instructions (or in fact one of a choice from a small set of
13903 different function prologues), and this information can be used to
13904 locate the start of functions inside an executable piece of code. The
13905 default is @option{-msched-prolog}.
13906
13907 @item -mfloat-abi=@var{name}
13908 @opindex mfloat-abi
13909 Specifies which floating-point ABI to use. Permissible values
13910 are: @samp{soft}, @samp{softfp} and @samp{hard}.
13911
13912 Specifying @samp{soft} causes GCC to generate output containing
13913 library calls for floating-point operations.
13914 @samp{softfp} allows the generation of code using hardware floating-point
13915 instructions, but still uses the soft-float calling conventions.
13916 @samp{hard} allows generation of floating-point instructions
13917 and uses FPU-specific calling conventions.
13918
13919 The default depends on the specific target configuration. Note that
13920 the hard-float and soft-float ABIs are not link-compatible; you must
13921 compile your entire program with the same ABI, and link with a
13922 compatible set of libraries.
13923
13924 @item -mlittle-endian
13925 @opindex mlittle-endian
13926 Generate code for a processor running in little-endian mode. This is
13927 the default for all standard configurations.
13928
13929 @item -mbig-endian
13930 @opindex mbig-endian
13931 Generate code for a processor running in big-endian mode; the default is
13932 to compile code for a little-endian processor.
13933
13934 @item -march=@var{name}
13935 @opindex march
13936 This specifies the name of the target ARM architecture. GCC uses this
13937 name to determine what kind of instructions it can emit when generating
13938 assembly code. This option can be used in conjunction with or instead
13939 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
13940 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
13941 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
13942 @samp{armv6}, @samp{armv6j},
13943 @samp{armv6t2}, @samp{armv6z}, @samp{armv6kz}, @samp{armv6-m},
13944 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m},
13945 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
13946 @samp{armv8.1-a+crc}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
13947
13948 @option{-march=armv7ve} is the armv7-a architecture with virtualization
13949 extensions.
13950
13951 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
13952 architecture together with the optional CRC32 extensions.
13953
13954 @option{-march=native} causes the compiler to auto-detect the architecture
13955 of the build computer. At present, this feature is only supported on
13956 GNU/Linux, and not all architectures are recognized. If the auto-detect
13957 is unsuccessful the option has no effect.
13958
13959 @item -mtune=@var{name}
13960 @opindex mtune
13961 This option specifies the name of the target ARM processor for
13962 which GCC should tune the performance of the code.
13963 For some ARM implementations better performance can be obtained by using
13964 this option.
13965 Permissible names are: @samp{arm2}, @samp{arm250},
13966 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
13967 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
13968 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
13969 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
13970 @samp{arm720},
13971 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
13972 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
13973 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
13974 @samp{strongarm1110},
13975 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
13976 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
13977 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
13978 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
13979 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
13980 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
13981 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
13982 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
13983 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
13984 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
13985 @samp{cortex-a72}, @samp{cortex-r4},
13986 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
13987 @samp{cortex-m7},
13988 @samp{cortex-m4},
13989 @samp{cortex-m3},
13990 @samp{cortex-m1},
13991 @samp{cortex-m0},
13992 @samp{cortex-m0plus},
13993 @samp{cortex-m1.small-multiply},
13994 @samp{cortex-m0.small-multiply},
13995 @samp{cortex-m0plus.small-multiply},
13996 @samp{exynos-m1},
13997 @samp{qdf24xx},
13998 @samp{marvell-pj4},
13999 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
14000 @samp{fa526}, @samp{fa626},
14001 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
14002 @samp{xgene1}.
14003
14004 Additionally, this option can specify that GCC should tune the performance
14005 of the code for a big.LITTLE system. Permissible names are:
14006 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
14007 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}.
14008
14009 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
14010 performance for a blend of processors within architecture @var{arch}.
14011 The aim is to generate code that run well on the current most popular
14012 processors, balancing between optimizations that benefit some CPUs in the
14013 range, and avoiding performance pitfalls of other CPUs. The effects of
14014 this option may change in future GCC versions as CPU models come and go.
14015
14016 @option{-mtune=native} causes the compiler to auto-detect the CPU
14017 of the build computer. At present, this feature is only supported on
14018 GNU/Linux, and not all architectures are recognized. If the auto-detect is
14019 unsuccessful the option has no effect.
14020
14021 @item -mcpu=@var{name}
14022 @opindex mcpu
14023 This specifies the name of the target ARM processor. GCC uses this name
14024 to derive the name of the target ARM architecture (as if specified
14025 by @option{-march}) and the ARM processor type for which to tune for
14026 performance (as if specified by @option{-mtune}). Where this option
14027 is used in conjunction with @option{-march} or @option{-mtune},
14028 those options take precedence over the appropriate part of this option.
14029
14030 Permissible names for this option are the same as those for
14031 @option{-mtune}.
14032
14033 @option{-mcpu=generic-@var{arch}} is also permissible, and is
14034 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
14035 See @option{-mtune} for more information.
14036
14037 @option{-mcpu=native} causes the compiler to auto-detect the CPU
14038 of the build computer. At present, this feature is only supported on
14039 GNU/Linux, and not all architectures are recognized. If the auto-detect
14040 is unsuccessful the option has no effect.
14041
14042 @item -mfpu=@var{name}
14043 @opindex mfpu
14044 This specifies what floating-point hardware (or hardware emulation) is
14045 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
14046 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
14047 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
14048 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
14049 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
14050 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
14051
14052 If @option{-msoft-float} is specified this specifies the format of
14053 floating-point values.
14054
14055 If the selected floating-point hardware includes the NEON extension
14056 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
14057 operations are not generated by GCC's auto-vectorization pass unless
14058 @option{-funsafe-math-optimizations} is also specified. This is
14059 because NEON hardware does not fully implement the IEEE 754 standard for
14060 floating-point arithmetic (in particular denormal values are treated as
14061 zero), so the use of NEON instructions may lead to a loss of precision.
14062
14063 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}).
14064
14065 @item -mfp16-format=@var{name}
14066 @opindex mfp16-format
14067 Specify the format of the @code{__fp16} half-precision floating-point type.
14068 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
14069 the default is @samp{none}, in which case the @code{__fp16} type is not
14070 defined. @xref{Half-Precision}, for more information.
14071
14072 @item -mstructure-size-boundary=@var{n}
14073 @opindex mstructure-size-boundary
14074 The sizes of all structures and unions are rounded up to a multiple
14075 of the number of bits set by this option. Permissible values are 8, 32
14076 and 64. The default value varies for different toolchains. For the COFF
14077 targeted toolchain the default value is 8. A value of 64 is only allowed
14078 if the underlying ABI supports it.
14079
14080 Specifying a larger number can produce faster, more efficient code, but
14081 can also increase the size of the program. Different values are potentially
14082 incompatible. Code compiled with one value cannot necessarily expect to
14083 work with code or libraries compiled with another value, if they exchange
14084 information using structures or unions.
14085
14086 @item -mabort-on-noreturn
14087 @opindex mabort-on-noreturn
14088 Generate a call to the function @code{abort} at the end of a
14089 @code{noreturn} function. It is executed if the function tries to
14090 return.
14091
14092 @item -mlong-calls
14093 @itemx -mno-long-calls
14094 @opindex mlong-calls
14095 @opindex mno-long-calls
14096 Tells the compiler to perform function calls by first loading the
14097 address of the function into a register and then performing a subroutine
14098 call on this register. This switch is needed if the target function
14099 lies outside of the 64-megabyte addressing range of the offset-based
14100 version of subroutine call instruction.
14101
14102 Even if this switch is enabled, not all function calls are turned
14103 into long calls. The heuristic is that static functions, functions
14104 that have the @code{short_call} attribute, functions that are inside
14105 the scope of a @code{#pragma no_long_calls} directive, and functions whose
14106 definitions have already been compiled within the current compilation
14107 unit are not turned into long calls. The exceptions to this rule are
14108 that weak function definitions, functions with the @code{long_call}
14109 attribute or the @code{section} attribute, and functions that are within
14110 the scope of a @code{#pragma long_calls} directive are always
14111 turned into long calls.
14112
14113 This feature is not enabled by default. Specifying
14114 @option{-mno-long-calls} restores the default behavior, as does
14115 placing the function calls within the scope of a @code{#pragma
14116 long_calls_off} directive. Note these switches have no effect on how
14117 the compiler generates code to handle function calls via function
14118 pointers.
14119
14120 @item -msingle-pic-base
14121 @opindex msingle-pic-base
14122 Treat the register used for PIC addressing as read-only, rather than
14123 loading it in the prologue for each function. The runtime system is
14124 responsible for initializing this register with an appropriate value
14125 before execution begins.
14126
14127 @item -mpic-register=@var{reg}
14128 @opindex mpic-register
14129 Specify the register to be used for PIC addressing.
14130 For standard PIC base case, the default is any suitable register
14131 determined by compiler. For single PIC base case, the default is
14132 @samp{R9} if target is EABI based or stack-checking is enabled,
14133 otherwise the default is @samp{R10}.
14134
14135 @item -mpic-data-is-text-relative
14136 @opindex mpic-data-is-text-relative
14137 Assume that each data segments are relative to text segment at load time.
14138 Therefore, it permits addressing data using PC-relative operations.
14139 This option is on by default for targets other than VxWorks RTP.
14140
14141 @item -mpoke-function-name
14142 @opindex mpoke-function-name
14143 Write the name of each function into the text section, directly
14144 preceding the function prologue. The generated code is similar to this:
14145
14146 @smallexample
14147 t0
14148 .ascii "arm_poke_function_name", 0
14149 .align
14150 t1
14151 .word 0xff000000 + (t1 - t0)
14152 arm_poke_function_name
14153 mov ip, sp
14154 stmfd sp!, @{fp, ip, lr, pc@}
14155 sub fp, ip, #4
14156 @end smallexample
14157
14158 When performing a stack backtrace, code can inspect the value of
14159 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
14160 location @code{pc - 12} and the top 8 bits are set, then we know that
14161 there is a function name embedded immediately preceding this location
14162 and has length @code{((pc[-3]) & 0xff000000)}.
14163
14164 @item -mthumb
14165 @itemx -marm
14166 @opindex marm
14167 @opindex mthumb
14168
14169 Select between generating code that executes in ARM and Thumb
14170 states. The default for most configurations is to generate code
14171 that executes in ARM state, but the default can be changed by
14172 configuring GCC with the @option{--with-mode=}@var{state}
14173 configure option.
14174
14175 You can also override the ARM and Thumb mode for each function
14176 by using the @code{target("thumb")} and @code{target("arm")} function attributes
14177 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
14178
14179 @item -mtpcs-frame
14180 @opindex mtpcs-frame
14181 Generate a stack frame that is compliant with the Thumb Procedure Call
14182 Standard for all non-leaf functions. (A leaf function is one that does
14183 not call any other functions.) The default is @option{-mno-tpcs-frame}.
14184
14185 @item -mtpcs-leaf-frame
14186 @opindex mtpcs-leaf-frame
14187 Generate a stack frame that is compliant with the Thumb Procedure Call
14188 Standard for all leaf functions. (A leaf function is one that does
14189 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
14190
14191 @item -mcallee-super-interworking
14192 @opindex mcallee-super-interworking
14193 Gives all externally visible functions in the file being compiled an ARM
14194 instruction set header which switches to Thumb mode before executing the
14195 rest of the function. This allows these functions to be called from
14196 non-interworking code. This option is not valid in AAPCS configurations
14197 because interworking is enabled by default.
14198
14199 @item -mcaller-super-interworking
14200 @opindex mcaller-super-interworking
14201 Allows calls via function pointers (including virtual functions) to
14202 execute correctly regardless of whether the target code has been
14203 compiled for interworking or not. There is a small overhead in the cost
14204 of executing a function pointer if this option is enabled. This option
14205 is not valid in AAPCS configurations because interworking is enabled
14206 by default.
14207
14208 @item -mtp=@var{name}
14209 @opindex mtp
14210 Specify the access model for the thread local storage pointer. The valid
14211 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
14212 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
14213 (supported in the arm6k architecture), and @samp{auto}, which uses the
14214 best available method for the selected processor. The default setting is
14215 @samp{auto}.
14216
14217 @item -mtls-dialect=@var{dialect}
14218 @opindex mtls-dialect
14219 Specify the dialect to use for accessing thread local storage. Two
14220 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
14221 @samp{gnu} dialect selects the original GNU scheme for supporting
14222 local and global dynamic TLS models. The @samp{gnu2} dialect
14223 selects the GNU descriptor scheme, which provides better performance
14224 for shared libraries. The GNU descriptor scheme is compatible with
14225 the original scheme, but does require new assembler, linker and
14226 library support. Initial and local exec TLS models are unaffected by
14227 this option and always use the original scheme.
14228
14229 @item -mword-relocations
14230 @opindex mword-relocations
14231 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
14232 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
14233 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
14234 is specified.
14235
14236 @item -mfix-cortex-m3-ldrd
14237 @opindex mfix-cortex-m3-ldrd
14238 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
14239 with overlapping destination and base registers are used. This option avoids
14240 generating these instructions. This option is enabled by default when
14241 @option{-mcpu=cortex-m3} is specified.
14242
14243 @item -munaligned-access
14244 @itemx -mno-unaligned-access
14245 @opindex munaligned-access
14246 @opindex mno-unaligned-access
14247 Enables (or disables) reading and writing of 16- and 32- bit values
14248 from addresses that are not 16- or 32- bit aligned. By default
14249 unaligned access is disabled for all pre-ARMv6 and all ARMv6-M
14250 architectures, and enabled for all other architectures. If unaligned
14251 access is not enabled then words in packed data structures are
14252 accessed a byte at a time.
14253
14254 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
14255 generated object file to either true or false, depending upon the
14256 setting of this option. If unaligned access is enabled then the
14257 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
14258 defined.
14259
14260 @item -mneon-for-64bits
14261 @opindex mneon-for-64bits
14262 Enables using Neon to handle scalar 64-bits operations. This is
14263 disabled by default since the cost of moving data from core registers
14264 to Neon is high.
14265
14266 @item -mslow-flash-data
14267 @opindex mslow-flash-data
14268 Assume loading data from flash is slower than fetching instruction.
14269 Therefore literal load is minimized for better performance.
14270 This option is only supported when compiling for ARMv7 M-profile and
14271 off by default.
14272
14273 @item -masm-syntax-unified
14274 @opindex masm-syntax-unified
14275 Assume inline assembler is using unified asm syntax. The default is
14276 currently off which implies divided syntax. This option has no impact
14277 on Thumb2. However, this may change in future releases of GCC.
14278 Divided syntax should be considered deprecated.
14279
14280 @item -mrestrict-it
14281 @opindex mrestrict-it
14282 Restricts generation of IT blocks to conform to the rules of ARMv8.
14283 IT blocks can only contain a single 16-bit instruction from a select
14284 set of instructions. This option is on by default for ARMv8 Thumb mode.
14285
14286 @item -mprint-tune-info
14287 @opindex mprint-tune-info
14288 Print CPU tuning information as comment in assembler file. This is
14289 an option used only for regression testing of the compiler and not
14290 intended for ordinary use in compiling code. This option is disabled
14291 by default.
14292 @end table
14293
14294 @node AVR Options
14295 @subsection AVR Options
14296 @cindex AVR Options
14297
14298 These options are defined for AVR implementations:
14299
14300 @table @gcctabopt
14301 @item -mmcu=@var{mcu}
14302 @opindex mmcu
14303 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
14304
14305 The default for this option is@tie{}@samp{avr2}.
14306
14307 GCC supports the following AVR devices and ISAs:
14308
14309 @include avr-mmcu.texi
14310
14311 @item -maccumulate-args
14312 @opindex maccumulate-args
14313 Accumulate outgoing function arguments and acquire/release the needed
14314 stack space for outgoing function arguments once in function
14315 prologue/epilogue. Without this option, outgoing arguments are pushed
14316 before calling a function and popped afterwards.
14317
14318 Popping the arguments after the function call can be expensive on
14319 AVR so that accumulating the stack space might lead to smaller
14320 executables because arguments need not to be removed from the
14321 stack after such a function call.
14322
14323 This option can lead to reduced code size for functions that perform
14324 several calls to functions that get their arguments on the stack like
14325 calls to printf-like functions.
14326
14327 @item -mbranch-cost=@var{cost}
14328 @opindex mbranch-cost
14329 Set the branch costs for conditional branch instructions to
14330 @var{cost}. Reasonable values for @var{cost} are small, non-negative
14331 integers. The default branch cost is 0.
14332
14333 @item -mcall-prologues
14334 @opindex mcall-prologues
14335 Functions prologues/epilogues are expanded as calls to appropriate
14336 subroutines. Code size is smaller.
14337
14338 @item -mint8
14339 @opindex mint8
14340 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
14341 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
14342 and @code{long long} is 4 bytes. Please note that this option does not
14343 conform to the C standards, but it results in smaller code
14344 size.
14345
14346 @item -mn-flash=@var{num}
14347 @opindex mn-flash
14348 Assume that the flash memory has a size of
14349 @var{num} times 64@tie{}KiB.
14350
14351 @item -mno-interrupts
14352 @opindex mno-interrupts
14353 Generated code is not compatible with hardware interrupts.
14354 Code size is smaller.
14355
14356 @item -mrelax
14357 @opindex mrelax
14358 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
14359 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
14360 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
14361 the assembler's command line and the @option{--relax} option to the
14362 linker's command line.
14363
14364 Jump relaxing is performed by the linker because jump offsets are not
14365 known before code is located. Therefore, the assembler code generated by the
14366 compiler is the same, but the instructions in the executable may
14367 differ from instructions in the assembler code.
14368
14369 Relaxing must be turned on if linker stubs are needed, see the
14370 section on @code{EIND} and linker stubs below.
14371
14372 @item -mrmw
14373 @opindex mrmw
14374 Assume that the device supports the Read-Modify-Write
14375 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
14376
14377 @item -msp8
14378 @opindex msp8
14379 Treat the stack pointer register as an 8-bit register,
14380 i.e.@: assume the high byte of the stack pointer is zero.
14381 In general, you don't need to set this option by hand.
14382
14383 This option is used internally by the compiler to select and
14384 build multilibs for architectures @code{avr2} and @code{avr25}.
14385 These architectures mix devices with and without @code{SPH}.
14386 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
14387 the compiler driver adds or removes this option from the compiler
14388 proper's command line, because the compiler then knows if the device
14389 or architecture has an 8-bit stack pointer and thus no @code{SPH}
14390 register or not.
14391
14392 @item -mstrict-X
14393 @opindex mstrict-X
14394 Use address register @code{X} in a way proposed by the hardware. This means
14395 that @code{X} is only used in indirect, post-increment or
14396 pre-decrement addressing.
14397
14398 Without this option, the @code{X} register may be used in the same way
14399 as @code{Y} or @code{Z} which then is emulated by additional
14400 instructions.
14401 For example, loading a value with @code{X+const} addressing with a
14402 small non-negative @code{const < 64} to a register @var{Rn} is
14403 performed as
14404
14405 @example
14406 adiw r26, const ; X += const
14407 ld @var{Rn}, X ; @var{Rn} = *X
14408 sbiw r26, const ; X -= const
14409 @end example
14410
14411 @item -mtiny-stack
14412 @opindex mtiny-stack
14413 Only change the lower 8@tie{}bits of the stack pointer.
14414
14415 @item -nodevicelib
14416 @opindex nodevicelib
14417 Don't link against AVR-LibC's device specific library @code{libdev.a}.
14418
14419 @item -Waddr-space-convert
14420 @opindex Waddr-space-convert
14421 Warn about conversions between address spaces in the case where the
14422 resulting address space is not contained in the incoming address space.
14423 @end table
14424
14425 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
14426 @cindex @code{EIND}
14427 Pointers in the implementation are 16@tie{}bits wide.
14428 The address of a function or label is represented as word address so
14429 that indirect jumps and calls can target any code address in the
14430 range of 64@tie{}Ki words.
14431
14432 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
14433 bytes of program memory space, there is a special function register called
14434 @code{EIND} that serves as most significant part of the target address
14435 when @code{EICALL} or @code{EIJMP} instructions are used.
14436
14437 Indirect jumps and calls on these devices are handled as follows by
14438 the compiler and are subject to some limitations:
14439
14440 @itemize @bullet
14441
14442 @item
14443 The compiler never sets @code{EIND}.
14444
14445 @item
14446 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
14447 instructions or might read @code{EIND} directly in order to emulate an
14448 indirect call/jump by means of a @code{RET} instruction.
14449
14450 @item
14451 The compiler assumes that @code{EIND} never changes during the startup
14452 code or during the application. In particular, @code{EIND} is not
14453 saved/restored in function or interrupt service routine
14454 prologue/epilogue.
14455
14456 @item
14457 For indirect calls to functions and computed goto, the linker
14458 generates @emph{stubs}. Stubs are jump pads sometimes also called
14459 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
14460 The stub contains a direct jump to the desired address.
14461
14462 @item
14463 Linker relaxation must be turned on so that the linker generates
14464 the stubs correctly in all situations. See the compiler option
14465 @option{-mrelax} and the linker option @option{--relax}.
14466 There are corner cases where the linker is supposed to generate stubs
14467 but aborts without relaxation and without a helpful error message.
14468
14469 @item
14470 The default linker script is arranged for code with @code{EIND = 0}.
14471 If code is supposed to work for a setup with @code{EIND != 0}, a custom
14472 linker script has to be used in order to place the sections whose
14473 name start with @code{.trampolines} into the segment where @code{EIND}
14474 points to.
14475
14476 @item
14477 The startup code from libgcc never sets @code{EIND}.
14478 Notice that startup code is a blend of code from libgcc and AVR-LibC.
14479 For the impact of AVR-LibC on @code{EIND}, see the
14480 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
14481
14482 @item
14483 It is legitimate for user-specific startup code to set up @code{EIND}
14484 early, for example by means of initialization code located in
14485 section @code{.init3}. Such code runs prior to general startup code
14486 that initializes RAM and calls constructors, but after the bit
14487 of startup code from AVR-LibC that sets @code{EIND} to the segment
14488 where the vector table is located.
14489 @example
14490 #include <avr/io.h>
14491
14492 static void
14493 __attribute__((section(".init3"),naked,used,no_instrument_function))
14494 init3_set_eind (void)
14495 @{
14496 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
14497 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
14498 @}
14499 @end example
14500
14501 @noindent
14502 The @code{__trampolines_start} symbol is defined in the linker script.
14503
14504 @item
14505 Stubs are generated automatically by the linker if
14506 the following two conditions are met:
14507 @itemize @minus
14508
14509 @item The address of a label is taken by means of the @code{gs} modifier
14510 (short for @emph{generate stubs}) like so:
14511 @example
14512 LDI r24, lo8(gs(@var{func}))
14513 LDI r25, hi8(gs(@var{func}))
14514 @end example
14515 @item The final location of that label is in a code segment
14516 @emph{outside} the segment where the stubs are located.
14517 @end itemize
14518
14519 @item
14520 The compiler emits such @code{gs} modifiers for code labels in the
14521 following situations:
14522 @itemize @minus
14523 @item Taking address of a function or code label.
14524 @item Computed goto.
14525 @item If prologue-save function is used, see @option{-mcall-prologues}
14526 command-line option.
14527 @item Switch/case dispatch tables. If you do not want such dispatch
14528 tables you can specify the @option{-fno-jump-tables} command-line option.
14529 @item C and C++ constructors/destructors called during startup/shutdown.
14530 @item If the tools hit a @code{gs()} modifier explained above.
14531 @end itemize
14532
14533 @item
14534 Jumping to non-symbolic addresses like so is @emph{not} supported:
14535
14536 @example
14537 int main (void)
14538 @{
14539 /* Call function at word address 0x2 */
14540 return ((int(*)(void)) 0x2)();
14541 @}
14542 @end example
14543
14544 Instead, a stub has to be set up, i.e.@: the function has to be called
14545 through a symbol (@code{func_4} in the example):
14546
14547 @example
14548 int main (void)
14549 @{
14550 extern int func_4 (void);
14551
14552 /* Call function at byte address 0x4 */
14553 return func_4();
14554 @}
14555 @end example
14556
14557 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
14558 Alternatively, @code{func_4} can be defined in the linker script.
14559 @end itemize
14560
14561 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
14562 @cindex @code{RAMPD}
14563 @cindex @code{RAMPX}
14564 @cindex @code{RAMPY}
14565 @cindex @code{RAMPZ}
14566 Some AVR devices support memories larger than the 64@tie{}KiB range
14567 that can be accessed with 16-bit pointers. To access memory locations
14568 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
14569 register is used as high part of the address:
14570 The @code{X}, @code{Y}, @code{Z} address register is concatenated
14571 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
14572 register, respectively, to get a wide address. Similarly,
14573 @code{RAMPD} is used together with direct addressing.
14574
14575 @itemize
14576 @item
14577 The startup code initializes the @code{RAMP} special function
14578 registers with zero.
14579
14580 @item
14581 If a @ref{AVR Named Address Spaces,named address space} other than
14582 generic or @code{__flash} is used, then @code{RAMPZ} is set
14583 as needed before the operation.
14584
14585 @item
14586 If the device supports RAM larger than 64@tie{}KiB and the compiler
14587 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
14588 is reset to zero after the operation.
14589
14590 @item
14591 If the device comes with a specific @code{RAMP} register, the ISR
14592 prologue/epilogue saves/restores that SFR and initializes it with
14593 zero in case the ISR code might (implicitly) use it.
14594
14595 @item
14596 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
14597 If you use inline assembler to read from locations outside the
14598 16-bit address range and change one of the @code{RAMP} registers,
14599 you must reset it to zero after the access.
14600
14601 @end itemize
14602
14603 @subsubsection AVR Built-in Macros
14604
14605 GCC defines several built-in macros so that the user code can test
14606 for the presence or absence of features. Almost any of the following
14607 built-in macros are deduced from device capabilities and thus
14608 triggered by the @option{-mmcu=} command-line option.
14609
14610 For even more AVR-specific built-in macros see
14611 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
14612
14613 @table @code
14614
14615 @item __AVR_ARCH__
14616 Build-in macro that resolves to a decimal number that identifies the
14617 architecture and depends on the @option{-mmcu=@var{mcu}} option.
14618 Possible values are:
14619
14620 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
14621 @code{4}, @code{5}, @code{51}, @code{6}
14622
14623 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
14624 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
14625
14626 respectively and
14627
14628 @code{100}, @code{102}, @code{104},
14629 @code{105}, @code{106}, @code{107}
14630
14631 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
14632 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
14633 If @var{mcu} specifies a device, this built-in macro is set
14634 accordingly. For example, with @option{-mmcu=atmega8} the macro is
14635 defined to @code{4}.
14636
14637 @item __AVR_@var{Device}__
14638 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
14639 the device's name. For example, @option{-mmcu=atmega8} defines the
14640 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
14641 @code{__AVR_ATtiny261A__}, etc.
14642
14643 The built-in macros' names follow
14644 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
14645 the device name as from the AVR user manual. The difference between
14646 @var{Device} in the built-in macro and @var{device} in
14647 @option{-mmcu=@var{device}} is that the latter is always lowercase.
14648
14649 If @var{device} is not a device but only a core architecture like
14650 @samp{avr51}, this macro is not defined.
14651
14652 @item __AVR_DEVICE_NAME__
14653 Setting @option{-mmcu=@var{device}} defines this built-in macro to
14654 the device's name. For example, with @option{-mmcu=atmega8} the macro
14655 is defined to @code{atmega8}.
14656
14657 If @var{device} is not a device but only a core architecture like
14658 @samp{avr51}, this macro is not defined.
14659
14660 @item __AVR_XMEGA__
14661 The device / architecture belongs to the XMEGA family of devices.
14662
14663 @item __AVR_HAVE_ELPM__
14664 The device has the @code{ELPM} instruction.
14665
14666 @item __AVR_HAVE_ELPMX__
14667 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
14668 R@var{n},Z+} instructions.
14669
14670 @item __AVR_HAVE_MOVW__
14671 The device has the @code{MOVW} instruction to perform 16-bit
14672 register-register moves.
14673
14674 @item __AVR_HAVE_LPMX__
14675 The device has the @code{LPM R@var{n},Z} and
14676 @code{LPM R@var{n},Z+} instructions.
14677
14678 @item __AVR_HAVE_MUL__
14679 The device has a hardware multiplier.
14680
14681 @item __AVR_HAVE_JMP_CALL__
14682 The device has the @code{JMP} and @code{CALL} instructions.
14683 This is the case for devices with at least 16@tie{}KiB of program
14684 memory.
14685
14686 @item __AVR_HAVE_EIJMP_EICALL__
14687 @itemx __AVR_3_BYTE_PC__
14688 The device has the @code{EIJMP} and @code{EICALL} instructions.
14689 This is the case for devices with more than 128@tie{}KiB of program memory.
14690 This also means that the program counter
14691 (PC) is 3@tie{}bytes wide.
14692
14693 @item __AVR_2_BYTE_PC__
14694 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
14695 with up to 128@tie{}KiB of program memory.
14696
14697 @item __AVR_HAVE_8BIT_SP__
14698 @itemx __AVR_HAVE_16BIT_SP__
14699 The stack pointer (SP) register is treated as 8-bit respectively
14700 16-bit register by the compiler.
14701 The definition of these macros is affected by @option{-mtiny-stack}.
14702
14703 @item __AVR_HAVE_SPH__
14704 @itemx __AVR_SP8__
14705 The device has the SPH (high part of stack pointer) special function
14706 register or has an 8-bit stack pointer, respectively.
14707 The definition of these macros is affected by @option{-mmcu=} and
14708 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
14709 by @option{-msp8}.
14710
14711 @item __AVR_HAVE_RAMPD__
14712 @itemx __AVR_HAVE_RAMPX__
14713 @itemx __AVR_HAVE_RAMPY__
14714 @itemx __AVR_HAVE_RAMPZ__
14715 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
14716 @code{RAMPZ} special function register, respectively.
14717
14718 @item __NO_INTERRUPTS__
14719 This macro reflects the @option{-mno-interrupts} command-line option.
14720
14721 @item __AVR_ERRATA_SKIP__
14722 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
14723 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
14724 instructions because of a hardware erratum. Skip instructions are
14725 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
14726 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
14727 set.
14728
14729 @item __AVR_ISA_RMW__
14730 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
14731
14732 @item __AVR_SFR_OFFSET__=@var{offset}
14733 Instructions that can address I/O special function registers directly
14734 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
14735 address as if addressed by an instruction to access RAM like @code{LD}
14736 or @code{STS}. This offset depends on the device architecture and has
14737 to be subtracted from the RAM address in order to get the
14738 respective I/O@tie{}address.
14739
14740 @item __WITH_AVRLIBC__
14741 The compiler is configured to be used together with AVR-Libc.
14742 See the @option{--with-avrlibc} configure option.
14743
14744 @end table
14745
14746 @node Blackfin Options
14747 @subsection Blackfin Options
14748 @cindex Blackfin Options
14749
14750 @table @gcctabopt
14751 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
14752 @opindex mcpu=
14753 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
14754 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
14755 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
14756 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
14757 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
14758 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
14759 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
14760 @samp{bf561}, @samp{bf592}.
14761
14762 The optional @var{sirevision} specifies the silicon revision of the target
14763 Blackfin processor. Any workarounds available for the targeted silicon revision
14764 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
14765 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
14766 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
14767 hexadecimal digits representing the major and minor numbers in the silicon
14768 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
14769 is not defined. If @var{sirevision} is @samp{any}, the
14770 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
14771 If this optional @var{sirevision} is not used, GCC assumes the latest known
14772 silicon revision of the targeted Blackfin processor.
14773
14774 GCC defines a preprocessor macro for the specified @var{cpu}.
14775 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
14776 provided by libgloss to be linked in if @option{-msim} is not given.
14777
14778 Without this option, @samp{bf532} is used as the processor by default.
14779
14780 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
14781 only the preprocessor macro is defined.
14782
14783 @item -msim
14784 @opindex msim
14785 Specifies that the program will be run on the simulator. This causes
14786 the simulator BSP provided by libgloss to be linked in. This option
14787 has effect only for @samp{bfin-elf} toolchain.
14788 Certain other options, such as @option{-mid-shared-library} and
14789 @option{-mfdpic}, imply @option{-msim}.
14790
14791 @item -momit-leaf-frame-pointer
14792 @opindex momit-leaf-frame-pointer
14793 Don't keep the frame pointer in a register for leaf functions. This
14794 avoids the instructions to save, set up and restore frame pointers and
14795 makes an extra register available in leaf functions. The option
14796 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
14797 which might make debugging harder.
14798
14799 @item -mspecld-anomaly
14800 @opindex mspecld-anomaly
14801 When enabled, the compiler ensures that the generated code does not
14802 contain speculative loads after jump instructions. If this option is used,
14803 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
14804
14805 @item -mno-specld-anomaly
14806 @opindex mno-specld-anomaly
14807 Don't generate extra code to prevent speculative loads from occurring.
14808
14809 @item -mcsync-anomaly
14810 @opindex mcsync-anomaly
14811 When enabled, the compiler ensures that the generated code does not
14812 contain CSYNC or SSYNC instructions too soon after conditional branches.
14813 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
14814
14815 @item -mno-csync-anomaly
14816 @opindex mno-csync-anomaly
14817 Don't generate extra code to prevent CSYNC or SSYNC instructions from
14818 occurring too soon after a conditional branch.
14819
14820 @item -mlow-64k
14821 @opindex mlow-64k
14822 When enabled, the compiler is free to take advantage of the knowledge that
14823 the entire program fits into the low 64k of memory.
14824
14825 @item -mno-low-64k
14826 @opindex mno-low-64k
14827 Assume that the program is arbitrarily large. This is the default.
14828
14829 @item -mstack-check-l1
14830 @opindex mstack-check-l1
14831 Do stack checking using information placed into L1 scratchpad memory by the
14832 uClinux kernel.
14833
14834 @item -mid-shared-library
14835 @opindex mid-shared-library
14836 Generate code that supports shared libraries via the library ID method.
14837 This allows for execute in place and shared libraries in an environment
14838 without virtual memory management. This option implies @option{-fPIC}.
14839 With a @samp{bfin-elf} target, this option implies @option{-msim}.
14840
14841 @item -mno-id-shared-library
14842 @opindex mno-id-shared-library
14843 Generate code that doesn't assume ID-based shared libraries are being used.
14844 This is the default.
14845
14846 @item -mleaf-id-shared-library
14847 @opindex mleaf-id-shared-library
14848 Generate code that supports shared libraries via the library ID method,
14849 but assumes that this library or executable won't link against any other
14850 ID shared libraries. That allows the compiler to use faster code for jumps
14851 and calls.
14852
14853 @item -mno-leaf-id-shared-library
14854 @opindex mno-leaf-id-shared-library
14855 Do not assume that the code being compiled won't link against any ID shared
14856 libraries. Slower code is generated for jump and call insns.
14857
14858 @item -mshared-library-id=n
14859 @opindex mshared-library-id
14860 Specifies the identification number of the ID-based shared library being
14861 compiled. Specifying a value of 0 generates more compact code; specifying
14862 other values forces the allocation of that number to the current
14863 library but is no more space- or time-efficient than omitting this option.
14864
14865 @item -msep-data
14866 @opindex msep-data
14867 Generate code that allows the data segment to be located in a different
14868 area of memory from the text segment. This allows for execute in place in
14869 an environment without virtual memory management by eliminating relocations
14870 against the text section.
14871
14872 @item -mno-sep-data
14873 @opindex mno-sep-data
14874 Generate code that assumes that the data segment follows the text segment.
14875 This is the default.
14876
14877 @item -mlong-calls
14878 @itemx -mno-long-calls
14879 @opindex mlong-calls
14880 @opindex mno-long-calls
14881 Tells the compiler to perform function calls by first loading the
14882 address of the function into a register and then performing a subroutine
14883 call on this register. This switch is needed if the target function
14884 lies outside of the 24-bit addressing range of the offset-based
14885 version of subroutine call instruction.
14886
14887 This feature is not enabled by default. Specifying
14888 @option{-mno-long-calls} restores the default behavior. Note these
14889 switches have no effect on how the compiler generates code to handle
14890 function calls via function pointers.
14891
14892 @item -mfast-fp
14893 @opindex mfast-fp
14894 Link with the fast floating-point library. This library relaxes some of
14895 the IEEE floating-point standard's rules for checking inputs against
14896 Not-a-Number (NAN), in the interest of performance.
14897
14898 @item -minline-plt
14899 @opindex minline-plt
14900 Enable inlining of PLT entries in function calls to functions that are
14901 not known to bind locally. It has no effect without @option{-mfdpic}.
14902
14903 @item -mmulticore
14904 @opindex mmulticore
14905 Build a standalone application for multicore Blackfin processors.
14906 This option causes proper start files and link scripts supporting
14907 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
14908 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
14909
14910 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
14911 selects the one-application-per-core programming model. Without
14912 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
14913 programming model is used. In this model, the main function of Core B
14914 should be named as @code{coreb_main}.
14915
14916 If this option is not used, the single-core application programming
14917 model is used.
14918
14919 @item -mcorea
14920 @opindex mcorea
14921 Build a standalone application for Core A of BF561 when using
14922 the one-application-per-core programming model. Proper start files
14923 and link scripts are used to support Core A, and the macro
14924 @code{__BFIN_COREA} is defined.
14925 This option can only be used in conjunction with @option{-mmulticore}.
14926
14927 @item -mcoreb
14928 @opindex mcoreb
14929 Build a standalone application for Core B of BF561 when using
14930 the one-application-per-core programming model. Proper start files
14931 and link scripts are used to support Core B, and the macro
14932 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
14933 should be used instead of @code{main}.
14934 This option can only be used in conjunction with @option{-mmulticore}.
14935
14936 @item -msdram
14937 @opindex msdram
14938 Build a standalone application for SDRAM. Proper start files and
14939 link scripts are used to put the application into SDRAM, and the macro
14940 @code{__BFIN_SDRAM} is defined.
14941 The loader should initialize SDRAM before loading the application.
14942
14943 @item -micplb
14944 @opindex micplb
14945 Assume that ICPLBs are enabled at run time. This has an effect on certain
14946 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
14947 are enabled; for standalone applications the default is off.
14948 @end table
14949
14950 @node C6X Options
14951 @subsection C6X Options
14952 @cindex C6X Options
14953
14954 @table @gcctabopt
14955 @item -march=@var{name}
14956 @opindex march
14957 This specifies the name of the target architecture. GCC uses this
14958 name to determine what kind of instructions it can emit when generating
14959 assembly code. Permissible names are: @samp{c62x},
14960 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
14961
14962 @item -mbig-endian
14963 @opindex mbig-endian
14964 Generate code for a big-endian target.
14965
14966 @item -mlittle-endian
14967 @opindex mlittle-endian
14968 Generate code for a little-endian target. This is the default.
14969
14970 @item -msim
14971 @opindex msim
14972 Choose startup files and linker script suitable for the simulator.
14973
14974 @item -msdata=default
14975 @opindex msdata=default
14976 Put small global and static data in the @code{.neardata} section,
14977 which is pointed to by register @code{B14}. Put small uninitialized
14978 global and static data in the @code{.bss} section, which is adjacent
14979 to the @code{.neardata} section. Put small read-only data into the
14980 @code{.rodata} section. The corresponding sections used for large
14981 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
14982
14983 @item -msdata=all
14984 @opindex msdata=all
14985 Put all data, not just small objects, into the sections reserved for
14986 small data, and use addressing relative to the @code{B14} register to
14987 access them.
14988
14989 @item -msdata=none
14990 @opindex msdata=none
14991 Make no use of the sections reserved for small data, and use absolute
14992 addresses to access all data. Put all initialized global and static
14993 data in the @code{.fardata} section, and all uninitialized data in the
14994 @code{.far} section. Put all constant data into the @code{.const}
14995 section.
14996 @end table
14997
14998 @node CRIS Options
14999 @subsection CRIS Options
15000 @cindex CRIS Options
15001
15002 These options are defined specifically for the CRIS ports.
15003
15004 @table @gcctabopt
15005 @item -march=@var{architecture-type}
15006 @itemx -mcpu=@var{architecture-type}
15007 @opindex march
15008 @opindex mcpu
15009 Generate code for the specified architecture. The choices for
15010 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
15011 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
15012 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
15013 @samp{v10}.
15014
15015 @item -mtune=@var{architecture-type}
15016 @opindex mtune
15017 Tune to @var{architecture-type} everything applicable about the generated
15018 code, except for the ABI and the set of available instructions. The
15019 choices for @var{architecture-type} are the same as for
15020 @option{-march=@var{architecture-type}}.
15021
15022 @item -mmax-stack-frame=@var{n}
15023 @opindex mmax-stack-frame
15024 Warn when the stack frame of a function exceeds @var{n} bytes.
15025
15026 @item -metrax4
15027 @itemx -metrax100
15028 @opindex metrax4
15029 @opindex metrax100
15030 The options @option{-metrax4} and @option{-metrax100} are synonyms for
15031 @option{-march=v3} and @option{-march=v8} respectively.
15032
15033 @item -mmul-bug-workaround
15034 @itemx -mno-mul-bug-workaround
15035 @opindex mmul-bug-workaround
15036 @opindex mno-mul-bug-workaround
15037 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
15038 models where it applies. This option is active by default.
15039
15040 @item -mpdebug
15041 @opindex mpdebug
15042 Enable CRIS-specific verbose debug-related information in the assembly
15043 code. This option also has the effect of turning off the @samp{#NO_APP}
15044 formatted-code indicator to the assembler at the beginning of the
15045 assembly file.
15046
15047 @item -mcc-init
15048 @opindex mcc-init
15049 Do not use condition-code results from previous instruction; always emit
15050 compare and test instructions before use of condition codes.
15051
15052 @item -mno-side-effects
15053 @opindex mno-side-effects
15054 Do not emit instructions with side effects in addressing modes other than
15055 post-increment.
15056
15057 @item -mstack-align
15058 @itemx -mno-stack-align
15059 @itemx -mdata-align
15060 @itemx -mno-data-align
15061 @itemx -mconst-align
15062 @itemx -mno-const-align
15063 @opindex mstack-align
15064 @opindex mno-stack-align
15065 @opindex mdata-align
15066 @opindex mno-data-align
15067 @opindex mconst-align
15068 @opindex mno-const-align
15069 These options (@samp{no-} options) arrange (eliminate arrangements) for the
15070 stack frame, individual data and constants to be aligned for the maximum
15071 single data access size for the chosen CPU model. The default is to
15072 arrange for 32-bit alignment. ABI details such as structure layout are
15073 not affected by these options.
15074
15075 @item -m32-bit
15076 @itemx -m16-bit
15077 @itemx -m8-bit
15078 @opindex m32-bit
15079 @opindex m16-bit
15080 @opindex m8-bit
15081 Similar to the stack- data- and const-align options above, these options
15082 arrange for stack frame, writable data and constants to all be 32-bit,
15083 16-bit or 8-bit aligned. The default is 32-bit alignment.
15084
15085 @item -mno-prologue-epilogue
15086 @itemx -mprologue-epilogue
15087 @opindex mno-prologue-epilogue
15088 @opindex mprologue-epilogue
15089 With @option{-mno-prologue-epilogue}, the normal function prologue and
15090 epilogue which set up the stack frame are omitted and no return
15091 instructions or return sequences are generated in the code. Use this
15092 option only together with visual inspection of the compiled code: no
15093 warnings or errors are generated when call-saved registers must be saved,
15094 or storage for local variables needs to be allocated.
15095
15096 @item -mno-gotplt
15097 @itemx -mgotplt
15098 @opindex mno-gotplt
15099 @opindex mgotplt
15100 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
15101 instruction sequences that load addresses for functions from the PLT part
15102 of the GOT rather than (traditional on other architectures) calls to the
15103 PLT@. The default is @option{-mgotplt}.
15104
15105 @item -melf
15106 @opindex melf
15107 Legacy no-op option only recognized with the cris-axis-elf and
15108 cris-axis-linux-gnu targets.
15109
15110 @item -mlinux
15111 @opindex mlinux
15112 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
15113
15114 @item -sim
15115 @opindex sim
15116 This option, recognized for the cris-axis-elf, arranges
15117 to link with input-output functions from a simulator library. Code,
15118 initialized data and zero-initialized data are allocated consecutively.
15119
15120 @item -sim2
15121 @opindex sim2
15122 Like @option{-sim}, but pass linker options to locate initialized data at
15123 0x40000000 and zero-initialized data at 0x80000000.
15124 @end table
15125
15126 @node CR16 Options
15127 @subsection CR16 Options
15128 @cindex CR16 Options
15129
15130 These options are defined specifically for the CR16 ports.
15131
15132 @table @gcctabopt
15133
15134 @item -mmac
15135 @opindex mmac
15136 Enable the use of multiply-accumulate instructions. Disabled by default.
15137
15138 @item -mcr16cplus
15139 @itemx -mcr16c
15140 @opindex mcr16cplus
15141 @opindex mcr16c
15142 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
15143 is default.
15144
15145 @item -msim
15146 @opindex msim
15147 Links the library libsim.a which is in compatible with simulator. Applicable
15148 to ELF compiler only.
15149
15150 @item -mint32
15151 @opindex mint32
15152 Choose integer type as 32-bit wide.
15153
15154 @item -mbit-ops
15155 @opindex mbit-ops
15156 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
15157
15158 @item -mdata-model=@var{model}
15159 @opindex mdata-model
15160 Choose a data model. The choices for @var{model} are @samp{near},
15161 @samp{far} or @samp{medium}. @samp{medium} is default.
15162 However, @samp{far} is not valid with @option{-mcr16c}, as the
15163 CR16C architecture does not support the far data model.
15164 @end table
15165
15166 @node Darwin Options
15167 @subsection Darwin Options
15168 @cindex Darwin options
15169
15170 These options are defined for all architectures running the Darwin operating
15171 system.
15172
15173 FSF GCC on Darwin does not create ``fat'' object files; it creates
15174 an object file for the single architecture that GCC was built to
15175 target. Apple's GCC on Darwin does create ``fat'' files if multiple
15176 @option{-arch} options are used; it does so by running the compiler or
15177 linker multiple times and joining the results together with
15178 @file{lipo}.
15179
15180 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
15181 @samp{i686}) is determined by the flags that specify the ISA
15182 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
15183 @option{-force_cpusubtype_ALL} option can be used to override this.
15184
15185 The Darwin tools vary in their behavior when presented with an ISA
15186 mismatch. The assembler, @file{as}, only permits instructions to
15187 be used that are valid for the subtype of the file it is generating,
15188 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
15189 The linker for shared libraries, @file{/usr/bin/libtool}, fails
15190 and prints an error if asked to create a shared library with a less
15191 restrictive subtype than its input files (for instance, trying to put
15192 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
15193 for executables, @command{ld}, quietly gives the executable the most
15194 restrictive subtype of any of its input files.
15195
15196 @table @gcctabopt
15197 @item -F@var{dir}
15198 @opindex F
15199 Add the framework directory @var{dir} to the head of the list of
15200 directories to be searched for header files. These directories are
15201 interleaved with those specified by @option{-I} options and are
15202 scanned in a left-to-right order.
15203
15204 A framework directory is a directory with frameworks in it. A
15205 framework is a directory with a @file{Headers} and/or
15206 @file{PrivateHeaders} directory contained directly in it that ends
15207 in @file{.framework}. The name of a framework is the name of this
15208 directory excluding the @file{.framework}. Headers associated with
15209 the framework are found in one of those two directories, with
15210 @file{Headers} being searched first. A subframework is a framework
15211 directory that is in a framework's @file{Frameworks} directory.
15212 Includes of subframework headers can only appear in a header of a
15213 framework that contains the subframework, or in a sibling subframework
15214 header. Two subframeworks are siblings if they occur in the same
15215 framework. A subframework should not have the same name as a
15216 framework; a warning is issued if this is violated. Currently a
15217 subframework cannot have subframeworks; in the future, the mechanism
15218 may be extended to support this. The standard frameworks can be found
15219 in @file{/System/Library/Frameworks} and
15220 @file{/Library/Frameworks}. An example include looks like
15221 @code{#include <Framework/header.h>}, where @file{Framework} denotes
15222 the name of the framework and @file{header.h} is found in the
15223 @file{PrivateHeaders} or @file{Headers} directory.
15224
15225 @item -iframework@var{dir}
15226 @opindex iframework
15227 Like @option{-F} except the directory is a treated as a system
15228 directory. The main difference between this @option{-iframework} and
15229 @option{-F} is that with @option{-iframework} the compiler does not
15230 warn about constructs contained within header files found via
15231 @var{dir}. This option is valid only for the C family of languages.
15232
15233 @item -gused
15234 @opindex gused
15235 Emit debugging information for symbols that are used. For stabs
15236 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
15237 This is by default ON@.
15238
15239 @item -gfull
15240 @opindex gfull
15241 Emit debugging information for all symbols and types.
15242
15243 @item -mmacosx-version-min=@var{version}
15244 The earliest version of MacOS X that this executable will run on
15245 is @var{version}. Typical values of @var{version} include @code{10.1},
15246 @code{10.2}, and @code{10.3.9}.
15247
15248 If the compiler was built to use the system's headers by default,
15249 then the default for this option is the system version on which the
15250 compiler is running, otherwise the default is to make choices that
15251 are compatible with as many systems and code bases as possible.
15252
15253 @item -mkernel
15254 @opindex mkernel
15255 Enable kernel development mode. The @option{-mkernel} option sets
15256 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
15257 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
15258 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
15259 applicable. This mode also sets @option{-mno-altivec},
15260 @option{-msoft-float}, @option{-fno-builtin} and
15261 @option{-mlong-branch} for PowerPC targets.
15262
15263 @item -mone-byte-bool
15264 @opindex mone-byte-bool
15265 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
15266 By default @code{sizeof(bool)} is @code{4} when compiling for
15267 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
15268 option has no effect on x86.
15269
15270 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
15271 to generate code that is not binary compatible with code generated
15272 without that switch. Using this switch may require recompiling all
15273 other modules in a program, including system libraries. Use this
15274 switch to conform to a non-default data model.
15275
15276 @item -mfix-and-continue
15277 @itemx -ffix-and-continue
15278 @itemx -findirect-data
15279 @opindex mfix-and-continue
15280 @opindex ffix-and-continue
15281 @opindex findirect-data
15282 Generate code suitable for fast turnaround development, such as to
15283 allow GDB to dynamically load @file{.o} files into already-running
15284 programs. @option{-findirect-data} and @option{-ffix-and-continue}
15285 are provided for backwards compatibility.
15286
15287 @item -all_load
15288 @opindex all_load
15289 Loads all members of static archive libraries.
15290 See man ld(1) for more information.
15291
15292 @item -arch_errors_fatal
15293 @opindex arch_errors_fatal
15294 Cause the errors having to do with files that have the wrong architecture
15295 to be fatal.
15296
15297 @item -bind_at_load
15298 @opindex bind_at_load
15299 Causes the output file to be marked such that the dynamic linker will
15300 bind all undefined references when the file is loaded or launched.
15301
15302 @item -bundle
15303 @opindex bundle
15304 Produce a Mach-o bundle format file.
15305 See man ld(1) for more information.
15306
15307 @item -bundle_loader @var{executable}
15308 @opindex bundle_loader
15309 This option specifies the @var{executable} that will load the build
15310 output file being linked. See man ld(1) for more information.
15311
15312 @item -dynamiclib
15313 @opindex dynamiclib
15314 When passed this option, GCC produces a dynamic library instead of
15315 an executable when linking, using the Darwin @file{libtool} command.
15316
15317 @item -force_cpusubtype_ALL
15318 @opindex force_cpusubtype_ALL
15319 This causes GCC's output file to have the @samp{ALL} subtype, instead of
15320 one controlled by the @option{-mcpu} or @option{-march} option.
15321
15322 @item -allowable_client @var{client_name}
15323 @itemx -client_name
15324 @itemx -compatibility_version
15325 @itemx -current_version
15326 @itemx -dead_strip
15327 @itemx -dependency-file
15328 @itemx -dylib_file
15329 @itemx -dylinker_install_name
15330 @itemx -dynamic
15331 @itemx -exported_symbols_list
15332 @itemx -filelist
15333 @need 800
15334 @itemx -flat_namespace
15335 @itemx -force_flat_namespace
15336 @itemx -headerpad_max_install_names
15337 @itemx -image_base
15338 @itemx -init
15339 @itemx -install_name
15340 @itemx -keep_private_externs
15341 @itemx -multi_module
15342 @itemx -multiply_defined
15343 @itemx -multiply_defined_unused
15344 @need 800
15345 @itemx -noall_load
15346 @itemx -no_dead_strip_inits_and_terms
15347 @itemx -nofixprebinding
15348 @itemx -nomultidefs
15349 @itemx -noprebind
15350 @itemx -noseglinkedit
15351 @itemx -pagezero_size
15352 @itemx -prebind
15353 @itemx -prebind_all_twolevel_modules
15354 @itemx -private_bundle
15355 @need 800
15356 @itemx -read_only_relocs
15357 @itemx -sectalign
15358 @itemx -sectobjectsymbols
15359 @itemx -whyload
15360 @itemx -seg1addr
15361 @itemx -sectcreate
15362 @itemx -sectobjectsymbols
15363 @itemx -sectorder
15364 @itemx -segaddr
15365 @itemx -segs_read_only_addr
15366 @need 800
15367 @itemx -segs_read_write_addr
15368 @itemx -seg_addr_table
15369 @itemx -seg_addr_table_filename
15370 @itemx -seglinkedit
15371 @itemx -segprot
15372 @itemx -segs_read_only_addr
15373 @itemx -segs_read_write_addr
15374 @itemx -single_module
15375 @itemx -static
15376 @itemx -sub_library
15377 @need 800
15378 @itemx -sub_umbrella
15379 @itemx -twolevel_namespace
15380 @itemx -umbrella
15381 @itemx -undefined
15382 @itemx -unexported_symbols_list
15383 @itemx -weak_reference_mismatches
15384 @itemx -whatsloaded
15385 @opindex allowable_client
15386 @opindex client_name
15387 @opindex compatibility_version
15388 @opindex current_version
15389 @opindex dead_strip
15390 @opindex dependency-file
15391 @opindex dylib_file
15392 @opindex dylinker_install_name
15393 @opindex dynamic
15394 @opindex exported_symbols_list
15395 @opindex filelist
15396 @opindex flat_namespace
15397 @opindex force_flat_namespace
15398 @opindex headerpad_max_install_names
15399 @opindex image_base
15400 @opindex init
15401 @opindex install_name
15402 @opindex keep_private_externs
15403 @opindex multi_module
15404 @opindex multiply_defined
15405 @opindex multiply_defined_unused
15406 @opindex noall_load
15407 @opindex no_dead_strip_inits_and_terms
15408 @opindex nofixprebinding
15409 @opindex nomultidefs
15410 @opindex noprebind
15411 @opindex noseglinkedit
15412 @opindex pagezero_size
15413 @opindex prebind
15414 @opindex prebind_all_twolevel_modules
15415 @opindex private_bundle
15416 @opindex read_only_relocs
15417 @opindex sectalign
15418 @opindex sectobjectsymbols
15419 @opindex whyload
15420 @opindex seg1addr
15421 @opindex sectcreate
15422 @opindex sectobjectsymbols
15423 @opindex sectorder
15424 @opindex segaddr
15425 @opindex segs_read_only_addr
15426 @opindex segs_read_write_addr
15427 @opindex seg_addr_table
15428 @opindex seg_addr_table_filename
15429 @opindex seglinkedit
15430 @opindex segprot
15431 @opindex segs_read_only_addr
15432 @opindex segs_read_write_addr
15433 @opindex single_module
15434 @opindex static
15435 @opindex sub_library
15436 @opindex sub_umbrella
15437 @opindex twolevel_namespace
15438 @opindex umbrella
15439 @opindex undefined
15440 @opindex unexported_symbols_list
15441 @opindex weak_reference_mismatches
15442 @opindex whatsloaded
15443 These options are passed to the Darwin linker. The Darwin linker man page
15444 describes them in detail.
15445 @end table
15446
15447 @node DEC Alpha Options
15448 @subsection DEC Alpha Options
15449
15450 These @samp{-m} options are defined for the DEC Alpha implementations:
15451
15452 @table @gcctabopt
15453 @item -mno-soft-float
15454 @itemx -msoft-float
15455 @opindex mno-soft-float
15456 @opindex msoft-float
15457 Use (do not use) the hardware floating-point instructions for
15458 floating-point operations. When @option{-msoft-float} is specified,
15459 functions in @file{libgcc.a} are used to perform floating-point
15460 operations. Unless they are replaced by routines that emulate the
15461 floating-point operations, or compiled in such a way as to call such
15462 emulations routines, these routines issue floating-point
15463 operations. If you are compiling for an Alpha without floating-point
15464 operations, you must ensure that the library is built so as not to call
15465 them.
15466
15467 Note that Alpha implementations without floating-point operations are
15468 required to have floating-point registers.
15469
15470 @item -mfp-reg
15471 @itemx -mno-fp-regs
15472 @opindex mfp-reg
15473 @opindex mno-fp-regs
15474 Generate code that uses (does not use) the floating-point register set.
15475 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
15476 register set is not used, floating-point operands are passed in integer
15477 registers as if they were integers and floating-point results are passed
15478 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
15479 so any function with a floating-point argument or return value called by code
15480 compiled with @option{-mno-fp-regs} must also be compiled with that
15481 option.
15482
15483 A typical use of this option is building a kernel that does not use,
15484 and hence need not save and restore, any floating-point registers.
15485
15486 @item -mieee
15487 @opindex mieee
15488 The Alpha architecture implements floating-point hardware optimized for
15489 maximum performance. It is mostly compliant with the IEEE floating-point
15490 standard. However, for full compliance, software assistance is
15491 required. This option generates code fully IEEE-compliant code
15492 @emph{except} that the @var{inexact-flag} is not maintained (see below).
15493 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
15494 defined during compilation. The resulting code is less efficient but is
15495 able to correctly support denormalized numbers and exceptional IEEE
15496 values such as not-a-number and plus/minus infinity. Other Alpha
15497 compilers call this option @option{-ieee_with_no_inexact}.
15498
15499 @item -mieee-with-inexact
15500 @opindex mieee-with-inexact
15501 This is like @option{-mieee} except the generated code also maintains
15502 the IEEE @var{inexact-flag}. Turning on this option causes the
15503 generated code to implement fully-compliant IEEE math. In addition to
15504 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
15505 macro. On some Alpha implementations the resulting code may execute
15506 significantly slower than the code generated by default. Since there is
15507 very little code that depends on the @var{inexact-flag}, you should
15508 normally not specify this option. Other Alpha compilers call this
15509 option @option{-ieee_with_inexact}.
15510
15511 @item -mfp-trap-mode=@var{trap-mode}
15512 @opindex mfp-trap-mode
15513 This option controls what floating-point related traps are enabled.
15514 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
15515 The trap mode can be set to one of four values:
15516
15517 @table @samp
15518 @item n
15519 This is the default (normal) setting. The only traps that are enabled
15520 are the ones that cannot be disabled in software (e.g., division by zero
15521 trap).
15522
15523 @item u
15524 In addition to the traps enabled by @samp{n}, underflow traps are enabled
15525 as well.
15526
15527 @item su
15528 Like @samp{u}, but the instructions are marked to be safe for software
15529 completion (see Alpha architecture manual for details).
15530
15531 @item sui
15532 Like @samp{su}, but inexact traps are enabled as well.
15533 @end table
15534
15535 @item -mfp-rounding-mode=@var{rounding-mode}
15536 @opindex mfp-rounding-mode
15537 Selects the IEEE rounding mode. Other Alpha compilers call this option
15538 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
15539 of:
15540
15541 @table @samp
15542 @item n
15543 Normal IEEE rounding mode. Floating-point numbers are rounded towards
15544 the nearest machine number or towards the even machine number in case
15545 of a tie.
15546
15547 @item m
15548 Round towards minus infinity.
15549
15550 @item c
15551 Chopped rounding mode. Floating-point numbers are rounded towards zero.
15552
15553 @item d
15554 Dynamic rounding mode. A field in the floating-point control register
15555 (@var{fpcr}, see Alpha architecture reference manual) controls the
15556 rounding mode in effect. The C library initializes this register for
15557 rounding towards plus infinity. Thus, unless your program modifies the
15558 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
15559 @end table
15560
15561 @item -mtrap-precision=@var{trap-precision}
15562 @opindex mtrap-precision
15563 In the Alpha architecture, floating-point traps are imprecise. This
15564 means without software assistance it is impossible to recover from a
15565 floating trap and program execution normally needs to be terminated.
15566 GCC can generate code that can assist operating system trap handlers
15567 in determining the exact location that caused a floating-point trap.
15568 Depending on the requirements of an application, different levels of
15569 precisions can be selected:
15570
15571 @table @samp
15572 @item p
15573 Program precision. This option is the default and means a trap handler
15574 can only identify which program caused a floating-point exception.
15575
15576 @item f
15577 Function precision. The trap handler can determine the function that
15578 caused a floating-point exception.
15579
15580 @item i
15581 Instruction precision. The trap handler can determine the exact
15582 instruction that caused a floating-point exception.
15583 @end table
15584
15585 Other Alpha compilers provide the equivalent options called
15586 @option{-scope_safe} and @option{-resumption_safe}.
15587
15588 @item -mieee-conformant
15589 @opindex mieee-conformant
15590 This option marks the generated code as IEEE conformant. You must not
15591 use this option unless you also specify @option{-mtrap-precision=i} and either
15592 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
15593 is to emit the line @samp{.eflag 48} in the function prologue of the
15594 generated assembly file.
15595
15596 @item -mbuild-constants
15597 @opindex mbuild-constants
15598 Normally GCC examines a 32- or 64-bit integer constant to
15599 see if it can construct it from smaller constants in two or three
15600 instructions. If it cannot, it outputs the constant as a literal and
15601 generates code to load it from the data segment at run time.
15602
15603 Use this option to require GCC to construct @emph{all} integer constants
15604 using code, even if it takes more instructions (the maximum is six).
15605
15606 You typically use this option to build a shared library dynamic
15607 loader. Itself a shared library, it must relocate itself in memory
15608 before it can find the variables and constants in its own data segment.
15609
15610 @item -mbwx
15611 @itemx -mno-bwx
15612 @itemx -mcix
15613 @itemx -mno-cix
15614 @itemx -mfix
15615 @itemx -mno-fix
15616 @itemx -mmax
15617 @itemx -mno-max
15618 @opindex mbwx
15619 @opindex mno-bwx
15620 @opindex mcix
15621 @opindex mno-cix
15622 @opindex mfix
15623 @opindex mno-fix
15624 @opindex mmax
15625 @opindex mno-max
15626 Indicate whether GCC should generate code to use the optional BWX,
15627 CIX, FIX and MAX instruction sets. The default is to use the instruction
15628 sets supported by the CPU type specified via @option{-mcpu=} option or that
15629 of the CPU on which GCC was built if none is specified.
15630
15631 @item -mfloat-vax
15632 @itemx -mfloat-ieee
15633 @opindex mfloat-vax
15634 @opindex mfloat-ieee
15635 Generate code that uses (does not use) VAX F and G floating-point
15636 arithmetic instead of IEEE single and double precision.
15637
15638 @item -mexplicit-relocs
15639 @itemx -mno-explicit-relocs
15640 @opindex mexplicit-relocs
15641 @opindex mno-explicit-relocs
15642 Older Alpha assemblers provided no way to generate symbol relocations
15643 except via assembler macros. Use of these macros does not allow
15644 optimal instruction scheduling. GNU binutils as of version 2.12
15645 supports a new syntax that allows the compiler to explicitly mark
15646 which relocations should apply to which instructions. This option
15647 is mostly useful for debugging, as GCC detects the capabilities of
15648 the assembler when it is built and sets the default accordingly.
15649
15650 @item -msmall-data
15651 @itemx -mlarge-data
15652 @opindex msmall-data
15653 @opindex mlarge-data
15654 When @option{-mexplicit-relocs} is in effect, static data is
15655 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
15656 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
15657 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
15658 16-bit relocations off of the @code{$gp} register. This limits the
15659 size of the small data area to 64KB, but allows the variables to be
15660 directly accessed via a single instruction.
15661
15662 The default is @option{-mlarge-data}. With this option the data area
15663 is limited to just below 2GB@. Programs that require more than 2GB of
15664 data must use @code{malloc} or @code{mmap} to allocate the data in the
15665 heap instead of in the program's data segment.
15666
15667 When generating code for shared libraries, @option{-fpic} implies
15668 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
15669
15670 @item -msmall-text
15671 @itemx -mlarge-text
15672 @opindex msmall-text
15673 @opindex mlarge-text
15674 When @option{-msmall-text} is used, the compiler assumes that the
15675 code of the entire program (or shared library) fits in 4MB, and is
15676 thus reachable with a branch instruction. When @option{-msmall-data}
15677 is used, the compiler can assume that all local symbols share the
15678 same @code{$gp} value, and thus reduce the number of instructions
15679 required for a function call from 4 to 1.
15680
15681 The default is @option{-mlarge-text}.
15682
15683 @item -mcpu=@var{cpu_type}
15684 @opindex mcpu
15685 Set the instruction set and instruction scheduling parameters for
15686 machine type @var{cpu_type}. You can specify either the @samp{EV}
15687 style name or the corresponding chip number. GCC supports scheduling
15688 parameters for the EV4, EV5 and EV6 family of processors and
15689 chooses the default values for the instruction set from the processor
15690 you specify. If you do not specify a processor type, GCC defaults
15691 to the processor on which the compiler was built.
15692
15693 Supported values for @var{cpu_type} are
15694
15695 @table @samp
15696 @item ev4
15697 @itemx ev45
15698 @itemx 21064
15699 Schedules as an EV4 and has no instruction set extensions.
15700
15701 @item ev5
15702 @itemx 21164
15703 Schedules as an EV5 and has no instruction set extensions.
15704
15705 @item ev56
15706 @itemx 21164a
15707 Schedules as an EV5 and supports the BWX extension.
15708
15709 @item pca56
15710 @itemx 21164pc
15711 @itemx 21164PC
15712 Schedules as an EV5 and supports the BWX and MAX extensions.
15713
15714 @item ev6
15715 @itemx 21264
15716 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
15717
15718 @item ev67
15719 @itemx 21264a
15720 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
15721 @end table
15722
15723 Native toolchains also support the value @samp{native},
15724 which selects the best architecture option for the host processor.
15725 @option{-mcpu=native} has no effect if GCC does not recognize
15726 the processor.
15727
15728 @item -mtune=@var{cpu_type}
15729 @opindex mtune
15730 Set only the instruction scheduling parameters for machine type
15731 @var{cpu_type}. The instruction set is not changed.
15732
15733 Native toolchains also support the value @samp{native},
15734 which selects the best architecture option for the host processor.
15735 @option{-mtune=native} has no effect if GCC does not recognize
15736 the processor.
15737
15738 @item -mmemory-latency=@var{time}
15739 @opindex mmemory-latency
15740 Sets the latency the scheduler should assume for typical memory
15741 references as seen by the application. This number is highly
15742 dependent on the memory access patterns used by the application
15743 and the size of the external cache on the machine.
15744
15745 Valid options for @var{time} are
15746
15747 @table @samp
15748 @item @var{number}
15749 A decimal number representing clock cycles.
15750
15751 @item L1
15752 @itemx L2
15753 @itemx L3
15754 @itemx main
15755 The compiler contains estimates of the number of clock cycles for
15756 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
15757 (also called Dcache, Scache, and Bcache), as well as to main memory.
15758 Note that L3 is only valid for EV5.
15759
15760 @end table
15761 @end table
15762
15763 @node FR30 Options
15764 @subsection FR30 Options
15765 @cindex FR30 Options
15766
15767 These options are defined specifically for the FR30 port.
15768
15769 @table @gcctabopt
15770
15771 @item -msmall-model
15772 @opindex msmall-model
15773 Use the small address space model. This can produce smaller code, but
15774 it does assume that all symbolic values and addresses fit into a
15775 20-bit range.
15776
15777 @item -mno-lsim
15778 @opindex mno-lsim
15779 Assume that runtime support has been provided and so there is no need
15780 to include the simulator library (@file{libsim.a}) on the linker
15781 command line.
15782
15783 @end table
15784
15785 @node FT32 Options
15786 @subsection FT32 Options
15787 @cindex FT32 Options
15788
15789 These options are defined specifically for the FT32 port.
15790
15791 @table @gcctabopt
15792
15793 @item -msim
15794 @opindex msim
15795 Specifies that the program will be run on the simulator. This causes
15796 an alternate runtime startup and library to be linked.
15797 You must not use this option when generating programs that will run on
15798 real hardware; you must provide your own runtime library for whatever
15799 I/O functions are needed.
15800
15801 @item -mlra
15802 @opindex mlra
15803 Enable Local Register Allocation. This is still experimental for FT32,
15804 so by default the compiler uses standard reload.
15805
15806 @end table
15807
15808 @node FRV Options
15809 @subsection FRV Options
15810 @cindex FRV Options
15811
15812 @table @gcctabopt
15813 @item -mgpr-32
15814 @opindex mgpr-32
15815
15816 Only use the first 32 general-purpose registers.
15817
15818 @item -mgpr-64
15819 @opindex mgpr-64
15820
15821 Use all 64 general-purpose registers.
15822
15823 @item -mfpr-32
15824 @opindex mfpr-32
15825
15826 Use only the first 32 floating-point registers.
15827
15828 @item -mfpr-64
15829 @opindex mfpr-64
15830
15831 Use all 64 floating-point registers.
15832
15833 @item -mhard-float
15834 @opindex mhard-float
15835
15836 Use hardware instructions for floating-point operations.
15837
15838 @item -msoft-float
15839 @opindex msoft-float
15840
15841 Use library routines for floating-point operations.
15842
15843 @item -malloc-cc
15844 @opindex malloc-cc
15845
15846 Dynamically allocate condition code registers.
15847
15848 @item -mfixed-cc
15849 @opindex mfixed-cc
15850
15851 Do not try to dynamically allocate condition code registers, only
15852 use @code{icc0} and @code{fcc0}.
15853
15854 @item -mdword
15855 @opindex mdword
15856
15857 Change ABI to use double word insns.
15858
15859 @item -mno-dword
15860 @opindex mno-dword
15861
15862 Do not use double word instructions.
15863
15864 @item -mdouble
15865 @opindex mdouble
15866
15867 Use floating-point double instructions.
15868
15869 @item -mno-double
15870 @opindex mno-double
15871
15872 Do not use floating-point double instructions.
15873
15874 @item -mmedia
15875 @opindex mmedia
15876
15877 Use media instructions.
15878
15879 @item -mno-media
15880 @opindex mno-media
15881
15882 Do not use media instructions.
15883
15884 @item -mmuladd
15885 @opindex mmuladd
15886
15887 Use multiply and add/subtract instructions.
15888
15889 @item -mno-muladd
15890 @opindex mno-muladd
15891
15892 Do not use multiply and add/subtract instructions.
15893
15894 @item -mfdpic
15895 @opindex mfdpic
15896
15897 Select the FDPIC ABI, which uses function descriptors to represent
15898 pointers to functions. Without any PIC/PIE-related options, it
15899 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
15900 assumes GOT entries and small data are within a 12-bit range from the
15901 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
15902 are computed with 32 bits.
15903 With a @samp{bfin-elf} target, this option implies @option{-msim}.
15904
15905 @item -minline-plt
15906 @opindex minline-plt
15907
15908 Enable inlining of PLT entries in function calls to functions that are
15909 not known to bind locally. It has no effect without @option{-mfdpic}.
15910 It's enabled by default if optimizing for speed and compiling for
15911 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
15912 optimization option such as @option{-O3} or above is present in the
15913 command line.
15914
15915 @item -mTLS
15916 @opindex mTLS
15917
15918 Assume a large TLS segment when generating thread-local code.
15919
15920 @item -mtls
15921 @opindex mtls
15922
15923 Do not assume a large TLS segment when generating thread-local code.
15924
15925 @item -mgprel-ro
15926 @opindex mgprel-ro
15927
15928 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
15929 that is known to be in read-only sections. It's enabled by default,
15930 except for @option{-fpic} or @option{-fpie}: even though it may help
15931 make the global offset table smaller, it trades 1 instruction for 4.
15932 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
15933 one of which may be shared by multiple symbols, and it avoids the need
15934 for a GOT entry for the referenced symbol, so it's more likely to be a
15935 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
15936
15937 @item -multilib-library-pic
15938 @opindex multilib-library-pic
15939
15940 Link with the (library, not FD) pic libraries. It's implied by
15941 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
15942 @option{-fpic} without @option{-mfdpic}. You should never have to use
15943 it explicitly.
15944
15945 @item -mlinked-fp
15946 @opindex mlinked-fp
15947
15948 Follow the EABI requirement of always creating a frame pointer whenever
15949 a stack frame is allocated. This option is enabled by default and can
15950 be disabled with @option{-mno-linked-fp}.
15951
15952 @item -mlong-calls
15953 @opindex mlong-calls
15954
15955 Use indirect addressing to call functions outside the current
15956 compilation unit. This allows the functions to be placed anywhere
15957 within the 32-bit address space.
15958
15959 @item -malign-labels
15960 @opindex malign-labels
15961
15962 Try to align labels to an 8-byte boundary by inserting NOPs into the
15963 previous packet. This option only has an effect when VLIW packing
15964 is enabled. It doesn't create new packets; it merely adds NOPs to
15965 existing ones.
15966
15967 @item -mlibrary-pic
15968 @opindex mlibrary-pic
15969
15970 Generate position-independent EABI code.
15971
15972 @item -macc-4
15973 @opindex macc-4
15974
15975 Use only the first four media accumulator registers.
15976
15977 @item -macc-8
15978 @opindex macc-8
15979
15980 Use all eight media accumulator registers.
15981
15982 @item -mpack
15983 @opindex mpack
15984
15985 Pack VLIW instructions.
15986
15987 @item -mno-pack
15988 @opindex mno-pack
15989
15990 Do not pack VLIW instructions.
15991
15992 @item -mno-eflags
15993 @opindex mno-eflags
15994
15995 Do not mark ABI switches in e_flags.
15996
15997 @item -mcond-move
15998 @opindex mcond-move
15999
16000 Enable the use of conditional-move instructions (default).
16001
16002 This switch is mainly for debugging the compiler and will likely be removed
16003 in a future version.
16004
16005 @item -mno-cond-move
16006 @opindex mno-cond-move
16007
16008 Disable the use of conditional-move instructions.
16009
16010 This switch is mainly for debugging the compiler and will likely be removed
16011 in a future version.
16012
16013 @item -mscc
16014 @opindex mscc
16015
16016 Enable the use of conditional set instructions (default).
16017
16018 This switch is mainly for debugging the compiler and will likely be removed
16019 in a future version.
16020
16021 @item -mno-scc
16022 @opindex mno-scc
16023
16024 Disable the use of conditional set instructions.
16025
16026 This switch is mainly for debugging the compiler and will likely be removed
16027 in a future version.
16028
16029 @item -mcond-exec
16030 @opindex mcond-exec
16031
16032 Enable the use of conditional execution (default).
16033
16034 This switch is mainly for debugging the compiler and will likely be removed
16035 in a future version.
16036
16037 @item -mno-cond-exec
16038 @opindex mno-cond-exec
16039
16040 Disable the use of conditional execution.
16041
16042 This switch is mainly for debugging the compiler and will likely be removed
16043 in a future version.
16044
16045 @item -mvliw-branch
16046 @opindex mvliw-branch
16047
16048 Run a pass to pack branches into VLIW instructions (default).
16049
16050 This switch is mainly for debugging the compiler and will likely be removed
16051 in a future version.
16052
16053 @item -mno-vliw-branch
16054 @opindex mno-vliw-branch
16055
16056 Do not run a pass to pack branches into VLIW instructions.
16057
16058 This switch is mainly for debugging the compiler and will likely be removed
16059 in a future version.
16060
16061 @item -mmulti-cond-exec
16062 @opindex mmulti-cond-exec
16063
16064 Enable optimization of @code{&&} and @code{||} in conditional execution
16065 (default).
16066
16067 This switch is mainly for debugging the compiler and will likely be removed
16068 in a future version.
16069
16070 @item -mno-multi-cond-exec
16071 @opindex mno-multi-cond-exec
16072
16073 Disable optimization of @code{&&} and @code{||} in conditional execution.
16074
16075 This switch is mainly for debugging the compiler and will likely be removed
16076 in a future version.
16077
16078 @item -mnested-cond-exec
16079 @opindex mnested-cond-exec
16080
16081 Enable nested conditional execution optimizations (default).
16082
16083 This switch is mainly for debugging the compiler and will likely be removed
16084 in a future version.
16085
16086 @item -mno-nested-cond-exec
16087 @opindex mno-nested-cond-exec
16088
16089 Disable nested conditional execution optimizations.
16090
16091 This switch is mainly for debugging the compiler and will likely be removed
16092 in a future version.
16093
16094 @item -moptimize-membar
16095 @opindex moptimize-membar
16096
16097 This switch removes redundant @code{membar} instructions from the
16098 compiler-generated code. It is enabled by default.
16099
16100 @item -mno-optimize-membar
16101 @opindex mno-optimize-membar
16102
16103 This switch disables the automatic removal of redundant @code{membar}
16104 instructions from the generated code.
16105
16106 @item -mtomcat-stats
16107 @opindex mtomcat-stats
16108
16109 Cause gas to print out tomcat statistics.
16110
16111 @item -mcpu=@var{cpu}
16112 @opindex mcpu
16113
16114 Select the processor type for which to generate code. Possible values are
16115 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
16116 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
16117
16118 @end table
16119
16120 @node GNU/Linux Options
16121 @subsection GNU/Linux Options
16122
16123 These @samp{-m} options are defined for GNU/Linux targets:
16124
16125 @table @gcctabopt
16126 @item -mglibc
16127 @opindex mglibc
16128 Use the GNU C library. This is the default except
16129 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
16130 @samp{*-*-linux-*android*} targets.
16131
16132 @item -muclibc
16133 @opindex muclibc
16134 Use uClibc C library. This is the default on
16135 @samp{*-*-linux-*uclibc*} targets.
16136
16137 @item -mmusl
16138 @opindex mmusl
16139 Use the musl C library. This is the default on
16140 @samp{*-*-linux-*musl*} targets.
16141
16142 @item -mbionic
16143 @opindex mbionic
16144 Use Bionic C library. This is the default on
16145 @samp{*-*-linux-*android*} targets.
16146
16147 @item -mandroid
16148 @opindex mandroid
16149 Compile code compatible with Android platform. This is the default on
16150 @samp{*-*-linux-*android*} targets.
16151
16152 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
16153 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
16154 this option makes the GCC driver pass Android-specific options to the linker.
16155 Finally, this option causes the preprocessor macro @code{__ANDROID__}
16156 to be defined.
16157
16158 @item -tno-android-cc
16159 @opindex tno-android-cc
16160 Disable compilation effects of @option{-mandroid}, i.e., do not enable
16161 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
16162 @option{-fno-rtti} by default.
16163
16164 @item -tno-android-ld
16165 @opindex tno-android-ld
16166 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
16167 linking options to the linker.
16168
16169 @end table
16170
16171 @node H8/300 Options
16172 @subsection H8/300 Options
16173
16174 These @samp{-m} options are defined for the H8/300 implementations:
16175
16176 @table @gcctabopt
16177 @item -mrelax
16178 @opindex mrelax
16179 Shorten some address references at link time, when possible; uses the
16180 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
16181 ld, Using ld}, for a fuller description.
16182
16183 @item -mh
16184 @opindex mh
16185 Generate code for the H8/300H@.
16186
16187 @item -ms
16188 @opindex ms
16189 Generate code for the H8S@.
16190
16191 @item -mn
16192 @opindex mn
16193 Generate code for the H8S and H8/300H in the normal mode. This switch
16194 must be used either with @option{-mh} or @option{-ms}.
16195
16196 @item -ms2600
16197 @opindex ms2600
16198 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
16199
16200 @item -mexr
16201 @opindex mexr
16202 Extended registers are stored on stack before execution of function
16203 with monitor attribute. Default option is @option{-mexr}.
16204 This option is valid only for H8S targets.
16205
16206 @item -mno-exr
16207 @opindex mno-exr
16208 Extended registers are not stored on stack before execution of function
16209 with monitor attribute. Default option is @option{-mno-exr}.
16210 This option is valid only for H8S targets.
16211
16212 @item -mint32
16213 @opindex mint32
16214 Make @code{int} data 32 bits by default.
16215
16216 @item -malign-300
16217 @opindex malign-300
16218 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
16219 The default for the H8/300H and H8S is to align longs and floats on
16220 4-byte boundaries.
16221 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
16222 This option has no effect on the H8/300.
16223 @end table
16224
16225 @node HPPA Options
16226 @subsection HPPA Options
16227 @cindex HPPA Options
16228
16229 These @samp{-m} options are defined for the HPPA family of computers:
16230
16231 @table @gcctabopt
16232 @item -march=@var{architecture-type}
16233 @opindex march
16234 Generate code for the specified architecture. The choices for
16235 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
16236 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
16237 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
16238 architecture option for your machine. Code compiled for lower numbered
16239 architectures runs on higher numbered architectures, but not the
16240 other way around.
16241
16242 @item -mpa-risc-1-0
16243 @itemx -mpa-risc-1-1
16244 @itemx -mpa-risc-2-0
16245 @opindex mpa-risc-1-0
16246 @opindex mpa-risc-1-1
16247 @opindex mpa-risc-2-0
16248 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
16249
16250 @item -mjump-in-delay
16251 @opindex mjump-in-delay
16252 This option is ignored and provided for compatibility purposes only.
16253
16254 @item -mdisable-fpregs
16255 @opindex mdisable-fpregs
16256 Prevent floating-point registers from being used in any manner. This is
16257 necessary for compiling kernels that perform lazy context switching of
16258 floating-point registers. If you use this option and attempt to perform
16259 floating-point operations, the compiler aborts.
16260
16261 @item -mdisable-indexing
16262 @opindex mdisable-indexing
16263 Prevent the compiler from using indexing address modes. This avoids some
16264 rather obscure problems when compiling MIG generated code under MACH@.
16265
16266 @item -mno-space-regs
16267 @opindex mno-space-regs
16268 Generate code that assumes the target has no space registers. This allows
16269 GCC to generate faster indirect calls and use unscaled index address modes.
16270
16271 Such code is suitable for level 0 PA systems and kernels.
16272
16273 @item -mfast-indirect-calls
16274 @opindex mfast-indirect-calls
16275 Generate code that assumes calls never cross space boundaries. This
16276 allows GCC to emit code that performs faster indirect calls.
16277
16278 This option does not work in the presence of shared libraries or nested
16279 functions.
16280
16281 @item -mfixed-range=@var{register-range}
16282 @opindex mfixed-range
16283 Generate code treating the given register range as fixed registers.
16284 A fixed register is one that the register allocator cannot use. This is
16285 useful when compiling kernel code. A register range is specified as
16286 two registers separated by a dash. Multiple register ranges can be
16287 specified separated by a comma.
16288
16289 @item -mlong-load-store
16290 @opindex mlong-load-store
16291 Generate 3-instruction load and store sequences as sometimes required by
16292 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
16293 the HP compilers.
16294
16295 @item -mportable-runtime
16296 @opindex mportable-runtime
16297 Use the portable calling conventions proposed by HP for ELF systems.
16298
16299 @item -mgas
16300 @opindex mgas
16301 Enable the use of assembler directives only GAS understands.
16302
16303 @item -mschedule=@var{cpu-type}
16304 @opindex mschedule
16305 Schedule code according to the constraints for the machine type
16306 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
16307 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
16308 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
16309 proper scheduling option for your machine. The default scheduling is
16310 @samp{8000}.
16311
16312 @item -mlinker-opt
16313 @opindex mlinker-opt
16314 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
16315 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
16316 linkers in which they give bogus error messages when linking some programs.
16317
16318 @item -msoft-float
16319 @opindex msoft-float
16320 Generate output containing library calls for floating point.
16321 @strong{Warning:} the requisite libraries are not available for all HPPA
16322 targets. Normally the facilities of the machine's usual C compiler are
16323 used, but this cannot be done directly in cross-compilation. You must make
16324 your own arrangements to provide suitable library functions for
16325 cross-compilation.
16326
16327 @option{-msoft-float} changes the calling convention in the output file;
16328 therefore, it is only useful if you compile @emph{all} of a program with
16329 this option. In particular, you need to compile @file{libgcc.a}, the
16330 library that comes with GCC, with @option{-msoft-float} in order for
16331 this to work.
16332
16333 @item -msio
16334 @opindex msio
16335 Generate the predefine, @code{_SIO}, for server IO@. The default is
16336 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
16337 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
16338 options are available under HP-UX and HI-UX@.
16339
16340 @item -mgnu-ld
16341 @opindex mgnu-ld
16342 Use options specific to GNU @command{ld}.
16343 This passes @option{-shared} to @command{ld} when
16344 building a shared library. It is the default when GCC is configured,
16345 explicitly or implicitly, with the GNU linker. This option does not
16346 affect which @command{ld} is called; it only changes what parameters
16347 are passed to that @command{ld}.
16348 The @command{ld} that is called is determined by the
16349 @option{--with-ld} configure option, GCC's program search path, and
16350 finally by the user's @env{PATH}. The linker used by GCC can be printed
16351 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
16352 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16353
16354 @item -mhp-ld
16355 @opindex mhp-ld
16356 Use options specific to HP @command{ld}.
16357 This passes @option{-b} to @command{ld} when building
16358 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
16359 links. It is the default when GCC is configured, explicitly or
16360 implicitly, with the HP linker. This option does not affect
16361 which @command{ld} is called; it only changes what parameters are passed to that
16362 @command{ld}.
16363 The @command{ld} that is called is determined by the @option{--with-ld}
16364 configure option, GCC's program search path, and finally by the user's
16365 @env{PATH}. The linker used by GCC can be printed using @samp{which
16366 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
16367 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16368
16369 @item -mlong-calls
16370 @opindex mno-long-calls
16371 Generate code that uses long call sequences. This ensures that a call
16372 is always able to reach linker generated stubs. The default is to generate
16373 long calls only when the distance from the call site to the beginning
16374 of the function or translation unit, as the case may be, exceeds a
16375 predefined limit set by the branch type being used. The limits for
16376 normal calls are 7,600,000 and 240,000 bytes, respectively for the
16377 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
16378 240,000 bytes.
16379
16380 Distances are measured from the beginning of functions when using the
16381 @option{-ffunction-sections} option, or when using the @option{-mgas}
16382 and @option{-mno-portable-runtime} options together under HP-UX with
16383 the SOM linker.
16384
16385 It is normally not desirable to use this option as it degrades
16386 performance. However, it may be useful in large applications,
16387 particularly when partial linking is used to build the application.
16388
16389 The types of long calls used depends on the capabilities of the
16390 assembler and linker, and the type of code being generated. The
16391 impact on systems that support long absolute calls, and long pic
16392 symbol-difference or pc-relative calls should be relatively small.
16393 However, an indirect call is used on 32-bit ELF systems in pic code
16394 and it is quite long.
16395
16396 @item -munix=@var{unix-std}
16397 @opindex march
16398 Generate compiler predefines and select a startfile for the specified
16399 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
16400 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
16401 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
16402 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
16403 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
16404 and later.
16405
16406 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
16407 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
16408 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
16409 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
16410 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
16411 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
16412
16413 It is @emph{important} to note that this option changes the interfaces
16414 for various library routines. It also affects the operational behavior
16415 of the C library. Thus, @emph{extreme} care is needed in using this
16416 option.
16417
16418 Library code that is intended to operate with more than one UNIX
16419 standard must test, set and restore the variable @code{__xpg4_extended_mask}
16420 as appropriate. Most GNU software doesn't provide this capability.
16421
16422 @item -nolibdld
16423 @opindex nolibdld
16424 Suppress the generation of link options to search libdld.sl when the
16425 @option{-static} option is specified on HP-UX 10 and later.
16426
16427 @item -static
16428 @opindex static
16429 The HP-UX implementation of setlocale in libc has a dependency on
16430 libdld.sl. There isn't an archive version of libdld.sl. Thus,
16431 when the @option{-static} option is specified, special link options
16432 are needed to resolve this dependency.
16433
16434 On HP-UX 10 and later, the GCC driver adds the necessary options to
16435 link with libdld.sl when the @option{-static} option is specified.
16436 This causes the resulting binary to be dynamic. On the 64-bit port,
16437 the linkers generate dynamic binaries by default in any case. The
16438 @option{-nolibdld} option can be used to prevent the GCC driver from
16439 adding these link options.
16440
16441 @item -threads
16442 @opindex threads
16443 Add support for multithreading with the @dfn{dce thread} library
16444 under HP-UX@. This option sets flags for both the preprocessor and
16445 linker.
16446 @end table
16447
16448 @node IA-64 Options
16449 @subsection IA-64 Options
16450 @cindex IA-64 Options
16451
16452 These are the @samp{-m} options defined for the Intel IA-64 architecture.
16453
16454 @table @gcctabopt
16455 @item -mbig-endian
16456 @opindex mbig-endian
16457 Generate code for a big-endian target. This is the default for HP-UX@.
16458
16459 @item -mlittle-endian
16460 @opindex mlittle-endian
16461 Generate code for a little-endian target. This is the default for AIX5
16462 and GNU/Linux.
16463
16464 @item -mgnu-as
16465 @itemx -mno-gnu-as
16466 @opindex mgnu-as
16467 @opindex mno-gnu-as
16468 Generate (or don't) code for the GNU assembler. This is the default.
16469 @c Also, this is the default if the configure option @option{--with-gnu-as}
16470 @c is used.
16471
16472 @item -mgnu-ld
16473 @itemx -mno-gnu-ld
16474 @opindex mgnu-ld
16475 @opindex mno-gnu-ld
16476 Generate (or don't) code for the GNU linker. This is the default.
16477 @c Also, this is the default if the configure option @option{--with-gnu-ld}
16478 @c is used.
16479
16480 @item -mno-pic
16481 @opindex mno-pic
16482 Generate code that does not use a global pointer register. The result
16483 is not position independent code, and violates the IA-64 ABI@.
16484
16485 @item -mvolatile-asm-stop
16486 @itemx -mno-volatile-asm-stop
16487 @opindex mvolatile-asm-stop
16488 @opindex mno-volatile-asm-stop
16489 Generate (or don't) a stop bit immediately before and after volatile asm
16490 statements.
16491
16492 @item -mregister-names
16493 @itemx -mno-register-names
16494 @opindex mregister-names
16495 @opindex mno-register-names
16496 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
16497 the stacked registers. This may make assembler output more readable.
16498
16499 @item -mno-sdata
16500 @itemx -msdata
16501 @opindex mno-sdata
16502 @opindex msdata
16503 Disable (or enable) optimizations that use the small data section. This may
16504 be useful for working around optimizer bugs.
16505
16506 @item -mconstant-gp
16507 @opindex mconstant-gp
16508 Generate code that uses a single constant global pointer value. This is
16509 useful when compiling kernel code.
16510
16511 @item -mauto-pic
16512 @opindex mauto-pic
16513 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
16514 This is useful when compiling firmware code.
16515
16516 @item -minline-float-divide-min-latency
16517 @opindex minline-float-divide-min-latency
16518 Generate code for inline divides of floating-point values
16519 using the minimum latency algorithm.
16520
16521 @item -minline-float-divide-max-throughput
16522 @opindex minline-float-divide-max-throughput
16523 Generate code for inline divides of floating-point values
16524 using the maximum throughput algorithm.
16525
16526 @item -mno-inline-float-divide
16527 @opindex mno-inline-float-divide
16528 Do not generate inline code for divides of floating-point values.
16529
16530 @item -minline-int-divide-min-latency
16531 @opindex minline-int-divide-min-latency
16532 Generate code for inline divides of integer values
16533 using the minimum latency algorithm.
16534
16535 @item -minline-int-divide-max-throughput
16536 @opindex minline-int-divide-max-throughput
16537 Generate code for inline divides of integer values
16538 using the maximum throughput algorithm.
16539
16540 @item -mno-inline-int-divide
16541 @opindex mno-inline-int-divide
16542 Do not generate inline code for divides of integer values.
16543
16544 @item -minline-sqrt-min-latency
16545 @opindex minline-sqrt-min-latency
16546 Generate code for inline square roots
16547 using the minimum latency algorithm.
16548
16549 @item -minline-sqrt-max-throughput
16550 @opindex minline-sqrt-max-throughput
16551 Generate code for inline square roots
16552 using the maximum throughput algorithm.
16553
16554 @item -mno-inline-sqrt
16555 @opindex mno-inline-sqrt
16556 Do not generate inline code for @code{sqrt}.
16557
16558 @item -mfused-madd
16559 @itemx -mno-fused-madd
16560 @opindex mfused-madd
16561 @opindex mno-fused-madd
16562 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
16563 instructions. The default is to use these instructions.
16564
16565 @item -mno-dwarf2-asm
16566 @itemx -mdwarf2-asm
16567 @opindex mno-dwarf2-asm
16568 @opindex mdwarf2-asm
16569 Don't (or do) generate assembler code for the DWARF line number debugging
16570 info. This may be useful when not using the GNU assembler.
16571
16572 @item -mearly-stop-bits
16573 @itemx -mno-early-stop-bits
16574 @opindex mearly-stop-bits
16575 @opindex mno-early-stop-bits
16576 Allow stop bits to be placed earlier than immediately preceding the
16577 instruction that triggered the stop bit. This can improve instruction
16578 scheduling, but does not always do so.
16579
16580 @item -mfixed-range=@var{register-range}
16581 @opindex mfixed-range
16582 Generate code treating the given register range as fixed registers.
16583 A fixed register is one that the register allocator cannot use. This is
16584 useful when compiling kernel code. A register range is specified as
16585 two registers separated by a dash. Multiple register ranges can be
16586 specified separated by a comma.
16587
16588 @item -mtls-size=@var{tls-size}
16589 @opindex mtls-size
16590 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
16591 64.
16592
16593 @item -mtune=@var{cpu-type}
16594 @opindex mtune
16595 Tune the instruction scheduling for a particular CPU, Valid values are
16596 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
16597 and @samp{mckinley}.
16598
16599 @item -milp32
16600 @itemx -mlp64
16601 @opindex milp32
16602 @opindex mlp64
16603 Generate code for a 32-bit or 64-bit environment.
16604 The 32-bit environment sets int, long and pointer to 32 bits.
16605 The 64-bit environment sets int to 32 bits and long and pointer
16606 to 64 bits. These are HP-UX specific flags.
16607
16608 @item -mno-sched-br-data-spec
16609 @itemx -msched-br-data-spec
16610 @opindex mno-sched-br-data-spec
16611 @opindex msched-br-data-spec
16612 (Dis/En)able data speculative scheduling before reload.
16613 This results in generation of @code{ld.a} instructions and
16614 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16615 The default setting is disabled.
16616
16617 @item -msched-ar-data-spec
16618 @itemx -mno-sched-ar-data-spec
16619 @opindex msched-ar-data-spec
16620 @opindex mno-sched-ar-data-spec
16621 (En/Dis)able data speculative scheduling after reload.
16622 This results in generation of @code{ld.a} instructions and
16623 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16624 The default setting is enabled.
16625
16626 @item -mno-sched-control-spec
16627 @itemx -msched-control-spec
16628 @opindex mno-sched-control-spec
16629 @opindex msched-control-spec
16630 (Dis/En)able control speculative scheduling. This feature is
16631 available only during region scheduling (i.e.@: before reload).
16632 This results in generation of the @code{ld.s} instructions and
16633 the corresponding check instructions @code{chk.s}.
16634 The default setting is disabled.
16635
16636 @item -msched-br-in-data-spec
16637 @itemx -mno-sched-br-in-data-spec
16638 @opindex msched-br-in-data-spec
16639 @opindex mno-sched-br-in-data-spec
16640 (En/Dis)able speculative scheduling of the instructions that
16641 are dependent on the data speculative loads before reload.
16642 This is effective only with @option{-msched-br-data-spec} enabled.
16643 The default setting is enabled.
16644
16645 @item -msched-ar-in-data-spec
16646 @itemx -mno-sched-ar-in-data-spec
16647 @opindex msched-ar-in-data-spec
16648 @opindex mno-sched-ar-in-data-spec
16649 (En/Dis)able speculative scheduling of the instructions that
16650 are dependent on the data speculative loads after reload.
16651 This is effective only with @option{-msched-ar-data-spec} enabled.
16652 The default setting is enabled.
16653
16654 @item -msched-in-control-spec
16655 @itemx -mno-sched-in-control-spec
16656 @opindex msched-in-control-spec
16657 @opindex mno-sched-in-control-spec
16658 (En/Dis)able speculative scheduling of the instructions that
16659 are dependent on the control speculative loads.
16660 This is effective only with @option{-msched-control-spec} enabled.
16661 The default setting is enabled.
16662
16663 @item -mno-sched-prefer-non-data-spec-insns
16664 @itemx -msched-prefer-non-data-spec-insns
16665 @opindex mno-sched-prefer-non-data-spec-insns
16666 @opindex msched-prefer-non-data-spec-insns
16667 If enabled, data-speculative instructions are chosen for schedule
16668 only if there are no other choices at the moment. This makes
16669 the use of the data speculation much more conservative.
16670 The default setting is disabled.
16671
16672 @item -mno-sched-prefer-non-control-spec-insns
16673 @itemx -msched-prefer-non-control-spec-insns
16674 @opindex mno-sched-prefer-non-control-spec-insns
16675 @opindex msched-prefer-non-control-spec-insns
16676 If enabled, control-speculative instructions are chosen for schedule
16677 only if there are no other choices at the moment. This makes
16678 the use of the control speculation much more conservative.
16679 The default setting is disabled.
16680
16681 @item -mno-sched-count-spec-in-critical-path
16682 @itemx -msched-count-spec-in-critical-path
16683 @opindex mno-sched-count-spec-in-critical-path
16684 @opindex msched-count-spec-in-critical-path
16685 If enabled, speculative dependencies are considered during
16686 computation of the instructions priorities. This makes the use of the
16687 speculation a bit more conservative.
16688 The default setting is disabled.
16689
16690 @item -msched-spec-ldc
16691 @opindex msched-spec-ldc
16692 Use a simple data speculation check. This option is on by default.
16693
16694 @item -msched-control-spec-ldc
16695 @opindex msched-spec-ldc
16696 Use a simple check for control speculation. This option is on by default.
16697
16698 @item -msched-stop-bits-after-every-cycle
16699 @opindex msched-stop-bits-after-every-cycle
16700 Place a stop bit after every cycle when scheduling. This option is on
16701 by default.
16702
16703 @item -msched-fp-mem-deps-zero-cost
16704 @opindex msched-fp-mem-deps-zero-cost
16705 Assume that floating-point stores and loads are not likely to cause a conflict
16706 when placed into the same instruction group. This option is disabled by
16707 default.
16708
16709 @item -msel-sched-dont-check-control-spec
16710 @opindex msel-sched-dont-check-control-spec
16711 Generate checks for control speculation in selective scheduling.
16712 This flag is disabled by default.
16713
16714 @item -msched-max-memory-insns=@var{max-insns}
16715 @opindex msched-max-memory-insns
16716 Limit on the number of memory insns per instruction group, giving lower
16717 priority to subsequent memory insns attempting to schedule in the same
16718 instruction group. Frequently useful to prevent cache bank conflicts.
16719 The default value is 1.
16720
16721 @item -msched-max-memory-insns-hard-limit
16722 @opindex msched-max-memory-insns-hard-limit
16723 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
16724 disallowing more than that number in an instruction group.
16725 Otherwise, the limit is ``soft'', meaning that non-memory operations
16726 are preferred when the limit is reached, but memory operations may still
16727 be scheduled.
16728
16729 @end table
16730
16731 @node LM32 Options
16732 @subsection LM32 Options
16733 @cindex LM32 options
16734
16735 These @option{-m} options are defined for the LatticeMico32 architecture:
16736
16737 @table @gcctabopt
16738 @item -mbarrel-shift-enabled
16739 @opindex mbarrel-shift-enabled
16740 Enable barrel-shift instructions.
16741
16742 @item -mdivide-enabled
16743 @opindex mdivide-enabled
16744 Enable divide and modulus instructions.
16745
16746 @item -mmultiply-enabled
16747 @opindex multiply-enabled
16748 Enable multiply instructions.
16749
16750 @item -msign-extend-enabled
16751 @opindex msign-extend-enabled
16752 Enable sign extend instructions.
16753
16754 @item -muser-enabled
16755 @opindex muser-enabled
16756 Enable user-defined instructions.
16757
16758 @end table
16759
16760 @node M32C Options
16761 @subsection M32C Options
16762 @cindex M32C options
16763
16764 @table @gcctabopt
16765 @item -mcpu=@var{name}
16766 @opindex mcpu=
16767 Select the CPU for which code is generated. @var{name} may be one of
16768 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
16769 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
16770 the M32C/80 series.
16771
16772 @item -msim
16773 @opindex msim
16774 Specifies that the program will be run on the simulator. This causes
16775 an alternate runtime library to be linked in which supports, for
16776 example, file I/O@. You must not use this option when generating
16777 programs that will run on real hardware; you must provide your own
16778 runtime library for whatever I/O functions are needed.
16779
16780 @item -memregs=@var{number}
16781 @opindex memregs=
16782 Specifies the number of memory-based pseudo-registers GCC uses
16783 during code generation. These pseudo-registers are used like real
16784 registers, so there is a tradeoff between GCC's ability to fit the
16785 code into available registers, and the performance penalty of using
16786 memory instead of registers. Note that all modules in a program must
16787 be compiled with the same value for this option. Because of that, you
16788 must not use this option with GCC's default runtime libraries.
16789
16790 @end table
16791
16792 @node M32R/D Options
16793 @subsection M32R/D Options
16794 @cindex M32R/D options
16795
16796 These @option{-m} options are defined for Renesas M32R/D architectures:
16797
16798 @table @gcctabopt
16799 @item -m32r2
16800 @opindex m32r2
16801 Generate code for the M32R/2@.
16802
16803 @item -m32rx
16804 @opindex m32rx
16805 Generate code for the M32R/X@.
16806
16807 @item -m32r
16808 @opindex m32r
16809 Generate code for the M32R@. This is the default.
16810
16811 @item -mmodel=small
16812 @opindex mmodel=small
16813 Assume all objects live in the lower 16MB of memory (so that their addresses
16814 can be loaded with the @code{ld24} instruction), and assume all subroutines
16815 are reachable with the @code{bl} instruction.
16816 This is the default.
16817
16818 The addressability of a particular object can be set with the
16819 @code{model} attribute.
16820
16821 @item -mmodel=medium
16822 @opindex mmodel=medium
16823 Assume objects may be anywhere in the 32-bit address space (the compiler
16824 generates @code{seth/add3} instructions to load their addresses), and
16825 assume all subroutines are reachable with the @code{bl} instruction.
16826
16827 @item -mmodel=large
16828 @opindex mmodel=large
16829 Assume objects may be anywhere in the 32-bit address space (the compiler
16830 generates @code{seth/add3} instructions to load their addresses), and
16831 assume subroutines may not be reachable with the @code{bl} instruction
16832 (the compiler generates the much slower @code{seth/add3/jl}
16833 instruction sequence).
16834
16835 @item -msdata=none
16836 @opindex msdata=none
16837 Disable use of the small data area. Variables are put into
16838 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
16839 @code{section} attribute has been specified).
16840 This is the default.
16841
16842 The small data area consists of sections @code{.sdata} and @code{.sbss}.
16843 Objects may be explicitly put in the small data area with the
16844 @code{section} attribute using one of these sections.
16845
16846 @item -msdata=sdata
16847 @opindex msdata=sdata
16848 Put small global and static data in the small data area, but do not
16849 generate special code to reference them.
16850
16851 @item -msdata=use
16852 @opindex msdata=use
16853 Put small global and static data in the small data area, and generate
16854 special instructions to reference them.
16855
16856 @item -G @var{num}
16857 @opindex G
16858 @cindex smaller data references
16859 Put global and static objects less than or equal to @var{num} bytes
16860 into the small data or BSS sections instead of the normal data or BSS
16861 sections. The default value of @var{num} is 8.
16862 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
16863 for this option to have any effect.
16864
16865 All modules should be compiled with the same @option{-G @var{num}} value.
16866 Compiling with different values of @var{num} may or may not work; if it
16867 doesn't the linker gives an error message---incorrect code is not
16868 generated.
16869
16870 @item -mdebug
16871 @opindex mdebug
16872 Makes the M32R-specific code in the compiler display some statistics
16873 that might help in debugging programs.
16874
16875 @item -malign-loops
16876 @opindex malign-loops
16877 Align all loops to a 32-byte boundary.
16878
16879 @item -mno-align-loops
16880 @opindex mno-align-loops
16881 Do not enforce a 32-byte alignment for loops. This is the default.
16882
16883 @item -missue-rate=@var{number}
16884 @opindex missue-rate=@var{number}
16885 Issue @var{number} instructions per cycle. @var{number} can only be 1
16886 or 2.
16887
16888 @item -mbranch-cost=@var{number}
16889 @opindex mbranch-cost=@var{number}
16890 @var{number} can only be 1 or 2. If it is 1 then branches are
16891 preferred over conditional code, if it is 2, then the opposite applies.
16892
16893 @item -mflush-trap=@var{number}
16894 @opindex mflush-trap=@var{number}
16895 Specifies the trap number to use to flush the cache. The default is
16896 12. Valid numbers are between 0 and 15 inclusive.
16897
16898 @item -mno-flush-trap
16899 @opindex mno-flush-trap
16900 Specifies that the cache cannot be flushed by using a trap.
16901
16902 @item -mflush-func=@var{name}
16903 @opindex mflush-func=@var{name}
16904 Specifies the name of the operating system function to call to flush
16905 the cache. The default is @samp{_flush_cache}, but a function call
16906 is only used if a trap is not available.
16907
16908 @item -mno-flush-func
16909 @opindex mno-flush-func
16910 Indicates that there is no OS function for flushing the cache.
16911
16912 @end table
16913
16914 @node M680x0 Options
16915 @subsection M680x0 Options
16916 @cindex M680x0 options
16917
16918 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
16919 The default settings depend on which architecture was selected when
16920 the compiler was configured; the defaults for the most common choices
16921 are given below.
16922
16923 @table @gcctabopt
16924 @item -march=@var{arch}
16925 @opindex march
16926 Generate code for a specific M680x0 or ColdFire instruction set
16927 architecture. Permissible values of @var{arch} for M680x0
16928 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
16929 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
16930 architectures are selected according to Freescale's ISA classification
16931 and the permissible values are: @samp{isaa}, @samp{isaaplus},
16932 @samp{isab} and @samp{isac}.
16933
16934 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
16935 code for a ColdFire target. The @var{arch} in this macro is one of the
16936 @option{-march} arguments given above.
16937
16938 When used together, @option{-march} and @option{-mtune} select code
16939 that runs on a family of similar processors but that is optimized
16940 for a particular microarchitecture.
16941
16942 @item -mcpu=@var{cpu}
16943 @opindex mcpu
16944 Generate code for a specific M680x0 or ColdFire processor.
16945 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
16946 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
16947 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
16948 below, which also classifies the CPUs into families:
16949
16950 @multitable @columnfractions 0.20 0.80
16951 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
16952 @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}
16953 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
16954 @item @samp{5206e} @tab @samp{5206e}
16955 @item @samp{5208} @tab @samp{5207} @samp{5208}
16956 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
16957 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
16958 @item @samp{5216} @tab @samp{5214} @samp{5216}
16959 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
16960 @item @samp{5225} @tab @samp{5224} @samp{5225}
16961 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
16962 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
16963 @item @samp{5249} @tab @samp{5249}
16964 @item @samp{5250} @tab @samp{5250}
16965 @item @samp{5271} @tab @samp{5270} @samp{5271}
16966 @item @samp{5272} @tab @samp{5272}
16967 @item @samp{5275} @tab @samp{5274} @samp{5275}
16968 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
16969 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
16970 @item @samp{5307} @tab @samp{5307}
16971 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
16972 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
16973 @item @samp{5407} @tab @samp{5407}
16974 @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}
16975 @end multitable
16976
16977 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
16978 @var{arch} is compatible with @var{cpu}. Other combinations of
16979 @option{-mcpu} and @option{-march} are rejected.
16980
16981 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
16982 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
16983 where the value of @var{family} is given by the table above.
16984
16985 @item -mtune=@var{tune}
16986 @opindex mtune
16987 Tune the code for a particular microarchitecture within the
16988 constraints set by @option{-march} and @option{-mcpu}.
16989 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
16990 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
16991 and @samp{cpu32}. The ColdFire microarchitectures
16992 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
16993
16994 You can also use @option{-mtune=68020-40} for code that needs
16995 to run relatively well on 68020, 68030 and 68040 targets.
16996 @option{-mtune=68020-60} is similar but includes 68060 targets
16997 as well. These two options select the same tuning decisions as
16998 @option{-m68020-40} and @option{-m68020-60} respectively.
16999
17000 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
17001 when tuning for 680x0 architecture @var{arch}. It also defines
17002 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
17003 option is used. If GCC is tuning for a range of architectures,
17004 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
17005 it defines the macros for every architecture in the range.
17006
17007 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
17008 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
17009 of the arguments given above.
17010
17011 @item -m68000
17012 @itemx -mc68000
17013 @opindex m68000
17014 @opindex mc68000
17015 Generate output for a 68000. This is the default
17016 when the compiler is configured for 68000-based systems.
17017 It is equivalent to @option{-march=68000}.
17018
17019 Use this option for microcontrollers with a 68000 or EC000 core,
17020 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
17021
17022 @item -m68010
17023 @opindex m68010
17024 Generate output for a 68010. This is the default
17025 when the compiler is configured for 68010-based systems.
17026 It is equivalent to @option{-march=68010}.
17027
17028 @item -m68020
17029 @itemx -mc68020
17030 @opindex m68020
17031 @opindex mc68020
17032 Generate output for a 68020. This is the default
17033 when the compiler is configured for 68020-based systems.
17034 It is equivalent to @option{-march=68020}.
17035
17036 @item -m68030
17037 @opindex m68030
17038 Generate output for a 68030. This is the default when the compiler is
17039 configured for 68030-based systems. It is equivalent to
17040 @option{-march=68030}.
17041
17042 @item -m68040
17043 @opindex m68040
17044 Generate output for a 68040. This is the default when the compiler is
17045 configured for 68040-based systems. It is equivalent to
17046 @option{-march=68040}.
17047
17048 This option inhibits the use of 68881/68882 instructions that have to be
17049 emulated by software on the 68040. Use this option if your 68040 does not
17050 have code to emulate those instructions.
17051
17052 @item -m68060
17053 @opindex m68060
17054 Generate output for a 68060. This is the default when the compiler is
17055 configured for 68060-based systems. It is equivalent to
17056 @option{-march=68060}.
17057
17058 This option inhibits the use of 68020 and 68881/68882 instructions that
17059 have to be emulated by software on the 68060. Use this option if your 68060
17060 does not have code to emulate those instructions.
17061
17062 @item -mcpu32
17063 @opindex mcpu32
17064 Generate output for a CPU32. This is the default
17065 when the compiler is configured for CPU32-based systems.
17066 It is equivalent to @option{-march=cpu32}.
17067
17068 Use this option for microcontrollers with a
17069 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
17070 68336, 68340, 68341, 68349 and 68360.
17071
17072 @item -m5200
17073 @opindex m5200
17074 Generate output for a 520X ColdFire CPU@. This is the default
17075 when the compiler is configured for 520X-based systems.
17076 It is equivalent to @option{-mcpu=5206}, and is now deprecated
17077 in favor of that option.
17078
17079 Use this option for microcontroller with a 5200 core, including
17080 the MCF5202, MCF5203, MCF5204 and MCF5206.
17081
17082 @item -m5206e
17083 @opindex m5206e
17084 Generate output for a 5206e ColdFire CPU@. The option is now
17085 deprecated in favor of the equivalent @option{-mcpu=5206e}.
17086
17087 @item -m528x
17088 @opindex m528x
17089 Generate output for a member of the ColdFire 528X family.
17090 The option is now deprecated in favor of the equivalent
17091 @option{-mcpu=528x}.
17092
17093 @item -m5307
17094 @opindex m5307
17095 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
17096 in favor of the equivalent @option{-mcpu=5307}.
17097
17098 @item -m5407
17099 @opindex m5407
17100 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
17101 in favor of the equivalent @option{-mcpu=5407}.
17102
17103 @item -mcfv4e
17104 @opindex mcfv4e
17105 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
17106 This includes use of hardware floating-point instructions.
17107 The option is equivalent to @option{-mcpu=547x}, and is now
17108 deprecated in favor of that option.
17109
17110 @item -m68020-40
17111 @opindex m68020-40
17112 Generate output for a 68040, without using any of the new instructions.
17113 This results in code that can run relatively efficiently on either a
17114 68020/68881 or a 68030 or a 68040. The generated code does use the
17115 68881 instructions that are emulated on the 68040.
17116
17117 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
17118
17119 @item -m68020-60
17120 @opindex m68020-60
17121 Generate output for a 68060, without using any of the new instructions.
17122 This results in code that can run relatively efficiently on either a
17123 68020/68881 or a 68030 or a 68040. The generated code does use the
17124 68881 instructions that are emulated on the 68060.
17125
17126 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
17127
17128 @item -mhard-float
17129 @itemx -m68881
17130 @opindex mhard-float
17131 @opindex m68881
17132 Generate floating-point instructions. This is the default for 68020
17133 and above, and for ColdFire devices that have an FPU@. It defines the
17134 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
17135 on ColdFire targets.
17136
17137 @item -msoft-float
17138 @opindex msoft-float
17139 Do not generate floating-point instructions; use library calls instead.
17140 This is the default for 68000, 68010, and 68832 targets. It is also
17141 the default for ColdFire devices that have no FPU.
17142
17143 @item -mdiv
17144 @itemx -mno-div
17145 @opindex mdiv
17146 @opindex mno-div
17147 Generate (do not generate) ColdFire hardware divide and remainder
17148 instructions. If @option{-march} is used without @option{-mcpu},
17149 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
17150 architectures. Otherwise, the default is taken from the target CPU
17151 (either the default CPU, or the one specified by @option{-mcpu}). For
17152 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
17153 @option{-mcpu=5206e}.
17154
17155 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
17156
17157 @item -mshort
17158 @opindex mshort
17159 Consider type @code{int} to be 16 bits wide, like @code{short int}.
17160 Additionally, parameters passed on the stack are also aligned to a
17161 16-bit boundary even on targets whose API mandates promotion to 32-bit.
17162
17163 @item -mno-short
17164 @opindex mno-short
17165 Do not consider type @code{int} to be 16 bits wide. This is the default.
17166
17167 @item -mnobitfield
17168 @itemx -mno-bitfield
17169 @opindex mnobitfield
17170 @opindex mno-bitfield
17171 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
17172 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
17173
17174 @item -mbitfield
17175 @opindex mbitfield
17176 Do use the bit-field instructions. The @option{-m68020} option implies
17177 @option{-mbitfield}. This is the default if you use a configuration
17178 designed for a 68020.
17179
17180 @item -mrtd
17181 @opindex mrtd
17182 Use a different function-calling convention, in which functions
17183 that take a fixed number of arguments return with the @code{rtd}
17184 instruction, which pops their arguments while returning. This
17185 saves one instruction in the caller since there is no need to pop
17186 the arguments there.
17187
17188 This calling convention is incompatible with the one normally
17189 used on Unix, so you cannot use it if you need to call libraries
17190 compiled with the Unix compiler.
17191
17192 Also, you must provide function prototypes for all functions that
17193 take variable numbers of arguments (including @code{printf});
17194 otherwise incorrect code is generated for calls to those
17195 functions.
17196
17197 In addition, seriously incorrect code results if you call a
17198 function with too many arguments. (Normally, extra arguments are
17199 harmlessly ignored.)
17200
17201 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
17202 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
17203
17204 @item -mno-rtd
17205 @opindex mno-rtd
17206 Do not use the calling conventions selected by @option{-mrtd}.
17207 This is the default.
17208
17209 @item -malign-int
17210 @itemx -mno-align-int
17211 @opindex malign-int
17212 @opindex mno-align-int
17213 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
17214 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
17215 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
17216 Aligning variables on 32-bit boundaries produces code that runs somewhat
17217 faster on processors with 32-bit busses at the expense of more memory.
17218
17219 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
17220 aligns structures containing the above types differently than
17221 most published application binary interface specifications for the m68k.
17222
17223 @item -mpcrel
17224 @opindex mpcrel
17225 Use the pc-relative addressing mode of the 68000 directly, instead of
17226 using a global offset table. At present, this option implies @option{-fpic},
17227 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
17228 not presently supported with @option{-mpcrel}, though this could be supported for
17229 68020 and higher processors.
17230
17231 @item -mno-strict-align
17232 @itemx -mstrict-align
17233 @opindex mno-strict-align
17234 @opindex mstrict-align
17235 Do not (do) assume that unaligned memory references are handled by
17236 the system.
17237
17238 @item -msep-data
17239 Generate code that allows the data segment to be located in a different
17240 area of memory from the text segment. This allows for execute-in-place in
17241 an environment without virtual memory management. This option implies
17242 @option{-fPIC}.
17243
17244 @item -mno-sep-data
17245 Generate code that assumes that the data segment follows the text segment.
17246 This is the default.
17247
17248 @item -mid-shared-library
17249 Generate code that supports shared libraries via the library ID method.
17250 This allows for execute-in-place and shared libraries in an environment
17251 without virtual memory management. This option implies @option{-fPIC}.
17252
17253 @item -mno-id-shared-library
17254 Generate code that doesn't assume ID-based shared libraries are being used.
17255 This is the default.
17256
17257 @item -mshared-library-id=n
17258 Specifies the identification number of the ID-based shared library being
17259 compiled. Specifying a value of 0 generates more compact code; specifying
17260 other values forces the allocation of that number to the current
17261 library, but is no more space- or time-efficient than omitting this option.
17262
17263 @item -mxgot
17264 @itemx -mno-xgot
17265 @opindex mxgot
17266 @opindex mno-xgot
17267 When generating position-independent code for ColdFire, generate code
17268 that works if the GOT has more than 8192 entries. This code is
17269 larger and slower than code generated without this option. On M680x0
17270 processors, this option is not needed; @option{-fPIC} suffices.
17271
17272 GCC normally uses a single instruction to load values from the GOT@.
17273 While this is relatively efficient, it only works if the GOT
17274 is smaller than about 64k. Anything larger causes the linker
17275 to report an error such as:
17276
17277 @cindex relocation truncated to fit (ColdFire)
17278 @smallexample
17279 relocation truncated to fit: R_68K_GOT16O foobar
17280 @end smallexample
17281
17282 If this happens, you should recompile your code with @option{-mxgot}.
17283 It should then work with very large GOTs. However, code generated with
17284 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
17285 the value of a global symbol.
17286
17287 Note that some linkers, including newer versions of the GNU linker,
17288 can create multiple GOTs and sort GOT entries. If you have such a linker,
17289 you should only need to use @option{-mxgot} when compiling a single
17290 object file that accesses more than 8192 GOT entries. Very few do.
17291
17292 These options have no effect unless GCC is generating
17293 position-independent code.
17294
17295 @end table
17296
17297 @node MCore Options
17298 @subsection MCore Options
17299 @cindex MCore options
17300
17301 These are the @samp{-m} options defined for the Motorola M*Core
17302 processors.
17303
17304 @table @gcctabopt
17305
17306 @item -mhardlit
17307 @itemx -mno-hardlit
17308 @opindex mhardlit
17309 @opindex mno-hardlit
17310 Inline constants into the code stream if it can be done in two
17311 instructions or less.
17312
17313 @item -mdiv
17314 @itemx -mno-div
17315 @opindex mdiv
17316 @opindex mno-div
17317 Use the divide instruction. (Enabled by default).
17318
17319 @item -mrelax-immediate
17320 @itemx -mno-relax-immediate
17321 @opindex mrelax-immediate
17322 @opindex mno-relax-immediate
17323 Allow arbitrary-sized immediates in bit operations.
17324
17325 @item -mwide-bitfields
17326 @itemx -mno-wide-bitfields
17327 @opindex mwide-bitfields
17328 @opindex mno-wide-bitfields
17329 Always treat bit-fields as @code{int}-sized.
17330
17331 @item -m4byte-functions
17332 @itemx -mno-4byte-functions
17333 @opindex m4byte-functions
17334 @opindex mno-4byte-functions
17335 Force all functions to be aligned to a 4-byte boundary.
17336
17337 @item -mcallgraph-data
17338 @itemx -mno-callgraph-data
17339 @opindex mcallgraph-data
17340 @opindex mno-callgraph-data
17341 Emit callgraph information.
17342
17343 @item -mslow-bytes
17344 @itemx -mno-slow-bytes
17345 @opindex mslow-bytes
17346 @opindex mno-slow-bytes
17347 Prefer word access when reading byte quantities.
17348
17349 @item -mlittle-endian
17350 @itemx -mbig-endian
17351 @opindex mlittle-endian
17352 @opindex mbig-endian
17353 Generate code for a little-endian target.
17354
17355 @item -m210
17356 @itemx -m340
17357 @opindex m210
17358 @opindex m340
17359 Generate code for the 210 processor.
17360
17361 @item -mno-lsim
17362 @opindex mno-lsim
17363 Assume that runtime support has been provided and so omit the
17364 simulator library (@file{libsim.a)} from the linker command line.
17365
17366 @item -mstack-increment=@var{size}
17367 @opindex mstack-increment
17368 Set the maximum amount for a single stack increment operation. Large
17369 values can increase the speed of programs that contain functions
17370 that need a large amount of stack space, but they can also trigger a
17371 segmentation fault if the stack is extended too much. The default
17372 value is 0x1000.
17373
17374 @end table
17375
17376 @node MeP Options
17377 @subsection MeP Options
17378 @cindex MeP options
17379
17380 @table @gcctabopt
17381
17382 @item -mabsdiff
17383 @opindex mabsdiff
17384 Enables the @code{abs} instruction, which is the absolute difference
17385 between two registers.
17386
17387 @item -mall-opts
17388 @opindex mall-opts
17389 Enables all the optional instructions---average, multiply, divide, bit
17390 operations, leading zero, absolute difference, min/max, clip, and
17391 saturation.
17392
17393
17394 @item -maverage
17395 @opindex maverage
17396 Enables the @code{ave} instruction, which computes the average of two
17397 registers.
17398
17399 @item -mbased=@var{n}
17400 @opindex mbased=
17401 Variables of size @var{n} bytes or smaller are placed in the
17402 @code{.based} section by default. Based variables use the @code{$tp}
17403 register as a base register, and there is a 128-byte limit to the
17404 @code{.based} section.
17405
17406 @item -mbitops
17407 @opindex mbitops
17408 Enables the bit operation instructions---bit test (@code{btstm}), set
17409 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
17410 test-and-set (@code{tas}).
17411
17412 @item -mc=@var{name}
17413 @opindex mc=
17414 Selects which section constant data is placed in. @var{name} may
17415 be @samp{tiny}, @samp{near}, or @samp{far}.
17416
17417 @item -mclip
17418 @opindex mclip
17419 Enables the @code{clip} instruction. Note that @option{-mclip} is not
17420 useful unless you also provide @option{-mminmax}.
17421
17422 @item -mconfig=@var{name}
17423 @opindex mconfig=
17424 Selects one of the built-in core configurations. Each MeP chip has
17425 one or more modules in it; each module has a core CPU and a variety of
17426 coprocessors, optional instructions, and peripherals. The
17427 @code{MeP-Integrator} tool, not part of GCC, provides these
17428 configurations through this option; using this option is the same as
17429 using all the corresponding command-line options. The default
17430 configuration is @samp{default}.
17431
17432 @item -mcop
17433 @opindex mcop
17434 Enables the coprocessor instructions. By default, this is a 32-bit
17435 coprocessor. Note that the coprocessor is normally enabled via the
17436 @option{-mconfig=} option.
17437
17438 @item -mcop32
17439 @opindex mcop32
17440 Enables the 32-bit coprocessor's instructions.
17441
17442 @item -mcop64
17443 @opindex mcop64
17444 Enables the 64-bit coprocessor's instructions.
17445
17446 @item -mivc2
17447 @opindex mivc2
17448 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
17449
17450 @item -mdc
17451 @opindex mdc
17452 Causes constant variables to be placed in the @code{.near} section.
17453
17454 @item -mdiv
17455 @opindex mdiv
17456 Enables the @code{div} and @code{divu} instructions.
17457
17458 @item -meb
17459 @opindex meb
17460 Generate big-endian code.
17461
17462 @item -mel
17463 @opindex mel
17464 Generate little-endian code.
17465
17466 @item -mio-volatile
17467 @opindex mio-volatile
17468 Tells the compiler that any variable marked with the @code{io}
17469 attribute is to be considered volatile.
17470
17471 @item -ml
17472 @opindex ml
17473 Causes variables to be assigned to the @code{.far} section by default.
17474
17475 @item -mleadz
17476 @opindex mleadz
17477 Enables the @code{leadz} (leading zero) instruction.
17478
17479 @item -mm
17480 @opindex mm
17481 Causes variables to be assigned to the @code{.near} section by default.
17482
17483 @item -mminmax
17484 @opindex mminmax
17485 Enables the @code{min} and @code{max} instructions.
17486
17487 @item -mmult
17488 @opindex mmult
17489 Enables the multiplication and multiply-accumulate instructions.
17490
17491 @item -mno-opts
17492 @opindex mno-opts
17493 Disables all the optional instructions enabled by @option{-mall-opts}.
17494
17495 @item -mrepeat
17496 @opindex mrepeat
17497 Enables the @code{repeat} and @code{erepeat} instructions, used for
17498 low-overhead looping.
17499
17500 @item -ms
17501 @opindex ms
17502 Causes all variables to default to the @code{.tiny} section. Note
17503 that there is a 65536-byte limit to this section. Accesses to these
17504 variables use the @code{%gp} base register.
17505
17506 @item -msatur
17507 @opindex msatur
17508 Enables the saturation instructions. Note that the compiler does not
17509 currently generate these itself, but this option is included for
17510 compatibility with other tools, like @code{as}.
17511
17512 @item -msdram
17513 @opindex msdram
17514 Link the SDRAM-based runtime instead of the default ROM-based runtime.
17515
17516 @item -msim
17517 @opindex msim
17518 Link the simulator run-time libraries.
17519
17520 @item -msimnovec
17521 @opindex msimnovec
17522 Link the simulator runtime libraries, excluding built-in support
17523 for reset and exception vectors and tables.
17524
17525 @item -mtf
17526 @opindex mtf
17527 Causes all functions to default to the @code{.far} section. Without
17528 this option, functions default to the @code{.near} section.
17529
17530 @item -mtiny=@var{n}
17531 @opindex mtiny=
17532 Variables that are @var{n} bytes or smaller are allocated to the
17533 @code{.tiny} section. These variables use the @code{$gp} base
17534 register. The default for this option is 4, but note that there's a
17535 65536-byte limit to the @code{.tiny} section.
17536
17537 @end table
17538
17539 @node MicroBlaze Options
17540 @subsection MicroBlaze Options
17541 @cindex MicroBlaze Options
17542
17543 @table @gcctabopt
17544
17545 @item -msoft-float
17546 @opindex msoft-float
17547 Use software emulation for floating point (default).
17548
17549 @item -mhard-float
17550 @opindex mhard-float
17551 Use hardware floating-point instructions.
17552
17553 @item -mmemcpy
17554 @opindex mmemcpy
17555 Do not optimize block moves, use @code{memcpy}.
17556
17557 @item -mno-clearbss
17558 @opindex mno-clearbss
17559 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
17560
17561 @item -mcpu=@var{cpu-type}
17562 @opindex mcpu=
17563 Use features of, and schedule code for, the given CPU.
17564 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
17565 where @var{X} is a major version, @var{YY} is the minor version, and
17566 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
17567 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
17568
17569 @item -mxl-soft-mul
17570 @opindex mxl-soft-mul
17571 Use software multiply emulation (default).
17572
17573 @item -mxl-soft-div
17574 @opindex mxl-soft-div
17575 Use software emulation for divides (default).
17576
17577 @item -mxl-barrel-shift
17578 @opindex mxl-barrel-shift
17579 Use the hardware barrel shifter.
17580
17581 @item -mxl-pattern-compare
17582 @opindex mxl-pattern-compare
17583 Use pattern compare instructions.
17584
17585 @item -msmall-divides
17586 @opindex msmall-divides
17587 Use table lookup optimization for small signed integer divisions.
17588
17589 @item -mxl-stack-check
17590 @opindex mxl-stack-check
17591 This option is deprecated. Use @option{-fstack-check} instead.
17592
17593 @item -mxl-gp-opt
17594 @opindex mxl-gp-opt
17595 Use GP-relative @code{.sdata}/@code{.sbss} sections.
17596
17597 @item -mxl-multiply-high
17598 @opindex mxl-multiply-high
17599 Use multiply high instructions for high part of 32x32 multiply.
17600
17601 @item -mxl-float-convert
17602 @opindex mxl-float-convert
17603 Use hardware floating-point conversion instructions.
17604
17605 @item -mxl-float-sqrt
17606 @opindex mxl-float-sqrt
17607 Use hardware floating-point square root instruction.
17608
17609 @item -mbig-endian
17610 @opindex mbig-endian
17611 Generate code for a big-endian target.
17612
17613 @item -mlittle-endian
17614 @opindex mlittle-endian
17615 Generate code for a little-endian target.
17616
17617 @item -mxl-reorder
17618 @opindex mxl-reorder
17619 Use reorder instructions (swap and byte reversed load/store).
17620
17621 @item -mxl-mode-@var{app-model}
17622 Select application model @var{app-model}. Valid models are
17623 @table @samp
17624 @item executable
17625 normal executable (default), uses startup code @file{crt0.o}.
17626
17627 @item xmdstub
17628 for use with Xilinx Microprocessor Debugger (XMD) based
17629 software intrusive debug agent called xmdstub. This uses startup file
17630 @file{crt1.o} and sets the start address of the program to 0x800.
17631
17632 @item bootstrap
17633 for applications that are loaded using a bootloader.
17634 This model uses startup file @file{crt2.o} which does not contain a processor
17635 reset vector handler. This is suitable for transferring control on a
17636 processor reset to the bootloader rather than the application.
17637
17638 @item novectors
17639 for applications that do not require any of the
17640 MicroBlaze vectors. This option may be useful for applications running
17641 within a monitoring application. This model uses @file{crt3.o} as a startup file.
17642 @end table
17643
17644 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
17645 @option{-mxl-mode-@var{app-model}}.
17646
17647 @end table
17648
17649 @node MIPS Options
17650 @subsection MIPS Options
17651 @cindex MIPS options
17652
17653 @table @gcctabopt
17654
17655 @item -EB
17656 @opindex EB
17657 Generate big-endian code.
17658
17659 @item -EL
17660 @opindex EL
17661 Generate little-endian code. This is the default for @samp{mips*el-*-*}
17662 configurations.
17663
17664 @item -march=@var{arch}
17665 @opindex march
17666 Generate code that runs on @var{arch}, which can be the name of a
17667 generic MIPS ISA, or the name of a particular processor.
17668 The ISA names are:
17669 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
17670 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
17671 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
17672 @samp{mips64r5} and @samp{mips64r6}.
17673 The processor names are:
17674 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
17675 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
17676 @samp{5kc}, @samp{5kf},
17677 @samp{20kc},
17678 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
17679 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
17680 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
17681 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
17682 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
17683 @samp{i6400},
17684 @samp{interaptiv},
17685 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
17686 @samp{m4k},
17687 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
17688 @samp{m5100}, @samp{m5101},
17689 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
17690 @samp{orion},
17691 @samp{p5600},
17692 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
17693 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
17694 @samp{rm7000}, @samp{rm9000},
17695 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
17696 @samp{sb1},
17697 @samp{sr71000},
17698 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
17699 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
17700 @samp{xlr} and @samp{xlp}.
17701 The special value @samp{from-abi} selects the
17702 most compatible architecture for the selected ABI (that is,
17703 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
17704
17705 The native Linux/GNU toolchain also supports the value @samp{native},
17706 which selects the best architecture option for the host processor.
17707 @option{-march=native} has no effect if GCC does not recognize
17708 the processor.
17709
17710 In processor names, a final @samp{000} can be abbreviated as @samp{k}
17711 (for example, @option{-march=r2k}). Prefixes are optional, and
17712 @samp{vr} may be written @samp{r}.
17713
17714 Names of the form @samp{@var{n}f2_1} refer to processors with
17715 FPUs clocked at half the rate of the core, names of the form
17716 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
17717 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
17718 processors with FPUs clocked a ratio of 3:2 with respect to the core.
17719 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
17720 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
17721 accepted as synonyms for @samp{@var{n}f1_1}.
17722
17723 GCC defines two macros based on the value of this option. The first
17724 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
17725 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
17726 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
17727 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
17728 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
17729
17730 Note that the @code{_MIPS_ARCH} macro uses the processor names given
17731 above. In other words, it has the full prefix and does not
17732 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
17733 the macro names the resolved architecture (either @code{"mips1"} or
17734 @code{"mips3"}). It names the default architecture when no
17735 @option{-march} option is given.
17736
17737 @item -mtune=@var{arch}
17738 @opindex mtune
17739 Optimize for @var{arch}. Among other things, this option controls
17740 the way instructions are scheduled, and the perceived cost of arithmetic
17741 operations. The list of @var{arch} values is the same as for
17742 @option{-march}.
17743
17744 When this option is not used, GCC optimizes for the processor
17745 specified by @option{-march}. By using @option{-march} and
17746 @option{-mtune} together, it is possible to generate code that
17747 runs on a family of processors, but optimize the code for one
17748 particular member of that family.
17749
17750 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
17751 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
17752 @option{-march} ones described above.
17753
17754 @item -mips1
17755 @opindex mips1
17756 Equivalent to @option{-march=mips1}.
17757
17758 @item -mips2
17759 @opindex mips2
17760 Equivalent to @option{-march=mips2}.
17761
17762 @item -mips3
17763 @opindex mips3
17764 Equivalent to @option{-march=mips3}.
17765
17766 @item -mips4
17767 @opindex mips4
17768 Equivalent to @option{-march=mips4}.
17769
17770 @item -mips32
17771 @opindex mips32
17772 Equivalent to @option{-march=mips32}.
17773
17774 @item -mips32r3
17775 @opindex mips32r3
17776 Equivalent to @option{-march=mips32r3}.
17777
17778 @item -mips32r5
17779 @opindex mips32r5
17780 Equivalent to @option{-march=mips32r5}.
17781
17782 @item -mips32r6
17783 @opindex mips32r6
17784 Equivalent to @option{-march=mips32r6}.
17785
17786 @item -mips64
17787 @opindex mips64
17788 Equivalent to @option{-march=mips64}.
17789
17790 @item -mips64r2
17791 @opindex mips64r2
17792 Equivalent to @option{-march=mips64r2}.
17793
17794 @item -mips64r3
17795 @opindex mips64r3
17796 Equivalent to @option{-march=mips64r3}.
17797
17798 @item -mips64r5
17799 @opindex mips64r5
17800 Equivalent to @option{-march=mips64r5}.
17801
17802 @item -mips64r6
17803 @opindex mips64r6
17804 Equivalent to @option{-march=mips64r6}.
17805
17806 @item -mips16
17807 @itemx -mno-mips16
17808 @opindex mips16
17809 @opindex mno-mips16
17810 Generate (do not generate) MIPS16 code. If GCC is targeting a
17811 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
17812
17813 MIPS16 code generation can also be controlled on a per-function basis
17814 by means of @code{mips16} and @code{nomips16} attributes.
17815 @xref{Function Attributes}, for more information.
17816
17817 @item -mflip-mips16
17818 @opindex mflip-mips16
17819 Generate MIPS16 code on alternating functions. This option is provided
17820 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
17821 not intended for ordinary use in compiling user code.
17822
17823 @item -minterlink-compressed
17824 @item -mno-interlink-compressed
17825 @opindex minterlink-compressed
17826 @opindex mno-interlink-compressed
17827 Require (do not require) that code using the standard (uncompressed) MIPS ISA
17828 be link-compatible with MIPS16 and microMIPS code, and vice versa.
17829
17830 For example, code using the standard ISA encoding cannot jump directly
17831 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
17832 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
17833 knows that the target of the jump is not compressed.
17834
17835 @item -minterlink-mips16
17836 @itemx -mno-interlink-mips16
17837 @opindex minterlink-mips16
17838 @opindex mno-interlink-mips16
17839 Aliases of @option{-minterlink-compressed} and
17840 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
17841 and are retained for backwards compatibility.
17842
17843 @item -mabi=32
17844 @itemx -mabi=o64
17845 @itemx -mabi=n32
17846 @itemx -mabi=64
17847 @itemx -mabi=eabi
17848 @opindex mabi=32
17849 @opindex mabi=o64
17850 @opindex mabi=n32
17851 @opindex mabi=64
17852 @opindex mabi=eabi
17853 Generate code for the given ABI@.
17854
17855 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
17856 generates 64-bit code when you select a 64-bit architecture, but you
17857 can use @option{-mgp32} to get 32-bit code instead.
17858
17859 For information about the O64 ABI, see
17860 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
17861
17862 GCC supports a variant of the o32 ABI in which floating-point registers
17863 are 64 rather than 32 bits wide. You can select this combination with
17864 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
17865 and @code{mfhc1} instructions and is therefore only supported for
17866 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
17867
17868 The register assignments for arguments and return values remain the
17869 same, but each scalar value is passed in a single 64-bit register
17870 rather than a pair of 32-bit registers. For example, scalar
17871 floating-point values are returned in @samp{$f0} only, not a
17872 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
17873 remains the same in that the even-numbered double-precision registers
17874 are saved.
17875
17876 Two additional variants of the o32 ABI are supported to enable
17877 a transition from 32-bit to 64-bit registers. These are FPXX
17878 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
17879 The FPXX extension mandates that all code must execute correctly
17880 when run using 32-bit or 64-bit registers. The code can be interlinked
17881 with either FP32 or FP64, but not both.
17882 The FP64A extension is similar to the FP64 extension but forbids the
17883 use of odd-numbered single-precision registers. This can be used
17884 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
17885 processors and allows both FP32 and FP64A code to interlink and
17886 run in the same process without changing FPU modes.
17887
17888 @item -mabicalls
17889 @itemx -mno-abicalls
17890 @opindex mabicalls
17891 @opindex mno-abicalls
17892 Generate (do not generate) code that is suitable for SVR4-style
17893 dynamic objects. @option{-mabicalls} is the default for SVR4-based
17894 systems.
17895
17896 @item -mshared
17897 @itemx -mno-shared
17898 Generate (do not generate) code that is fully position-independent,
17899 and that can therefore be linked into shared libraries. This option
17900 only affects @option{-mabicalls}.
17901
17902 All @option{-mabicalls} code has traditionally been position-independent,
17903 regardless of options like @option{-fPIC} and @option{-fpic}. However,
17904 as an extension, the GNU toolchain allows executables to use absolute
17905 accesses for locally-binding symbols. It can also use shorter GP
17906 initialization sequences and generate direct calls to locally-defined
17907 functions. This mode is selected by @option{-mno-shared}.
17908
17909 @option{-mno-shared} depends on binutils 2.16 or higher and generates
17910 objects that can only be linked by the GNU linker. However, the option
17911 does not affect the ABI of the final executable; it only affects the ABI
17912 of relocatable objects. Using @option{-mno-shared} generally makes
17913 executables both smaller and quicker.
17914
17915 @option{-mshared} is the default.
17916
17917 @item -mplt
17918 @itemx -mno-plt
17919 @opindex mplt
17920 @opindex mno-plt
17921 Assume (do not assume) that the static and dynamic linkers
17922 support PLTs and copy relocations. This option only affects
17923 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
17924 has no effect without @option{-msym32}.
17925
17926 You can make @option{-mplt} the default by configuring
17927 GCC with @option{--with-mips-plt}. The default is
17928 @option{-mno-plt} otherwise.
17929
17930 @item -mxgot
17931 @itemx -mno-xgot
17932 @opindex mxgot
17933 @opindex mno-xgot
17934 Lift (do not lift) the usual restrictions on the size of the global
17935 offset table.
17936
17937 GCC normally uses a single instruction to load values from the GOT@.
17938 While this is relatively efficient, it only works if the GOT
17939 is smaller than about 64k. Anything larger causes the linker
17940 to report an error such as:
17941
17942 @cindex relocation truncated to fit (MIPS)
17943 @smallexample
17944 relocation truncated to fit: R_MIPS_GOT16 foobar
17945 @end smallexample
17946
17947 If this happens, you should recompile your code with @option{-mxgot}.
17948 This works with very large GOTs, although the code is also
17949 less efficient, since it takes three instructions to fetch the
17950 value of a global symbol.
17951
17952 Note that some linkers can create multiple GOTs. If you have such a
17953 linker, you should only need to use @option{-mxgot} when a single object
17954 file accesses more than 64k's worth of GOT entries. Very few do.
17955
17956 These options have no effect unless GCC is generating position
17957 independent code.
17958
17959 @item -mgp32
17960 @opindex mgp32
17961 Assume that general-purpose registers are 32 bits wide.
17962
17963 @item -mgp64
17964 @opindex mgp64
17965 Assume that general-purpose registers are 64 bits wide.
17966
17967 @item -mfp32
17968 @opindex mfp32
17969 Assume that floating-point registers are 32 bits wide.
17970
17971 @item -mfp64
17972 @opindex mfp64
17973 Assume that floating-point registers are 64 bits wide.
17974
17975 @item -mfpxx
17976 @opindex mfpxx
17977 Do not assume the width of floating-point registers.
17978
17979 @item -mhard-float
17980 @opindex mhard-float
17981 Use floating-point coprocessor instructions.
17982
17983 @item -msoft-float
17984 @opindex msoft-float
17985 Do not use floating-point coprocessor instructions. Implement
17986 floating-point calculations using library calls instead.
17987
17988 @item -mno-float
17989 @opindex mno-float
17990 Equivalent to @option{-msoft-float}, but additionally asserts that the
17991 program being compiled does not perform any floating-point operations.
17992 This option is presently supported only by some bare-metal MIPS
17993 configurations, where it may select a special set of libraries
17994 that lack all floating-point support (including, for example, the
17995 floating-point @code{printf} formats).
17996 If code compiled with @option{-mno-float} accidentally contains
17997 floating-point operations, it is likely to suffer a link-time
17998 or run-time failure.
17999
18000 @item -msingle-float
18001 @opindex msingle-float
18002 Assume that the floating-point coprocessor only supports single-precision
18003 operations.
18004
18005 @item -mdouble-float
18006 @opindex mdouble-float
18007 Assume that the floating-point coprocessor supports double-precision
18008 operations. This is the default.
18009
18010 @item -modd-spreg
18011 @itemx -mno-odd-spreg
18012 @opindex modd-spreg
18013 @opindex mno-odd-spreg
18014 Enable the use of odd-numbered single-precision floating-point registers
18015 for the o32 ABI. This is the default for processors that are known to
18016 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
18017 is set by default.
18018
18019 @item -mabs=2008
18020 @itemx -mabs=legacy
18021 @opindex mabs=2008
18022 @opindex mabs=legacy
18023 These options control the treatment of the special not-a-number (NaN)
18024 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
18025 @code{neg.@i{fmt}} machine instructions.
18026
18027 By default or when @option{-mabs=legacy} is used the legacy
18028 treatment is selected. In this case these instructions are considered
18029 arithmetic and avoided where correct operation is required and the
18030 input operand might be a NaN. A longer sequence of instructions that
18031 manipulate the sign bit of floating-point datum manually is used
18032 instead unless the @option{-ffinite-math-only} option has also been
18033 specified.
18034
18035 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
18036 this case these instructions are considered non-arithmetic and therefore
18037 operating correctly in all cases, including in particular where the
18038 input operand is a NaN. These instructions are therefore always used
18039 for the respective operations.
18040
18041 @item -mnan=2008
18042 @itemx -mnan=legacy
18043 @opindex mnan=2008
18044 @opindex mnan=legacy
18045 These options control the encoding of the special not-a-number (NaN)
18046 IEEE 754 floating-point data.
18047
18048 The @option{-mnan=legacy} option selects the legacy encoding. In this
18049 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
18050 significand field being 0, whereas signalling NaNs (sNaNs) are denoted
18051 by the first bit of their trailing significand field being 1.
18052
18053 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
18054 this case qNaNs are denoted by the first bit of their trailing
18055 significand field being 1, whereas sNaNs are denoted by the first bit of
18056 their trailing significand field being 0.
18057
18058 The default is @option{-mnan=legacy} unless GCC has been configured with
18059 @option{--with-nan=2008}.
18060
18061 @item -mllsc
18062 @itemx -mno-llsc
18063 @opindex mllsc
18064 @opindex mno-llsc
18065 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
18066 implement atomic memory built-in functions. When neither option is
18067 specified, GCC uses the instructions if the target architecture
18068 supports them.
18069
18070 @option{-mllsc} is useful if the runtime environment can emulate the
18071 instructions and @option{-mno-llsc} can be useful when compiling for
18072 nonstandard ISAs. You can make either option the default by
18073 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
18074 respectively. @option{--with-llsc} is the default for some
18075 configurations; see the installation documentation for details.
18076
18077 @item -mdsp
18078 @itemx -mno-dsp
18079 @opindex mdsp
18080 @opindex mno-dsp
18081 Use (do not use) revision 1 of the MIPS DSP ASE@.
18082 @xref{MIPS DSP Built-in Functions}. This option defines the
18083 preprocessor macro @code{__mips_dsp}. It also defines
18084 @code{__mips_dsp_rev} to 1.
18085
18086 @item -mdspr2
18087 @itemx -mno-dspr2
18088 @opindex mdspr2
18089 @opindex mno-dspr2
18090 Use (do not use) revision 2 of the MIPS DSP ASE@.
18091 @xref{MIPS DSP Built-in Functions}. This option defines the
18092 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
18093 It also defines @code{__mips_dsp_rev} to 2.
18094
18095 @item -msmartmips
18096 @itemx -mno-smartmips
18097 @opindex msmartmips
18098 @opindex mno-smartmips
18099 Use (do not use) the MIPS SmartMIPS ASE.
18100
18101 @item -mpaired-single
18102 @itemx -mno-paired-single
18103 @opindex mpaired-single
18104 @opindex mno-paired-single
18105 Use (do not use) paired-single floating-point instructions.
18106 @xref{MIPS Paired-Single Support}. This option requires
18107 hardware floating-point support to be enabled.
18108
18109 @item -mdmx
18110 @itemx -mno-mdmx
18111 @opindex mdmx
18112 @opindex mno-mdmx
18113 Use (do not use) MIPS Digital Media Extension instructions.
18114 This option can only be used when generating 64-bit code and requires
18115 hardware floating-point support to be enabled.
18116
18117 @item -mips3d
18118 @itemx -mno-mips3d
18119 @opindex mips3d
18120 @opindex mno-mips3d
18121 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
18122 The option @option{-mips3d} implies @option{-mpaired-single}.
18123
18124 @item -mmicromips
18125 @itemx -mno-micromips
18126 @opindex mmicromips
18127 @opindex mno-mmicromips
18128 Generate (do not generate) microMIPS code.
18129
18130 MicroMIPS code generation can also be controlled on a per-function basis
18131 by means of @code{micromips} and @code{nomicromips} attributes.
18132 @xref{Function Attributes}, for more information.
18133
18134 @item -mmt
18135 @itemx -mno-mt
18136 @opindex mmt
18137 @opindex mno-mt
18138 Use (do not use) MT Multithreading instructions.
18139
18140 @item -mmcu
18141 @itemx -mno-mcu
18142 @opindex mmcu
18143 @opindex mno-mcu
18144 Use (do not use) the MIPS MCU ASE instructions.
18145
18146 @item -meva
18147 @itemx -mno-eva
18148 @opindex meva
18149 @opindex mno-eva
18150 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
18151
18152 @item -mvirt
18153 @itemx -mno-virt
18154 @opindex mvirt
18155 @opindex mno-virt
18156 Use (do not use) the MIPS Virtualization Application Specific instructions.
18157
18158 @item -mxpa
18159 @itemx -mno-xpa
18160 @opindex mxpa
18161 @opindex mno-xpa
18162 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
18163
18164 @item -mlong64
18165 @opindex mlong64
18166 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
18167 an explanation of the default and the way that the pointer size is
18168 determined.
18169
18170 @item -mlong32
18171 @opindex mlong32
18172 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
18173
18174 The default size of @code{int}s, @code{long}s and pointers depends on
18175 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
18176 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
18177 32-bit @code{long}s. Pointers are the same size as @code{long}s,
18178 or the same size as integer registers, whichever is smaller.
18179
18180 @item -msym32
18181 @itemx -mno-sym32
18182 @opindex msym32
18183 @opindex mno-sym32
18184 Assume (do not assume) that all symbols have 32-bit values, regardless
18185 of the selected ABI@. This option is useful in combination with
18186 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
18187 to generate shorter and faster references to symbolic addresses.
18188
18189 @item -G @var{num}
18190 @opindex G
18191 Put definitions of externally-visible data in a small data section
18192 if that data is no bigger than @var{num} bytes. GCC can then generate
18193 more efficient accesses to the data; see @option{-mgpopt} for details.
18194
18195 The default @option{-G} option depends on the configuration.
18196
18197 @item -mlocal-sdata
18198 @itemx -mno-local-sdata
18199 @opindex mlocal-sdata
18200 @opindex mno-local-sdata
18201 Extend (do not extend) the @option{-G} behavior to local data too,
18202 such as to static variables in C@. @option{-mlocal-sdata} is the
18203 default for all configurations.
18204
18205 If the linker complains that an application is using too much small data,
18206 you might want to try rebuilding the less performance-critical parts with
18207 @option{-mno-local-sdata}. You might also want to build large
18208 libraries with @option{-mno-local-sdata}, so that the libraries leave
18209 more room for the main program.
18210
18211 @item -mextern-sdata
18212 @itemx -mno-extern-sdata
18213 @opindex mextern-sdata
18214 @opindex mno-extern-sdata
18215 Assume (do not assume) that externally-defined data is in
18216 a small data section if the size of that data is within the @option{-G} limit.
18217 @option{-mextern-sdata} is the default for all configurations.
18218
18219 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
18220 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
18221 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
18222 is placed in a small data section. If @var{Var} is defined by another
18223 module, you must either compile that module with a high-enough
18224 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
18225 definition. If @var{Var} is common, you must link the application
18226 with a high-enough @option{-G} setting.
18227
18228 The easiest way of satisfying these restrictions is to compile
18229 and link every module with the same @option{-G} option. However,
18230 you may wish to build a library that supports several different
18231 small data limits. You can do this by compiling the library with
18232 the highest supported @option{-G} setting and additionally using
18233 @option{-mno-extern-sdata} to stop the library from making assumptions
18234 about externally-defined data.
18235
18236 @item -mgpopt
18237 @itemx -mno-gpopt
18238 @opindex mgpopt
18239 @opindex mno-gpopt
18240 Use (do not use) GP-relative accesses for symbols that are known to be
18241 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
18242 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
18243 configurations.
18244
18245 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
18246 might not hold the value of @code{_gp}. For example, if the code is
18247 part of a library that might be used in a boot monitor, programs that
18248 call boot monitor routines pass an unknown value in @code{$gp}.
18249 (In such situations, the boot monitor itself is usually compiled
18250 with @option{-G0}.)
18251
18252 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
18253 @option{-mno-extern-sdata}.
18254
18255 @item -membedded-data
18256 @itemx -mno-embedded-data
18257 @opindex membedded-data
18258 @opindex mno-embedded-data
18259 Allocate variables to the read-only data section first if possible, then
18260 next in the small data section if possible, otherwise in data. This gives
18261 slightly slower code than the default, but reduces the amount of RAM required
18262 when executing, and thus may be preferred for some embedded systems.
18263
18264 @item -muninit-const-in-rodata
18265 @itemx -mno-uninit-const-in-rodata
18266 @opindex muninit-const-in-rodata
18267 @opindex mno-uninit-const-in-rodata
18268 Put uninitialized @code{const} variables in the read-only data section.
18269 This option is only meaningful in conjunction with @option{-membedded-data}.
18270
18271 @item -mcode-readable=@var{setting}
18272 @opindex mcode-readable
18273 Specify whether GCC may generate code that reads from executable sections.
18274 There are three possible settings:
18275
18276 @table @gcctabopt
18277 @item -mcode-readable=yes
18278 Instructions may freely access executable sections. This is the
18279 default setting.
18280
18281 @item -mcode-readable=pcrel
18282 MIPS16 PC-relative load instructions can access executable sections,
18283 but other instructions must not do so. This option is useful on 4KSc
18284 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
18285 It is also useful on processors that can be configured to have a dual
18286 instruction/data SRAM interface and that, like the M4K, automatically
18287 redirect PC-relative loads to the instruction RAM.
18288
18289 @item -mcode-readable=no
18290 Instructions must not access executable sections. This option can be
18291 useful on targets that are configured to have a dual instruction/data
18292 SRAM interface but that (unlike the M4K) do not automatically redirect
18293 PC-relative loads to the instruction RAM.
18294 @end table
18295
18296 @item -msplit-addresses
18297 @itemx -mno-split-addresses
18298 @opindex msplit-addresses
18299 @opindex mno-split-addresses
18300 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
18301 relocation operators. This option has been superseded by
18302 @option{-mexplicit-relocs} but is retained for backwards compatibility.
18303
18304 @item -mexplicit-relocs
18305 @itemx -mno-explicit-relocs
18306 @opindex mexplicit-relocs
18307 @opindex mno-explicit-relocs
18308 Use (do not use) assembler relocation operators when dealing with symbolic
18309 addresses. The alternative, selected by @option{-mno-explicit-relocs},
18310 is to use assembler macros instead.
18311
18312 @option{-mexplicit-relocs} is the default if GCC was configured
18313 to use an assembler that supports relocation operators.
18314
18315 @item -mcheck-zero-division
18316 @itemx -mno-check-zero-division
18317 @opindex mcheck-zero-division
18318 @opindex mno-check-zero-division
18319 Trap (do not trap) on integer division by zero.
18320
18321 The default is @option{-mcheck-zero-division}.
18322
18323 @item -mdivide-traps
18324 @itemx -mdivide-breaks
18325 @opindex mdivide-traps
18326 @opindex mdivide-breaks
18327 MIPS systems check for division by zero by generating either a
18328 conditional trap or a break instruction. Using traps results in
18329 smaller code, but is only supported on MIPS II and later. Also, some
18330 versions of the Linux kernel have a bug that prevents trap from
18331 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
18332 allow conditional traps on architectures that support them and
18333 @option{-mdivide-breaks} to force the use of breaks.
18334
18335 The default is usually @option{-mdivide-traps}, but this can be
18336 overridden at configure time using @option{--with-divide=breaks}.
18337 Divide-by-zero checks can be completely disabled using
18338 @option{-mno-check-zero-division}.
18339
18340 @item -mmemcpy
18341 @itemx -mno-memcpy
18342 @opindex mmemcpy
18343 @opindex mno-memcpy
18344 Force (do not force) the use of @code{memcpy} for non-trivial block
18345 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
18346 most constant-sized copies.
18347
18348 @item -mlong-calls
18349 @itemx -mno-long-calls
18350 @opindex mlong-calls
18351 @opindex mno-long-calls
18352 Disable (do not disable) use of the @code{jal} instruction. Calling
18353 functions using @code{jal} is more efficient but requires the caller
18354 and callee to be in the same 256 megabyte segment.
18355
18356 This option has no effect on abicalls code. The default is
18357 @option{-mno-long-calls}.
18358
18359 @item -mmad
18360 @itemx -mno-mad
18361 @opindex mmad
18362 @opindex mno-mad
18363 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
18364 instructions, as provided by the R4650 ISA@.
18365
18366 @item -mimadd
18367 @itemx -mno-imadd
18368 @opindex mimadd
18369 @opindex mno-imadd
18370 Enable (disable) use of the @code{madd} and @code{msub} integer
18371 instructions. The default is @option{-mimadd} on architectures
18372 that support @code{madd} and @code{msub} except for the 74k
18373 architecture where it was found to generate slower code.
18374
18375 @item -mfused-madd
18376 @itemx -mno-fused-madd
18377 @opindex mfused-madd
18378 @opindex mno-fused-madd
18379 Enable (disable) use of the floating-point multiply-accumulate
18380 instructions, when they are available. The default is
18381 @option{-mfused-madd}.
18382
18383 On the R8000 CPU when multiply-accumulate instructions are used,
18384 the intermediate product is calculated to infinite precision
18385 and is not subject to the FCSR Flush to Zero bit. This may be
18386 undesirable in some circumstances. On other processors the result
18387 is numerically identical to the equivalent computation using
18388 separate multiply, add, subtract and negate instructions.
18389
18390 @item -nocpp
18391 @opindex nocpp
18392 Tell the MIPS assembler to not run its preprocessor over user
18393 assembler files (with a @samp{.s} suffix) when assembling them.
18394
18395 @item -mfix-24k
18396 @item -mno-fix-24k
18397 @opindex mfix-24k
18398 @opindex mno-fix-24k
18399 Work around the 24K E48 (lost data on stores during refill) errata.
18400 The workarounds are implemented by the assembler rather than by GCC@.
18401
18402 @item -mfix-r4000
18403 @itemx -mno-fix-r4000
18404 @opindex mfix-r4000
18405 @opindex mno-fix-r4000
18406 Work around certain R4000 CPU errata:
18407 @itemize @minus
18408 @item
18409 A double-word or a variable shift may give an incorrect result if executed
18410 immediately after starting an integer division.
18411 @item
18412 A double-word or a variable shift may give an incorrect result if executed
18413 while an integer multiplication is in progress.
18414 @item
18415 An integer division may give an incorrect result if started in a delay slot
18416 of a taken branch or a jump.
18417 @end itemize
18418
18419 @item -mfix-r4400
18420 @itemx -mno-fix-r4400
18421 @opindex mfix-r4400
18422 @opindex mno-fix-r4400
18423 Work around certain R4400 CPU errata:
18424 @itemize @minus
18425 @item
18426 A double-word or a variable shift may give an incorrect result if executed
18427 immediately after starting an integer division.
18428 @end itemize
18429
18430 @item -mfix-r10000
18431 @itemx -mno-fix-r10000
18432 @opindex mfix-r10000
18433 @opindex mno-fix-r10000
18434 Work around certain R10000 errata:
18435 @itemize @minus
18436 @item
18437 @code{ll}/@code{sc} sequences may not behave atomically on revisions
18438 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
18439 @end itemize
18440
18441 This option can only be used if the target architecture supports
18442 branch-likely instructions. @option{-mfix-r10000} is the default when
18443 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
18444 otherwise.
18445
18446 @item -mfix-rm7000
18447 @itemx -mno-fix-rm7000
18448 @opindex mfix-rm7000
18449 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
18450 workarounds are implemented by the assembler rather than by GCC@.
18451
18452 @item -mfix-vr4120
18453 @itemx -mno-fix-vr4120
18454 @opindex mfix-vr4120
18455 Work around certain VR4120 errata:
18456 @itemize @minus
18457 @item
18458 @code{dmultu} does not always produce the correct result.
18459 @item
18460 @code{div} and @code{ddiv} do not always produce the correct result if one
18461 of the operands is negative.
18462 @end itemize
18463 The workarounds for the division errata rely on special functions in
18464 @file{libgcc.a}. At present, these functions are only provided by
18465 the @code{mips64vr*-elf} configurations.
18466
18467 Other VR4120 errata require a NOP to be inserted between certain pairs of
18468 instructions. These errata are handled by the assembler, not by GCC itself.
18469
18470 @item -mfix-vr4130
18471 @opindex mfix-vr4130
18472 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
18473 workarounds are implemented by the assembler rather than by GCC,
18474 although GCC avoids using @code{mflo} and @code{mfhi} if the
18475 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
18476 instructions are available instead.
18477
18478 @item -mfix-sb1
18479 @itemx -mno-fix-sb1
18480 @opindex mfix-sb1
18481 Work around certain SB-1 CPU core errata.
18482 (This flag currently works around the SB-1 revision 2
18483 ``F1'' and ``F2'' floating-point errata.)
18484
18485 @item -mr10k-cache-barrier=@var{setting}
18486 @opindex mr10k-cache-barrier
18487 Specify whether GCC should insert cache barriers to avoid the
18488 side-effects of speculation on R10K processors.
18489
18490 In common with many processors, the R10K tries to predict the outcome
18491 of a conditional branch and speculatively executes instructions from
18492 the ``taken'' branch. It later aborts these instructions if the
18493 predicted outcome is wrong. However, on the R10K, even aborted
18494 instructions can have side effects.
18495
18496 This problem only affects kernel stores and, depending on the system,
18497 kernel loads. As an example, a speculatively-executed store may load
18498 the target memory into cache and mark the cache line as dirty, even if
18499 the store itself is later aborted. If a DMA operation writes to the
18500 same area of memory before the ``dirty'' line is flushed, the cached
18501 data overwrites the DMA-ed data. See the R10K processor manual
18502 for a full description, including other potential problems.
18503
18504 One workaround is to insert cache barrier instructions before every memory
18505 access that might be speculatively executed and that might have side
18506 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
18507 controls GCC's implementation of this workaround. It assumes that
18508 aborted accesses to any byte in the following regions does not have
18509 side effects:
18510
18511 @enumerate
18512 @item
18513 the memory occupied by the current function's stack frame;
18514
18515 @item
18516 the memory occupied by an incoming stack argument;
18517
18518 @item
18519 the memory occupied by an object with a link-time-constant address.
18520 @end enumerate
18521
18522 It is the kernel's responsibility to ensure that speculative
18523 accesses to these regions are indeed safe.
18524
18525 If the input program contains a function declaration such as:
18526
18527 @smallexample
18528 void foo (void);
18529 @end smallexample
18530
18531 then the implementation of @code{foo} must allow @code{j foo} and
18532 @code{jal foo} to be executed speculatively. GCC honors this
18533 restriction for functions it compiles itself. It expects non-GCC
18534 functions (such as hand-written assembly code) to do the same.
18535
18536 The option has three forms:
18537
18538 @table @gcctabopt
18539 @item -mr10k-cache-barrier=load-store
18540 Insert a cache barrier before a load or store that might be
18541 speculatively executed and that might have side effects even
18542 if aborted.
18543
18544 @item -mr10k-cache-barrier=store
18545 Insert a cache barrier before a store that might be speculatively
18546 executed and that might have side effects even if aborted.
18547
18548 @item -mr10k-cache-barrier=none
18549 Disable the insertion of cache barriers. This is the default setting.
18550 @end table
18551
18552 @item -mflush-func=@var{func}
18553 @itemx -mno-flush-func
18554 @opindex mflush-func
18555 Specifies the function to call to flush the I and D caches, or to not
18556 call any such function. If called, the function must take the same
18557 arguments as the common @code{_flush_func}, that is, the address of the
18558 memory range for which the cache is being flushed, the size of the
18559 memory range, and the number 3 (to flush both caches). The default
18560 depends on the target GCC was configured for, but commonly is either
18561 @code{_flush_func} or @code{__cpu_flush}.
18562
18563 @item mbranch-cost=@var{num}
18564 @opindex mbranch-cost
18565 Set the cost of branches to roughly @var{num} ``simple'' instructions.
18566 This cost is only a heuristic and is not guaranteed to produce
18567 consistent results across releases. A zero cost redundantly selects
18568 the default, which is based on the @option{-mtune} setting.
18569
18570 @item -mbranch-likely
18571 @itemx -mno-branch-likely
18572 @opindex mbranch-likely
18573 @opindex mno-branch-likely
18574 Enable or disable use of Branch Likely instructions, regardless of the
18575 default for the selected architecture. By default, Branch Likely
18576 instructions may be generated if they are supported by the selected
18577 architecture. An exception is for the MIPS32 and MIPS64 architectures
18578 and processors that implement those architectures; for those, Branch
18579 Likely instructions are not be generated by default because the MIPS32
18580 and MIPS64 architectures specifically deprecate their use.
18581
18582 @item -mcompact-branches=never
18583 @itemx -mcompact-branches=optimal
18584 @itemx -mcompact-branches=always
18585 @opindex mcompact-branches=never
18586 @opindex mcompact-branches=optimal
18587 @opindex mcompact-branches=always
18588 These options control which form of branches will be generated. The
18589 default is @option{-mcompact-branches=optimal}.
18590
18591 The @option{-mcompact-branches=never} option ensures that compact branch
18592 instructions will never be generated.
18593
18594 The @option{-mcompact-branches=always} option ensures that a compact
18595 branch instruction will be generated if available. If a compact branch
18596 instruction is not available, a delay slot form of the branch will be
18597 used instead.
18598
18599 This option is supported from MIPS Release 6 onwards.
18600
18601 The @option{-mcompact-branches=optimal} option will cause a delay slot
18602 branch to be used if one is available in the current ISA and the delay
18603 slot is successfully filled. If the delay slot is not filled, a compact
18604 branch will be chosen if one is available.
18605
18606 @item -mfp-exceptions
18607 @itemx -mno-fp-exceptions
18608 @opindex mfp-exceptions
18609 Specifies whether FP exceptions are enabled. This affects how
18610 FP instructions are scheduled for some processors.
18611 The default is that FP exceptions are
18612 enabled.
18613
18614 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
18615 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
18616 FP pipe.
18617
18618 @item -mvr4130-align
18619 @itemx -mno-vr4130-align
18620 @opindex mvr4130-align
18621 The VR4130 pipeline is two-way superscalar, but can only issue two
18622 instructions together if the first one is 8-byte aligned. When this
18623 option is enabled, GCC aligns pairs of instructions that it
18624 thinks should execute in parallel.
18625
18626 This option only has an effect when optimizing for the VR4130.
18627 It normally makes code faster, but at the expense of making it bigger.
18628 It is enabled by default at optimization level @option{-O3}.
18629
18630 @item -msynci
18631 @itemx -mno-synci
18632 @opindex msynci
18633 Enable (disable) generation of @code{synci} instructions on
18634 architectures that support it. The @code{synci} instructions (if
18635 enabled) are generated when @code{__builtin___clear_cache} is
18636 compiled.
18637
18638 This option defaults to @option{-mno-synci}, but the default can be
18639 overridden by configuring GCC with @option{--with-synci}.
18640
18641 When compiling code for single processor systems, it is generally safe
18642 to use @code{synci}. However, on many multi-core (SMP) systems, it
18643 does not invalidate the instruction caches on all cores and may lead
18644 to undefined behavior.
18645
18646 @item -mrelax-pic-calls
18647 @itemx -mno-relax-pic-calls
18648 @opindex mrelax-pic-calls
18649 Try to turn PIC calls that are normally dispatched via register
18650 @code{$25} into direct calls. This is only possible if the linker can
18651 resolve the destination at link time and if the destination is within
18652 range for a direct call.
18653
18654 @option{-mrelax-pic-calls} is the default if GCC was configured to use
18655 an assembler and a linker that support the @code{.reloc} assembly
18656 directive and @option{-mexplicit-relocs} is in effect. With
18657 @option{-mno-explicit-relocs}, this optimization can be performed by the
18658 assembler and the linker alone without help from the compiler.
18659
18660 @item -mmcount-ra-address
18661 @itemx -mno-mcount-ra-address
18662 @opindex mmcount-ra-address
18663 @opindex mno-mcount-ra-address
18664 Emit (do not emit) code that allows @code{_mcount} to modify the
18665 calling function's return address. When enabled, this option extends
18666 the usual @code{_mcount} interface with a new @var{ra-address}
18667 parameter, which has type @code{intptr_t *} and is passed in register
18668 @code{$12}. @code{_mcount} can then modify the return address by
18669 doing both of the following:
18670 @itemize
18671 @item
18672 Returning the new address in register @code{$31}.
18673 @item
18674 Storing the new address in @code{*@var{ra-address}},
18675 if @var{ra-address} is nonnull.
18676 @end itemize
18677
18678 The default is @option{-mno-mcount-ra-address}.
18679
18680 @item -mframe-header-opt
18681 @itemx -mno-frame-header-opt
18682 @opindex mframe-header-opt
18683 Enable (disable) frame header optimization in the o32 ABI. When using the
18684 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
18685 function to write out register arguments. When enabled, this optimization
18686 will suppress the allocation of the frame header if it can be determined that
18687 it is unused.
18688
18689 This optimization is off by default at all optimization levels.
18690
18691 @end table
18692
18693 @node MMIX Options
18694 @subsection MMIX Options
18695 @cindex MMIX Options
18696
18697 These options are defined for the MMIX:
18698
18699 @table @gcctabopt
18700 @item -mlibfuncs
18701 @itemx -mno-libfuncs
18702 @opindex mlibfuncs
18703 @opindex mno-libfuncs
18704 Specify that intrinsic library functions are being compiled, passing all
18705 values in registers, no matter the size.
18706
18707 @item -mepsilon
18708 @itemx -mno-epsilon
18709 @opindex mepsilon
18710 @opindex mno-epsilon
18711 Generate floating-point comparison instructions that compare with respect
18712 to the @code{rE} epsilon register.
18713
18714 @item -mabi=mmixware
18715 @itemx -mabi=gnu
18716 @opindex mabi=mmixware
18717 @opindex mabi=gnu
18718 Generate code that passes function parameters and return values that (in
18719 the called function) are seen as registers @code{$0} and up, as opposed to
18720 the GNU ABI which uses global registers @code{$231} and up.
18721
18722 @item -mzero-extend
18723 @itemx -mno-zero-extend
18724 @opindex mzero-extend
18725 @opindex mno-zero-extend
18726 When reading data from memory in sizes shorter than 64 bits, use (do not
18727 use) zero-extending load instructions by default, rather than
18728 sign-extending ones.
18729
18730 @item -mknuthdiv
18731 @itemx -mno-knuthdiv
18732 @opindex mknuthdiv
18733 @opindex mno-knuthdiv
18734 Make the result of a division yielding a remainder have the same sign as
18735 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
18736 remainder follows the sign of the dividend. Both methods are
18737 arithmetically valid, the latter being almost exclusively used.
18738
18739 @item -mtoplevel-symbols
18740 @itemx -mno-toplevel-symbols
18741 @opindex mtoplevel-symbols
18742 @opindex mno-toplevel-symbols
18743 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
18744 code can be used with the @code{PREFIX} assembly directive.
18745
18746 @item -melf
18747 @opindex melf
18748 Generate an executable in the ELF format, rather than the default
18749 @samp{mmo} format used by the @command{mmix} simulator.
18750
18751 @item -mbranch-predict
18752 @itemx -mno-branch-predict
18753 @opindex mbranch-predict
18754 @opindex mno-branch-predict
18755 Use (do not use) the probable-branch instructions, when static branch
18756 prediction indicates a probable branch.
18757
18758 @item -mbase-addresses
18759 @itemx -mno-base-addresses
18760 @opindex mbase-addresses
18761 @opindex mno-base-addresses
18762 Generate (do not generate) code that uses @emph{base addresses}. Using a
18763 base address automatically generates a request (handled by the assembler
18764 and the linker) for a constant to be set up in a global register. The
18765 register is used for one or more base address requests within the range 0
18766 to 255 from the value held in the register. The generally leads to short
18767 and fast code, but the number of different data items that can be
18768 addressed is limited. This means that a program that uses lots of static
18769 data may require @option{-mno-base-addresses}.
18770
18771 @item -msingle-exit
18772 @itemx -mno-single-exit
18773 @opindex msingle-exit
18774 @opindex mno-single-exit
18775 Force (do not force) generated code to have a single exit point in each
18776 function.
18777 @end table
18778
18779 @node MN10300 Options
18780 @subsection MN10300 Options
18781 @cindex MN10300 options
18782
18783 These @option{-m} options are defined for Matsushita MN10300 architectures:
18784
18785 @table @gcctabopt
18786 @item -mmult-bug
18787 @opindex mmult-bug
18788 Generate code to avoid bugs in the multiply instructions for the MN10300
18789 processors. This is the default.
18790
18791 @item -mno-mult-bug
18792 @opindex mno-mult-bug
18793 Do not generate code to avoid bugs in the multiply instructions for the
18794 MN10300 processors.
18795
18796 @item -mam33
18797 @opindex mam33
18798 Generate code using features specific to the AM33 processor.
18799
18800 @item -mno-am33
18801 @opindex mno-am33
18802 Do not generate code using features specific to the AM33 processor. This
18803 is the default.
18804
18805 @item -mam33-2
18806 @opindex mam33-2
18807 Generate code using features specific to the AM33/2.0 processor.
18808
18809 @item -mam34
18810 @opindex mam34
18811 Generate code using features specific to the AM34 processor.
18812
18813 @item -mtune=@var{cpu-type}
18814 @opindex mtune
18815 Use the timing characteristics of the indicated CPU type when
18816 scheduling instructions. This does not change the targeted processor
18817 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
18818 @samp{am33-2} or @samp{am34}.
18819
18820 @item -mreturn-pointer-on-d0
18821 @opindex mreturn-pointer-on-d0
18822 When generating a function that returns a pointer, return the pointer
18823 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
18824 only in @code{a0}, and attempts to call such functions without a prototype
18825 result in errors. Note that this option is on by default; use
18826 @option{-mno-return-pointer-on-d0} to disable it.
18827
18828 @item -mno-crt0
18829 @opindex mno-crt0
18830 Do not link in the C run-time initialization object file.
18831
18832 @item -mrelax
18833 @opindex mrelax
18834 Indicate to the linker that it should perform a relaxation optimization pass
18835 to shorten branches, calls and absolute memory addresses. This option only
18836 has an effect when used on the command line for the final link step.
18837
18838 This option makes symbolic debugging impossible.
18839
18840 @item -mliw
18841 @opindex mliw
18842 Allow the compiler to generate @emph{Long Instruction Word}
18843 instructions if the target is the @samp{AM33} or later. This is the
18844 default. This option defines the preprocessor macro @code{__LIW__}.
18845
18846 @item -mnoliw
18847 @opindex mnoliw
18848 Do not allow the compiler to generate @emph{Long Instruction Word}
18849 instructions. This option defines the preprocessor macro
18850 @code{__NO_LIW__}.
18851
18852 @item -msetlb
18853 @opindex msetlb
18854 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
18855 instructions if the target is the @samp{AM33} or later. This is the
18856 default. This option defines the preprocessor macro @code{__SETLB__}.
18857
18858 @item -mnosetlb
18859 @opindex mnosetlb
18860 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
18861 instructions. This option defines the preprocessor macro
18862 @code{__NO_SETLB__}.
18863
18864 @end table
18865
18866 @node Moxie Options
18867 @subsection Moxie Options
18868 @cindex Moxie Options
18869
18870 @table @gcctabopt
18871
18872 @item -meb
18873 @opindex meb
18874 Generate big-endian code. This is the default for @samp{moxie-*-*}
18875 configurations.
18876
18877 @item -mel
18878 @opindex mel
18879 Generate little-endian code.
18880
18881 @item -mmul.x
18882 @opindex mmul.x
18883 Generate mul.x and umul.x instructions. This is the default for
18884 @samp{moxiebox-*-*} configurations.
18885
18886 @item -mno-crt0
18887 @opindex mno-crt0
18888 Do not link in the C run-time initialization object file.
18889
18890 @end table
18891
18892 @node MSP430 Options
18893 @subsection MSP430 Options
18894 @cindex MSP430 Options
18895
18896 These options are defined for the MSP430:
18897
18898 @table @gcctabopt
18899
18900 @item -masm-hex
18901 @opindex masm-hex
18902 Force assembly output to always use hex constants. Normally such
18903 constants are signed decimals, but this option is available for
18904 testsuite and/or aesthetic purposes.
18905
18906 @item -mmcu=
18907 @opindex mmcu=
18908 Select the MCU to target. This is used to create a C preprocessor
18909 symbol based upon the MCU name, converted to upper case and pre- and
18910 post-fixed with @samp{__}. This in turn is used by the
18911 @file{msp430.h} header file to select an MCU-specific supplementary
18912 header file.
18913
18914 The option also sets the ISA to use. If the MCU name is one that is
18915 known to only support the 430 ISA then that is selected, otherwise the
18916 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
18917 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
18918 name selects the 430X ISA.
18919
18920 In addition an MCU-specific linker script is added to the linker
18921 command line. The script's name is the name of the MCU with
18922 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
18923 command line defines the C preprocessor symbol @code{__XXX__} and
18924 cause the linker to search for a script called @file{xxx.ld}.
18925
18926 This option is also passed on to the assembler.
18927
18928 @item -mwarn-mcu
18929 @itemx -mno-warn-mcu
18930 @opindex mwarn-mcu
18931 @opindex mno-warn-mcu
18932 This option enables or disables warnings about conflicts between the
18933 MCU name specified by the @option{-mmcu} option and the ISA set by the
18934 @option{-mcpu} option and/or the hardware multiply support set by the
18935 @option{-mhwmult} option. It also toggles warnings about unrecognized
18936 MCU names. This option is on by default.
18937
18938 @item -mcpu=
18939 @opindex mcpu=
18940 Specifies the ISA to use. Accepted values are @samp{msp430},
18941 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
18942 @option{-mmcu=} option should be used to select the ISA.
18943
18944 @item -msim
18945 @opindex msim
18946 Link to the simulator runtime libraries and linker script. Overrides
18947 any scripts that would be selected by the @option{-mmcu=} option.
18948
18949 @item -mlarge
18950 @opindex mlarge
18951 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
18952
18953 @item -msmall
18954 @opindex msmall
18955 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
18956
18957 @item -mrelax
18958 @opindex mrelax
18959 This option is passed to the assembler and linker, and allows the
18960 linker to perform certain optimizations that cannot be done until
18961 the final link.
18962
18963 @item mhwmult=
18964 @opindex mhwmult=
18965 Describes the type of hardware multiply supported by the target.
18966 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
18967 for the original 16-bit-only multiply supported by early MCUs.
18968 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
18969 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
18970 A value of @samp{auto} can also be given. This tells GCC to deduce
18971 the hardware multiply support based upon the MCU name provided by the
18972 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
18973 the MCU name is not recognized then no hardware multiply support is
18974 assumed. @code{auto} is the default setting.
18975
18976 Hardware multiplies are normally performed by calling a library
18977 routine. This saves space in the generated code. When compiling at
18978 @option{-O3} or higher however the hardware multiplier is invoked
18979 inline. This makes for bigger, but faster code.
18980
18981 The hardware multiply routines disable interrupts whilst running and
18982 restore the previous interrupt state when they finish. This makes
18983 them safe to use inside interrupt handlers as well as in normal code.
18984
18985 @item -minrt
18986 @opindex minrt
18987 Enable the use of a minimum runtime environment - no static
18988 initializers or constructors. This is intended for memory-constrained
18989 devices. The compiler includes special symbols in some objects
18990 that tell the linker and runtime which code fragments are required.
18991
18992 @item -mcode-region=
18993 @itemx -mdata-region=
18994 @opindex mcode-region
18995 @opindex mdata-region
18996 These options tell the compiler where to place functions and data that
18997 do not have one of the @code{lower}, @code{upper}, @code{either} or
18998 @code{section} attributes. Possible values are @code{lower},
18999 @code{upper}, @code{either} or @code{any}. The first three behave
19000 like the corresponding attribute. The fourth possible value -
19001 @code{any} - is the default. It leaves placement entirely up to the
19002 linker script and how it assigns the standard sections
19003 (@code{.text}, @code{.data}, etc) to the memory regions.
19004
19005 @item -msilicon-errata=
19006 @opindex msilicon-errata
19007 This option passes on a request to assembler to enable the fixes for
19008 the named silicon errata.
19009
19010 @item -msilicon-errata-warn=
19011 @opindex msilicon-errata-warn
19012 This option passes on a request to the assembler to enable warning
19013 messages when a silicon errata might need to be applied.
19014
19015 @end table
19016
19017 @node NDS32 Options
19018 @subsection NDS32 Options
19019 @cindex NDS32 Options
19020
19021 These options are defined for NDS32 implementations:
19022
19023 @table @gcctabopt
19024
19025 @item -mbig-endian
19026 @opindex mbig-endian
19027 Generate code in big-endian mode.
19028
19029 @item -mlittle-endian
19030 @opindex mlittle-endian
19031 Generate code in little-endian mode.
19032
19033 @item -mreduced-regs
19034 @opindex mreduced-regs
19035 Use reduced-set registers for register allocation.
19036
19037 @item -mfull-regs
19038 @opindex mfull-regs
19039 Use full-set registers for register allocation.
19040
19041 @item -mcmov
19042 @opindex mcmov
19043 Generate conditional move instructions.
19044
19045 @item -mno-cmov
19046 @opindex mno-cmov
19047 Do not generate conditional move instructions.
19048
19049 @item -mperf-ext
19050 @opindex mperf-ext
19051 Generate performance extension instructions.
19052
19053 @item -mno-perf-ext
19054 @opindex mno-perf-ext
19055 Do not generate performance extension instructions.
19056
19057 @item -mv3push
19058 @opindex mv3push
19059 Generate v3 push25/pop25 instructions.
19060
19061 @item -mno-v3push
19062 @opindex mno-v3push
19063 Do not generate v3 push25/pop25 instructions.
19064
19065 @item -m16-bit
19066 @opindex m16-bit
19067 Generate 16-bit instructions.
19068
19069 @item -mno-16-bit
19070 @opindex mno-16-bit
19071 Do not generate 16-bit instructions.
19072
19073 @item -misr-vector-size=@var{num}
19074 @opindex misr-vector-size
19075 Specify the size of each interrupt vector, which must be 4 or 16.
19076
19077 @item -mcache-block-size=@var{num}
19078 @opindex mcache-block-size
19079 Specify the size of each cache block,
19080 which must be a power of 2 between 4 and 512.
19081
19082 @item -march=@var{arch}
19083 @opindex march
19084 Specify the name of the target architecture.
19085
19086 @item -mcmodel=@var{code-model}
19087 @opindex mcmodel
19088 Set the code model to one of
19089 @table @asis
19090 @item @samp{small}
19091 All the data and read-only data segments must be within 512KB addressing space.
19092 The text segment must be within 16MB addressing space.
19093 @item @samp{medium}
19094 The data segment must be within 512KB while the read-only data segment can be
19095 within 4GB addressing space. The text segment should be still within 16MB
19096 addressing space.
19097 @item @samp{large}
19098 All the text and data segments can be within 4GB addressing space.
19099 @end table
19100
19101 @item -mctor-dtor
19102 @opindex mctor-dtor
19103 Enable constructor/destructor feature.
19104
19105 @item -mrelax
19106 @opindex mrelax
19107 Guide linker to relax instructions.
19108
19109 @end table
19110
19111 @node Nios II Options
19112 @subsection Nios II Options
19113 @cindex Nios II options
19114 @cindex Altera Nios II options
19115
19116 These are the options defined for the Altera Nios II processor.
19117
19118 @table @gcctabopt
19119
19120 @item -G @var{num}
19121 @opindex G
19122 @cindex smaller data references
19123 Put global and static objects less than or equal to @var{num} bytes
19124 into the small data or BSS sections instead of the normal data or BSS
19125 sections. The default value of @var{num} is 8.
19126
19127 @item -mgpopt=@var{option}
19128 @item -mgpopt
19129 @itemx -mno-gpopt
19130 @opindex mgpopt
19131 @opindex mno-gpopt
19132 Generate (do not generate) GP-relative accesses. The following
19133 @var{option} names are recognized:
19134
19135 @table @samp
19136
19137 @item none
19138 Do not generate GP-relative accesses.
19139
19140 @item local
19141 Generate GP-relative accesses for small data objects that are not
19142 external, weak, or uninitialized common symbols.
19143 Also use GP-relative addressing for objects that
19144 have been explicitly placed in a small data section via a @code{section}
19145 attribute.
19146
19147 @item global
19148 As for @samp{local}, but also generate GP-relative accesses for
19149 small data objects that are external, weak, or common. If you use this option,
19150 you must ensure that all parts of your program (including libraries) are
19151 compiled with the same @option{-G} setting.
19152
19153 @item data
19154 Generate GP-relative accesses for all data objects in the program. If you
19155 use this option, the entire data and BSS segments
19156 of your program must fit in 64K of memory and you must use an appropriate
19157 linker script to allocate them within the addressable range of the
19158 global pointer.
19159
19160 @item all
19161 Generate GP-relative addresses for function pointers as well as data
19162 pointers. If you use this option, the entire text, data, and BSS segments
19163 of your program must fit in 64K of memory and you must use an appropriate
19164 linker script to allocate them within the addressable range of the
19165 global pointer.
19166
19167 @end table
19168
19169 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
19170 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
19171
19172 The default is @option{-mgpopt} except when @option{-fpic} or
19173 @option{-fPIC} is specified to generate position-independent code.
19174 Note that the Nios II ABI does not permit GP-relative accesses from
19175 shared libraries.
19176
19177 You may need to specify @option{-mno-gpopt} explicitly when building
19178 programs that include large amounts of small data, including large
19179 GOT data sections. In this case, the 16-bit offset for GP-relative
19180 addressing may not be large enough to allow access to the entire
19181 small data section.
19182
19183 @item -mel
19184 @itemx -meb
19185 @opindex mel
19186 @opindex meb
19187 Generate little-endian (default) or big-endian (experimental) code,
19188 respectively.
19189
19190 @item -march=@var{arch}
19191 @opindex march
19192 This specifies the name of the target Nios II architecture. GCC uses this
19193 name to determine what kind of instructions it can emit when generating
19194 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
19195
19196 The preprocessor macro @code{__nios2_arch__} is available to programs,
19197 with value 1 or 2, indicating the targeted ISA level.
19198
19199 @item -mbypass-cache
19200 @itemx -mno-bypass-cache
19201 @opindex mno-bypass-cache
19202 @opindex mbypass-cache
19203 Force all load and store instructions to always bypass cache by
19204 using I/O variants of the instructions. The default is not to
19205 bypass the cache.
19206
19207 @item -mno-cache-volatile
19208 @itemx -mcache-volatile
19209 @opindex mcache-volatile
19210 @opindex mno-cache-volatile
19211 Volatile memory access bypass the cache using the I/O variants of
19212 the load and store instructions. The default is not to bypass the cache.
19213
19214 @item -mno-fast-sw-div
19215 @itemx -mfast-sw-div
19216 @opindex mno-fast-sw-div
19217 @opindex mfast-sw-div
19218 Do not use table-based fast divide for small numbers. The default
19219 is to use the fast divide at @option{-O3} and above.
19220
19221 @item -mno-hw-mul
19222 @itemx -mhw-mul
19223 @itemx -mno-hw-mulx
19224 @itemx -mhw-mulx
19225 @itemx -mno-hw-div
19226 @itemx -mhw-div
19227 @opindex mno-hw-mul
19228 @opindex mhw-mul
19229 @opindex mno-hw-mulx
19230 @opindex mhw-mulx
19231 @opindex mno-hw-div
19232 @opindex mhw-div
19233 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
19234 instructions by the compiler. The default is to emit @code{mul}
19235 and not emit @code{div} and @code{mulx}.
19236
19237 @item -mbmx
19238 @itemx -mno-bmx
19239 @itemx -mcdx
19240 @itemx -mno-cdx
19241 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
19242 CDX (code density) instructions. Enabling these instructions also
19243 requires @option{-march=r2}. Since these instructions are optional
19244 extensions to the R2 architecture, the default is not to emit them.
19245
19246 @item -mcustom-@var{insn}=@var{N}
19247 @itemx -mno-custom-@var{insn}
19248 @opindex mcustom-@var{insn}
19249 @opindex mno-custom-@var{insn}
19250 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
19251 custom instruction with encoding @var{N} when generating code that uses
19252 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
19253 instruction 253 for single-precision floating-point add operations instead
19254 of the default behavior of using a library call.
19255
19256 The following values of @var{insn} are supported. Except as otherwise
19257 noted, floating-point operations are expected to be implemented with
19258 normal IEEE 754 semantics and correspond directly to the C operators or the
19259 equivalent GCC built-in functions (@pxref{Other Builtins}).
19260
19261 Single-precision floating point:
19262 @table @asis
19263
19264 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
19265 Binary arithmetic operations.
19266
19267 @item @samp{fnegs}
19268 Unary negation.
19269
19270 @item @samp{fabss}
19271 Unary absolute value.
19272
19273 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
19274 Comparison operations.
19275
19276 @item @samp{fmins}, @samp{fmaxs}
19277 Floating-point minimum and maximum. These instructions are only
19278 generated if @option{-ffinite-math-only} is specified.
19279
19280 @item @samp{fsqrts}
19281 Unary square root operation.
19282
19283 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
19284 Floating-point trigonometric and exponential functions. These instructions
19285 are only generated if @option{-funsafe-math-optimizations} is also specified.
19286
19287 @end table
19288
19289 Double-precision floating point:
19290 @table @asis
19291
19292 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
19293 Binary arithmetic operations.
19294
19295 @item @samp{fnegd}
19296 Unary negation.
19297
19298 @item @samp{fabsd}
19299 Unary absolute value.
19300
19301 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
19302 Comparison operations.
19303
19304 @item @samp{fmind}, @samp{fmaxd}
19305 Double-precision minimum and maximum. These instructions are only
19306 generated if @option{-ffinite-math-only} is specified.
19307
19308 @item @samp{fsqrtd}
19309 Unary square root operation.
19310
19311 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
19312 Double-precision trigonometric and exponential functions. These instructions
19313 are only generated if @option{-funsafe-math-optimizations} is also specified.
19314
19315 @end table
19316
19317 Conversions:
19318 @table @asis
19319 @item @samp{fextsd}
19320 Conversion from single precision to double precision.
19321
19322 @item @samp{ftruncds}
19323 Conversion from double precision to single precision.
19324
19325 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
19326 Conversion from floating point to signed or unsigned integer types, with
19327 truncation towards zero.
19328
19329 @item @samp{round}
19330 Conversion from single-precision floating point to signed integer,
19331 rounding to the nearest integer and ties away from zero.
19332 This corresponds to the @code{__builtin_lroundf} function when
19333 @option{-fno-math-errno} is used.
19334
19335 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
19336 Conversion from signed or unsigned integer types to floating-point types.
19337
19338 @end table
19339
19340 In addition, all of the following transfer instructions for internal
19341 registers X and Y must be provided to use any of the double-precision
19342 floating-point instructions. Custom instructions taking two
19343 double-precision source operands expect the first operand in the
19344 64-bit register X. The other operand (or only operand of a unary
19345 operation) is given to the custom arithmetic instruction with the
19346 least significant half in source register @var{src1} and the most
19347 significant half in @var{src2}. A custom instruction that returns a
19348 double-precision result returns the most significant 32 bits in the
19349 destination register and the other half in 32-bit register Y.
19350 GCC automatically generates the necessary code sequences to write
19351 register X and/or read register Y when double-precision floating-point
19352 instructions are used.
19353
19354 @table @asis
19355
19356 @item @samp{fwrx}
19357 Write @var{src1} into the least significant half of X and @var{src2} into
19358 the most significant half of X.
19359
19360 @item @samp{fwry}
19361 Write @var{src1} into Y.
19362
19363 @item @samp{frdxhi}, @samp{frdxlo}
19364 Read the most or least (respectively) significant half of X and store it in
19365 @var{dest}.
19366
19367 @item @samp{frdy}
19368 Read the value of Y and store it into @var{dest}.
19369 @end table
19370
19371 Note that you can gain more local control over generation of Nios II custom
19372 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
19373 and @code{target("no-custom-@var{insn}")} function attributes
19374 (@pxref{Function Attributes})
19375 or pragmas (@pxref{Function Specific Option Pragmas}).
19376
19377 @item -mcustom-fpu-cfg=@var{name}
19378 @opindex mcustom-fpu-cfg
19379
19380 This option enables a predefined, named set of custom instruction encodings
19381 (see @option{-mcustom-@var{insn}} above).
19382 Currently, the following sets are defined:
19383
19384 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
19385 @gccoptlist{-mcustom-fmuls=252 @gol
19386 -mcustom-fadds=253 @gol
19387 -mcustom-fsubs=254 @gol
19388 -fsingle-precision-constant}
19389
19390 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
19391 @gccoptlist{-mcustom-fmuls=252 @gol
19392 -mcustom-fadds=253 @gol
19393 -mcustom-fsubs=254 @gol
19394 -mcustom-fdivs=255 @gol
19395 -fsingle-precision-constant}
19396
19397 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
19398 @gccoptlist{-mcustom-floatus=243 @gol
19399 -mcustom-fixsi=244 @gol
19400 -mcustom-floatis=245 @gol
19401 -mcustom-fcmpgts=246 @gol
19402 -mcustom-fcmples=249 @gol
19403 -mcustom-fcmpeqs=250 @gol
19404 -mcustom-fcmpnes=251 @gol
19405 -mcustom-fmuls=252 @gol
19406 -mcustom-fadds=253 @gol
19407 -mcustom-fsubs=254 @gol
19408 -mcustom-fdivs=255 @gol
19409 -fsingle-precision-constant}
19410
19411 Custom instruction assignments given by individual
19412 @option{-mcustom-@var{insn}=} options override those given by
19413 @option{-mcustom-fpu-cfg=}, regardless of the
19414 order of the options on the command line.
19415
19416 Note that you can gain more local control over selection of a FPU
19417 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
19418 function attribute (@pxref{Function Attributes})
19419 or pragma (@pxref{Function Specific Option Pragmas}).
19420
19421 @end table
19422
19423 These additional @samp{-m} options are available for the Altera Nios II
19424 ELF (bare-metal) target:
19425
19426 @table @gcctabopt
19427
19428 @item -mhal
19429 @opindex mhal
19430 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
19431 startup and termination code, and is typically used in conjunction with
19432 @option{-msys-crt0=} to specify the location of the alternate startup code
19433 provided by the HAL BSP.
19434
19435 @item -msmallc
19436 @opindex msmallc
19437 Link with a limited version of the C library, @option{-lsmallc}, rather than
19438 Newlib.
19439
19440 @item -msys-crt0=@var{startfile}
19441 @opindex msys-crt0
19442 @var{startfile} is the file name of the startfile (crt0) to use
19443 when linking. This option is only useful in conjunction with @option{-mhal}.
19444
19445 @item -msys-lib=@var{systemlib}
19446 @opindex msys-lib
19447 @var{systemlib} is the library name of the library that provides
19448 low-level system calls required by the C library,
19449 e.g. @code{read} and @code{write}.
19450 This option is typically used to link with a library provided by a HAL BSP.
19451
19452 @end table
19453
19454 @node Nvidia PTX Options
19455 @subsection Nvidia PTX Options
19456 @cindex Nvidia PTX options
19457 @cindex nvptx options
19458
19459 These options are defined for Nvidia PTX:
19460
19461 @table @gcctabopt
19462
19463 @item -m32
19464 @itemx -m64
19465 @opindex m32
19466 @opindex m64
19467 Generate code for 32-bit or 64-bit ABI.
19468
19469 @item -mmainkernel
19470 @opindex mmainkernel
19471 Link in code for a __main kernel. This is for stand-alone instead of
19472 offloading execution.
19473
19474 @item -moptimize
19475 @opindex moptimize
19476 Apply partitioned execution optimizations. This is the default when any
19477 level of optimization is selected.
19478
19479 @end table
19480
19481 @node PDP-11 Options
19482 @subsection PDP-11 Options
19483 @cindex PDP-11 Options
19484
19485 These options are defined for the PDP-11:
19486
19487 @table @gcctabopt
19488 @item -mfpu
19489 @opindex mfpu
19490 Use hardware FPP floating point. This is the default. (FIS floating
19491 point on the PDP-11/40 is not supported.)
19492
19493 @item -msoft-float
19494 @opindex msoft-float
19495 Do not use hardware floating point.
19496
19497 @item -mac0
19498 @opindex mac0
19499 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
19500
19501 @item -mno-ac0
19502 @opindex mno-ac0
19503 Return floating-point results in memory. This is the default.
19504
19505 @item -m40
19506 @opindex m40
19507 Generate code for a PDP-11/40.
19508
19509 @item -m45
19510 @opindex m45
19511 Generate code for a PDP-11/45. This is the default.
19512
19513 @item -m10
19514 @opindex m10
19515 Generate code for a PDP-11/10.
19516
19517 @item -mbcopy-builtin
19518 @opindex mbcopy-builtin
19519 Use inline @code{movmemhi} patterns for copying memory. This is the
19520 default.
19521
19522 @item -mbcopy
19523 @opindex mbcopy
19524 Do not use inline @code{movmemhi} patterns for copying memory.
19525
19526 @item -mint16
19527 @itemx -mno-int32
19528 @opindex mint16
19529 @opindex mno-int32
19530 Use 16-bit @code{int}. This is the default.
19531
19532 @item -mint32
19533 @itemx -mno-int16
19534 @opindex mint32
19535 @opindex mno-int16
19536 Use 32-bit @code{int}.
19537
19538 @item -mfloat64
19539 @itemx -mno-float32
19540 @opindex mfloat64
19541 @opindex mno-float32
19542 Use 64-bit @code{float}. This is the default.
19543
19544 @item -mfloat32
19545 @itemx -mno-float64
19546 @opindex mfloat32
19547 @opindex mno-float64
19548 Use 32-bit @code{float}.
19549
19550 @item -mabshi
19551 @opindex mabshi
19552 Use @code{abshi2} pattern. This is the default.
19553
19554 @item -mno-abshi
19555 @opindex mno-abshi
19556 Do not use @code{abshi2} pattern.
19557
19558 @item -mbranch-expensive
19559 @opindex mbranch-expensive
19560 Pretend that branches are expensive. This is for experimenting with
19561 code generation only.
19562
19563 @item -mbranch-cheap
19564 @opindex mbranch-cheap
19565 Do not pretend that branches are expensive. This is the default.
19566
19567 @item -munix-asm
19568 @opindex munix-asm
19569 Use Unix assembler syntax. This is the default when configured for
19570 @samp{pdp11-*-bsd}.
19571
19572 @item -mdec-asm
19573 @opindex mdec-asm
19574 Use DEC assembler syntax. This is the default when configured for any
19575 PDP-11 target other than @samp{pdp11-*-bsd}.
19576 @end table
19577
19578 @node picoChip Options
19579 @subsection picoChip Options
19580 @cindex picoChip options
19581
19582 These @samp{-m} options are defined for picoChip implementations:
19583
19584 @table @gcctabopt
19585
19586 @item -mae=@var{ae_type}
19587 @opindex mcpu
19588 Set the instruction set, register set, and instruction scheduling
19589 parameters for array element type @var{ae_type}. Supported values
19590 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
19591
19592 @option{-mae=ANY} selects a completely generic AE type. Code
19593 generated with this option runs on any of the other AE types. The
19594 code is not as efficient as it would be if compiled for a specific
19595 AE type, and some types of operation (e.g., multiplication) do not
19596 work properly on all types of AE.
19597
19598 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
19599 for compiled code, and is the default.
19600
19601 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
19602 option may suffer from poor performance of byte (char) manipulation,
19603 since the DSP AE does not provide hardware support for byte load/stores.
19604
19605 @item -msymbol-as-address
19606 Enable the compiler to directly use a symbol name as an address in a
19607 load/store instruction, without first loading it into a
19608 register. Typically, the use of this option generates larger
19609 programs, which run faster than when the option isn't used. However, the
19610 results vary from program to program, so it is left as a user option,
19611 rather than being permanently enabled.
19612
19613 @item -mno-inefficient-warnings
19614 Disables warnings about the generation of inefficient code. These
19615 warnings can be generated, for example, when compiling code that
19616 performs byte-level memory operations on the MAC AE type. The MAC AE has
19617 no hardware support for byte-level memory operations, so all byte
19618 load/stores must be synthesized from word load/store operations. This is
19619 inefficient and a warning is generated to indicate
19620 that you should rewrite the code to avoid byte operations, or to target
19621 an AE type that has the necessary hardware support. This option disables
19622 these warnings.
19623
19624 @end table
19625
19626 @node PowerPC Options
19627 @subsection PowerPC Options
19628 @cindex PowerPC options
19629
19630 These are listed under @xref{RS/6000 and PowerPC Options}.
19631
19632 @node RL78 Options
19633 @subsection RL78 Options
19634 @cindex RL78 Options
19635
19636 @table @gcctabopt
19637
19638 @item -msim
19639 @opindex msim
19640 Links in additional target libraries to support operation within a
19641 simulator.
19642
19643 @item -mmul=none
19644 @itemx -mmul=g10
19645 @itemx -mmul=g13
19646 @itemx -mmul=g14
19647 @itemx -mmul=rl78
19648 @opindex mmul
19649 Specifies the type of hardware multiplication and division support to
19650 be used. The simplest is @code{none}, which uses software for both
19651 multiplication and division. This is the default. The @code{g13}
19652 value is for the hardware multiply/divide peripheral found on the
19653 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
19654 the multiplication and division instructions supported by the RL78/G14
19655 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
19656 the value @code{mg10} is an alias for @code{none}.
19657
19658 In addition a C preprocessor macro is defined, based upon the setting
19659 of this option. Possible values are: @code{__RL78_MUL_NONE__},
19660 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
19661
19662 @item -mcpu=g10
19663 @itemx -mcpu=g13
19664 @itemx -mcpu=g14
19665 @itemx -mcpu=rl78
19666 @opindex mcpu
19667 Specifies the RL78 core to target. The default is the G14 core, also
19668 known as an S3 core or just RL78. The G13 or S2 core does not have
19669 multiply or divide instructions, instead it uses a hardware peripheral
19670 for these operations. The G10 or S1 core does not have register
19671 banks, so it uses a different calling convention.
19672
19673 If this option is set it also selects the type of hardware multiply
19674 support to use, unless this is overridden by an explicit
19675 @option{-mmul=none} option on the command line. Thus specifying
19676 @option{-mcpu=g13} enables the use of the G13 hardware multiply
19677 peripheral and specifying @option{-mcpu=g10} disables the use of
19678 hardware multiplications altogether.
19679
19680 Note, although the RL78/G14 core is the default target, specifying
19681 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
19682 change the behavior of the toolchain since it also enables G14
19683 hardware multiply support. If these options are not specified on the
19684 command line then software multiplication routines will be used even
19685 though the code targets the RL78 core. This is for backwards
19686 compatibility with older toolchains which did not have hardware
19687 multiply and divide support.
19688
19689 In addition a C preprocessor macro is defined, based upon the setting
19690 of this option. Possible values are: @code{__RL78_G10__},
19691 @code{__RL78_G13__} or @code{__RL78_G14__}.
19692
19693 @item -mg10
19694 @itemx -mg13
19695 @itemx -mg14
19696 @itemx -mrl78
19697 @opindex mg10
19698 @opindex mg13
19699 @opindex mg14
19700 @opindex mrl78
19701 These are aliases for the corresponding @option{-mcpu=} option. They
19702 are provided for backwards compatibility.
19703
19704 @item -mallregs
19705 @opindex mallregs
19706 Allow the compiler to use all of the available registers. By default
19707 registers @code{r24..r31} are reserved for use in interrupt handlers.
19708 With this option enabled these registers can be used in ordinary
19709 functions as well.
19710
19711 @item -m64bit-doubles
19712 @itemx -m32bit-doubles
19713 @opindex m64bit-doubles
19714 @opindex m32bit-doubles
19715 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
19716 or 32 bits (@option{-m32bit-doubles}) in size. The default is
19717 @option{-m32bit-doubles}.
19718
19719 @end table
19720
19721 @node RS/6000 and PowerPC Options
19722 @subsection IBM RS/6000 and PowerPC Options
19723 @cindex RS/6000 and PowerPC Options
19724 @cindex IBM RS/6000 and PowerPC Options
19725
19726 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
19727 @table @gcctabopt
19728 @item -mpowerpc-gpopt
19729 @itemx -mno-powerpc-gpopt
19730 @itemx -mpowerpc-gfxopt
19731 @itemx -mno-powerpc-gfxopt
19732 @need 800
19733 @itemx -mpowerpc64
19734 @itemx -mno-powerpc64
19735 @itemx -mmfcrf
19736 @itemx -mno-mfcrf
19737 @itemx -mpopcntb
19738 @itemx -mno-popcntb
19739 @itemx -mpopcntd
19740 @itemx -mno-popcntd
19741 @itemx -mfprnd
19742 @itemx -mno-fprnd
19743 @need 800
19744 @itemx -mcmpb
19745 @itemx -mno-cmpb
19746 @itemx -mmfpgpr
19747 @itemx -mno-mfpgpr
19748 @itemx -mhard-dfp
19749 @itemx -mno-hard-dfp
19750 @opindex mpowerpc-gpopt
19751 @opindex mno-powerpc-gpopt
19752 @opindex mpowerpc-gfxopt
19753 @opindex mno-powerpc-gfxopt
19754 @opindex mpowerpc64
19755 @opindex mno-powerpc64
19756 @opindex mmfcrf
19757 @opindex mno-mfcrf
19758 @opindex mpopcntb
19759 @opindex mno-popcntb
19760 @opindex mpopcntd
19761 @opindex mno-popcntd
19762 @opindex mfprnd
19763 @opindex mno-fprnd
19764 @opindex mcmpb
19765 @opindex mno-cmpb
19766 @opindex mmfpgpr
19767 @opindex mno-mfpgpr
19768 @opindex mhard-dfp
19769 @opindex mno-hard-dfp
19770 You use these options to specify which instructions are available on the
19771 processor you are using. The default value of these options is
19772 determined when configuring GCC@. Specifying the
19773 @option{-mcpu=@var{cpu_type}} overrides the specification of these
19774 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
19775 rather than the options listed above.
19776
19777 Specifying @option{-mpowerpc-gpopt} allows
19778 GCC to use the optional PowerPC architecture instructions in the
19779 General Purpose group, including floating-point square root. Specifying
19780 @option{-mpowerpc-gfxopt} allows GCC to
19781 use the optional PowerPC architecture instructions in the Graphics
19782 group, including floating-point select.
19783
19784 The @option{-mmfcrf} option allows GCC to generate the move from
19785 condition register field instruction implemented on the POWER4
19786 processor and other processors that support the PowerPC V2.01
19787 architecture.
19788 The @option{-mpopcntb} option allows GCC to generate the popcount and
19789 double-precision FP reciprocal estimate instruction implemented on the
19790 POWER5 processor and other processors that support the PowerPC V2.02
19791 architecture.
19792 The @option{-mpopcntd} option allows GCC to generate the popcount
19793 instruction implemented on the POWER7 processor and other processors
19794 that support the PowerPC V2.06 architecture.
19795 The @option{-mfprnd} option allows GCC to generate the FP round to
19796 integer instructions implemented on the POWER5+ processor and other
19797 processors that support the PowerPC V2.03 architecture.
19798 The @option{-mcmpb} option allows GCC to generate the compare bytes
19799 instruction implemented on the POWER6 processor and other processors
19800 that support the PowerPC V2.05 architecture.
19801 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
19802 general-purpose register instructions implemented on the POWER6X
19803 processor and other processors that support the extended PowerPC V2.05
19804 architecture.
19805 The @option{-mhard-dfp} option allows GCC to generate the decimal
19806 floating-point instructions implemented on some POWER processors.
19807
19808 The @option{-mpowerpc64} option allows GCC to generate the additional
19809 64-bit instructions that are found in the full PowerPC64 architecture
19810 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
19811 @option{-mno-powerpc64}.
19812
19813 @item -mcpu=@var{cpu_type}
19814 @opindex mcpu
19815 Set architecture type, register usage, and
19816 instruction scheduling parameters for machine type @var{cpu_type}.
19817 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
19818 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
19819 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
19820 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
19821 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
19822 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
19823 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
19824 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
19825 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
19826 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
19827 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
19828 and @samp{rs64}.
19829
19830 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
19831 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
19832 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
19833 architecture machine types, with an appropriate, generic processor
19834 model assumed for scheduling purposes.
19835
19836 The other options specify a specific processor. Code generated under
19837 those options runs best on that processor, and may not run at all on
19838 others.
19839
19840 The @option{-mcpu} options automatically enable or disable the
19841 following options:
19842
19843 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
19844 -mpopcntb -mpopcntd -mpowerpc64 @gol
19845 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
19846 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
19847 -mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol
19848 -mquad-memory -mquad-memory-atomic -mmodulo -mfloat128 -mfloat128-hardware @gol
19849 -mpower9-fusion -mpower9-vector}
19850
19851 The particular options set for any particular CPU varies between
19852 compiler versions, depending on what setting seems to produce optimal
19853 code for that CPU; it doesn't necessarily reflect the actual hardware's
19854 capabilities. If you wish to set an individual option to a particular
19855 value, you may specify it after the @option{-mcpu} option, like
19856 @option{-mcpu=970 -mno-altivec}.
19857
19858 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
19859 not enabled or disabled by the @option{-mcpu} option at present because
19860 AIX does not have full support for these options. You may still
19861 enable or disable them individually if you're sure it'll work in your
19862 environment.
19863
19864 @item -mtune=@var{cpu_type}
19865 @opindex mtune
19866 Set the instruction scheduling parameters for machine type
19867 @var{cpu_type}, but do not set the architecture type or register usage,
19868 as @option{-mcpu=@var{cpu_type}} does. The same
19869 values for @var{cpu_type} are used for @option{-mtune} as for
19870 @option{-mcpu}. If both are specified, the code generated uses the
19871 architecture and registers set by @option{-mcpu}, but the
19872 scheduling parameters set by @option{-mtune}.
19873
19874 @item -mcmodel=small
19875 @opindex mcmodel=small
19876 Generate PowerPC64 code for the small model: The TOC is limited to
19877 64k.
19878
19879 @item -mcmodel=medium
19880 @opindex mcmodel=medium
19881 Generate PowerPC64 code for the medium model: The TOC and other static
19882 data may be up to a total of 4G in size.
19883
19884 @item -mcmodel=large
19885 @opindex mcmodel=large
19886 Generate PowerPC64 code for the large model: The TOC may be up to 4G
19887 in size. Other data and code is only limited by the 64-bit address
19888 space.
19889
19890 @item -maltivec
19891 @itemx -mno-altivec
19892 @opindex maltivec
19893 @opindex mno-altivec
19894 Generate code that uses (does not use) AltiVec instructions, and also
19895 enable the use of built-in functions that allow more direct access to
19896 the AltiVec instruction set. You may also need to set
19897 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
19898 enhancements.
19899
19900 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
19901 @option{-maltivec=be}, the element order for AltiVec intrinsics such
19902 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
19903 match array element order corresponding to the endianness of the
19904 target. That is, element zero identifies the leftmost element in a
19905 vector register when targeting a big-endian platform, and identifies
19906 the rightmost element in a vector register when targeting a
19907 little-endian platform.
19908
19909 @item -maltivec=be
19910 @opindex maltivec=be
19911 Generate AltiVec instructions using big-endian element order,
19912 regardless of whether the target is big- or little-endian. This is
19913 the default when targeting a big-endian platform.
19914
19915 The element order is used to interpret element numbers in AltiVec
19916 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
19917 @code{vec_insert}. By default, these match array element order
19918 corresponding to the endianness for the target.
19919
19920 @item -maltivec=le
19921 @opindex maltivec=le
19922 Generate AltiVec instructions using little-endian element order,
19923 regardless of whether the target is big- or little-endian. This is
19924 the default when targeting a little-endian platform. This option is
19925 currently ignored when targeting a big-endian platform.
19926
19927 The element order is used to interpret element numbers in AltiVec
19928 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
19929 @code{vec_insert}. By default, these match array element order
19930 corresponding to the endianness for the target.
19931
19932 @item -mvrsave
19933 @itemx -mno-vrsave
19934 @opindex mvrsave
19935 @opindex mno-vrsave
19936 Generate VRSAVE instructions when generating AltiVec code.
19937
19938 @item -mgen-cell-microcode
19939 @opindex mgen-cell-microcode
19940 Generate Cell microcode instructions.
19941
19942 @item -mwarn-cell-microcode
19943 @opindex mwarn-cell-microcode
19944 Warn when a Cell microcode instruction is emitted. An example
19945 of a Cell microcode instruction is a variable shift.
19946
19947 @item -msecure-plt
19948 @opindex msecure-plt
19949 Generate code that allows @command{ld} and @command{ld.so}
19950 to build executables and shared
19951 libraries with non-executable @code{.plt} and @code{.got} sections.
19952 This is a PowerPC
19953 32-bit SYSV ABI option.
19954
19955 @item -mbss-plt
19956 @opindex mbss-plt
19957 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
19958 fills in, and
19959 requires @code{.plt} and @code{.got}
19960 sections that are both writable and executable.
19961 This is a PowerPC 32-bit SYSV ABI option.
19962
19963 @item -misel
19964 @itemx -mno-isel
19965 @opindex misel
19966 @opindex mno-isel
19967 This switch enables or disables the generation of ISEL instructions.
19968
19969 @item -misel=@var{yes/no}
19970 This switch has been deprecated. Use @option{-misel} and
19971 @option{-mno-isel} instead.
19972
19973 @item -mspe
19974 @itemx -mno-spe
19975 @opindex mspe
19976 @opindex mno-spe
19977 This switch enables or disables the generation of SPE simd
19978 instructions.
19979
19980 @item -mpaired
19981 @itemx -mno-paired
19982 @opindex mpaired
19983 @opindex mno-paired
19984 This switch enables or disables the generation of PAIRED simd
19985 instructions.
19986
19987 @item -mspe=@var{yes/no}
19988 This option has been deprecated. Use @option{-mspe} and
19989 @option{-mno-spe} instead.
19990
19991 @item -mvsx
19992 @itemx -mno-vsx
19993 @opindex mvsx
19994 @opindex mno-vsx
19995 Generate code that uses (does not use) vector/scalar (VSX)
19996 instructions, and also enable the use of built-in functions that allow
19997 more direct access to the VSX instruction set.
19998
19999 @item -mcrypto
20000 @itemx -mno-crypto
20001 @opindex mcrypto
20002 @opindex mno-crypto
20003 Enable the use (disable) of the built-in functions that allow direct
20004 access to the cryptographic instructions that were added in version
20005 2.07 of the PowerPC ISA.
20006
20007 @item -mdirect-move
20008 @itemx -mno-direct-move
20009 @opindex mdirect-move
20010 @opindex mno-direct-move
20011 Generate code that uses (does not use) the instructions to move data
20012 between the general purpose registers and the vector/scalar (VSX)
20013 registers that were added in version 2.07 of the PowerPC ISA.
20014
20015 @item -mpower8-fusion
20016 @itemx -mno-power8-fusion
20017 @opindex mpower8-fusion
20018 @opindex mno-power8-fusion
20019 Generate code that keeps (does not keeps) some integer operations
20020 adjacent so that the instructions can be fused together on power8 and
20021 later processors.
20022
20023 @item -mpower8-vector
20024 @itemx -mno-power8-vector
20025 @opindex mpower8-vector
20026 @opindex mno-power8-vector
20027 Generate code that uses (does not use) the vector and scalar
20028 instructions that were added in version 2.07 of the PowerPC ISA. Also
20029 enable the use of built-in functions that allow more direct access to
20030 the vector instructions.
20031
20032 @item -mquad-memory
20033 @itemx -mno-quad-memory
20034 @opindex mquad-memory
20035 @opindex mno-quad-memory
20036 Generate code that uses (does not use) the non-atomic quad word memory
20037 instructions. The @option{-mquad-memory} option requires use of
20038 64-bit mode.
20039
20040 @item -mquad-memory-atomic
20041 @itemx -mno-quad-memory-atomic
20042 @opindex mquad-memory-atomic
20043 @opindex mno-quad-memory-atomic
20044 Generate code that uses (does not use) the atomic quad word memory
20045 instructions. The @option{-mquad-memory-atomic} option requires use of
20046 64-bit mode.
20047
20048 @item -mupper-regs-df
20049 @itemx -mno-upper-regs-df
20050 @opindex mupper-regs-df
20051 @opindex mno-upper-regs-df
20052 Generate code that uses (does not use) the scalar double precision
20053 instructions that target all 64 registers in the vector/scalar
20054 floating point register set that were added in version 2.06 of the
20055 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
20056 use any of the @option{-mcpu=power7}, @option{-mcpu=power8}, or
20057 @option{-mvsx} options.
20058
20059 @item -mupper-regs-sf
20060 @itemx -mno-upper-regs-sf
20061 @opindex mupper-regs-sf
20062 @opindex mno-upper-regs-sf
20063 Generate code that uses (does not use) the scalar single precision
20064 instructions that target all 64 registers in the vector/scalar
20065 floating point register set that were added in version 2.07 of the
20066 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
20067 use either of the @option{-mcpu=power8} or @option{-mpower8-vector}
20068 options.
20069
20070 @item -mupper-regs
20071 @itemx -mno-upper-regs
20072 @opindex mupper-regs
20073 @opindex mno-upper-regs
20074 Generate code that uses (does not use) the scalar
20075 instructions that target all 64 registers in the vector/scalar
20076 floating point register set, depending on the model of the machine.
20077
20078 If the @option{-mno-upper-regs} option is used, it turns off both
20079 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
20080
20081 @item -mfloat128
20082 @itemx -mno-float128
20083 @opindex mfloat128
20084 @opindex mno-float128
20085 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
20086 and use either software emulation for IEEE 128-bit floating point or
20087 hardware instructions.
20088
20089 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
20090 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
20091 option. The @code{-mfloat128} option only works on PowerPC 64-bit
20092 Linux systems.
20093
20094 @item -mfloat128-hardware
20095 @itemx -mno-float128-hardware
20096 @opindex mfloat128-hardware
20097 @opindex mno-float128-hardware
20098 Enable/disable using ISA 3.0 hardware instructions to support the
20099 @var{__float128} data type.
20100
20101 @item -mmodulo
20102 @itemx -mno-modulo
20103 @opindex mmodulo
20104 @opindex mno-module
20105 Generate code that uses (does not use) the ISA 3.0 integer modulo
20106 instructions. The @option{-mmodulo} option is enabled by default
20107 with the @option{-mcpu=power9} option.
20108
20109 @item -mpower9-fusion
20110 @itemx -mno-power9-fusion
20111 @opindex mpower9-fusion
20112 @opindex mno-power9-fusion
20113 Generate code that keeps (does not keeps) some operations adjacent so
20114 that the instructions can be fused together on power9 and later
20115 processors.
20116
20117 @item -mpower9-vector
20118 @itemx -mno-power9-vector
20119 @opindex mpower9-vector
20120 @opindex mno-power9-vector
20121 Generate code that uses (does not use) the vector and scalar
20122 instructions that were added in version 2.07 of the PowerPC ISA. Also
20123 enable the use of built-in functions that allow more direct access to
20124 the vector instructions.
20125
20126 @item -mfloat-gprs=@var{yes/single/double/no}
20127 @itemx -mfloat-gprs
20128 @opindex mfloat-gprs
20129 This switch enables or disables the generation of floating-point
20130 operations on the general-purpose registers for architectures that
20131 support it.
20132
20133 The argument @samp{yes} or @samp{single} enables the use of
20134 single-precision floating-point operations.
20135
20136 The argument @samp{double} enables the use of single and
20137 double-precision floating-point operations.
20138
20139 The argument @samp{no} disables floating-point operations on the
20140 general-purpose registers.
20141
20142 This option is currently only available on the MPC854x.
20143
20144 @item -m32
20145 @itemx -m64
20146 @opindex m32
20147 @opindex m64
20148 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
20149 targets (including GNU/Linux). The 32-bit environment sets int, long
20150 and pointer to 32 bits and generates code that runs on any PowerPC
20151 variant. The 64-bit environment sets int to 32 bits and long and
20152 pointer to 64 bits, and generates code for PowerPC64, as for
20153 @option{-mpowerpc64}.
20154
20155 @item -mfull-toc
20156 @itemx -mno-fp-in-toc
20157 @itemx -mno-sum-in-toc
20158 @itemx -mminimal-toc
20159 @opindex mfull-toc
20160 @opindex mno-fp-in-toc
20161 @opindex mno-sum-in-toc
20162 @opindex mminimal-toc
20163 Modify generation of the TOC (Table Of Contents), which is created for
20164 every executable file. The @option{-mfull-toc} option is selected by
20165 default. In that case, GCC allocates at least one TOC entry for
20166 each unique non-automatic variable reference in your program. GCC
20167 also places floating-point constants in the TOC@. However, only
20168 16,384 entries are available in the TOC@.
20169
20170 If you receive a linker error message that saying you have overflowed
20171 the available TOC space, you can reduce the amount of TOC space used
20172 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
20173 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
20174 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
20175 generate code to calculate the sum of an address and a constant at
20176 run time instead of putting that sum into the TOC@. You may specify one
20177 or both of these options. Each causes GCC to produce very slightly
20178 slower and larger code at the expense of conserving TOC space.
20179
20180 If you still run out of space in the TOC even when you specify both of
20181 these options, specify @option{-mminimal-toc} instead. This option causes
20182 GCC to make only one TOC entry for every file. When you specify this
20183 option, GCC produces code that is slower and larger but which
20184 uses extremely little TOC space. You may wish to use this option
20185 only on files that contain less frequently-executed code.
20186
20187 @item -maix64
20188 @itemx -maix32
20189 @opindex maix64
20190 @opindex maix32
20191 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
20192 @code{long} type, and the infrastructure needed to support them.
20193 Specifying @option{-maix64} implies @option{-mpowerpc64},
20194 while @option{-maix32} disables the 64-bit ABI and
20195 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
20196
20197 @item -mxl-compat
20198 @itemx -mno-xl-compat
20199 @opindex mxl-compat
20200 @opindex mno-xl-compat
20201 Produce code that conforms more closely to IBM XL compiler semantics
20202 when using AIX-compatible ABI@. Pass floating-point arguments to
20203 prototyped functions beyond the register save area (RSA) on the stack
20204 in addition to argument FPRs. Do not assume that most significant
20205 double in 128-bit long double value is properly rounded when comparing
20206 values and converting to double. Use XL symbol names for long double
20207 support routines.
20208
20209 The AIX calling convention was extended but not initially documented to
20210 handle an obscure K&R C case of calling a function that takes the
20211 address of its arguments with fewer arguments than declared. IBM XL
20212 compilers access floating-point arguments that do not fit in the
20213 RSA from the stack when a subroutine is compiled without
20214 optimization. Because always storing floating-point arguments on the
20215 stack is inefficient and rarely needed, this option is not enabled by
20216 default and only is necessary when calling subroutines compiled by IBM
20217 XL compilers without optimization.
20218
20219 @item -mpe
20220 @opindex mpe
20221 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
20222 application written to use message passing with special startup code to
20223 enable the application to run. The system must have PE installed in the
20224 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
20225 must be overridden with the @option{-specs=} option to specify the
20226 appropriate directory location. The Parallel Environment does not
20227 support threads, so the @option{-mpe} option and the @option{-pthread}
20228 option are incompatible.
20229
20230 @item -malign-natural
20231 @itemx -malign-power
20232 @opindex malign-natural
20233 @opindex malign-power
20234 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
20235 @option{-malign-natural} overrides the ABI-defined alignment of larger
20236 types, such as floating-point doubles, on their natural size-based boundary.
20237 The option @option{-malign-power} instructs GCC to follow the ABI-specified
20238 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
20239
20240 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
20241 is not supported.
20242
20243 @item -msoft-float
20244 @itemx -mhard-float
20245 @opindex msoft-float
20246 @opindex mhard-float
20247 Generate code that does not use (uses) the floating-point register set.
20248 Software floating-point emulation is provided if you use the
20249 @option{-msoft-float} option, and pass the option to GCC when linking.
20250
20251 @item -msingle-float
20252 @itemx -mdouble-float
20253 @opindex msingle-float
20254 @opindex mdouble-float
20255 Generate code for single- or double-precision floating-point operations.
20256 @option{-mdouble-float} implies @option{-msingle-float}.
20257
20258 @item -msimple-fpu
20259 @opindex msimple-fpu
20260 Do not generate @code{sqrt} and @code{div} instructions for hardware
20261 floating-point unit.
20262
20263 @item -mfpu=@var{name}
20264 @opindex mfpu
20265 Specify type of floating-point unit. Valid values for @var{name} are
20266 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
20267 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
20268 @samp{sp_full} (equivalent to @option{-msingle-float}),
20269 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
20270
20271 @item -mxilinx-fpu
20272 @opindex mxilinx-fpu
20273 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
20274
20275 @item -mmultiple
20276 @itemx -mno-multiple
20277 @opindex mmultiple
20278 @opindex mno-multiple
20279 Generate code that uses (does not use) the load multiple word
20280 instructions and the store multiple word instructions. These
20281 instructions are generated by default on POWER systems, and not
20282 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
20283 PowerPC systems, since those instructions do not work when the
20284 processor is in little-endian mode. The exceptions are PPC740 and
20285 PPC750 which permit these instructions in little-endian mode.
20286
20287 @item -mstring
20288 @itemx -mno-string
20289 @opindex mstring
20290 @opindex mno-string
20291 Generate code that uses (does not use) the load string instructions
20292 and the store string word instructions to save multiple registers and
20293 do small block moves. These instructions are generated by default on
20294 POWER systems, and not generated on PowerPC systems. Do not use
20295 @option{-mstring} on little-endian PowerPC systems, since those
20296 instructions do not work when the processor is in little-endian mode.
20297 The exceptions are PPC740 and PPC750 which permit these instructions
20298 in little-endian mode.
20299
20300 @item -mupdate
20301 @itemx -mno-update
20302 @opindex mupdate
20303 @opindex mno-update
20304 Generate code that uses (does not use) the load or store instructions
20305 that update the base register to the address of the calculated memory
20306 location. These instructions are generated by default. If you use
20307 @option{-mno-update}, there is a small window between the time that the
20308 stack pointer is updated and the address of the previous frame is
20309 stored, which means code that walks the stack frame across interrupts or
20310 signals may get corrupted data.
20311
20312 @item -mavoid-indexed-addresses
20313 @itemx -mno-avoid-indexed-addresses
20314 @opindex mavoid-indexed-addresses
20315 @opindex mno-avoid-indexed-addresses
20316 Generate code that tries to avoid (not avoid) the use of indexed load
20317 or store instructions. These instructions can incur a performance
20318 penalty on Power6 processors in certain situations, such as when
20319 stepping through large arrays that cross a 16M boundary. This option
20320 is enabled by default when targeting Power6 and disabled otherwise.
20321
20322 @item -mfused-madd
20323 @itemx -mno-fused-madd
20324 @opindex mfused-madd
20325 @opindex mno-fused-madd
20326 Generate code that uses (does not use) the floating-point multiply and
20327 accumulate instructions. These instructions are generated by default
20328 if hardware floating point is used. The machine-dependent
20329 @option{-mfused-madd} option is now mapped to the machine-independent
20330 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
20331 mapped to @option{-ffp-contract=off}.
20332
20333 @item -mmulhw
20334 @itemx -mno-mulhw
20335 @opindex mmulhw
20336 @opindex mno-mulhw
20337 Generate code that uses (does not use) the half-word multiply and
20338 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
20339 These instructions are generated by default when targeting those
20340 processors.
20341
20342 @item -mdlmzb
20343 @itemx -mno-dlmzb
20344 @opindex mdlmzb
20345 @opindex mno-dlmzb
20346 Generate code that uses (does not use) the string-search @samp{dlmzb}
20347 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
20348 generated by default when targeting those processors.
20349
20350 @item -mno-bit-align
20351 @itemx -mbit-align
20352 @opindex mno-bit-align
20353 @opindex mbit-align
20354 On System V.4 and embedded PowerPC systems do not (do) force structures
20355 and unions that contain bit-fields to be aligned to the base type of the
20356 bit-field.
20357
20358 For example, by default a structure containing nothing but 8
20359 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
20360 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
20361 the structure is aligned to a 1-byte boundary and is 1 byte in
20362 size.
20363
20364 @item -mno-strict-align
20365 @itemx -mstrict-align
20366 @opindex mno-strict-align
20367 @opindex mstrict-align
20368 On System V.4 and embedded PowerPC systems do not (do) assume that
20369 unaligned memory references are handled by the system.
20370
20371 @item -mrelocatable
20372 @itemx -mno-relocatable
20373 @opindex mrelocatable
20374 @opindex mno-relocatable
20375 Generate code that allows (does not allow) a static executable to be
20376 relocated to a different address at run time. A simple embedded
20377 PowerPC system loader should relocate the entire contents of
20378 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
20379 a table of 32-bit addresses generated by this option. For this to
20380 work, all objects linked together must be compiled with
20381 @option{-mrelocatable} or @option{-mrelocatable-lib}.
20382 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
20383
20384 @item -mrelocatable-lib
20385 @itemx -mno-relocatable-lib
20386 @opindex mrelocatable-lib
20387 @opindex mno-relocatable-lib
20388 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
20389 @code{.fixup} section to allow static executables to be relocated at
20390 run time, but @option{-mrelocatable-lib} does not use the smaller stack
20391 alignment of @option{-mrelocatable}. Objects compiled with
20392 @option{-mrelocatable-lib} may be linked with objects compiled with
20393 any combination of the @option{-mrelocatable} options.
20394
20395 @item -mno-toc
20396 @itemx -mtoc
20397 @opindex mno-toc
20398 @opindex mtoc
20399 On System V.4 and embedded PowerPC systems do not (do) assume that
20400 register 2 contains a pointer to a global area pointing to the addresses
20401 used in the program.
20402
20403 @item -mlittle
20404 @itemx -mlittle-endian
20405 @opindex mlittle
20406 @opindex mlittle-endian
20407 On System V.4 and embedded PowerPC systems compile code for the
20408 processor in little-endian mode. The @option{-mlittle-endian} option is
20409 the same as @option{-mlittle}.
20410
20411 @item -mbig
20412 @itemx -mbig-endian
20413 @opindex mbig
20414 @opindex mbig-endian
20415 On System V.4 and embedded PowerPC systems compile code for the
20416 processor in big-endian mode. The @option{-mbig-endian} option is
20417 the same as @option{-mbig}.
20418
20419 @item -mdynamic-no-pic
20420 @opindex mdynamic-no-pic
20421 On Darwin and Mac OS X systems, compile code so that it is not
20422 relocatable, but that its external references are relocatable. The
20423 resulting code is suitable for applications, but not shared
20424 libraries.
20425
20426 @item -msingle-pic-base
20427 @opindex msingle-pic-base
20428 Treat the register used for PIC addressing as read-only, rather than
20429 loading it in the prologue for each function. The runtime system is
20430 responsible for initializing this register with an appropriate value
20431 before execution begins.
20432
20433 @item -mprioritize-restricted-insns=@var{priority}
20434 @opindex mprioritize-restricted-insns
20435 This option controls the priority that is assigned to
20436 dispatch-slot restricted instructions during the second scheduling
20437 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
20438 or @samp{2} to assign no, highest, or second-highest (respectively)
20439 priority to dispatch-slot restricted
20440 instructions.
20441
20442 @item -msched-costly-dep=@var{dependence_type}
20443 @opindex msched-costly-dep
20444 This option controls which dependences are considered costly
20445 by the target during instruction scheduling. The argument
20446 @var{dependence_type} takes one of the following values:
20447
20448 @table @asis
20449 @item @samp{no}
20450 No dependence is costly.
20451
20452 @item @samp{all}
20453 All dependences are costly.
20454
20455 @item @samp{true_store_to_load}
20456 A true dependence from store to load is costly.
20457
20458 @item @samp{store_to_load}
20459 Any dependence from store to load is costly.
20460
20461 @item @var{number}
20462 Any dependence for which the latency is greater than or equal to
20463 @var{number} is costly.
20464 @end table
20465
20466 @item -minsert-sched-nops=@var{scheme}
20467 @opindex minsert-sched-nops
20468 This option controls which NOP insertion scheme is used during
20469 the second scheduling pass. The argument @var{scheme} takes one of the
20470 following values:
20471
20472 @table @asis
20473 @item @samp{no}
20474 Don't insert NOPs.
20475
20476 @item @samp{pad}
20477 Pad with NOPs any dispatch group that has vacant issue slots,
20478 according to the scheduler's grouping.
20479
20480 @item @samp{regroup_exact}
20481 Insert NOPs to force costly dependent insns into
20482 separate groups. Insert exactly as many NOPs as needed to force an insn
20483 to a new group, according to the estimated processor grouping.
20484
20485 @item @var{number}
20486 Insert NOPs to force costly dependent insns into
20487 separate groups. Insert @var{number} NOPs to force an insn to a new group.
20488 @end table
20489
20490 @item -mcall-sysv
20491 @opindex mcall-sysv
20492 On System V.4 and embedded PowerPC systems compile code using calling
20493 conventions that adhere to the March 1995 draft of the System V
20494 Application Binary Interface, PowerPC processor supplement. This is the
20495 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
20496
20497 @item -mcall-sysv-eabi
20498 @itemx -mcall-eabi
20499 @opindex mcall-sysv-eabi
20500 @opindex mcall-eabi
20501 Specify both @option{-mcall-sysv} and @option{-meabi} options.
20502
20503 @item -mcall-sysv-noeabi
20504 @opindex mcall-sysv-noeabi
20505 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
20506
20507 @item -mcall-aixdesc
20508 @opindex m
20509 On System V.4 and embedded PowerPC systems compile code for the AIX
20510 operating system.
20511
20512 @item -mcall-linux
20513 @opindex mcall-linux
20514 On System V.4 and embedded PowerPC systems compile code for the
20515 Linux-based GNU system.
20516
20517 @item -mcall-freebsd
20518 @opindex mcall-freebsd
20519 On System V.4 and embedded PowerPC systems compile code for the
20520 FreeBSD operating system.
20521
20522 @item -mcall-netbsd
20523 @opindex mcall-netbsd
20524 On System V.4 and embedded PowerPC systems compile code for the
20525 NetBSD operating system.
20526
20527 @item -mcall-openbsd
20528 @opindex mcall-netbsd
20529 On System V.4 and embedded PowerPC systems compile code for the
20530 OpenBSD operating system.
20531
20532 @item -maix-struct-return
20533 @opindex maix-struct-return
20534 Return all structures in memory (as specified by the AIX ABI)@.
20535
20536 @item -msvr4-struct-return
20537 @opindex msvr4-struct-return
20538 Return structures smaller than 8 bytes in registers (as specified by the
20539 SVR4 ABI)@.
20540
20541 @item -mabi=@var{abi-type}
20542 @opindex mabi
20543 Extend the current ABI with a particular extension, or remove such extension.
20544 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
20545 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
20546 @samp{elfv1}, @samp{elfv2}@.
20547
20548 @item -mabi=spe
20549 @opindex mabi=spe
20550 Extend the current ABI with SPE ABI extensions. This does not change
20551 the default ABI, instead it adds the SPE ABI extensions to the current
20552 ABI@.
20553
20554 @item -mabi=no-spe
20555 @opindex mabi=no-spe
20556 Disable Book-E SPE ABI extensions for the current ABI@.
20557
20558 @item -mabi=ibmlongdouble
20559 @opindex mabi=ibmlongdouble
20560 Change the current ABI to use IBM extended-precision long double.
20561 This is a PowerPC 32-bit SYSV ABI option.
20562
20563 @item -mabi=ieeelongdouble
20564 @opindex mabi=ieeelongdouble
20565 Change the current ABI to use IEEE extended-precision long double.
20566 This is a PowerPC 32-bit Linux ABI option.
20567
20568 @item -mabi=elfv1
20569 @opindex mabi=elfv1
20570 Change the current ABI to use the ELFv1 ABI.
20571 This is the default ABI for big-endian PowerPC 64-bit Linux.
20572 Overriding the default ABI requires special system support and is
20573 likely to fail in spectacular ways.
20574
20575 @item -mabi=elfv2
20576 @opindex mabi=elfv2
20577 Change the current ABI to use the ELFv2 ABI.
20578 This is the default ABI for little-endian PowerPC 64-bit Linux.
20579 Overriding the default ABI requires special system support and is
20580 likely to fail in spectacular ways.
20581
20582 @item -mprototype
20583 @itemx -mno-prototype
20584 @opindex mprototype
20585 @opindex mno-prototype
20586 On System V.4 and embedded PowerPC systems assume that all calls to
20587 variable argument functions are properly prototyped. Otherwise, the
20588 compiler must insert an instruction before every non-prototyped call to
20589 set or clear bit 6 of the condition code register (@code{CR}) to
20590 indicate whether floating-point values are passed in the floating-point
20591 registers in case the function takes variable arguments. With
20592 @option{-mprototype}, only calls to prototyped variable argument functions
20593 set or clear the bit.
20594
20595 @item -msim
20596 @opindex msim
20597 On embedded PowerPC systems, assume that the startup module is called
20598 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
20599 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
20600 configurations.
20601
20602 @item -mmvme
20603 @opindex mmvme
20604 On embedded PowerPC systems, assume that the startup module is called
20605 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
20606 @file{libc.a}.
20607
20608 @item -mads
20609 @opindex mads
20610 On embedded PowerPC systems, assume that the startup module is called
20611 @file{crt0.o} and the standard C libraries are @file{libads.a} and
20612 @file{libc.a}.
20613
20614 @item -myellowknife
20615 @opindex myellowknife
20616 On embedded PowerPC systems, assume that the startup module is called
20617 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
20618 @file{libc.a}.
20619
20620 @item -mvxworks
20621 @opindex mvxworks
20622 On System V.4 and embedded PowerPC systems, specify that you are
20623 compiling for a VxWorks system.
20624
20625 @item -memb
20626 @opindex memb
20627 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
20628 header to indicate that @samp{eabi} extended relocations are used.
20629
20630 @item -meabi
20631 @itemx -mno-eabi
20632 @opindex meabi
20633 @opindex mno-eabi
20634 On System V.4 and embedded PowerPC systems do (do not) adhere to the
20635 Embedded Applications Binary Interface (EABI), which is a set of
20636 modifications to the System V.4 specifications. Selecting @option{-meabi}
20637 means that the stack is aligned to an 8-byte boundary, a function
20638 @code{__eabi} is called from @code{main} to set up the EABI
20639 environment, and the @option{-msdata} option can use both @code{r2} and
20640 @code{r13} to point to two separate small data areas. Selecting
20641 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
20642 no EABI initialization function is called from @code{main}, and the
20643 @option{-msdata} option only uses @code{r13} to point to a single
20644 small data area. The @option{-meabi} option is on by default if you
20645 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
20646
20647 @item -msdata=eabi
20648 @opindex msdata=eabi
20649 On System V.4 and embedded PowerPC systems, put small initialized
20650 @code{const} global and static data in the @code{.sdata2} section, which
20651 is pointed to by register @code{r2}. Put small initialized
20652 non-@code{const} global and static data in the @code{.sdata} section,
20653 which is pointed to by register @code{r13}. Put small uninitialized
20654 global and static data in the @code{.sbss} section, which is adjacent to
20655 the @code{.sdata} section. The @option{-msdata=eabi} option is
20656 incompatible with the @option{-mrelocatable} option. The
20657 @option{-msdata=eabi} option also sets the @option{-memb} option.
20658
20659 @item -msdata=sysv
20660 @opindex msdata=sysv
20661 On System V.4 and embedded PowerPC systems, put small global and static
20662 data in the @code{.sdata} section, which is pointed to by register
20663 @code{r13}. Put small uninitialized global and static data in the
20664 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
20665 The @option{-msdata=sysv} option is incompatible with the
20666 @option{-mrelocatable} option.
20667
20668 @item -msdata=default
20669 @itemx -msdata
20670 @opindex msdata=default
20671 @opindex msdata
20672 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
20673 compile code the same as @option{-msdata=eabi}, otherwise compile code the
20674 same as @option{-msdata=sysv}.
20675
20676 @item -msdata=data
20677 @opindex msdata=data
20678 On System V.4 and embedded PowerPC systems, put small global
20679 data in the @code{.sdata} section. Put small uninitialized global
20680 data in the @code{.sbss} section. Do not use register @code{r13}
20681 to address small data however. This is the default behavior unless
20682 other @option{-msdata} options are used.
20683
20684 @item -msdata=none
20685 @itemx -mno-sdata
20686 @opindex msdata=none
20687 @opindex mno-sdata
20688 On embedded PowerPC systems, put all initialized global and static data
20689 in the @code{.data} section, and all uninitialized data in the
20690 @code{.bss} section.
20691
20692 @item -mblock-move-inline-limit=@var{num}
20693 @opindex mblock-move-inline-limit
20694 Inline all block moves (such as calls to @code{memcpy} or structure
20695 copies) less than or equal to @var{num} bytes. The minimum value for
20696 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
20697 targets. The default value is target-specific.
20698
20699 @item -G @var{num}
20700 @opindex G
20701 @cindex smaller data references (PowerPC)
20702 @cindex .sdata/.sdata2 references (PowerPC)
20703 On embedded PowerPC systems, put global and static items less than or
20704 equal to @var{num} bytes into the small data or BSS sections instead of
20705 the normal data or BSS section. By default, @var{num} is 8. The
20706 @option{-G @var{num}} switch is also passed to the linker.
20707 All modules should be compiled with the same @option{-G @var{num}} value.
20708
20709 @item -mregnames
20710 @itemx -mno-regnames
20711 @opindex mregnames
20712 @opindex mno-regnames
20713 On System V.4 and embedded PowerPC systems do (do not) emit register
20714 names in the assembly language output using symbolic forms.
20715
20716 @item -mlongcall
20717 @itemx -mno-longcall
20718 @opindex mlongcall
20719 @opindex mno-longcall
20720 By default assume that all calls are far away so that a longer and more
20721 expensive calling sequence is required. This is required for calls
20722 farther than 32 megabytes (33,554,432 bytes) from the current location.
20723 A short call is generated if the compiler knows
20724 the call cannot be that far away. This setting can be overridden by
20725 the @code{shortcall} function attribute, or by @code{#pragma
20726 longcall(0)}.
20727
20728 Some linkers are capable of detecting out-of-range calls and generating
20729 glue code on the fly. On these systems, long calls are unnecessary and
20730 generate slower code. As of this writing, the AIX linker can do this,
20731 as can the GNU linker for PowerPC/64. It is planned to add this feature
20732 to the GNU linker for 32-bit PowerPC systems as well.
20733
20734 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
20735 callee, L42}, plus a @dfn{branch island} (glue code). The two target
20736 addresses represent the callee and the branch island. The
20737 Darwin/PPC linker prefers the first address and generates a @code{bl
20738 callee} if the PPC @code{bl} instruction reaches the callee directly;
20739 otherwise, the linker generates @code{bl L42} to call the branch
20740 island. The branch island is appended to the body of the
20741 calling function; it computes the full 32-bit address of the callee
20742 and jumps to it.
20743
20744 On Mach-O (Darwin) systems, this option directs the compiler emit to
20745 the glue for every direct call, and the Darwin linker decides whether
20746 to use or discard it.
20747
20748 In the future, GCC may ignore all longcall specifications
20749 when the linker is known to generate glue.
20750
20751 @item -mtls-markers
20752 @itemx -mno-tls-markers
20753 @opindex mtls-markers
20754 @opindex mno-tls-markers
20755 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
20756 specifying the function argument. The relocation allows the linker to
20757 reliably associate function call with argument setup instructions for
20758 TLS optimization, which in turn allows GCC to better schedule the
20759 sequence.
20760
20761 @item -pthread
20762 @opindex pthread
20763 Adds support for multithreading with the @dfn{pthreads} library.
20764 This option sets flags for both the preprocessor and linker.
20765
20766 @item -mrecip
20767 @itemx -mno-recip
20768 @opindex mrecip
20769 This option enables use of the reciprocal estimate and
20770 reciprocal square root estimate instructions with additional
20771 Newton-Raphson steps to increase precision instead of doing a divide or
20772 square root and divide for floating-point arguments. You should use
20773 the @option{-ffast-math} option when using @option{-mrecip} (or at
20774 least @option{-funsafe-math-optimizations},
20775 @option{-ffinite-math-only}, @option{-freciprocal-math} and
20776 @option{-fno-trapping-math}). Note that while the throughput of the
20777 sequence is generally higher than the throughput of the non-reciprocal
20778 instruction, the precision of the sequence can be decreased by up to 2
20779 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
20780 roots.
20781
20782 @item -mrecip=@var{opt}
20783 @opindex mrecip=opt
20784 This option controls which reciprocal estimate instructions
20785 may be used. @var{opt} is a comma-separated list of options, which may
20786 be preceded by a @code{!} to invert the option:
20787
20788 @table @samp
20789
20790 @item all
20791 Enable all estimate instructions.
20792
20793 @item default
20794 Enable the default instructions, equivalent to @option{-mrecip}.
20795
20796 @item none
20797 Disable all estimate instructions, equivalent to @option{-mno-recip}.
20798
20799 @item div
20800 Enable the reciprocal approximation instructions for both
20801 single and double precision.
20802
20803 @item divf
20804 Enable the single-precision reciprocal approximation instructions.
20805
20806 @item divd
20807 Enable the double-precision reciprocal approximation instructions.
20808
20809 @item rsqrt
20810 Enable the reciprocal square root approximation instructions for both
20811 single and double precision.
20812
20813 @item rsqrtf
20814 Enable the single-precision reciprocal square root approximation instructions.
20815
20816 @item rsqrtd
20817 Enable the double-precision reciprocal square root approximation instructions.
20818
20819 @end table
20820
20821 So, for example, @option{-mrecip=all,!rsqrtd} enables
20822 all of the reciprocal estimate instructions, except for the
20823 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
20824 which handle the double-precision reciprocal square root calculations.
20825
20826 @item -mrecip-precision
20827 @itemx -mno-recip-precision
20828 @opindex mrecip-precision
20829 Assume (do not assume) that the reciprocal estimate instructions
20830 provide higher-precision estimates than is mandated by the PowerPC
20831 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
20832 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
20833 The double-precision square root estimate instructions are not generated by
20834 default on low-precision machines, since they do not provide an
20835 estimate that converges after three steps.
20836
20837 @item -mveclibabi=@var{type}
20838 @opindex mveclibabi
20839 Specifies the ABI type to use for vectorizing intrinsics using an
20840 external library. The only type supported at present is @samp{mass},
20841 which specifies to use IBM's Mathematical Acceleration Subsystem
20842 (MASS) libraries for vectorizing intrinsics using external libraries.
20843 GCC currently emits calls to @code{acosd2}, @code{acosf4},
20844 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
20845 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
20846 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
20847 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
20848 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
20849 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
20850 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
20851 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
20852 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
20853 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
20854 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
20855 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
20856 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
20857 for power7. Both @option{-ftree-vectorize} and
20858 @option{-funsafe-math-optimizations} must also be enabled. The MASS
20859 libraries must be specified at link time.
20860
20861 @item -mfriz
20862 @itemx -mno-friz
20863 @opindex mfriz
20864 Generate (do not generate) the @code{friz} instruction when the
20865 @option{-funsafe-math-optimizations} option is used to optimize
20866 rounding of floating-point values to 64-bit integer and back to floating
20867 point. The @code{friz} instruction does not return the same value if
20868 the floating-point number is too large to fit in an integer.
20869
20870 @item -mpointers-to-nested-functions
20871 @itemx -mno-pointers-to-nested-functions
20872 @opindex mpointers-to-nested-functions
20873 Generate (do not generate) code to load up the static chain register
20874 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
20875 systems where a function pointer points to a 3-word descriptor giving
20876 the function address, TOC value to be loaded in register @code{r2}, and
20877 static chain value to be loaded in register @code{r11}. The
20878 @option{-mpointers-to-nested-functions} is on by default. You cannot
20879 call through pointers to nested functions or pointers
20880 to functions compiled in other languages that use the static chain if
20881 you use @option{-mno-pointers-to-nested-functions}.
20882
20883 @item -msave-toc-indirect
20884 @itemx -mno-save-toc-indirect
20885 @opindex msave-toc-indirect
20886 Generate (do not generate) code to save the TOC value in the reserved
20887 stack location in the function prologue if the function calls through
20888 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
20889 saved in the prologue, it is saved just before the call through the
20890 pointer. The @option{-mno-save-toc-indirect} option is the default.
20891
20892 @item -mcompat-align-parm
20893 @itemx -mno-compat-align-parm
20894 @opindex mcompat-align-parm
20895 Generate (do not generate) code to pass structure parameters with a
20896 maximum alignment of 64 bits, for compatibility with older versions
20897 of GCC.
20898
20899 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
20900 structure parameter on a 128-bit boundary when that structure contained
20901 a member requiring 128-bit alignment. This is corrected in more
20902 recent versions of GCC. This option may be used to generate code
20903 that is compatible with functions compiled with older versions of
20904 GCC.
20905
20906 The @option{-mno-compat-align-parm} option is the default.
20907 @end table
20908
20909 @node RX Options
20910 @subsection RX Options
20911 @cindex RX Options
20912
20913 These command-line options are defined for RX targets:
20914
20915 @table @gcctabopt
20916 @item -m64bit-doubles
20917 @itemx -m32bit-doubles
20918 @opindex m64bit-doubles
20919 @opindex m32bit-doubles
20920 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
20921 or 32 bits (@option{-m32bit-doubles}) in size. The default is
20922 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
20923 works on 32-bit values, which is why the default is
20924 @option{-m32bit-doubles}.
20925
20926 @item -fpu
20927 @itemx -nofpu
20928 @opindex fpu
20929 @opindex nofpu
20930 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
20931 floating-point hardware. The default is enabled for the RX600
20932 series and disabled for the RX200 series.
20933
20934 Floating-point instructions are only generated for 32-bit floating-point
20935 values, however, so the FPU hardware is not used for doubles if the
20936 @option{-m64bit-doubles} option is used.
20937
20938 @emph{Note} If the @option{-fpu} option is enabled then
20939 @option{-funsafe-math-optimizations} is also enabled automatically.
20940 This is because the RX FPU instructions are themselves unsafe.
20941
20942 @item -mcpu=@var{name}
20943 @opindex mcpu
20944 Selects the type of RX CPU to be targeted. Currently three types are
20945 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
20946 the specific @samp{RX610} CPU. The default is @samp{RX600}.
20947
20948 The only difference between @samp{RX600} and @samp{RX610} is that the
20949 @samp{RX610} does not support the @code{MVTIPL} instruction.
20950
20951 The @samp{RX200} series does not have a hardware floating-point unit
20952 and so @option{-nofpu} is enabled by default when this type is
20953 selected.
20954
20955 @item -mbig-endian-data
20956 @itemx -mlittle-endian-data
20957 @opindex mbig-endian-data
20958 @opindex mlittle-endian-data
20959 Store data (but not code) in the big-endian format. The default is
20960 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
20961 format.
20962
20963 @item -msmall-data-limit=@var{N}
20964 @opindex msmall-data-limit
20965 Specifies the maximum size in bytes of global and static variables
20966 which can be placed into the small data area. Using the small data
20967 area can lead to smaller and faster code, but the size of area is
20968 limited and it is up to the programmer to ensure that the area does
20969 not overflow. Also when the small data area is used one of the RX's
20970 registers (usually @code{r13}) is reserved for use pointing to this
20971 area, so it is no longer available for use by the compiler. This
20972 could result in slower and/or larger code if variables are pushed onto
20973 the stack instead of being held in this register.
20974
20975 Note, common variables (variables that have not been initialized) and
20976 constants are not placed into the small data area as they are assigned
20977 to other sections in the output executable.
20978
20979 The default value is zero, which disables this feature. Note, this
20980 feature is not enabled by default with higher optimization levels
20981 (@option{-O2} etc) because of the potentially detrimental effects of
20982 reserving a register. It is up to the programmer to experiment and
20983 discover whether this feature is of benefit to their program. See the
20984 description of the @option{-mpid} option for a description of how the
20985 actual register to hold the small data area pointer is chosen.
20986
20987 @item -msim
20988 @itemx -mno-sim
20989 @opindex msim
20990 @opindex mno-sim
20991 Use the simulator runtime. The default is to use the libgloss
20992 board-specific runtime.
20993
20994 @item -mas100-syntax
20995 @itemx -mno-as100-syntax
20996 @opindex mas100-syntax
20997 @opindex mno-as100-syntax
20998 When generating assembler output use a syntax that is compatible with
20999 Renesas's AS100 assembler. This syntax can also be handled by the GAS
21000 assembler, but it has some restrictions so it is not generated by default.
21001
21002 @item -mmax-constant-size=@var{N}
21003 @opindex mmax-constant-size
21004 Specifies the maximum size, in bytes, of a constant that can be used as
21005 an operand in a RX instruction. Although the RX instruction set does
21006 allow constants of up to 4 bytes in length to be used in instructions,
21007 a longer value equates to a longer instruction. Thus in some
21008 circumstances it can be beneficial to restrict the size of constants
21009 that are used in instructions. Constants that are too big are instead
21010 placed into a constant pool and referenced via register indirection.
21011
21012 The value @var{N} can be between 0 and 4. A value of 0 (the default)
21013 or 4 means that constants of any size are allowed.
21014
21015 @item -mrelax
21016 @opindex mrelax
21017 Enable linker relaxation. Linker relaxation is a process whereby the
21018 linker attempts to reduce the size of a program by finding shorter
21019 versions of various instructions. Disabled by default.
21020
21021 @item -mint-register=@var{N}
21022 @opindex mint-register
21023 Specify the number of registers to reserve for fast interrupt handler
21024 functions. The value @var{N} can be between 0 and 4. A value of 1
21025 means that register @code{r13} is reserved for the exclusive use
21026 of fast interrupt handlers. A value of 2 reserves @code{r13} and
21027 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
21028 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
21029 A value of 0, the default, does not reserve any registers.
21030
21031 @item -msave-acc-in-interrupts
21032 @opindex msave-acc-in-interrupts
21033 Specifies that interrupt handler functions should preserve the
21034 accumulator register. This is only necessary if normal code might use
21035 the accumulator register, for example because it performs 64-bit
21036 multiplications. The default is to ignore the accumulator as this
21037 makes the interrupt handlers faster.
21038
21039 @item -mpid
21040 @itemx -mno-pid
21041 @opindex mpid
21042 @opindex mno-pid
21043 Enables the generation of position independent data. When enabled any
21044 access to constant data is done via an offset from a base address
21045 held in a register. This allows the location of constant data to be
21046 determined at run time without requiring the executable to be
21047 relocated, which is a benefit to embedded applications with tight
21048 memory constraints. Data that can be modified is not affected by this
21049 option.
21050
21051 Note, using this feature reserves a register, usually @code{r13}, for
21052 the constant data base address. This can result in slower and/or
21053 larger code, especially in complicated functions.
21054
21055 The actual register chosen to hold the constant data base address
21056 depends upon whether the @option{-msmall-data-limit} and/or the
21057 @option{-mint-register} command-line options are enabled. Starting
21058 with register @code{r13} and proceeding downwards, registers are
21059 allocated first to satisfy the requirements of @option{-mint-register},
21060 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
21061 is possible for the small data area register to be @code{r8} if both
21062 @option{-mint-register=4} and @option{-mpid} are specified on the
21063 command line.
21064
21065 By default this feature is not enabled. The default can be restored
21066 via the @option{-mno-pid} command-line option.
21067
21068 @item -mno-warn-multiple-fast-interrupts
21069 @itemx -mwarn-multiple-fast-interrupts
21070 @opindex mno-warn-multiple-fast-interrupts
21071 @opindex mwarn-multiple-fast-interrupts
21072 Prevents GCC from issuing a warning message if it finds more than one
21073 fast interrupt handler when it is compiling a file. The default is to
21074 issue a warning for each extra fast interrupt handler found, as the RX
21075 only supports one such interrupt.
21076
21077 @item -mallow-string-insns
21078 @itemx -mno-allow-string-insns
21079 @opindex mallow-string-insns
21080 @opindex mno-allow-string-insns
21081 Enables or disables the use of the string manipulation instructions
21082 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
21083 @code{SWHILE} and also the @code{RMPA} instruction. These
21084 instructions may prefetch data, which is not safe to do if accessing
21085 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
21086 for more information).
21087
21088 The default is to allow these instructions, but it is not possible for
21089 GCC to reliably detect all circumstances where a string instruction
21090 might be used to access an I/O register, so their use cannot be
21091 disabled automatically. Instead it is reliant upon the programmer to
21092 use the @option{-mno-allow-string-insns} option if their program
21093 accesses I/O space.
21094
21095 When the instructions are enabled GCC defines the C preprocessor
21096 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
21097 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
21098
21099 @item -mjsr
21100 @itemx -mno-jsr
21101 @opindex mjsr
21102 @opindex mno-jsr
21103 Use only (or not only) @code{JSR} instructions to access functions.
21104 This option can be used when code size exceeds the range of @code{BSR}
21105 instructions. Note that @option{-mno-jsr} does not mean to not use
21106 @code{JSR} but instead means that any type of branch may be used.
21107 @end table
21108
21109 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
21110 has special significance to the RX port when used with the
21111 @code{interrupt} function attribute. This attribute indicates a
21112 function intended to process fast interrupts. GCC ensures
21113 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
21114 and/or @code{r13} and only provided that the normal use of the
21115 corresponding registers have been restricted via the
21116 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
21117 options.
21118
21119 @node S/390 and zSeries Options
21120 @subsection S/390 and zSeries Options
21121 @cindex S/390 and zSeries Options
21122
21123 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
21124
21125 @table @gcctabopt
21126 @item -mhard-float
21127 @itemx -msoft-float
21128 @opindex mhard-float
21129 @opindex msoft-float
21130 Use (do not use) the hardware floating-point instructions and registers
21131 for floating-point operations. When @option{-msoft-float} is specified,
21132 functions in @file{libgcc.a} are used to perform floating-point
21133 operations. When @option{-mhard-float} is specified, the compiler
21134 generates IEEE floating-point instructions. This is the default.
21135
21136 @item -mhard-dfp
21137 @itemx -mno-hard-dfp
21138 @opindex mhard-dfp
21139 @opindex mno-hard-dfp
21140 Use (do not use) the hardware decimal-floating-point instructions for
21141 decimal-floating-point operations. When @option{-mno-hard-dfp} is
21142 specified, functions in @file{libgcc.a} are used to perform
21143 decimal-floating-point operations. When @option{-mhard-dfp} is
21144 specified, the compiler generates decimal-floating-point hardware
21145 instructions. This is the default for @option{-march=z9-ec} or higher.
21146
21147 @item -mlong-double-64
21148 @itemx -mlong-double-128
21149 @opindex mlong-double-64
21150 @opindex mlong-double-128
21151 These switches control the size of @code{long double} type. A size
21152 of 64 bits makes the @code{long double} type equivalent to the @code{double}
21153 type. This is the default.
21154
21155 @item -mbackchain
21156 @itemx -mno-backchain
21157 @opindex mbackchain
21158 @opindex mno-backchain
21159 Store (do not store) the address of the caller's frame as backchain pointer
21160 into the callee's stack frame.
21161 A backchain may be needed to allow debugging using tools that do not understand
21162 DWARF call frame information.
21163 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
21164 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
21165 the backchain is placed into the topmost word of the 96/160 byte register
21166 save area.
21167
21168 In general, code compiled with @option{-mbackchain} is call-compatible with
21169 code compiled with @option{-mmo-backchain}; however, use of the backchain
21170 for debugging purposes usually requires that the whole binary is built with
21171 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
21172 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21173 to build a linux kernel use @option{-msoft-float}.
21174
21175 The default is to not maintain the backchain.
21176
21177 @item -mpacked-stack
21178 @itemx -mno-packed-stack
21179 @opindex mpacked-stack
21180 @opindex mno-packed-stack
21181 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
21182 specified, the compiler uses the all fields of the 96/160 byte register save
21183 area only for their default purpose; unused fields still take up stack space.
21184 When @option{-mpacked-stack} is specified, register save slots are densely
21185 packed at the top of the register save area; unused space is reused for other
21186 purposes, allowing for more efficient use of the available stack space.
21187 However, when @option{-mbackchain} is also in effect, the topmost word of
21188 the save area is always used to store the backchain, and the return address
21189 register is always saved two words below the backchain.
21190
21191 As long as the stack frame backchain is not used, code generated with
21192 @option{-mpacked-stack} is call-compatible with code generated with
21193 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
21194 S/390 or zSeries generated code that uses the stack frame backchain at run
21195 time, not just for debugging purposes. Such code is not call-compatible
21196 with code compiled with @option{-mpacked-stack}. Also, note that the
21197 combination of @option{-mbackchain},
21198 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21199 to build a linux kernel use @option{-msoft-float}.
21200
21201 The default is to not use the packed stack layout.
21202
21203 @item -msmall-exec
21204 @itemx -mno-small-exec
21205 @opindex msmall-exec
21206 @opindex mno-small-exec
21207 Generate (or do not generate) code using the @code{bras} instruction
21208 to do subroutine calls.
21209 This only works reliably if the total executable size does not
21210 exceed 64k. The default is to use the @code{basr} instruction instead,
21211 which does not have this limitation.
21212
21213 @item -m64
21214 @itemx -m31
21215 @opindex m64
21216 @opindex m31
21217 When @option{-m31} is specified, generate code compliant to the
21218 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
21219 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
21220 particular to generate 64-bit instructions. For the @samp{s390}
21221 targets, the default is @option{-m31}, while the @samp{s390x}
21222 targets default to @option{-m64}.
21223
21224 @item -mzarch
21225 @itemx -mesa
21226 @opindex mzarch
21227 @opindex mesa
21228 When @option{-mzarch} is specified, generate code using the
21229 instructions available on z/Architecture.
21230 When @option{-mesa} is specified, generate code using the
21231 instructions available on ESA/390. Note that @option{-mesa} is
21232 not possible with @option{-m64}.
21233 When generating code compliant to the GNU/Linux for S/390 ABI,
21234 the default is @option{-mesa}. When generating code compliant
21235 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
21236
21237 @item -mhtm
21238 @itemx -mno-htm
21239 @opindex mhtm
21240 @opindex mno-htm
21241 The @option{-mhtm} option enables a set of builtins making use of
21242 instructions available with the transactional execution facility
21243 introduced with the IBM zEnterprise EC12 machine generation
21244 @ref{S/390 System z Built-in Functions}.
21245 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
21246
21247 @item -mvx
21248 @itemx -mno-vx
21249 @opindex mvx
21250 @opindex mno-vx
21251 When @option{-mvx} is specified, generate code using the instructions
21252 available with the vector extension facility introduced with the IBM
21253 z13 machine generation.
21254 This option changes the ABI for some vector type values with regard to
21255 alignment and calling conventions. In case vector type values are
21256 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
21257 command will be added to mark the resulting binary with the ABI used.
21258 @option{-mvx} is enabled by default when using @option{-march=z13}.
21259
21260 @item -mzvector
21261 @itemx -mno-zvector
21262 @opindex mzvector
21263 @opindex mno-zvector
21264 The @option{-mzvector} option enables vector language extensions and
21265 builtins using instructions available with the vector extension
21266 facility introduced with the IBM z13 machine generation.
21267 This option adds support for @samp{vector} to be used as a keyword to
21268 define vector type variables and arguments. @samp{vector} is only
21269 available when GNU extensions are enabled. It will not be expanded
21270 when requesting strict standard compliance e.g. with @option{-std=c99}.
21271 In addition to the GCC low-level builtins @option{-mzvector} enables
21272 a set of builtins added for compatibility with AltiVec-style
21273 implementations like Power and Cell. In order to make use of these
21274 builtins the header file @file{vecintrin.h} needs to be included.
21275 @option{-mzvector} is disabled by default.
21276
21277 @item -mmvcle
21278 @itemx -mno-mvcle
21279 @opindex mmvcle
21280 @opindex mno-mvcle
21281 Generate (or do not generate) code using the @code{mvcle} instruction
21282 to perform block moves. When @option{-mno-mvcle} is specified,
21283 use a @code{mvc} loop instead. This is the default unless optimizing for
21284 size.
21285
21286 @item -mdebug
21287 @itemx -mno-debug
21288 @opindex mdebug
21289 @opindex mno-debug
21290 Print (or do not print) additional debug information when compiling.
21291 The default is to not print debug information.
21292
21293 @item -march=@var{cpu-type}
21294 @opindex march
21295 Generate code that runs on @var{cpu-type}, which is the name of a
21296 system representing a certain processor type. Possible values for
21297 @var{cpu-type} are @samp{z900}, @samp{z990}, @samp{z9-109},
21298 @samp{z9-ec}, @samp{z10}, @samp{z196}, @samp{zEC12}, and @samp{z13}.
21299 The default is @option{-march=z900}. @samp{g5} and @samp{g6} are
21300 deprecated and will be removed with future releases.
21301
21302 @item -mtune=@var{cpu-type}
21303 @opindex mtune
21304 Tune to @var{cpu-type} everything applicable about the generated code,
21305 except for the ABI and the set of available instructions.
21306 The list of @var{cpu-type} values is the same as for @option{-march}.
21307 The default is the value used for @option{-march}.
21308
21309 @item -mtpf-trace
21310 @itemx -mno-tpf-trace
21311 @opindex mtpf-trace
21312 @opindex mno-tpf-trace
21313 Generate code that adds (does not add) in TPF OS specific branches to trace
21314 routines in the operating system. This option is off by default, even
21315 when compiling for the TPF OS@.
21316
21317 @item -mfused-madd
21318 @itemx -mno-fused-madd
21319 @opindex mfused-madd
21320 @opindex mno-fused-madd
21321 Generate code that uses (does not use) the floating-point multiply and
21322 accumulate instructions. These instructions are generated by default if
21323 hardware floating point is used.
21324
21325 @item -mwarn-framesize=@var{framesize}
21326 @opindex mwarn-framesize
21327 Emit a warning if the current function exceeds the given frame size. Because
21328 this is a compile-time check it doesn't need to be a real problem when the program
21329 runs. It is intended to identify functions that most probably cause
21330 a stack overflow. It is useful to be used in an environment with limited stack
21331 size e.g.@: the linux kernel.
21332
21333 @item -mwarn-dynamicstack
21334 @opindex mwarn-dynamicstack
21335 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
21336 arrays. This is generally a bad idea with a limited stack size.
21337
21338 @item -mstack-guard=@var{stack-guard}
21339 @itemx -mstack-size=@var{stack-size}
21340 @opindex mstack-guard
21341 @opindex mstack-size
21342 If these options are provided the S/390 back end emits additional instructions in
21343 the function prologue that trigger a trap if the stack size is @var{stack-guard}
21344 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
21345 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
21346 the frame size of the compiled function is chosen.
21347 These options are intended to be used to help debugging stack overflow problems.
21348 The additionally emitted code causes only little overhead and hence can also be
21349 used in production-like systems without greater performance degradation. The given
21350 values have to be exact powers of 2 and @var{stack-size} has to be greater than
21351 @var{stack-guard} without exceeding 64k.
21352 In order to be efficient the extra code makes the assumption that the stack starts
21353 at an address aligned to the value given by @var{stack-size}.
21354 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
21355
21356 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
21357 @opindex mhotpatch
21358 If the hotpatch option is enabled, a ``hot-patching'' function
21359 prologue is generated for all functions in the compilation unit.
21360 The funtion label is prepended with the given number of two-byte
21361 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
21362 the label, 2 * @var{post-halfwords} bytes are appended, using the
21363 largest NOP like instructions the architecture allows (maximum
21364 1000000).
21365
21366 If both arguments are zero, hotpatching is disabled.
21367
21368 This option can be overridden for individual functions with the
21369 @code{hotpatch} attribute.
21370 @end table
21371
21372 @node Score Options
21373 @subsection Score Options
21374 @cindex Score Options
21375
21376 These options are defined for Score implementations:
21377
21378 @table @gcctabopt
21379 @item -meb
21380 @opindex meb
21381 Compile code for big-endian mode. This is the default.
21382
21383 @item -mel
21384 @opindex mel
21385 Compile code for little-endian mode.
21386
21387 @item -mnhwloop
21388 @opindex mnhwloop
21389 Disable generation of @code{bcnz} instructions.
21390
21391 @item -muls
21392 @opindex muls
21393 Enable generation of unaligned load and store instructions.
21394
21395 @item -mmac
21396 @opindex mmac
21397 Enable the use of multiply-accumulate instructions. Disabled by default.
21398
21399 @item -mscore5
21400 @opindex mscore5
21401 Specify the SCORE5 as the target architecture.
21402
21403 @item -mscore5u
21404 @opindex mscore5u
21405 Specify the SCORE5U of the target architecture.
21406
21407 @item -mscore7
21408 @opindex mscore7
21409 Specify the SCORE7 as the target architecture. This is the default.
21410
21411 @item -mscore7d
21412 @opindex mscore7d
21413 Specify the SCORE7D as the target architecture.
21414 @end table
21415
21416 @node SH Options
21417 @subsection SH Options
21418
21419 These @samp{-m} options are defined for the SH implementations:
21420
21421 @table @gcctabopt
21422 @item -m1
21423 @opindex m1
21424 Generate code for the SH1.
21425
21426 @item -m2
21427 @opindex m2
21428 Generate code for the SH2.
21429
21430 @item -m2e
21431 Generate code for the SH2e.
21432
21433 @item -m2a-nofpu
21434 @opindex m2a-nofpu
21435 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
21436 that the floating-point unit is not used.
21437
21438 @item -m2a-single-only
21439 @opindex m2a-single-only
21440 Generate code for the SH2a-FPU, in such a way that no double-precision
21441 floating-point operations are used.
21442
21443 @item -m2a-single
21444 @opindex m2a-single
21445 Generate code for the SH2a-FPU assuming the floating-point unit is in
21446 single-precision mode by default.
21447
21448 @item -m2a
21449 @opindex m2a
21450 Generate code for the SH2a-FPU assuming the floating-point unit is in
21451 double-precision mode by default.
21452
21453 @item -m3
21454 @opindex m3
21455 Generate code for the SH3.
21456
21457 @item -m3e
21458 @opindex m3e
21459 Generate code for the SH3e.
21460
21461 @item -m4-nofpu
21462 @opindex m4-nofpu
21463 Generate code for the SH4 without a floating-point unit.
21464
21465 @item -m4-single-only
21466 @opindex m4-single-only
21467 Generate code for the SH4 with a floating-point unit that only
21468 supports single-precision arithmetic.
21469
21470 @item -m4-single
21471 @opindex m4-single
21472 Generate code for the SH4 assuming the floating-point unit is in
21473 single-precision mode by default.
21474
21475 @item -m4
21476 @opindex m4
21477 Generate code for the SH4.
21478
21479 @item -m4-100
21480 @opindex m4-100
21481 Generate code for SH4-100.
21482
21483 @item -m4-100-nofpu
21484 @opindex m4-100-nofpu
21485 Generate code for SH4-100 in such a way that the
21486 floating-point unit is not used.
21487
21488 @item -m4-100-single
21489 @opindex m4-100-single
21490 Generate code for SH4-100 assuming the floating-point unit is in
21491 single-precision mode by default.
21492
21493 @item -m4-100-single-only
21494 @opindex m4-100-single-only
21495 Generate code for SH4-100 in such a way that no double-precision
21496 floating-point operations are used.
21497
21498 @item -m4-200
21499 @opindex m4-200
21500 Generate code for SH4-200.
21501
21502 @item -m4-200-nofpu
21503 @opindex m4-200-nofpu
21504 Generate code for SH4-200 without in such a way that the
21505 floating-point unit is not used.
21506
21507 @item -m4-200-single
21508 @opindex m4-200-single
21509 Generate code for SH4-200 assuming the floating-point unit is in
21510 single-precision mode by default.
21511
21512 @item -m4-200-single-only
21513 @opindex m4-200-single-only
21514 Generate code for SH4-200 in such a way that no double-precision
21515 floating-point operations are used.
21516
21517 @item -m4-300
21518 @opindex m4-300
21519 Generate code for SH4-300.
21520
21521 @item -m4-300-nofpu
21522 @opindex m4-300-nofpu
21523 Generate code for SH4-300 without in such a way that the
21524 floating-point unit is not used.
21525
21526 @item -m4-300-single
21527 @opindex m4-300-single
21528 Generate code for SH4-300 in such a way that no double-precision
21529 floating-point operations are used.
21530
21531 @item -m4-300-single-only
21532 @opindex m4-300-single-only
21533 Generate code for SH4-300 in such a way that no double-precision
21534 floating-point operations are used.
21535
21536 @item -m4-340
21537 @opindex m4-340
21538 Generate code for SH4-340 (no MMU, no FPU).
21539
21540 @item -m4-500
21541 @opindex m4-500
21542 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
21543 assembler.
21544
21545 @item -m4a-nofpu
21546 @opindex m4a-nofpu
21547 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
21548 floating-point unit is not used.
21549
21550 @item -m4a-single-only
21551 @opindex m4a-single-only
21552 Generate code for the SH4a, in such a way that no double-precision
21553 floating-point operations are used.
21554
21555 @item -m4a-single
21556 @opindex m4a-single
21557 Generate code for the SH4a assuming the floating-point unit is in
21558 single-precision mode by default.
21559
21560 @item -m4a
21561 @opindex m4a
21562 Generate code for the SH4a.
21563
21564 @item -m4al
21565 @opindex m4al
21566 Same as @option{-m4a-nofpu}, except that it implicitly passes
21567 @option{-dsp} to the assembler. GCC doesn't generate any DSP
21568 instructions at the moment.
21569
21570 @item -mb
21571 @opindex mb
21572 Compile code for the processor in big-endian mode.
21573
21574 @item -ml
21575 @opindex ml
21576 Compile code for the processor in little-endian mode.
21577
21578 @item -mdalign
21579 @opindex mdalign
21580 Align doubles at 64-bit boundaries. Note that this changes the calling
21581 conventions, and thus some functions from the standard C library do
21582 not work unless you recompile it first with @option{-mdalign}.
21583
21584 @item -mrelax
21585 @opindex mrelax
21586 Shorten some address references at link time, when possible; uses the
21587 linker option @option{-relax}.
21588
21589 @item -mbigtable
21590 @opindex mbigtable
21591 Use 32-bit offsets in @code{switch} tables. The default is to use
21592 16-bit offsets.
21593
21594 @item -mbitops
21595 @opindex mbitops
21596 Enable the use of bit manipulation instructions on SH2A.
21597
21598 @item -mfmovd
21599 @opindex mfmovd
21600 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
21601 alignment constraints.
21602
21603 @item -mrenesas
21604 @opindex mrenesas
21605 Comply with the calling conventions defined by Renesas.
21606
21607 @item -mno-renesas
21608 @opindex mno-renesas
21609 Comply with the calling conventions defined for GCC before the Renesas
21610 conventions were available. This option is the default for all
21611 targets of the SH toolchain.
21612
21613 @item -mnomacsave
21614 @opindex mnomacsave
21615 Mark the @code{MAC} register as call-clobbered, even if
21616 @option{-mrenesas} is given.
21617
21618 @item -mieee
21619 @itemx -mno-ieee
21620 @opindex mieee
21621 @opindex mno-ieee
21622 Control the IEEE compliance of floating-point comparisons, which affects the
21623 handling of cases where the result of a comparison is unordered. By default
21624 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
21625 enabled @option{-mno-ieee} is implicitly set, which results in faster
21626 floating-point greater-equal and less-equal comparisons. The implicit settings
21627 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
21628
21629 @item -minline-ic_invalidate
21630 @opindex minline-ic_invalidate
21631 Inline code to invalidate instruction cache entries after setting up
21632 nested function trampolines.
21633 This option has no effect if @option{-musermode} is in effect and the selected
21634 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
21635 instruction.
21636 If the selected code generation option does not allow the use of the @code{icbi}
21637 instruction, and @option{-musermode} is not in effect, the inlined code
21638 manipulates the instruction cache address array directly with an associative
21639 write. This not only requires privileged mode at run time, but it also
21640 fails if the cache line had been mapped via the TLB and has become unmapped.
21641
21642 @item -misize
21643 @opindex misize
21644 Dump instruction size and location in the assembly code.
21645
21646 @item -mpadstruct
21647 @opindex mpadstruct
21648 This option is deprecated. It pads structures to multiple of 4 bytes,
21649 which is incompatible with the SH ABI@.
21650
21651 @item -matomic-model=@var{model}
21652 @opindex matomic-model=@var{model}
21653 Sets the model of atomic operations and additional parameters as a comma
21654 separated list. For details on the atomic built-in functions see
21655 @ref{__atomic Builtins}. The following models and parameters are supported:
21656
21657 @table @samp
21658
21659 @item none
21660 Disable compiler generated atomic sequences and emit library calls for atomic
21661 operations. This is the default if the target is not @code{sh*-*-linux*}.
21662
21663 @item soft-gusa
21664 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
21665 built-in functions. The generated atomic sequences require additional support
21666 from the interrupt/exception handling code of the system and are only suitable
21667 for SH3* and SH4* single-core systems. This option is enabled by default when
21668 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
21669 this option also partially utilizes the hardware atomic instructions
21670 @code{movli.l} and @code{movco.l} to create more efficient code, unless
21671 @samp{strict} is specified.
21672
21673 @item soft-tcb
21674 Generate software atomic sequences that use a variable in the thread control
21675 block. This is a variation of the gUSA sequences which can also be used on
21676 SH1* and SH2* targets. The generated atomic sequences require additional
21677 support from the interrupt/exception handling code of the system and are only
21678 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
21679 parameter has to be specified as well.
21680
21681 @item soft-imask
21682 Generate software atomic sequences that temporarily disable interrupts by
21683 setting @code{SR.IMASK = 1111}. This model works only when the program runs
21684 in privileged mode and is only suitable for single-core systems. Additional
21685 support from the interrupt/exception handling code of the system is not
21686 required. This model is enabled by default when the target is
21687 @code{sh*-*-linux*} and SH1* or SH2*.
21688
21689 @item hard-llcs
21690 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
21691 instructions only. This is only available on SH4A and is suitable for
21692 multi-core systems. Since the hardware instructions support only 32 bit atomic
21693 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
21694 Code compiled with this option is also compatible with other software
21695 atomic model interrupt/exception handling systems if executed on an SH4A
21696 system. Additional support from the interrupt/exception handling code of the
21697 system is not required for this model.
21698
21699 @item gbr-offset=
21700 This parameter specifies the offset in bytes of the variable in the thread
21701 control block structure that should be used by the generated atomic sequences
21702 when the @samp{soft-tcb} model has been selected. For other models this
21703 parameter is ignored. The specified value must be an integer multiple of four
21704 and in the range 0-1020.
21705
21706 @item strict
21707 This parameter prevents mixed usage of multiple atomic models, even if they
21708 are compatible, and makes the compiler generate atomic sequences of the
21709 specified model only.
21710
21711 @end table
21712
21713 @item -mtas
21714 @opindex mtas
21715 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
21716 Notice that depending on the particular hardware and software configuration
21717 this can degrade overall performance due to the operand cache line flushes
21718 that are implied by the @code{tas.b} instruction. On multi-core SH4A
21719 processors the @code{tas.b} instruction must be used with caution since it
21720 can result in data corruption for certain cache configurations.
21721
21722 @item -mprefergot
21723 @opindex mprefergot
21724 When generating position-independent code, emit function calls using
21725 the Global Offset Table instead of the Procedure Linkage Table.
21726
21727 @item -musermode
21728 @itemx -mno-usermode
21729 @opindex musermode
21730 @opindex mno-usermode
21731 Don't allow (allow) the compiler generating privileged mode code. Specifying
21732 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
21733 inlined code would not work in user mode. @option{-musermode} is the default
21734 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
21735 @option{-musermode} has no effect, since there is no user mode.
21736
21737 @item -multcost=@var{number}
21738 @opindex multcost=@var{number}
21739 Set the cost to assume for a multiply insn.
21740
21741 @item -mdiv=@var{strategy}
21742 @opindex mdiv=@var{strategy}
21743 Set the division strategy to be used for integer division operations.
21744 @var{strategy} can be one of:
21745
21746 @table @samp
21747
21748 @item call-div1
21749 Calls a library function that uses the single-step division instruction
21750 @code{div1} to perform the operation. Division by zero calculates an
21751 unspecified result and does not trap. This is the default except for SH4,
21752 SH2A and SHcompact.
21753
21754 @item call-fp
21755 Calls a library function that performs the operation in double precision
21756 floating point. Division by zero causes a floating-point exception. This is
21757 the default for SHcompact with FPU. Specifying this for targets that do not
21758 have a double precision FPU defaults to @code{call-div1}.
21759
21760 @item call-table
21761 Calls a library function that uses a lookup table for small divisors and
21762 the @code{div1} instruction with case distinction for larger divisors. Division
21763 by zero calculates an unspecified result and does not trap. This is the default
21764 for SH4. Specifying this for targets that do not have dynamic shift
21765 instructions defaults to @code{call-div1}.
21766
21767 @end table
21768
21769 When a division strategy has not been specified the default strategy is
21770 selected based on the current target. For SH2A the default strategy is to
21771 use the @code{divs} and @code{divu} instructions instead of library function
21772 calls.
21773
21774 @item -maccumulate-outgoing-args
21775 @opindex maccumulate-outgoing-args
21776 Reserve space once for outgoing arguments in the function prologue rather
21777 than around each call. Generally beneficial for performance and size. Also
21778 needed for unwinding to avoid changing the stack frame around conditional code.
21779
21780 @item -mdivsi3_libfunc=@var{name}
21781 @opindex mdivsi3_libfunc=@var{name}
21782 Set the name of the library function used for 32-bit signed division to
21783 @var{name}.
21784 This only affects the name used in the @samp{call} division strategies, and
21785 the compiler still expects the same sets of input/output/clobbered registers as
21786 if this option were not present.
21787
21788 @item -mfixed-range=@var{register-range}
21789 @opindex mfixed-range
21790 Generate code treating the given register range as fixed registers.
21791 A fixed register is one that the register allocator can not use. This is
21792 useful when compiling kernel code. A register range is specified as
21793 two registers separated by a dash. Multiple register ranges can be
21794 specified separated by a comma.
21795
21796 @item -mbranch-cost=@var{num}
21797 @opindex mbranch-cost=@var{num}
21798 Assume @var{num} to be the cost for a branch instruction. Higher numbers
21799 make the compiler try to generate more branch-free code if possible.
21800 If not specified the value is selected depending on the processor type that
21801 is being compiled for.
21802
21803 @item -mzdcbranch
21804 @itemx -mno-zdcbranch
21805 @opindex mzdcbranch
21806 @opindex mno-zdcbranch
21807 Assume (do not assume) that zero displacement conditional branch instructions
21808 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
21809 compiler prefers zero displacement branch code sequences. This is
21810 enabled by default when generating code for SH4 and SH4A. It can be explicitly
21811 disabled by specifying @option{-mno-zdcbranch}.
21812
21813 @item -mcbranch-force-delay-slot
21814 @opindex mcbranch-force-delay-slot
21815 Force the usage of delay slots for conditional branches, which stuffs the delay
21816 slot with a @code{nop} if a suitable instruction can't be found. By default
21817 this option is disabled. It can be enabled to work around hardware bugs as
21818 found in the original SH7055.
21819
21820 @item -mfused-madd
21821 @itemx -mno-fused-madd
21822 @opindex mfused-madd
21823 @opindex mno-fused-madd
21824 Generate code that uses (does not use) the floating-point multiply and
21825 accumulate instructions. These instructions are generated by default
21826 if hardware floating point is used. The machine-dependent
21827 @option{-mfused-madd} option is now mapped to the machine-independent
21828 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
21829 mapped to @option{-ffp-contract=off}.
21830
21831 @item -mfsca
21832 @itemx -mno-fsca
21833 @opindex mfsca
21834 @opindex mno-fsca
21835 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
21836 and cosine approximations. The option @option{-mfsca} must be used in
21837 combination with @option{-funsafe-math-optimizations}. It is enabled by default
21838 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
21839 approximations even if @option{-funsafe-math-optimizations} is in effect.
21840
21841 @item -mfsrra
21842 @itemx -mno-fsrra
21843 @opindex mfsrra
21844 @opindex mno-fsrra
21845 Allow or disallow the compiler to emit the @code{fsrra} instruction for
21846 reciprocal square root approximations. The option @option{-mfsrra} must be used
21847 in combination with @option{-funsafe-math-optimizations} and
21848 @option{-ffinite-math-only}. It is enabled by default when generating code for
21849 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
21850 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
21851 in effect.
21852
21853 @item -mpretend-cmove
21854 @opindex mpretend-cmove
21855 Prefer zero-displacement conditional branches for conditional move instruction
21856 patterns. This can result in faster code on the SH4 processor.
21857
21858 @item -mfdpic
21859 @opindex fdpic
21860 Generate code using the FDPIC ABI.
21861
21862 @end table
21863
21864 @node Solaris 2 Options
21865 @subsection Solaris 2 Options
21866 @cindex Solaris 2 options
21867
21868 These @samp{-m} options are supported on Solaris 2:
21869
21870 @table @gcctabopt
21871 @item -mclear-hwcap
21872 @opindex mclear-hwcap
21873 @option{-mclear-hwcap} tells the compiler to remove the hardware
21874 capabilities generated by the Solaris assembler. This is only necessary
21875 when object files use ISA extensions not supported by the current
21876 machine, but check at runtime whether or not to use them.
21877
21878 @item -mimpure-text
21879 @opindex mimpure-text
21880 @option{-mimpure-text}, used in addition to @option{-shared}, tells
21881 the compiler to not pass @option{-z text} to the linker when linking a
21882 shared object. Using this option, you can link position-dependent
21883 code into a shared object.
21884
21885 @option{-mimpure-text} suppresses the ``relocations remain against
21886 allocatable but non-writable sections'' linker error message.
21887 However, the necessary relocations trigger copy-on-write, and the
21888 shared object is not actually shared across processes. Instead of
21889 using @option{-mimpure-text}, you should compile all source code with
21890 @option{-fpic} or @option{-fPIC}.
21891
21892 @end table
21893
21894 These switches are supported in addition to the above on Solaris 2:
21895
21896 @table @gcctabopt
21897 @item -pthreads
21898 @opindex pthreads
21899 Add support for multithreading using the POSIX threads library. This
21900 option sets flags for both the preprocessor and linker. This option does
21901 not affect the thread safety of object code produced by the compiler or
21902 that of libraries supplied with it.
21903
21904 @item -pthread
21905 @opindex pthread
21906 This is a synonym for @option{-pthreads}.
21907 @end table
21908
21909 @node SPARC Options
21910 @subsection SPARC Options
21911 @cindex SPARC options
21912
21913 These @samp{-m} options are supported on the SPARC:
21914
21915 @table @gcctabopt
21916 @item -mno-app-regs
21917 @itemx -mapp-regs
21918 @opindex mno-app-regs
21919 @opindex mapp-regs
21920 Specify @option{-mapp-regs} to generate output using the global registers
21921 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
21922 global register 1, each global register 2 through 4 is then treated as an
21923 allocable register that is clobbered by function calls. This is the default.
21924
21925 To be fully SVR4 ABI-compliant at the cost of some performance loss,
21926 specify @option{-mno-app-regs}. You should compile libraries and system
21927 software with this option.
21928
21929 @item -mflat
21930 @itemx -mno-flat
21931 @opindex mflat
21932 @opindex mno-flat
21933 With @option{-mflat}, the compiler does not generate save/restore instructions
21934 and uses a ``flat'' or single register window model. This model is compatible
21935 with the regular register window model. The local registers and the input
21936 registers (0--5) are still treated as ``call-saved'' registers and are
21937 saved on the stack as needed.
21938
21939 With @option{-mno-flat} (the default), the compiler generates save/restore
21940 instructions (except for leaf functions). This is the normal operating mode.
21941
21942 @item -mfpu
21943 @itemx -mhard-float
21944 @opindex mfpu
21945 @opindex mhard-float
21946 Generate output containing floating-point instructions. This is the
21947 default.
21948
21949 @item -mno-fpu
21950 @itemx -msoft-float
21951 @opindex mno-fpu
21952 @opindex msoft-float
21953 Generate output containing library calls for floating point.
21954 @strong{Warning:} the requisite libraries are not available for all SPARC
21955 targets. Normally the facilities of the machine's usual C compiler are
21956 used, but this cannot be done directly in cross-compilation. You must make
21957 your own arrangements to provide suitable library functions for
21958 cross-compilation. The embedded targets @samp{sparc-*-aout} and
21959 @samp{sparclite-*-*} do provide software floating-point support.
21960
21961 @option{-msoft-float} changes the calling convention in the output file;
21962 therefore, it is only useful if you compile @emph{all} of a program with
21963 this option. In particular, you need to compile @file{libgcc.a}, the
21964 library that comes with GCC, with @option{-msoft-float} in order for
21965 this to work.
21966
21967 @item -mhard-quad-float
21968 @opindex mhard-quad-float
21969 Generate output containing quad-word (long double) floating-point
21970 instructions.
21971
21972 @item -msoft-quad-float
21973 @opindex msoft-quad-float
21974 Generate output containing library calls for quad-word (long double)
21975 floating-point instructions. The functions called are those specified
21976 in the SPARC ABI@. This is the default.
21977
21978 As of this writing, there are no SPARC implementations that have hardware
21979 support for the quad-word floating-point instructions. They all invoke
21980 a trap handler for one of these instructions, and then the trap handler
21981 emulates the effect of the instruction. Because of the trap handler overhead,
21982 this is much slower than calling the ABI library routines. Thus the
21983 @option{-msoft-quad-float} option is the default.
21984
21985 @item -mno-unaligned-doubles
21986 @itemx -munaligned-doubles
21987 @opindex mno-unaligned-doubles
21988 @opindex munaligned-doubles
21989 Assume that doubles have 8-byte alignment. This is the default.
21990
21991 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
21992 alignment only if they are contained in another type, or if they have an
21993 absolute address. Otherwise, it assumes they have 4-byte alignment.
21994 Specifying this option avoids some rare compatibility problems with code
21995 generated by other compilers. It is not the default because it results
21996 in a performance loss, especially for floating-point code.
21997
21998 @item -muser-mode
21999 @itemx -mno-user-mode
22000 @opindex muser-mode
22001 @opindex mno-user-mode
22002 Do not generate code that can only run in supervisor mode. This is relevant
22003 only for the @code{casa} instruction emitted for the LEON3 processor. This
22004 is the default.
22005
22006 @item -mfaster-structs
22007 @itemx -mno-faster-structs
22008 @opindex mfaster-structs
22009 @opindex mno-faster-structs
22010 With @option{-mfaster-structs}, the compiler assumes that structures
22011 should have 8-byte alignment. This enables the use of pairs of
22012 @code{ldd} and @code{std} instructions for copies in structure
22013 assignment, in place of twice as many @code{ld} and @code{st} pairs.
22014 However, the use of this changed alignment directly violates the SPARC
22015 ABI@. Thus, it's intended only for use on targets where the developer
22016 acknowledges that their resulting code is not directly in line with
22017 the rules of the ABI@.
22018
22019 @item -mstd-struct-return
22020 @itemx -mno-std-struct-return
22021 @opindex mstd-struct-return
22022 @opindex mno-std-struct-return
22023 With @option{-mstd-struct-return}, the compiler generates checking code
22024 in functions returning structures or unions to detect size mismatches
22025 between the two sides of function calls, as per the 32-bit ABI@.
22026
22027 The default is @option{-mno-std-struct-return}. This option has no effect
22028 in 64-bit mode.
22029
22030 @item -mcpu=@var{cpu_type}
22031 @opindex mcpu
22032 Set the instruction set, register set, and instruction scheduling parameters
22033 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22034 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
22035 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
22036 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
22037 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
22038 @samp{niagara3} and @samp{niagara4}.
22039
22040 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
22041 which selects the best architecture option for the host processor.
22042 @option{-mcpu=native} has no effect if GCC does not recognize
22043 the processor.
22044
22045 Default instruction scheduling parameters are used for values that select
22046 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
22047 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
22048
22049 Here is a list of each supported architecture and their supported
22050 implementations.
22051
22052 @table @asis
22053 @item v7
22054 cypress, leon3v7
22055
22056 @item v8
22057 supersparc, hypersparc, leon, leon3
22058
22059 @item sparclite
22060 f930, f934, sparclite86x
22061
22062 @item sparclet
22063 tsc701
22064
22065 @item v9
22066 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
22067 @end table
22068
22069 By default (unless configured otherwise), GCC generates code for the V7
22070 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
22071 additionally optimizes it for the Cypress CY7C602 chip, as used in the
22072 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
22073 SPARCStation 1, 2, IPX etc.
22074
22075 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
22076 architecture. The only difference from V7 code is that the compiler emits
22077 the integer multiply and integer divide instructions which exist in SPARC-V8
22078 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
22079 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
22080 2000 series.
22081
22082 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
22083 the SPARC architecture. This adds the integer multiply, integer divide step
22084 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
22085 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
22086 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
22087 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
22088 MB86934 chip, which is the more recent SPARClite with FPU@.
22089
22090 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
22091 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
22092 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
22093 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
22094 optimizes it for the TEMIC SPARClet chip.
22095
22096 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
22097 architecture. This adds 64-bit integer and floating-point move instructions,
22098 3 additional floating-point condition code registers and conditional move
22099 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
22100 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
22101 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
22102 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
22103 @option{-mcpu=niagara}, the compiler additionally optimizes it for
22104 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
22105 additionally optimizes it for Sun UltraSPARC T2 chips. With
22106 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
22107 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
22108 additionally optimizes it for Sun UltraSPARC T4 chips.
22109
22110 @item -mtune=@var{cpu_type}
22111 @opindex mtune
22112 Set the instruction scheduling parameters for machine type
22113 @var{cpu_type}, but do not set the instruction set or register set that the
22114 option @option{-mcpu=@var{cpu_type}} does.
22115
22116 The same values for @option{-mcpu=@var{cpu_type}} can be used for
22117 @option{-mtune=@var{cpu_type}}, but the only useful values are those
22118 that select a particular CPU implementation. Those are @samp{cypress},
22119 @samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3},
22120 @samp{leon3v7}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{tsc701},
22121 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
22122 @samp{niagara3} and @samp{niagara4}. With native Solaris and GNU/Linux
22123 toolchains, @samp{native} can also be used.
22124
22125 @item -mv8plus
22126 @itemx -mno-v8plus
22127 @opindex mv8plus
22128 @opindex mno-v8plus
22129 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
22130 difference from the V8 ABI is that the global and out registers are
22131 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
22132 mode for all SPARC-V9 processors.
22133
22134 @item -mvis
22135 @itemx -mno-vis
22136 @opindex mvis
22137 @opindex mno-vis
22138 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
22139 Visual Instruction Set extensions. The default is @option{-mno-vis}.
22140
22141 @item -mvis2
22142 @itemx -mno-vis2
22143 @opindex mvis2
22144 @opindex mno-vis2
22145 With @option{-mvis2}, GCC generates code that takes advantage of
22146 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
22147 default is @option{-mvis2} when targeting a cpu that supports such
22148 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
22149 also sets @option{-mvis}.
22150
22151 @item -mvis3
22152 @itemx -mno-vis3
22153 @opindex mvis3
22154 @opindex mno-vis3
22155 With @option{-mvis3}, GCC generates code that takes advantage of
22156 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
22157 default is @option{-mvis3} when targeting a cpu that supports such
22158 instructions, such as niagara-3 and later. Setting @option{-mvis3}
22159 also sets @option{-mvis2} and @option{-mvis}.
22160
22161 @item -mcbcond
22162 @itemx -mno-cbcond
22163 @opindex mcbcond
22164 @opindex mno-cbcond
22165 With @option{-mcbcond}, GCC generates code that takes advantage of
22166 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
22167 The default is @option{-mcbcond} when targeting a cpu that supports such
22168 instructions, such as niagara-4 and later.
22169
22170 @item -mpopc
22171 @itemx -mno-popc
22172 @opindex mpopc
22173 @opindex mno-popc
22174 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
22175 population count instruction. The default is @option{-mpopc}
22176 when targeting a cpu that supports such instructions, such as Niagara-2 and
22177 later.
22178
22179 @item -mfmaf
22180 @itemx -mno-fmaf
22181 @opindex mfmaf
22182 @opindex mno-fmaf
22183 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
22184 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
22185 when targeting a cpu that supports such instructions, such as Niagara-3 and
22186 later.
22187
22188 @item -mfix-at697f
22189 @opindex mfix-at697f
22190 Enable the documented workaround for the single erratum of the Atmel AT697F
22191 processor (which corresponds to erratum #13 of the AT697E processor).
22192
22193 @item -mfix-ut699
22194 @opindex mfix-ut699
22195 Enable the documented workarounds for the floating-point errata and the data
22196 cache nullify errata of the UT699 processor.
22197 @end table
22198
22199 These @samp{-m} options are supported in addition to the above
22200 on SPARC-V9 processors in 64-bit environments:
22201
22202 @table @gcctabopt
22203 @item -m32
22204 @itemx -m64
22205 @opindex m32
22206 @opindex m64
22207 Generate code for a 32-bit or 64-bit environment.
22208 The 32-bit environment sets int, long and pointer to 32 bits.
22209 The 64-bit environment sets int to 32 bits and long and pointer
22210 to 64 bits.
22211
22212 @item -mcmodel=@var{which}
22213 @opindex mcmodel
22214 Set the code model to one of
22215
22216 @table @samp
22217 @item medlow
22218 The Medium/Low code model: 64-bit addresses, programs
22219 must be linked in the low 32 bits of memory. Programs can be statically
22220 or dynamically linked.
22221
22222 @item medmid
22223 The Medium/Middle code model: 64-bit addresses, programs
22224 must be linked in the low 44 bits of memory, the text and data segments must
22225 be less than 2GB in size and the data segment must be located within 2GB of
22226 the text segment.
22227
22228 @item medany
22229 The Medium/Anywhere code model: 64-bit addresses, programs
22230 may be linked anywhere in memory, the text and data segments must be less
22231 than 2GB in size and the data segment must be located within 2GB of the
22232 text segment.
22233
22234 @item embmedany
22235 The Medium/Anywhere code model for embedded systems:
22236 64-bit addresses, the text and data segments must be less than 2GB in
22237 size, both starting anywhere in memory (determined at link time). The
22238 global register %g4 points to the base of the data segment. Programs
22239 are statically linked and PIC is not supported.
22240 @end table
22241
22242 @item -mmemory-model=@var{mem-model}
22243 @opindex mmemory-model
22244 Set the memory model in force on the processor to one of
22245
22246 @table @samp
22247 @item default
22248 The default memory model for the processor and operating system.
22249
22250 @item rmo
22251 Relaxed Memory Order
22252
22253 @item pso
22254 Partial Store Order
22255
22256 @item tso
22257 Total Store Order
22258
22259 @item sc
22260 Sequential Consistency
22261 @end table
22262
22263 These memory models are formally defined in Appendix D of the Sparc V9
22264 architecture manual, as set in the processor's @code{PSTATE.MM} field.
22265
22266 @item -mstack-bias
22267 @itemx -mno-stack-bias
22268 @opindex mstack-bias
22269 @opindex mno-stack-bias
22270 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
22271 frame pointer if present, are offset by @minus{}2047 which must be added back
22272 when making stack frame references. This is the default in 64-bit mode.
22273 Otherwise, assume no such offset is present.
22274 @end table
22275
22276 @node SPU Options
22277 @subsection SPU Options
22278 @cindex SPU options
22279
22280 These @samp{-m} options are supported on the SPU:
22281
22282 @table @gcctabopt
22283 @item -mwarn-reloc
22284 @itemx -merror-reloc
22285 @opindex mwarn-reloc
22286 @opindex merror-reloc
22287
22288 The loader for SPU does not handle dynamic relocations. By default, GCC
22289 gives an error when it generates code that requires a dynamic
22290 relocation. @option{-mno-error-reloc} disables the error,
22291 @option{-mwarn-reloc} generates a warning instead.
22292
22293 @item -msafe-dma
22294 @itemx -munsafe-dma
22295 @opindex msafe-dma
22296 @opindex munsafe-dma
22297
22298 Instructions that initiate or test completion of DMA must not be
22299 reordered with respect to loads and stores of the memory that is being
22300 accessed.
22301 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
22302 memory accesses, but that can lead to inefficient code in places where the
22303 memory is known to not change. Rather than mark the memory as volatile,
22304 you can use @option{-msafe-dma} to tell the compiler to treat
22305 the DMA instructions as potentially affecting all memory.
22306
22307 @item -mbranch-hints
22308 @opindex mbranch-hints
22309
22310 By default, GCC generates a branch hint instruction to avoid
22311 pipeline stalls for always-taken or probably-taken branches. A hint
22312 is not generated closer than 8 instructions away from its branch.
22313 There is little reason to disable them, except for debugging purposes,
22314 or to make an object a little bit smaller.
22315
22316 @item -msmall-mem
22317 @itemx -mlarge-mem
22318 @opindex msmall-mem
22319 @opindex mlarge-mem
22320
22321 By default, GCC generates code assuming that addresses are never larger
22322 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
22323 a full 32-bit address.
22324
22325 @item -mstdmain
22326 @opindex mstdmain
22327
22328 By default, GCC links against startup code that assumes the SPU-style
22329 main function interface (which has an unconventional parameter list).
22330 With @option{-mstdmain}, GCC links your program against startup
22331 code that assumes a C99-style interface to @code{main}, including a
22332 local copy of @code{argv} strings.
22333
22334 @item -mfixed-range=@var{register-range}
22335 @opindex mfixed-range
22336 Generate code treating the given register range as fixed registers.
22337 A fixed register is one that the register allocator cannot use. This is
22338 useful when compiling kernel code. A register range is specified as
22339 two registers separated by a dash. Multiple register ranges can be
22340 specified separated by a comma.
22341
22342 @item -mea32
22343 @itemx -mea64
22344 @opindex mea32
22345 @opindex mea64
22346 Compile code assuming that pointers to the PPU address space accessed
22347 via the @code{__ea} named address space qualifier are either 32 or 64
22348 bits wide. The default is 32 bits. As this is an ABI-changing option,
22349 all object code in an executable must be compiled with the same setting.
22350
22351 @item -maddress-space-conversion
22352 @itemx -mno-address-space-conversion
22353 @opindex maddress-space-conversion
22354 @opindex mno-address-space-conversion
22355 Allow/disallow treating the @code{__ea} address space as superset
22356 of the generic address space. This enables explicit type casts
22357 between @code{__ea} and generic pointer as well as implicit
22358 conversions of generic pointers to @code{__ea} pointers. The
22359 default is to allow address space pointer conversions.
22360
22361 @item -mcache-size=@var{cache-size}
22362 @opindex mcache-size
22363 This option controls the version of libgcc that the compiler links to an
22364 executable and selects a software-managed cache for accessing variables
22365 in the @code{__ea} address space with a particular cache size. Possible
22366 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
22367 and @samp{128}. The default cache size is 64KB.
22368
22369 @item -matomic-updates
22370 @itemx -mno-atomic-updates
22371 @opindex matomic-updates
22372 @opindex mno-atomic-updates
22373 This option controls the version of libgcc that the compiler links to an
22374 executable and selects whether atomic updates to the software-managed
22375 cache of PPU-side variables are used. If you use atomic updates, changes
22376 to a PPU variable from SPU code using the @code{__ea} named address space
22377 qualifier do not interfere with changes to other PPU variables residing
22378 in the same cache line from PPU code. If you do not use atomic updates,
22379 such interference may occur; however, writing back cache lines is
22380 more efficient. The default behavior is to use atomic updates.
22381
22382 @item -mdual-nops
22383 @itemx -mdual-nops=@var{n}
22384 @opindex mdual-nops
22385 By default, GCC inserts nops to increase dual issue when it expects
22386 it to increase performance. @var{n} can be a value from 0 to 10. A
22387 smaller @var{n} inserts fewer nops. 10 is the default, 0 is the
22388 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
22389
22390 @item -mhint-max-nops=@var{n}
22391 @opindex mhint-max-nops
22392 Maximum number of nops to insert for a branch hint. A branch hint must
22393 be at least 8 instructions away from the branch it is affecting. GCC
22394 inserts up to @var{n} nops to enforce this, otherwise it does not
22395 generate the branch hint.
22396
22397 @item -mhint-max-distance=@var{n}
22398 @opindex mhint-max-distance
22399 The encoding of the branch hint instruction limits the hint to be within
22400 256 instructions of the branch it is affecting. By default, GCC makes
22401 sure it is within 125.
22402
22403 @item -msafe-hints
22404 @opindex msafe-hints
22405 Work around a hardware bug that causes the SPU to stall indefinitely.
22406 By default, GCC inserts the @code{hbrp} instruction to make sure
22407 this stall won't happen.
22408
22409 @end table
22410
22411 @node System V Options
22412 @subsection Options for System V
22413
22414 These additional options are available on System V Release 4 for
22415 compatibility with other compilers on those systems:
22416
22417 @table @gcctabopt
22418 @item -G
22419 @opindex G
22420 Create a shared object.
22421 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
22422
22423 @item -Qy
22424 @opindex Qy
22425 Identify the versions of each tool used by the compiler, in a
22426 @code{.ident} assembler directive in the output.
22427
22428 @item -Qn
22429 @opindex Qn
22430 Refrain from adding @code{.ident} directives to the output file (this is
22431 the default).
22432
22433 @item -YP,@var{dirs}
22434 @opindex YP
22435 Search the directories @var{dirs}, and no others, for libraries
22436 specified with @option{-l}.
22437
22438 @item -Ym,@var{dir}
22439 @opindex Ym
22440 Look in the directory @var{dir} to find the M4 preprocessor.
22441 The assembler uses this option.
22442 @c This is supposed to go with a -Yd for predefined M4 macro files, but
22443 @c the generic assembler that comes with Solaris takes just -Ym.
22444 @end table
22445
22446 @node TILE-Gx Options
22447 @subsection TILE-Gx Options
22448 @cindex TILE-Gx options
22449
22450 These @samp{-m} options are supported on the TILE-Gx:
22451
22452 @table @gcctabopt
22453 @item -mcmodel=small
22454 @opindex mcmodel=small
22455 Generate code for the small model. The distance for direct calls is
22456 limited to 500M in either direction. PC-relative addresses are 32
22457 bits. Absolute addresses support the full address range.
22458
22459 @item -mcmodel=large
22460 @opindex mcmodel=large
22461 Generate code for the large model. There is no limitation on call
22462 distance, pc-relative addresses, or absolute addresses.
22463
22464 @item -mcpu=@var{name}
22465 @opindex mcpu
22466 Selects the type of CPU to be targeted. Currently the only supported
22467 type is @samp{tilegx}.
22468
22469 @item -m32
22470 @itemx -m64
22471 @opindex m32
22472 @opindex m64
22473 Generate code for a 32-bit or 64-bit environment. The 32-bit
22474 environment sets int, long, and pointer to 32 bits. The 64-bit
22475 environment sets int to 32 bits and long and pointer to 64 bits.
22476
22477 @item -mbig-endian
22478 @itemx -mlittle-endian
22479 @opindex mbig-endian
22480 @opindex mlittle-endian
22481 Generate code in big/little endian mode, respectively.
22482 @end table
22483
22484 @node TILEPro Options
22485 @subsection TILEPro Options
22486 @cindex TILEPro options
22487
22488 These @samp{-m} options are supported on the TILEPro:
22489
22490 @table @gcctabopt
22491 @item -mcpu=@var{name}
22492 @opindex mcpu
22493 Selects the type of CPU to be targeted. Currently the only supported
22494 type is @samp{tilepro}.
22495
22496 @item -m32
22497 @opindex m32
22498 Generate code for a 32-bit environment, which sets int, long, and
22499 pointer to 32 bits. This is the only supported behavior so the flag
22500 is essentially ignored.
22501 @end table
22502
22503 @node V850 Options
22504 @subsection V850 Options
22505 @cindex V850 Options
22506
22507 These @samp{-m} options are defined for V850 implementations:
22508
22509 @table @gcctabopt
22510 @item -mlong-calls
22511 @itemx -mno-long-calls
22512 @opindex mlong-calls
22513 @opindex mno-long-calls
22514 Treat all calls as being far away (near). If calls are assumed to be
22515 far away, the compiler always loads the function's address into a
22516 register, and calls indirect through the pointer.
22517
22518 @item -mno-ep
22519 @itemx -mep
22520 @opindex mno-ep
22521 @opindex mep
22522 Do not optimize (do optimize) basic blocks that use the same index
22523 pointer 4 or more times to copy pointer into the @code{ep} register, and
22524 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
22525 option is on by default if you optimize.
22526
22527 @item -mno-prolog-function
22528 @itemx -mprolog-function
22529 @opindex mno-prolog-function
22530 @opindex mprolog-function
22531 Do not use (do use) external functions to save and restore registers
22532 at the prologue and epilogue of a function. The external functions
22533 are slower, but use less code space if more than one function saves
22534 the same number of registers. The @option{-mprolog-function} option
22535 is on by default if you optimize.
22536
22537 @item -mspace
22538 @opindex mspace
22539 Try to make the code as small as possible. At present, this just turns
22540 on the @option{-mep} and @option{-mprolog-function} options.
22541
22542 @item -mtda=@var{n}
22543 @opindex mtda
22544 Put static or global variables whose size is @var{n} bytes or less into
22545 the tiny data area that register @code{ep} points to. The tiny data
22546 area can hold up to 256 bytes in total (128 bytes for byte references).
22547
22548 @item -msda=@var{n}
22549 @opindex msda
22550 Put static or global variables whose size is @var{n} bytes or less into
22551 the small data area that register @code{gp} points to. The small data
22552 area can hold up to 64 kilobytes.
22553
22554 @item -mzda=@var{n}
22555 @opindex mzda
22556 Put static or global variables whose size is @var{n} bytes or less into
22557 the first 32 kilobytes of memory.
22558
22559 @item -mv850
22560 @opindex mv850
22561 Specify that the target processor is the V850.
22562
22563 @item -mv850e3v5
22564 @opindex mv850e3v5
22565 Specify that the target processor is the V850E3V5. The preprocessor
22566 constant @code{__v850e3v5__} is defined if this option is used.
22567
22568 @item -mv850e2v4
22569 @opindex mv850e2v4
22570 Specify that the target processor is the V850E3V5. This is an alias for
22571 the @option{-mv850e3v5} option.
22572
22573 @item -mv850e2v3
22574 @opindex mv850e2v3
22575 Specify that the target processor is the V850E2V3. The preprocessor
22576 constant @code{__v850e2v3__} is defined if this option is used.
22577
22578 @item -mv850e2
22579 @opindex mv850e2
22580 Specify that the target processor is the V850E2. The preprocessor
22581 constant @code{__v850e2__} is defined if this option is used.
22582
22583 @item -mv850e1
22584 @opindex mv850e1
22585 Specify that the target processor is the V850E1. The preprocessor
22586 constants @code{__v850e1__} and @code{__v850e__} are defined if
22587 this option is used.
22588
22589 @item -mv850es
22590 @opindex mv850es
22591 Specify that the target processor is the V850ES. This is an alias for
22592 the @option{-mv850e1} option.
22593
22594 @item -mv850e
22595 @opindex mv850e
22596 Specify that the target processor is the V850E@. The preprocessor
22597 constant @code{__v850e__} is defined if this option is used.
22598
22599 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
22600 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
22601 are defined then a default target processor is chosen and the
22602 relevant @samp{__v850*__} preprocessor constant is defined.
22603
22604 The preprocessor constants @code{__v850} and @code{__v851__} are always
22605 defined, regardless of which processor variant is the target.
22606
22607 @item -mdisable-callt
22608 @itemx -mno-disable-callt
22609 @opindex mdisable-callt
22610 @opindex mno-disable-callt
22611 This option suppresses generation of the @code{CALLT} instruction for the
22612 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
22613 architecture.
22614
22615 This option is enabled by default when the RH850 ABI is
22616 in use (see @option{-mrh850-abi}), and disabled by default when the
22617 GCC ABI is in use. If @code{CALLT} instructions are being generated
22618 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
22619
22620 @item -mrelax
22621 @itemx -mno-relax
22622 @opindex mrelax
22623 @opindex mno-relax
22624 Pass on (or do not pass on) the @option{-mrelax} command-line option
22625 to the assembler.
22626
22627 @item -mlong-jumps
22628 @itemx -mno-long-jumps
22629 @opindex mlong-jumps
22630 @opindex mno-long-jumps
22631 Disable (or re-enable) the generation of PC-relative jump instructions.
22632
22633 @item -msoft-float
22634 @itemx -mhard-float
22635 @opindex msoft-float
22636 @opindex mhard-float
22637 Disable (or re-enable) the generation of hardware floating point
22638 instructions. This option is only significant when the target
22639 architecture is @samp{V850E2V3} or higher. If hardware floating point
22640 instructions are being generated then the C preprocessor symbol
22641 @code{__FPU_OK__} is defined, otherwise the symbol
22642 @code{__NO_FPU__} is defined.
22643
22644 @item -mloop
22645 @opindex mloop
22646 Enables the use of the e3v5 LOOP instruction. The use of this
22647 instruction is not enabled by default when the e3v5 architecture is
22648 selected because its use is still experimental.
22649
22650 @item -mrh850-abi
22651 @itemx -mghs
22652 @opindex mrh850-abi
22653 @opindex mghs
22654 Enables support for the RH850 version of the V850 ABI. This is the
22655 default. With this version of the ABI the following rules apply:
22656
22657 @itemize
22658 @item
22659 Integer sized structures and unions are returned via a memory pointer
22660 rather than a register.
22661
22662 @item
22663 Large structures and unions (more than 8 bytes in size) are passed by
22664 value.
22665
22666 @item
22667 Functions are aligned to 16-bit boundaries.
22668
22669 @item
22670 The @option{-m8byte-align} command-line option is supported.
22671
22672 @item
22673 The @option{-mdisable-callt} command-line option is enabled by
22674 default. The @option{-mno-disable-callt} command-line option is not
22675 supported.
22676 @end itemize
22677
22678 When this version of the ABI is enabled the C preprocessor symbol
22679 @code{__V850_RH850_ABI__} is defined.
22680
22681 @item -mgcc-abi
22682 @opindex mgcc-abi
22683 Enables support for the old GCC version of the V850 ABI. With this
22684 version of the ABI the following rules apply:
22685
22686 @itemize
22687 @item
22688 Integer sized structures and unions are returned in register @code{r10}.
22689
22690 @item
22691 Large structures and unions (more than 8 bytes in size) are passed by
22692 reference.
22693
22694 @item
22695 Functions are aligned to 32-bit boundaries, unless optimizing for
22696 size.
22697
22698 @item
22699 The @option{-m8byte-align} command-line option is not supported.
22700
22701 @item
22702 The @option{-mdisable-callt} command-line option is supported but not
22703 enabled by default.
22704 @end itemize
22705
22706 When this version of the ABI is enabled the C preprocessor symbol
22707 @code{__V850_GCC_ABI__} is defined.
22708
22709 @item -m8byte-align
22710 @itemx -mno-8byte-align
22711 @opindex m8byte-align
22712 @opindex mno-8byte-align
22713 Enables support for @code{double} and @code{long long} types to be
22714 aligned on 8-byte boundaries. The default is to restrict the
22715 alignment of all objects to at most 4-bytes. When
22716 @option{-m8byte-align} is in effect the C preprocessor symbol
22717 @code{__V850_8BYTE_ALIGN__} is defined.
22718
22719 @item -mbig-switch
22720 @opindex mbig-switch
22721 Generate code suitable for big switch tables. Use this option only if
22722 the assembler/linker complain about out of range branches within a switch
22723 table.
22724
22725 @item -mapp-regs
22726 @opindex mapp-regs
22727 This option causes r2 and r5 to be used in the code generated by
22728 the compiler. This setting is the default.
22729
22730 @item -mno-app-regs
22731 @opindex mno-app-regs
22732 This option causes r2 and r5 to be treated as fixed registers.
22733
22734 @end table
22735
22736 @node VAX Options
22737 @subsection VAX Options
22738 @cindex VAX options
22739
22740 These @samp{-m} options are defined for the VAX:
22741
22742 @table @gcctabopt
22743 @item -munix
22744 @opindex munix
22745 Do not output certain jump instructions (@code{aobleq} and so on)
22746 that the Unix assembler for the VAX cannot handle across long
22747 ranges.
22748
22749 @item -mgnu
22750 @opindex mgnu
22751 Do output those jump instructions, on the assumption that the
22752 GNU assembler is being used.
22753
22754 @item -mg
22755 @opindex mg
22756 Output code for G-format floating-point numbers instead of D-format.
22757 @end table
22758
22759 @node Visium Options
22760 @subsection Visium Options
22761 @cindex Visium options
22762
22763 @table @gcctabopt
22764
22765 @item -mdebug
22766 @opindex mdebug
22767 A program which performs file I/O and is destined to run on an MCM target
22768 should be linked with this option. It causes the libraries libc.a and
22769 libdebug.a to be linked. The program should be run on the target under
22770 the control of the GDB remote debugging stub.
22771
22772 @item -msim
22773 @opindex msim
22774 A program which performs file I/O and is destined to run on the simulator
22775 should be linked with option. This causes libraries libc.a and libsim.a to
22776 be linked.
22777
22778 @item -mfpu
22779 @itemx -mhard-float
22780 @opindex mfpu
22781 @opindex mhard-float
22782 Generate code containing floating-point instructions. This is the
22783 default.
22784
22785 @item -mno-fpu
22786 @itemx -msoft-float
22787 @opindex mno-fpu
22788 @opindex msoft-float
22789 Generate code containing library calls for floating-point.
22790
22791 @option{-msoft-float} changes the calling convention in the output file;
22792 therefore, it is only useful if you compile @emph{all} of a program with
22793 this option. In particular, you need to compile @file{libgcc.a}, the
22794 library that comes with GCC, with @option{-msoft-float} in order for
22795 this to work.
22796
22797 @item -mcpu=@var{cpu_type}
22798 @opindex mcpu
22799 Set the instruction set, register set, and instruction scheduling parameters
22800 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22801 @samp{mcm}, @samp{gr5} and @samp{gr6}.
22802
22803 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
22804
22805 By default (unless configured otherwise), GCC generates code for the GR5
22806 variant of the Visium architecture.
22807
22808 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
22809 architecture. The only difference from GR5 code is that the compiler will
22810 generate block move instructions.
22811
22812 @item -mtune=@var{cpu_type}
22813 @opindex mtune
22814 Set the instruction scheduling parameters for machine type @var{cpu_type},
22815 but do not set the instruction set or register set that the option
22816 @option{-mcpu=@var{cpu_type}} would.
22817
22818 @item -msv-mode
22819 @opindex msv-mode
22820 Generate code for the supervisor mode, where there are no restrictions on
22821 the access to general registers. This is the default.
22822
22823 @item -muser-mode
22824 @opindex muser-mode
22825 Generate code for the user mode, where the access to some general registers
22826 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
22827 mode; on the GR6, only registers r29 to r31 are affected.
22828 @end table
22829
22830 @node VMS Options
22831 @subsection VMS Options
22832
22833 These @samp{-m} options are defined for the VMS implementations:
22834
22835 @table @gcctabopt
22836 @item -mvms-return-codes
22837 @opindex mvms-return-codes
22838 Return VMS condition codes from @code{main}. The default is to return POSIX-style
22839 condition (e.g.@ error) codes.
22840
22841 @item -mdebug-main=@var{prefix}
22842 @opindex mdebug-main=@var{prefix}
22843 Flag the first routine whose name starts with @var{prefix} as the main
22844 routine for the debugger.
22845
22846 @item -mmalloc64
22847 @opindex mmalloc64
22848 Default to 64-bit memory allocation routines.
22849
22850 @item -mpointer-size=@var{size}
22851 @opindex mpointer-size=@var{size}
22852 Set the default size of pointers. Possible options for @var{size} are
22853 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
22854 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
22855 The later option disables @code{pragma pointer_size}.
22856 @end table
22857
22858 @node VxWorks Options
22859 @subsection VxWorks Options
22860 @cindex VxWorks Options
22861
22862 The options in this section are defined for all VxWorks targets.
22863 Options specific to the target hardware are listed with the other
22864 options for that target.
22865
22866 @table @gcctabopt
22867 @item -mrtp
22868 @opindex mrtp
22869 GCC can generate code for both VxWorks kernels and real time processes
22870 (RTPs). This option switches from the former to the latter. It also
22871 defines the preprocessor macro @code{__RTP__}.
22872
22873 @item -non-static
22874 @opindex non-static
22875 Link an RTP executable against shared libraries rather than static
22876 libraries. The options @option{-static} and @option{-shared} can
22877 also be used for RTPs (@pxref{Link Options}); @option{-static}
22878 is the default.
22879
22880 @item -Bstatic
22881 @itemx -Bdynamic
22882 @opindex Bstatic
22883 @opindex Bdynamic
22884 These options are passed down to the linker. They are defined for
22885 compatibility with Diab.
22886
22887 @item -Xbind-lazy
22888 @opindex Xbind-lazy
22889 Enable lazy binding of function calls. This option is equivalent to
22890 @option{-Wl,-z,now} and is defined for compatibility with Diab.
22891
22892 @item -Xbind-now
22893 @opindex Xbind-now
22894 Disable lazy binding of function calls. This option is the default and
22895 is defined for compatibility with Diab.
22896 @end table
22897
22898 @node x86 Options
22899 @subsection x86 Options
22900 @cindex x86 Options
22901
22902 These @samp{-m} options are defined for the x86 family of computers.
22903
22904 @table @gcctabopt
22905
22906 @item -march=@var{cpu-type}
22907 @opindex march
22908 Generate instructions for the machine type @var{cpu-type}. In contrast to
22909 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
22910 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
22911 to generate code that may not run at all on processors other than the one
22912 indicated. Specifying @option{-march=@var{cpu-type}} implies
22913 @option{-mtune=@var{cpu-type}}.
22914
22915 The choices for @var{cpu-type} are:
22916
22917 @table @samp
22918 @item native
22919 This selects the CPU to generate code for at compilation time by determining
22920 the processor type of the compiling machine. Using @option{-march=native}
22921 enables all instruction subsets supported by the local machine (hence
22922 the result might not run on different machines). Using @option{-mtune=native}
22923 produces code optimized for the local machine under the constraints
22924 of the selected instruction set.
22925
22926 @item i386
22927 Original Intel i386 CPU@.
22928
22929 @item i486
22930 Intel i486 CPU@. (No scheduling is implemented for this chip.)
22931
22932 @item i586
22933 @itemx pentium
22934 Intel Pentium CPU with no MMX support.
22935
22936 @item lakemont
22937 Intel Lakemont MCU, based on Intel Pentium CPU.
22938
22939 @item pentium-mmx
22940 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
22941
22942 @item pentiumpro
22943 Intel Pentium Pro CPU@.
22944
22945 @item i686
22946 When used with @option{-march}, the Pentium Pro
22947 instruction set is used, so the code runs on all i686 family chips.
22948 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
22949
22950 @item pentium2
22951 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
22952 support.
22953
22954 @item pentium3
22955 @itemx pentium3m
22956 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
22957 set support.
22958
22959 @item pentium-m
22960 Intel Pentium M; low-power version of Intel Pentium III CPU
22961 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
22962
22963 @item pentium4
22964 @itemx pentium4m
22965 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
22966
22967 @item prescott
22968 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
22969 set support.
22970
22971 @item nocona
22972 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
22973 SSE2 and SSE3 instruction set support.
22974
22975 @item core2
22976 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
22977 instruction set support.
22978
22979 @item nehalem
22980 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
22981 SSE4.1, SSE4.2 and POPCNT instruction set support.
22982
22983 @item westmere
22984 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
22985 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
22986
22987 @item sandybridge
22988 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
22989 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
22990
22991 @item ivybridge
22992 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
22993 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
22994 instruction set support.
22995
22996 @item haswell
22997 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
22998 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
22999 BMI, BMI2 and F16C instruction set support.
23000
23001 @item broadwell
23002 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23003 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23004 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
23005
23006 @item skylake
23007 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23008 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23009 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
23010 XSAVES instruction set support.
23011
23012 @item bonnell
23013 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
23014 instruction set support.
23015
23016 @item silvermont
23017 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23018 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
23019
23020 @item knl
23021 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23022 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23023 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
23024 AVX512CD instruction set support.
23025
23026 @item skylake-avx512
23027 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23028 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23029 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
23030 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
23031
23032 @item k6
23033 AMD K6 CPU with MMX instruction set support.
23034
23035 @item k6-2
23036 @itemx k6-3
23037 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
23038
23039 @item athlon
23040 @itemx athlon-tbird
23041 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
23042 support.
23043
23044 @item athlon-4
23045 @itemx athlon-xp
23046 @itemx athlon-mp
23047 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
23048 instruction set support.
23049
23050 @item k8
23051 @itemx opteron
23052 @itemx athlon64
23053 @itemx athlon-fx
23054 Processors based on the AMD K8 core with x86-64 instruction set support,
23055 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
23056 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
23057 instruction set extensions.)
23058
23059 @item k8-sse3
23060 @itemx opteron-sse3
23061 @itemx athlon64-sse3
23062 Improved versions of AMD K8 cores with SSE3 instruction set support.
23063
23064 @item amdfam10
23065 @itemx barcelona
23066 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
23067 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
23068 instruction set extensions.)
23069
23070 @item bdver1
23071 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
23072 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
23073 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
23074 @item bdver2
23075 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23076 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
23077 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
23078 extensions.)
23079 @item bdver3
23080 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23081 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
23082 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
23083 64-bit instruction set extensions.
23084 @item bdver4
23085 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23086 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
23087 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
23088 SSE4.2, ABM and 64-bit instruction set extensions.
23089
23090 @item znver1
23091 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
23092 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
23093 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
23094 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
23095 instruction set extensions.
23096
23097 @item btver1
23098 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
23099 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
23100 instruction set extensions.)
23101
23102 @item btver2
23103 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
23104 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
23105 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
23106
23107 @item winchip-c6
23108 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
23109 set support.
23110
23111 @item winchip2
23112 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
23113 instruction set support.
23114
23115 @item c3
23116 VIA C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is
23117 implemented for this chip.)
23118
23119 @item c3-2
23120 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
23121 (No scheduling is
23122 implemented for this chip.)
23123
23124 @item geode
23125 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
23126 @end table
23127
23128 @item -mtune=@var{cpu-type}
23129 @opindex mtune
23130 Tune to @var{cpu-type} everything applicable about the generated code, except
23131 for the ABI and the set of available instructions.
23132 While picking a specific @var{cpu-type} schedules things appropriately
23133 for that particular chip, the compiler does not generate any code that
23134 cannot run on the default machine type unless you use a
23135 @option{-march=@var{cpu-type}} option.
23136 For example, if GCC is configured for i686-pc-linux-gnu
23137 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
23138 but still runs on i686 machines.
23139
23140 The choices for @var{cpu-type} are the same as for @option{-march}.
23141 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
23142
23143 @table @samp
23144 @item generic
23145 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
23146 If you know the CPU on which your code will run, then you should use
23147 the corresponding @option{-mtune} or @option{-march} option instead of
23148 @option{-mtune=generic}. But, if you do not know exactly what CPU users
23149 of your application will have, then you should use this option.
23150
23151 As new processors are deployed in the marketplace, the behavior of this
23152 option will change. Therefore, if you upgrade to a newer version of
23153 GCC, code generation controlled by this option will change to reflect
23154 the processors
23155 that are most common at the time that version of GCC is released.
23156
23157 There is no @option{-march=generic} option because @option{-march}
23158 indicates the instruction set the compiler can use, and there is no
23159 generic instruction set applicable to all processors. In contrast,
23160 @option{-mtune} indicates the processor (or, in this case, collection of
23161 processors) for which the code is optimized.
23162
23163 @item intel
23164 Produce code optimized for the most current Intel processors, which are
23165 Haswell and Silvermont for this version of GCC. If you know the CPU
23166 on which your code will run, then you should use the corresponding
23167 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
23168 But, if you want your application performs better on both Haswell and
23169 Silvermont, then you should use this option.
23170
23171 As new Intel processors are deployed in the marketplace, the behavior of
23172 this option will change. Therefore, if you upgrade to a newer version of
23173 GCC, code generation controlled by this option will change to reflect
23174 the most current Intel processors at the time that version of GCC is
23175 released.
23176
23177 There is no @option{-march=intel} option because @option{-march} indicates
23178 the instruction set the compiler can use, and there is no common
23179 instruction set applicable to all processors. In contrast,
23180 @option{-mtune} indicates the processor (or, in this case, collection of
23181 processors) for which the code is optimized.
23182 @end table
23183
23184 @item -mcpu=@var{cpu-type}
23185 @opindex mcpu
23186 A deprecated synonym for @option{-mtune}.
23187
23188 @item -mfpmath=@var{unit}
23189 @opindex mfpmath
23190 Generate floating-point arithmetic for selected unit @var{unit}. The choices
23191 for @var{unit} are:
23192
23193 @table @samp
23194 @item 387
23195 Use the standard 387 floating-point coprocessor present on the majority of chips and
23196 emulated otherwise. Code compiled with this option runs almost everywhere.
23197 The temporary results are computed in 80-bit precision instead of the precision
23198 specified by the type, resulting in slightly different results compared to most
23199 of other chips. See @option{-ffloat-store} for more detailed description.
23200
23201 This is the default choice for x86-32 targets.
23202
23203 @item sse
23204 Use scalar floating-point instructions present in the SSE instruction set.
23205 This instruction set is supported by Pentium III and newer chips,
23206 and in the AMD line
23207 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
23208 instruction set supports only single-precision arithmetic, thus the double and
23209 extended-precision arithmetic are still done using 387. A later version, present
23210 only in Pentium 4 and AMD x86-64 chips, supports double-precision
23211 arithmetic too.
23212
23213 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
23214 or @option{-msse2} switches to enable SSE extensions and make this option
23215 effective. For the x86-64 compiler, these extensions are enabled by default.
23216
23217 The resulting code should be considerably faster in the majority of cases and avoid
23218 the numerical instability problems of 387 code, but may break some existing
23219 code that expects temporaries to be 80 bits.
23220
23221 This is the default choice for the x86-64 compiler.
23222
23223 @item sse,387
23224 @itemx sse+387
23225 @itemx both
23226 Attempt to utilize both instruction sets at once. This effectively doubles the
23227 amount of available registers, and on chips with separate execution units for
23228 387 and SSE the execution resources too. Use this option with care, as it is
23229 still experimental, because the GCC register allocator does not model separate
23230 functional units well, resulting in unstable performance.
23231 @end table
23232
23233 @item -masm=@var{dialect}
23234 @opindex masm=@var{dialect}
23235 Output assembly instructions using selected @var{dialect}. Also affects
23236 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
23237 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
23238 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
23239 not support @samp{intel}.
23240
23241 @item -mieee-fp
23242 @itemx -mno-ieee-fp
23243 @opindex mieee-fp
23244 @opindex mno-ieee-fp
23245 Control whether or not the compiler uses IEEE floating-point
23246 comparisons. These correctly handle the case where the result of a
23247 comparison is unordered.
23248
23249 @item -msoft-float
23250 @opindex msoft-float
23251 Generate output containing library calls for floating point.
23252
23253 @strong{Warning:} the requisite libraries are not part of GCC@.
23254 Normally the facilities of the machine's usual C compiler are used, but
23255 this can't be done directly in cross-compilation. You must make your
23256 own arrangements to provide suitable library functions for
23257 cross-compilation.
23258
23259 On machines where a function returns floating-point results in the 80387
23260 register stack, some floating-point opcodes may be emitted even if
23261 @option{-msoft-float} is used.
23262
23263 @item -mno-fp-ret-in-387
23264 @opindex mno-fp-ret-in-387
23265 Do not use the FPU registers for return values of functions.
23266
23267 The usual calling convention has functions return values of types
23268 @code{float} and @code{double} in an FPU register, even if there
23269 is no FPU@. The idea is that the operating system should emulate
23270 an FPU@.
23271
23272 The option @option{-mno-fp-ret-in-387} causes such values to be returned
23273 in ordinary CPU registers instead.
23274
23275 @item -mno-fancy-math-387
23276 @opindex mno-fancy-math-387
23277 Some 387 emulators do not support the @code{sin}, @code{cos} and
23278 @code{sqrt} instructions for the 387. Specify this option to avoid
23279 generating those instructions. This option is the default on
23280 OpenBSD and NetBSD@. This option is overridden when @option{-march}
23281 indicates that the target CPU always has an FPU and so the
23282 instruction does not need emulation. These
23283 instructions are not generated unless you also use the
23284 @option{-funsafe-math-optimizations} switch.
23285
23286 @item -malign-double
23287 @itemx -mno-align-double
23288 @opindex malign-double
23289 @opindex mno-align-double
23290 Control whether GCC aligns @code{double}, @code{long double}, and
23291 @code{long long} variables on a two-word boundary or a one-word
23292 boundary. Aligning @code{double} variables on a two-word boundary
23293 produces code that runs somewhat faster on a Pentium at the
23294 expense of more memory.
23295
23296 On x86-64, @option{-malign-double} is enabled by default.
23297
23298 @strong{Warning:} if you use the @option{-malign-double} switch,
23299 structures containing the above types are aligned differently than
23300 the published application binary interface specifications for the x86-32
23301 and are not binary compatible with structures in code compiled
23302 without that switch.
23303
23304 @item -m96bit-long-double
23305 @itemx -m128bit-long-double
23306 @opindex m96bit-long-double
23307 @opindex m128bit-long-double
23308 These switches control the size of @code{long double} type. The x86-32
23309 application binary interface specifies the size to be 96 bits,
23310 so @option{-m96bit-long-double} is the default in 32-bit mode.
23311
23312 Modern architectures (Pentium and newer) prefer @code{long double}
23313 to be aligned to an 8- or 16-byte boundary. In arrays or structures
23314 conforming to the ABI, this is not possible. So specifying
23315 @option{-m128bit-long-double} aligns @code{long double}
23316 to a 16-byte boundary by padding the @code{long double} with an additional
23317 32-bit zero.
23318
23319 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
23320 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
23321
23322 Notice that neither of these options enable any extra precision over the x87
23323 standard of 80 bits for a @code{long double}.
23324
23325 @strong{Warning:} if you override the default value for your target ABI, this
23326 changes the size of
23327 structures and arrays containing @code{long double} variables,
23328 as well as modifying the function calling convention for functions taking
23329 @code{long double}. Hence they are not binary-compatible
23330 with code compiled without that switch.
23331
23332 @item -mlong-double-64
23333 @itemx -mlong-double-80
23334 @itemx -mlong-double-128
23335 @opindex mlong-double-64
23336 @opindex mlong-double-80
23337 @opindex mlong-double-128
23338 These switches control the size of @code{long double} type. A size
23339 of 64 bits makes the @code{long double} type equivalent to the @code{double}
23340 type. This is the default for 32-bit Bionic C library. A size
23341 of 128 bits makes the @code{long double} type equivalent to the
23342 @code{__float128} type. This is the default for 64-bit Bionic C library.
23343
23344 @strong{Warning:} if you override the default value for your target ABI, this
23345 changes the size of
23346 structures and arrays containing @code{long double} variables,
23347 as well as modifying the function calling convention for functions taking
23348 @code{long double}. Hence they are not binary-compatible
23349 with code compiled without that switch.
23350
23351 @item -malign-data=@var{type}
23352 @opindex malign-data
23353 Control how GCC aligns variables. Supported values for @var{type} are
23354 @samp{compat} uses increased alignment value compatible uses GCC 4.8
23355 and earlier, @samp{abi} uses alignment value as specified by the
23356 psABI, and @samp{cacheline} uses increased alignment value to match
23357 the cache line size. @samp{compat} is the default.
23358
23359 @item -mlarge-data-threshold=@var{threshold}
23360 @opindex mlarge-data-threshold
23361 When @option{-mcmodel=medium} is specified, data objects larger than
23362 @var{threshold} are placed in the large data section. This value must be the
23363 same across all objects linked into the binary, and defaults to 65535.
23364
23365 @item -mrtd
23366 @opindex mrtd
23367 Use a different function-calling convention, in which functions that
23368 take a fixed number of arguments return with the @code{ret @var{num}}
23369 instruction, which pops their arguments while returning. This saves one
23370 instruction in the caller since there is no need to pop the arguments
23371 there.
23372
23373 You can specify that an individual function is called with this calling
23374 sequence with the function attribute @code{stdcall}. You can also
23375 override the @option{-mrtd} option by using the function attribute
23376 @code{cdecl}. @xref{Function Attributes}.
23377
23378 @strong{Warning:} this calling convention is incompatible with the one
23379 normally used on Unix, so you cannot use it if you need to call
23380 libraries compiled with the Unix compiler.
23381
23382 Also, you must provide function prototypes for all functions that
23383 take variable numbers of arguments (including @code{printf});
23384 otherwise incorrect code is generated for calls to those
23385 functions.
23386
23387 In addition, seriously incorrect code results if you call a
23388 function with too many arguments. (Normally, extra arguments are
23389 harmlessly ignored.)
23390
23391 @item -mregparm=@var{num}
23392 @opindex mregparm
23393 Control how many registers are used to pass integer arguments. By
23394 default, no registers are used to pass arguments, and at most 3
23395 registers can be used. You can control this behavior for a specific
23396 function by using the function attribute @code{regparm}.
23397 @xref{Function Attributes}.
23398
23399 @strong{Warning:} if you use this switch, and
23400 @var{num} is nonzero, then you must build all modules with the same
23401 value, including any libraries. This includes the system libraries and
23402 startup modules.
23403
23404 @item -msseregparm
23405 @opindex msseregparm
23406 Use SSE register passing conventions for float and double arguments
23407 and return values. You can control this behavior for a specific
23408 function by using the function attribute @code{sseregparm}.
23409 @xref{Function Attributes}.
23410
23411 @strong{Warning:} if you use this switch then you must build all
23412 modules with the same value, including any libraries. This includes
23413 the system libraries and startup modules.
23414
23415 @item -mvect8-ret-in-mem
23416 @opindex mvect8-ret-in-mem
23417 Return 8-byte vectors in memory instead of MMX registers. This is the
23418 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
23419 Studio compilers until version 12. Later compiler versions (starting
23420 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
23421 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
23422 you need to remain compatible with existing code produced by those
23423 previous compiler versions or older versions of GCC@.
23424
23425 @item -mpc32
23426 @itemx -mpc64
23427 @itemx -mpc80
23428 @opindex mpc32
23429 @opindex mpc64
23430 @opindex mpc80
23431
23432 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
23433 is specified, the significands of results of floating-point operations are
23434 rounded to 24 bits (single precision); @option{-mpc64} rounds the
23435 significands of results of floating-point operations to 53 bits (double
23436 precision) and @option{-mpc80} rounds the significands of results of
23437 floating-point operations to 64 bits (extended double precision), which is
23438 the default. When this option is used, floating-point operations in higher
23439 precisions are not available to the programmer without setting the FPU
23440 control word explicitly.
23441
23442 Setting the rounding of floating-point operations to less than the default
23443 80 bits can speed some programs by 2% or more. Note that some mathematical
23444 libraries assume that extended-precision (80-bit) floating-point operations
23445 are enabled by default; routines in such libraries could suffer significant
23446 loss of accuracy, typically through so-called ``catastrophic cancellation'',
23447 when this option is used to set the precision to less than extended precision.
23448
23449 @item -mstackrealign
23450 @opindex mstackrealign
23451 Realign the stack at entry. On the x86, the @option{-mstackrealign}
23452 option generates an alternate prologue and epilogue that realigns the
23453 run-time stack if necessary. This supports mixing legacy codes that keep
23454 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
23455 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
23456 applicable to individual functions.
23457
23458 @item -mpreferred-stack-boundary=@var{num}
23459 @opindex mpreferred-stack-boundary
23460 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23461 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23462 the default is 4 (16 bytes or 128 bits).
23463
23464 @strong{Warning:} When generating code for the x86-64 architecture with
23465 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
23466 used to keep the stack boundary aligned to 8 byte boundary. Since
23467 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
23468 intended to be used in controlled environment where stack space is
23469 important limitation. This option leads to wrong code when functions
23470 compiled with 16 byte stack alignment (such as functions from a standard
23471 library) are called with misaligned stack. In this case, SSE
23472 instructions may lead to misaligned memory access traps. In addition,
23473 variable arguments are handled incorrectly for 16 byte aligned
23474 objects (including x87 long double and __int128), leading to wrong
23475 results. You must build all modules with
23476 @option{-mpreferred-stack-boundary=3}, including any libraries. This
23477 includes the system libraries and startup modules.
23478
23479 @item -mincoming-stack-boundary=@var{num}
23480 @opindex mincoming-stack-boundary
23481 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
23482 boundary. If @option{-mincoming-stack-boundary} is not specified,
23483 the one specified by @option{-mpreferred-stack-boundary} is used.
23484
23485 On Pentium and Pentium Pro, @code{double} and @code{long double} values
23486 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
23487 suffer significant run time performance penalties. On Pentium III, the
23488 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
23489 properly if it is not 16-byte aligned.
23490
23491 To ensure proper alignment of this values on the stack, the stack boundary
23492 must be as aligned as that required by any value stored on the stack.
23493 Further, every function must be generated such that it keeps the stack
23494 aligned. Thus calling a function compiled with a higher preferred
23495 stack boundary from a function compiled with a lower preferred stack
23496 boundary most likely misaligns the stack. It is recommended that
23497 libraries that use callbacks always use the default setting.
23498
23499 This extra alignment does consume extra stack space, and generally
23500 increases code size. Code that is sensitive to stack space usage, such
23501 as embedded systems and operating system kernels, may want to reduce the
23502 preferred alignment to @option{-mpreferred-stack-boundary=2}.
23503
23504 @need 200
23505 @item -mmmx
23506 @opindex mmmx
23507 @need 200
23508 @itemx -msse
23509 @opindex msse
23510 @need 200
23511 @itemx -msse2
23512 @opindex msse2
23513 @need 200
23514 @itemx -msse3
23515 @opindex msse3
23516 @need 200
23517 @itemx -mssse3
23518 @opindex mssse3
23519 @need 200
23520 @itemx -msse4
23521 @opindex msse4
23522 @need 200
23523 @itemx -msse4a
23524 @opindex msse4a
23525 @need 200
23526 @itemx -msse4.1
23527 @opindex msse4.1
23528 @need 200
23529 @itemx -msse4.2
23530 @opindex msse4.2
23531 @need 200
23532 @itemx -mavx
23533 @opindex mavx
23534 @need 200
23535 @itemx -mavx2
23536 @opindex mavx2
23537 @need 200
23538 @itemx -mavx512f
23539 @opindex mavx512f
23540 @need 200
23541 @itemx -mavx512pf
23542 @opindex mavx512pf
23543 @need 200
23544 @itemx -mavx512er
23545 @opindex mavx512er
23546 @need 200
23547 @itemx -mavx512cd
23548 @opindex mavx512cd
23549 @need 200
23550 @itemx -mavx512vl
23551 @opindex mavx512vl
23552 @need 200
23553 @itemx -mavx512bw
23554 @opindex mavx512bw
23555 @need 200
23556 @itemx -mavx512dq
23557 @opindex mavx512dq
23558 @need 200
23559 @itemx -mavx512ifma
23560 @opindex mavx512ifma
23561 @need 200
23562 @itemx -mavx512vbmi
23563 @opindex mavx512vbmi
23564 @need 200
23565 @itemx -msha
23566 @opindex msha
23567 @need 200
23568 @itemx -maes
23569 @opindex maes
23570 @need 200
23571 @itemx -mpclmul
23572 @opindex mpclmul
23573 @need 200
23574 @itemx -mclfushopt
23575 @opindex mclfushopt
23576 @need 200
23577 @itemx -mfsgsbase
23578 @opindex mfsgsbase
23579 @need 200
23580 @itemx -mrdrnd
23581 @opindex mrdrnd
23582 @need 200
23583 @itemx -mf16c
23584 @opindex mf16c
23585 @need 200
23586 @itemx -mfma
23587 @opindex mfma
23588 @need 200
23589 @itemx -mfma4
23590 @opindex mfma4
23591 @need 200
23592 @itemx -mprefetchwt1
23593 @opindex mprefetchwt1
23594 @need 200
23595 @itemx -mxop
23596 @opindex mxop
23597 @need 200
23598 @itemx -mlwp
23599 @opindex mlwp
23600 @need 200
23601 @itemx -m3dnow
23602 @opindex m3dnow
23603 @need 200
23604 @itemx -mpopcnt
23605 @opindex mpopcnt
23606 @need 200
23607 @itemx -mabm
23608 @opindex mabm
23609 @need 200
23610 @itemx -mbmi
23611 @opindex mbmi
23612 @need 200
23613 @itemx -mbmi2
23614 @need 200
23615 @itemx -mlzcnt
23616 @opindex mlzcnt
23617 @need 200
23618 @itemx -mfxsr
23619 @opindex mfxsr
23620 @need 200
23621 @itemx -mxsave
23622 @opindex mxsave
23623 @need 200
23624 @itemx -mxsaveopt
23625 @opindex mxsaveopt
23626 @need 200
23627 @itemx -mxsavec
23628 @opindex mxsavec
23629 @need 200
23630 @itemx -mxsaves
23631 @opindex mxsaves
23632 @need 200
23633 @itemx -mrtm
23634 @opindex mrtm
23635 @need 200
23636 @itemx -mtbm
23637 @opindex mtbm
23638 @need 200
23639 @itemx -mmpx
23640 @opindex mmpx
23641 @need 200
23642 @itemx -mmwaitx
23643 @opindex mmwaitx
23644 @need 200
23645 @itemx -mclzero
23646 @opindex mclzero
23647 @itemx -mpku
23648 @opindex mpku
23649 These switches enable the use of instructions in the MMX, SSE,
23650 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
23651 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
23652 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
23653 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU or 3DNow!@:
23654 extended instruction sets. Each has a corresponding @option{-mno-} option
23655 to disable use of these instructions.
23656
23657 These extensions are also available as built-in functions: see
23658 @ref{x86 Built-in Functions}, for details of the functions enabled and
23659 disabled by these switches.
23660
23661 To generate SSE/SSE2 instructions automatically from floating-point
23662 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
23663
23664 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
23665 generates new AVX instructions or AVX equivalence for all SSEx instructions
23666 when needed.
23667
23668 These options enable GCC to use these extended instructions in
23669 generated code, even without @option{-mfpmath=sse}. Applications that
23670 perform run-time CPU detection must compile separate files for each
23671 supported architecture, using the appropriate flags. In particular,
23672 the file containing the CPU detection code should be compiled without
23673 these options.
23674
23675 @item -mdump-tune-features
23676 @opindex mdump-tune-features
23677 This option instructs GCC to dump the names of the x86 performance
23678 tuning features and default settings. The names can be used in
23679 @option{-mtune-ctrl=@var{feature-list}}.
23680
23681 @item -mtune-ctrl=@var{feature-list}
23682 @opindex mtune-ctrl=@var{feature-list}
23683 This option is used to do fine grain control of x86 code generation features.
23684 @var{feature-list} is a comma separated list of @var{feature} names. See also
23685 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
23686 on if it is not preceded with @samp{^}, otherwise, it is turned off.
23687 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
23688 developers. Using it may lead to code paths not covered by testing and can
23689 potentially result in compiler ICEs or runtime errors.
23690
23691 @item -mno-default
23692 @opindex mno-default
23693 This option instructs GCC to turn off all tunable features. See also
23694 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
23695
23696 @item -mcld
23697 @opindex mcld
23698 This option instructs GCC to emit a @code{cld} instruction in the prologue
23699 of functions that use string instructions. String instructions depend on
23700 the DF flag to select between autoincrement or autodecrement mode. While the
23701 ABI specifies the DF flag to be cleared on function entry, some operating
23702 systems violate this specification by not clearing the DF flag in their
23703 exception dispatchers. The exception handler can be invoked with the DF flag
23704 set, which leads to wrong direction mode when string instructions are used.
23705 This option can be enabled by default on 32-bit x86 targets by configuring
23706 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
23707 instructions can be suppressed with the @option{-mno-cld} compiler option
23708 in this case.
23709
23710 @item -mvzeroupper
23711 @opindex mvzeroupper
23712 This option instructs GCC to emit a @code{vzeroupper} instruction
23713 before a transfer of control flow out of the function to minimize
23714 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
23715 intrinsics.
23716
23717 @item -mprefer-avx128
23718 @opindex mprefer-avx128
23719 This option instructs GCC to use 128-bit AVX instructions instead of
23720 256-bit AVX instructions in the auto-vectorizer.
23721
23722 @item -mcx16
23723 @opindex mcx16
23724 This option enables GCC to generate @code{CMPXCHG16B} instructions.
23725 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
23726 (or oword) data types.
23727 This is useful for high-resolution counters that can be updated
23728 by multiple processors (or cores). This instruction is generated as part of
23729 atomic built-in functions: see @ref{__sync Builtins} or
23730 @ref{__atomic Builtins} for details.
23731
23732 @item -msahf
23733 @opindex msahf
23734 This option enables generation of @code{SAHF} instructions in 64-bit code.
23735 Early Intel Pentium 4 CPUs with Intel 64 support,
23736 prior to the introduction of Pentium 4 G1 step in December 2005,
23737 lacked the @code{LAHF} and @code{SAHF} instructions
23738 which are supported by AMD64.
23739 These are load and store instructions, respectively, for certain status flags.
23740 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
23741 @code{drem}, and @code{remainder} built-in functions;
23742 see @ref{Other Builtins} for details.
23743
23744 @item -mmovbe
23745 @opindex mmovbe
23746 This option enables use of the @code{movbe} instruction to implement
23747 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
23748
23749 @item -mcrc32
23750 @opindex mcrc32
23751 This option enables built-in functions @code{__builtin_ia32_crc32qi},
23752 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
23753 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
23754
23755 @item -mrecip
23756 @opindex mrecip
23757 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
23758 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
23759 with an additional Newton-Raphson step
23760 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
23761 (and their vectorized
23762 variants) for single-precision floating-point arguments. These instructions
23763 are generated only when @option{-funsafe-math-optimizations} is enabled
23764 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
23765 Note that while the throughput of the sequence is higher than the throughput
23766 of the non-reciprocal instruction, the precision of the sequence can be
23767 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
23768
23769 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
23770 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
23771 combination), and doesn't need @option{-mrecip}.
23772
23773 Also note that GCC emits the above sequence with additional Newton-Raphson step
23774 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
23775 already with @option{-ffast-math} (or the above option combination), and
23776 doesn't need @option{-mrecip}.
23777
23778 @item -mrecip=@var{opt}
23779 @opindex mrecip=opt
23780 This option controls which reciprocal estimate instructions
23781 may be used. @var{opt} is a comma-separated list of options, which may
23782 be preceded by a @samp{!} to invert the option:
23783
23784 @table @samp
23785 @item all
23786 Enable all estimate instructions.
23787
23788 @item default
23789 Enable the default instructions, equivalent to @option{-mrecip}.
23790
23791 @item none
23792 Disable all estimate instructions, equivalent to @option{-mno-recip}.
23793
23794 @item div
23795 Enable the approximation for scalar division.
23796
23797 @item vec-div
23798 Enable the approximation for vectorized division.
23799
23800 @item sqrt
23801 Enable the approximation for scalar square root.
23802
23803 @item vec-sqrt
23804 Enable the approximation for vectorized square root.
23805 @end table
23806
23807 So, for example, @option{-mrecip=all,!sqrt} enables
23808 all of the reciprocal approximations, except for square root.
23809
23810 @item -mveclibabi=@var{type}
23811 @opindex mveclibabi
23812 Specifies the ABI type to use for vectorizing intrinsics using an
23813 external library. Supported values for @var{type} are @samp{svml}
23814 for the Intel short
23815 vector math library and @samp{acml} for the AMD math core library.
23816 To use this option, both @option{-ftree-vectorize} and
23817 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
23818 ABI-compatible library must be specified at link time.
23819
23820 GCC currently emits calls to @code{vmldExp2},
23821 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
23822 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
23823 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
23824 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
23825 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
23826 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
23827 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
23828 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
23829 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
23830 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
23831 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
23832 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
23833 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
23834 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
23835 when @option{-mveclibabi=acml} is used.
23836
23837 @item -mabi=@var{name}
23838 @opindex mabi
23839 Generate code for the specified calling convention. Permissible values
23840 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
23841 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
23842 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
23843 You can control this behavior for specific functions by
23844 using the function attributes @code{ms_abi} and @code{sysv_abi}.
23845 @xref{Function Attributes}.
23846
23847 @item -mtls-dialect=@var{type}
23848 @opindex mtls-dialect
23849 Generate code to access thread-local storage using the @samp{gnu} or
23850 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
23851 @samp{gnu2} is more efficient, but it may add compile- and run-time
23852 requirements that cannot be satisfied on all systems.
23853
23854 @item -mpush-args
23855 @itemx -mno-push-args
23856 @opindex mpush-args
23857 @opindex mno-push-args
23858 Use PUSH operations to store outgoing parameters. This method is shorter
23859 and usually equally fast as method using SUB/MOV operations and is enabled
23860 by default. In some cases disabling it may improve performance because of
23861 improved scheduling and reduced dependencies.
23862
23863 @item -maccumulate-outgoing-args
23864 @opindex maccumulate-outgoing-args
23865 If enabled, the maximum amount of space required for outgoing arguments is
23866 computed in the function prologue. This is faster on most modern CPUs
23867 because of reduced dependencies, improved scheduling and reduced stack usage
23868 when the preferred stack boundary is not equal to 2. The drawback is a notable
23869 increase in code size. This switch implies @option{-mno-push-args}.
23870
23871 @item -mthreads
23872 @opindex mthreads
23873 Support thread-safe exception handling on MinGW. Programs that rely
23874 on thread-safe exception handling must compile and link all code with the
23875 @option{-mthreads} option. When compiling, @option{-mthreads} defines
23876 @option{-D_MT}; when linking, it links in a special thread helper library
23877 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
23878
23879 @item -mms-bitfields
23880 @itemx -mno-ms-bitfields
23881 @opindex mms-bitfields
23882 @opindex mno-ms-bitfields
23883
23884 Enable/disable bit-field layout compatible with the native Microsoft
23885 Windows compiler.
23886
23887 If @code{packed} is used on a structure, or if bit-fields are used,
23888 it may be that the Microsoft ABI lays out the structure differently
23889 than the way GCC normally does. Particularly when moving packed
23890 data between functions compiled with GCC and the native Microsoft compiler
23891 (either via function call or as data in a file), it may be necessary to access
23892 either format.
23893
23894 This option is enabled by default for Microsoft Windows
23895 targets. This behavior can also be controlled locally by use of variable
23896 or type attributes. For more information, see @ref{x86 Variable Attributes}
23897 and @ref{x86 Type Attributes}.
23898
23899 The Microsoft structure layout algorithm is fairly simple with the exception
23900 of the bit-field packing.
23901 The padding and alignment of members of structures and whether a bit-field
23902 can straddle a storage-unit boundary are determine by these rules:
23903
23904 @enumerate
23905 @item Structure members are stored sequentially in the order in which they are
23906 declared: the first member has the lowest memory address and the last member
23907 the highest.
23908
23909 @item Every data object has an alignment requirement. The alignment requirement
23910 for all data except structures, unions, and arrays is either the size of the
23911 object or the current packing size (specified with either the
23912 @code{aligned} attribute or the @code{pack} pragma),
23913 whichever is less. For structures, unions, and arrays,
23914 the alignment requirement is the largest alignment requirement of its members.
23915 Every object is allocated an offset so that:
23916
23917 @smallexample
23918 offset % alignment_requirement == 0
23919 @end smallexample
23920
23921 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
23922 unit if the integral types are the same size and if the next bit-field fits
23923 into the current allocation unit without crossing the boundary imposed by the
23924 common alignment requirements of the bit-fields.
23925 @end enumerate
23926
23927 MSVC interprets zero-length bit-fields in the following ways:
23928
23929 @enumerate
23930 @item If a zero-length bit-field is inserted between two bit-fields that
23931 are normally coalesced, the bit-fields are not coalesced.
23932
23933 For example:
23934
23935 @smallexample
23936 struct
23937 @{
23938 unsigned long bf_1 : 12;
23939 unsigned long : 0;
23940 unsigned long bf_2 : 12;
23941 @} t1;
23942 @end smallexample
23943
23944 @noindent
23945 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
23946 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
23947
23948 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
23949 alignment of the zero-length bit-field is greater than the member that follows it,
23950 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
23951
23952 For example:
23953
23954 @smallexample
23955 struct
23956 @{
23957 char foo : 4;
23958 short : 0;
23959 char bar;
23960 @} t2;
23961
23962 struct
23963 @{
23964 char foo : 4;
23965 short : 0;
23966 double bar;
23967 @} t3;
23968 @end smallexample
23969
23970 @noindent
23971 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
23972 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
23973 bit-field does not affect the alignment of @code{bar} or, as a result, the size
23974 of the structure.
23975
23976 Taking this into account, it is important to note the following:
23977
23978 @enumerate
23979 @item If a zero-length bit-field follows a normal bit-field, the type of the
23980 zero-length bit-field may affect the alignment of the structure as whole. For
23981 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
23982 normal bit-field, and is of type short.
23983
23984 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
23985 still affect the alignment of the structure:
23986
23987 @smallexample
23988 struct
23989 @{
23990 char foo : 6;
23991 long : 0;
23992 @} t4;
23993 @end smallexample
23994
23995 @noindent
23996 Here, @code{t4} takes up 4 bytes.
23997 @end enumerate
23998
23999 @item Zero-length bit-fields following non-bit-field members are ignored:
24000
24001 @smallexample
24002 struct
24003 @{
24004 char foo;
24005 long : 0;
24006 char bar;
24007 @} t5;
24008 @end smallexample
24009
24010 @noindent
24011 Here, @code{t5} takes up 2 bytes.
24012 @end enumerate
24013
24014
24015 @item -mno-align-stringops
24016 @opindex mno-align-stringops
24017 Do not align the destination of inlined string operations. This switch reduces
24018 code size and improves performance in case the destination is already aligned,
24019 but GCC doesn't know about it.
24020
24021 @item -minline-all-stringops
24022 @opindex minline-all-stringops
24023 By default GCC inlines string operations only when the destination is
24024 known to be aligned to least a 4-byte boundary.
24025 This enables more inlining and increases code
24026 size, but may improve performance of code that depends on fast
24027 @code{memcpy}, @code{strlen},
24028 and @code{memset} for short lengths.
24029
24030 @item -minline-stringops-dynamically
24031 @opindex minline-stringops-dynamically
24032 For string operations of unknown size, use run-time checks with
24033 inline code for small blocks and a library call for large blocks.
24034
24035 @item -mstringop-strategy=@var{alg}
24036 @opindex mstringop-strategy=@var{alg}
24037 Override the internal decision heuristic for the particular algorithm to use
24038 for inlining string operations. The allowed values for @var{alg} are:
24039
24040 @table @samp
24041 @item rep_byte
24042 @itemx rep_4byte
24043 @itemx rep_8byte
24044 Expand using i386 @code{rep} prefix of the specified size.
24045
24046 @item byte_loop
24047 @itemx loop
24048 @itemx unrolled_loop
24049 Expand into an inline loop.
24050
24051 @item libcall
24052 Always use a library call.
24053 @end table
24054
24055 @item -mmemcpy-strategy=@var{strategy}
24056 @opindex mmemcpy-strategy=@var{strategy}
24057 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
24058 should be inlined and what inline algorithm to use when the expected size
24059 of the copy operation is known. @var{strategy}
24060 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
24061 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
24062 the max byte size with which inline algorithm @var{alg} is allowed. For the last
24063 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
24064 in the list must be specified in increasing order. The minimal byte size for
24065 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
24066 preceding range.
24067
24068 @item -mmemset-strategy=@var{strategy}
24069 @opindex mmemset-strategy=@var{strategy}
24070 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
24071 @code{__builtin_memset} expansion.
24072
24073 @item -momit-leaf-frame-pointer
24074 @opindex momit-leaf-frame-pointer
24075 Don't keep the frame pointer in a register for leaf functions. This
24076 avoids the instructions to save, set up, and restore frame pointers and
24077 makes an extra register available in leaf functions. The option
24078 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
24079 which might make debugging harder.
24080
24081 @item -mtls-direct-seg-refs
24082 @itemx -mno-tls-direct-seg-refs
24083 @opindex mtls-direct-seg-refs
24084 Controls whether TLS variables may be accessed with offsets from the
24085 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
24086 or whether the thread base pointer must be added. Whether or not this
24087 is valid depends on the operating system, and whether it maps the
24088 segment to cover the entire TLS area.
24089
24090 For systems that use the GNU C Library, the default is on.
24091
24092 @item -msse2avx
24093 @itemx -mno-sse2avx
24094 @opindex msse2avx
24095 Specify that the assembler should encode SSE instructions with VEX
24096 prefix. The option @option{-mavx} turns this on by default.
24097
24098 @item -mfentry
24099 @itemx -mno-fentry
24100 @opindex mfentry
24101 If profiling is active (@option{-pg}), put the profiling
24102 counter call before the prologue.
24103 Note: On x86 architectures the attribute @code{ms_hook_prologue}
24104 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
24105
24106 @item -mrecord-mcount
24107 @itemx -mno-record-mcount
24108 @opindex mrecord-mcount
24109 If profiling is active (@option{-pg}), generate a __mcount_loc section
24110 that contains pointers to each profiling call. This is useful for
24111 automatically patching and out calls.
24112
24113 @item -mnop-mcount
24114 @itemx -mno-nop-mcount
24115 @opindex mnop-mcount
24116 If profiling is active (@option{-pg}), generate the calls to
24117 the profiling functions as nops. This is useful when they
24118 should be patched in later dynamically. This is likely only
24119 useful together with @option{-mrecord-mcount}.
24120
24121 @item -mskip-rax-setup
24122 @itemx -mno-skip-rax-setup
24123 @opindex mskip-rax-setup
24124 When generating code for the x86-64 architecture with SSE extensions
24125 disabled, @option{-skip-rax-setup} can be used to skip setting up RAX
24126 register when there are no variable arguments passed in vector registers.
24127
24128 @strong{Warning:} Since RAX register is used to avoid unnecessarily
24129 saving vector registers on stack when passing variable arguments, the
24130 impacts of this option are callees may waste some stack space,
24131 misbehave or jump to a random location. GCC 4.4 or newer don't have
24132 those issues, regardless the RAX register value.
24133
24134 @item -m8bit-idiv
24135 @itemx -mno-8bit-idiv
24136 @opindex m8bit-idiv
24137 On some processors, like Intel Atom, 8-bit unsigned integer divide is
24138 much faster than 32-bit/64-bit integer divide. This option generates a
24139 run-time check. If both dividend and divisor are within range of 0
24140 to 255, 8-bit unsigned integer divide is used instead of
24141 32-bit/64-bit integer divide.
24142
24143 @item -mavx256-split-unaligned-load
24144 @itemx -mavx256-split-unaligned-store
24145 @opindex mavx256-split-unaligned-load
24146 @opindex mavx256-split-unaligned-store
24147 Split 32-byte AVX unaligned load and store.
24148
24149 @item -mstack-protector-guard=@var{guard}
24150 @opindex mstack-protector-guard=@var{guard}
24151 Generate stack protection code using canary at @var{guard}. Supported
24152 locations are @samp{global} for global canary or @samp{tls} for per-thread
24153 canary in the TLS block (the default). This option has effect only when
24154 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
24155
24156 @item -mmitigate-rop
24157 @opindex mmitigate-rop
24158 Try to avoid generating code sequences that contain unintended return
24159 opcodes, to mitigate against certain forms of attack. At the moment,
24160 this option is limited in what it can do and should not be relied
24161 on to provide serious protection.
24162
24163 @end table
24164
24165 These @samp{-m} switches are supported in addition to the above
24166 on x86-64 processors in 64-bit environments.
24167
24168 @table @gcctabopt
24169 @item -m32
24170 @itemx -m64
24171 @itemx -mx32
24172 @itemx -m16
24173 @itemx -miamcu
24174 @opindex m32
24175 @opindex m64
24176 @opindex mx32
24177 @opindex m16
24178 @opindex miamcu
24179 Generate code for a 16-bit, 32-bit or 64-bit environment.
24180 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
24181 to 32 bits, and
24182 generates code that runs on any i386 system.
24183
24184 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
24185 types to 64 bits, and generates code for the x86-64 architecture.
24186 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
24187 and @option{-mdynamic-no-pic} options.
24188
24189 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
24190 to 32 bits, and
24191 generates code for the x86-64 architecture.
24192
24193 The @option{-m16} option is the same as @option{-m32}, except for that
24194 it outputs the @code{.code16gcc} assembly directive at the beginning of
24195 the assembly output so that the binary can run in 16-bit mode.
24196
24197 The @option{-miamcu} option generates code which conforms to Intel MCU
24198 psABI. It requires the @option{-m32} option to be turned on.
24199
24200 @item -mno-red-zone
24201 @opindex mno-red-zone
24202 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
24203 by the x86-64 ABI; it is a 128-byte area beyond the location of the
24204 stack pointer that is not modified by signal or interrupt handlers
24205 and therefore can be used for temporary data without adjusting the stack
24206 pointer. The flag @option{-mno-red-zone} disables this red zone.
24207
24208 @item -mcmodel=small
24209 @opindex mcmodel=small
24210 Generate code for the small code model: the program and its symbols must
24211 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
24212 Programs can be statically or dynamically linked. This is the default
24213 code model.
24214
24215 @item -mcmodel=kernel
24216 @opindex mcmodel=kernel
24217 Generate code for the kernel code model. The kernel runs in the
24218 negative 2 GB of the address space.
24219 This model has to be used for Linux kernel code.
24220
24221 @item -mcmodel=medium
24222 @opindex mcmodel=medium
24223 Generate code for the medium model: the program is linked in the lower 2
24224 GB of the address space. Small symbols are also placed there. Symbols
24225 with sizes larger than @option{-mlarge-data-threshold} are put into
24226 large data or BSS sections and can be located above 2GB. Programs can
24227 be statically or dynamically linked.
24228
24229 @item -mcmodel=large
24230 @opindex mcmodel=large
24231 Generate code for the large model. This model makes no assumptions
24232 about addresses and sizes of sections.
24233
24234 @item -maddress-mode=long
24235 @opindex maddress-mode=long
24236 Generate code for long address mode. This is only supported for 64-bit
24237 and x32 environments. It is the default address mode for 64-bit
24238 environments.
24239
24240 @item -maddress-mode=short
24241 @opindex maddress-mode=short
24242 Generate code for short address mode. This is only supported for 32-bit
24243 and x32 environments. It is the default address mode for 32-bit and
24244 x32 environments.
24245 @end table
24246
24247 @node x86 Windows Options
24248 @subsection x86 Windows Options
24249 @cindex x86 Windows Options
24250 @cindex Windows Options for x86
24251
24252 These additional options are available for Microsoft Windows targets:
24253
24254 @table @gcctabopt
24255 @item -mconsole
24256 @opindex mconsole
24257 This option
24258 specifies that a console application is to be generated, by
24259 instructing the linker to set the PE header subsystem type
24260 required for console applications.
24261 This option is available for Cygwin and MinGW targets and is
24262 enabled by default on those targets.
24263
24264 @item -mdll
24265 @opindex mdll
24266 This option is available for Cygwin and MinGW targets. It
24267 specifies that a DLL---a dynamic link library---is to be
24268 generated, enabling the selection of the required runtime
24269 startup object and entry point.
24270
24271 @item -mnop-fun-dllimport
24272 @opindex mnop-fun-dllimport
24273 This option is available for Cygwin and MinGW targets. It
24274 specifies that the @code{dllimport} attribute should be ignored.
24275
24276 @item -mthread
24277 @opindex mthread
24278 This option is available for MinGW targets. It specifies
24279 that MinGW-specific thread support is to be used.
24280
24281 @item -municode
24282 @opindex municode
24283 This option is available for MinGW-w64 targets. It causes
24284 the @code{UNICODE} preprocessor macro to be predefined, and
24285 chooses Unicode-capable runtime startup code.
24286
24287 @item -mwin32
24288 @opindex mwin32
24289 This option is available for Cygwin and MinGW targets. It
24290 specifies that the typical Microsoft Windows predefined macros are to
24291 be set in the pre-processor, but does not influence the choice
24292 of runtime library/startup code.
24293
24294 @item -mwindows
24295 @opindex mwindows
24296 This option is available for Cygwin and MinGW targets. It
24297 specifies that a GUI application is to be generated by
24298 instructing the linker to set the PE header subsystem type
24299 appropriately.
24300
24301 @item -fno-set-stack-executable
24302 @opindex fno-set-stack-executable
24303 This option is available for MinGW targets. It specifies that
24304 the executable flag for the stack used by nested functions isn't
24305 set. This is necessary for binaries running in kernel mode of
24306 Microsoft Windows, as there the User32 API, which is used to set executable
24307 privileges, isn't available.
24308
24309 @item -fwritable-relocated-rdata
24310 @opindex fno-writable-relocated-rdata
24311 This option is available for MinGW and Cygwin targets. It specifies
24312 that relocated-data in read-only section is put into the @code{.data}
24313 section. This is a necessary for older runtimes not supporting
24314 modification of @code{.rdata} sections for pseudo-relocation.
24315
24316 @item -mpe-aligned-commons
24317 @opindex mpe-aligned-commons
24318 This option is available for Cygwin and MinGW targets. It
24319 specifies that the GNU extension to the PE file format that
24320 permits the correct alignment of COMMON variables should be
24321 used when generating code. It is enabled by default if
24322 GCC detects that the target assembler found during configuration
24323 supports the feature.
24324 @end table
24325
24326 See also under @ref{x86 Options} for standard options.
24327
24328 @node Xstormy16 Options
24329 @subsection Xstormy16 Options
24330 @cindex Xstormy16 Options
24331
24332 These options are defined for Xstormy16:
24333
24334 @table @gcctabopt
24335 @item -msim
24336 @opindex msim
24337 Choose startup files and linker script suitable for the simulator.
24338 @end table
24339
24340 @node Xtensa Options
24341 @subsection Xtensa Options
24342 @cindex Xtensa Options
24343
24344 These options are supported for Xtensa targets:
24345
24346 @table @gcctabopt
24347 @item -mconst16
24348 @itemx -mno-const16
24349 @opindex mconst16
24350 @opindex mno-const16
24351 Enable or disable use of @code{CONST16} instructions for loading
24352 constant values. The @code{CONST16} instruction is currently not a
24353 standard option from Tensilica. When enabled, @code{CONST16}
24354 instructions are always used in place of the standard @code{L32R}
24355 instructions. The use of @code{CONST16} is enabled by default only if
24356 the @code{L32R} instruction is not available.
24357
24358 @item -mfused-madd
24359 @itemx -mno-fused-madd
24360 @opindex mfused-madd
24361 @opindex mno-fused-madd
24362 Enable or disable use of fused multiply/add and multiply/subtract
24363 instructions in the floating-point option. This has no effect if the
24364 floating-point option is not also enabled. Disabling fused multiply/add
24365 and multiply/subtract instructions forces the compiler to use separate
24366 instructions for the multiply and add/subtract operations. This may be
24367 desirable in some cases where strict IEEE 754-compliant results are
24368 required: the fused multiply add/subtract instructions do not round the
24369 intermediate result, thereby producing results with @emph{more} bits of
24370 precision than specified by the IEEE standard. Disabling fused multiply
24371 add/subtract instructions also ensures that the program output is not
24372 sensitive to the compiler's ability to combine multiply and add/subtract
24373 operations.
24374
24375 @item -mserialize-volatile
24376 @itemx -mno-serialize-volatile
24377 @opindex mserialize-volatile
24378 @opindex mno-serialize-volatile
24379 When this option is enabled, GCC inserts @code{MEMW} instructions before
24380 @code{volatile} memory references to guarantee sequential consistency.
24381 The default is @option{-mserialize-volatile}. Use
24382 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
24383
24384 @item -mforce-no-pic
24385 @opindex mforce-no-pic
24386 For targets, like GNU/Linux, where all user-mode Xtensa code must be
24387 position-independent code (PIC), this option disables PIC for compiling
24388 kernel code.
24389
24390 @item -mtext-section-literals
24391 @itemx -mno-text-section-literals
24392 @opindex mtext-section-literals
24393 @opindex mno-text-section-literals
24394 These options control the treatment of literal pools. The default is
24395 @option{-mno-text-section-literals}, which places literals in a separate
24396 section in the output file. This allows the literal pool to be placed
24397 in a data RAM/ROM, and it also allows the linker to combine literal
24398 pools from separate object files to remove redundant literals and
24399 improve code size. With @option{-mtext-section-literals}, the literals
24400 are interspersed in the text section in order to keep them as close as
24401 possible to their references. This may be necessary for large assembly
24402 files. Literals for each function are placed right before that function.
24403
24404 @item -mauto-litpools
24405 @itemx -mno-auto-litpools
24406 @opindex mauto-litpools
24407 @opindex mno-auto-litpools
24408 These options control the treatment of literal pools. The default is
24409 @option{-mno-auto-litpools}, which places literals in a separate
24410 section in the output file unless @option{-mtext-section-literals} is
24411 used. With @option{-mauto-litpools} the literals are interspersed in
24412 the text section by the assembler. Compiler does not produce explicit
24413 @code{.literal} directives and loads literals into registers with
24414 @code{MOVI} instructions instead of @code{L32R} to let the assembler
24415 do relaxation and place literals as necessary. This option allows
24416 assembler to create several literal pools per function and assemble
24417 very big functions, which may not be possible with
24418 @option{-mtext-section-literals}.
24419
24420 @item -mtarget-align
24421 @itemx -mno-target-align
24422 @opindex mtarget-align
24423 @opindex mno-target-align
24424 When this option is enabled, GCC instructs the assembler to
24425 automatically align instructions to reduce branch penalties at the
24426 expense of some code density. The assembler attempts to widen density
24427 instructions to align branch targets and the instructions following call
24428 instructions. If there are not enough preceding safe density
24429 instructions to align a target, no widening is performed. The
24430 default is @option{-mtarget-align}. These options do not affect the
24431 treatment of auto-aligned instructions like @code{LOOP}, which the
24432 assembler always aligns, either by widening density instructions or
24433 by inserting NOP instructions.
24434
24435 @item -mlongcalls
24436 @itemx -mno-longcalls
24437 @opindex mlongcalls
24438 @opindex mno-longcalls
24439 When this option is enabled, GCC instructs the assembler to translate
24440 direct calls to indirect calls unless it can determine that the target
24441 of a direct call is in the range allowed by the call instruction. This
24442 translation typically occurs for calls to functions in other source
24443 files. Specifically, the assembler translates a direct @code{CALL}
24444 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
24445 The default is @option{-mno-longcalls}. This option should be used in
24446 programs where the call target can potentially be out of range. This
24447 option is implemented in the assembler, not the compiler, so the
24448 assembly code generated by GCC still shows direct call
24449 instructions---look at the disassembled object code to see the actual
24450 instructions. Note that the assembler uses an indirect call for
24451 every cross-file call, not just those that really are out of range.
24452 @end table
24453
24454 @node zSeries Options
24455 @subsection zSeries Options
24456 @cindex zSeries options
24457
24458 These are listed under @xref{S/390 and zSeries Options}.
24459
24460
24461 @c man end
24462
24463 @node Spec Files
24464 @section Specifying Subprocesses and the Switches to Pass to Them
24465 @cindex Spec Files
24466
24467 @command{gcc} is a driver program. It performs its job by invoking a
24468 sequence of other programs to do the work of compiling, assembling and
24469 linking. GCC interprets its command-line parameters and uses these to
24470 deduce which programs it should invoke, and which command-line options
24471 it ought to place on their command lines. This behavior is controlled
24472 by @dfn{spec strings}. In most cases there is one spec string for each
24473 program that GCC can invoke, but a few programs have multiple spec
24474 strings to control their behavior. The spec strings built into GCC can
24475 be overridden by using the @option{-specs=} command-line switch to specify
24476 a spec file.
24477
24478 @dfn{Spec files} are plain-text files that are used to construct spec
24479 strings. They consist of a sequence of directives separated by blank
24480 lines. The type of directive is determined by the first non-whitespace
24481 character on the line, which can be one of the following:
24482
24483 @table @code
24484 @item %@var{command}
24485 Issues a @var{command} to the spec file processor. The commands that can
24486 appear here are:
24487
24488 @table @code
24489 @item %include <@var{file}>
24490 @cindex @code{%include}
24491 Search for @var{file} and insert its text at the current point in the
24492 specs file.
24493
24494 @item %include_noerr <@var{file}>
24495 @cindex @code{%include_noerr}
24496 Just like @samp{%include}, but do not generate an error message if the include
24497 file cannot be found.
24498
24499 @item %rename @var{old_name} @var{new_name}
24500 @cindex @code{%rename}
24501 Rename the spec string @var{old_name} to @var{new_name}.
24502
24503 @end table
24504
24505 @item *[@var{spec_name}]:
24506 This tells the compiler to create, override or delete the named spec
24507 string. All lines after this directive up to the next directive or
24508 blank line are considered to be the text for the spec string. If this
24509 results in an empty string then the spec is deleted. (Or, if the
24510 spec did not exist, then nothing happens.) Otherwise, if the spec
24511 does not currently exist a new spec is created. If the spec does
24512 exist then its contents are overridden by the text of this
24513 directive, unless the first character of that text is the @samp{+}
24514 character, in which case the text is appended to the spec.
24515
24516 @item [@var{suffix}]:
24517 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
24518 and up to the next directive or blank line are considered to make up the
24519 spec string for the indicated suffix. When the compiler encounters an
24520 input file with the named suffix, it processes the spec string in
24521 order to work out how to compile that file. For example:
24522
24523 @smallexample
24524 .ZZ:
24525 z-compile -input %i
24526 @end smallexample
24527
24528 This says that any input file whose name ends in @samp{.ZZ} should be
24529 passed to the program @samp{z-compile}, which should be invoked with the
24530 command-line switch @option{-input} and with the result of performing the
24531 @samp{%i} substitution. (See below.)
24532
24533 As an alternative to providing a spec string, the text following a
24534 suffix directive can be one of the following:
24535
24536 @table @code
24537 @item @@@var{language}
24538 This says that the suffix is an alias for a known @var{language}. This is
24539 similar to using the @option{-x} command-line switch to GCC to specify a
24540 language explicitly. For example:
24541
24542 @smallexample
24543 .ZZ:
24544 @@c++
24545 @end smallexample
24546
24547 Says that .ZZ files are, in fact, C++ source files.
24548
24549 @item #@var{name}
24550 This causes an error messages saying:
24551
24552 @smallexample
24553 @var{name} compiler not installed on this system.
24554 @end smallexample
24555 @end table
24556
24557 GCC already has an extensive list of suffixes built into it.
24558 This directive adds an entry to the end of the list of suffixes, but
24559 since the list is searched from the end backwards, it is effectively
24560 possible to override earlier entries using this technique.
24561
24562 @end table
24563
24564 GCC has the following spec strings built into it. Spec files can
24565 override these strings or create their own. Note that individual
24566 targets can also add their own spec strings to this list.
24567
24568 @smallexample
24569 asm Options to pass to the assembler
24570 asm_final Options to pass to the assembler post-processor
24571 cpp Options to pass to the C preprocessor
24572 cc1 Options to pass to the C compiler
24573 cc1plus Options to pass to the C++ compiler
24574 endfile Object files to include at the end of the link
24575 link Options to pass to the linker
24576 lib Libraries to include on the command line to the linker
24577 libgcc Decides which GCC support library to pass to the linker
24578 linker Sets the name of the linker
24579 predefines Defines to be passed to the C preprocessor
24580 signed_char Defines to pass to CPP to say whether @code{char} is signed
24581 by default
24582 startfile Object files to include at the start of the link
24583 @end smallexample
24584
24585 Here is a small example of a spec file:
24586
24587 @smallexample
24588 %rename lib old_lib
24589
24590 *lib:
24591 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
24592 @end smallexample
24593
24594 This example renames the spec called @samp{lib} to @samp{old_lib} and
24595 then overrides the previous definition of @samp{lib} with a new one.
24596 The new definition adds in some extra command-line options before
24597 including the text of the old definition.
24598
24599 @dfn{Spec strings} are a list of command-line options to be passed to their
24600 corresponding program. In addition, the spec strings can contain
24601 @samp{%}-prefixed sequences to substitute variable text or to
24602 conditionally insert text into the command line. Using these constructs
24603 it is possible to generate quite complex command lines.
24604
24605 Here is a table of all defined @samp{%}-sequences for spec
24606 strings. Note that spaces are not generated automatically around the
24607 results of expanding these sequences. Therefore you can concatenate them
24608 together or combine them with constant text in a single argument.
24609
24610 @table @code
24611 @item %%
24612 Substitute one @samp{%} into the program name or argument.
24613
24614 @item %i
24615 Substitute the name of the input file being processed.
24616
24617 @item %b
24618 Substitute the basename of the input file being processed.
24619 This is the substring up to (and not including) the last period
24620 and not including the directory.
24621
24622 @item %B
24623 This is the same as @samp{%b}, but include the file suffix (text after
24624 the last period).
24625
24626 @item %d
24627 Marks the argument containing or following the @samp{%d} as a
24628 temporary file name, so that that file is deleted if GCC exits
24629 successfully. Unlike @samp{%g}, this contributes no text to the
24630 argument.
24631
24632 @item %g@var{suffix}
24633 Substitute a file name that has suffix @var{suffix} and is chosen
24634 once per compilation, and mark the argument in the same way as
24635 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
24636 name is now chosen in a way that is hard to predict even when previously
24637 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
24638 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
24639 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
24640 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
24641 was simply substituted with a file name chosen once per compilation,
24642 without regard to any appended suffix (which was therefore treated
24643 just like ordinary text), making such attacks more likely to succeed.
24644
24645 @item %u@var{suffix}
24646 Like @samp{%g}, but generates a new temporary file name
24647 each time it appears instead of once per compilation.
24648
24649 @item %U@var{suffix}
24650 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
24651 new one if there is no such last file name. In the absence of any
24652 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
24653 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
24654 involves the generation of two distinct file names, one
24655 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
24656 simply substituted with a file name chosen for the previous @samp{%u},
24657 without regard to any appended suffix.
24658
24659 @item %j@var{suffix}
24660 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
24661 writable, and if @option{-save-temps} is not used;
24662 otherwise, substitute the name
24663 of a temporary file, just like @samp{%u}. This temporary file is not
24664 meant for communication between processes, but rather as a junk
24665 disposal mechanism.
24666
24667 @item %|@var{suffix}
24668 @itemx %m@var{suffix}
24669 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
24670 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
24671 all. These are the two most common ways to instruct a program that it
24672 should read from standard input or write to standard output. If you
24673 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
24674 construct: see for example @file{f/lang-specs.h}.
24675
24676 @item %.@var{SUFFIX}
24677 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
24678 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
24679 terminated by the next space or %.
24680
24681 @item %w
24682 Marks the argument containing or following the @samp{%w} as the
24683 designated output file of this compilation. This puts the argument
24684 into the sequence of arguments that @samp{%o} substitutes.
24685
24686 @item %o
24687 Substitutes the names of all the output files, with spaces
24688 automatically placed around them. You should write spaces
24689 around the @samp{%o} as well or the results are undefined.
24690 @samp{%o} is for use in the specs for running the linker.
24691 Input files whose names have no recognized suffix are not compiled
24692 at all, but they are included among the output files, so they are
24693 linked.
24694
24695 @item %O
24696 Substitutes the suffix for object files. Note that this is
24697 handled specially when it immediately follows @samp{%g, %u, or %U},
24698 because of the need for those to form complete file names. The
24699 handling is such that @samp{%O} is treated exactly as if it had already
24700 been substituted, except that @samp{%g, %u, and %U} do not currently
24701 support additional @var{suffix} characters following @samp{%O} as they do
24702 following, for example, @samp{.o}.
24703
24704 @item %p
24705 Substitutes the standard macro predefinitions for the
24706 current target machine. Use this when running @command{cpp}.
24707
24708 @item %P
24709 Like @samp{%p}, but puts @samp{__} before and after the name of each
24710 predefined macro, except for macros that start with @samp{__} or with
24711 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
24712 C@.
24713
24714 @item %I
24715 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
24716 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
24717 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
24718 and @option{-imultilib} as necessary.
24719
24720 @item %s
24721 Current argument is the name of a library or startup file of some sort.
24722 Search for that file in a standard list of directories and substitute
24723 the full name found. The current working directory is included in the
24724 list of directories scanned.
24725
24726 @item %T
24727 Current argument is the name of a linker script. Search for that file
24728 in the current list of directories to scan for libraries. If the file
24729 is located insert a @option{--script} option into the command line
24730 followed by the full path name found. If the file is not found then
24731 generate an error message. Note: the current working directory is not
24732 searched.
24733
24734 @item %e@var{str}
24735 Print @var{str} as an error message. @var{str} is terminated by a newline.
24736 Use this when inconsistent options are detected.
24737
24738 @item %(@var{name})
24739 Substitute the contents of spec string @var{name} at this point.
24740
24741 @item %x@{@var{option}@}
24742 Accumulate an option for @samp{%X}.
24743
24744 @item %X
24745 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
24746 spec string.
24747
24748 @item %Y
24749 Output the accumulated assembler options specified by @option{-Wa}.
24750
24751 @item %Z
24752 Output the accumulated preprocessor options specified by @option{-Wp}.
24753
24754 @item %a
24755 Process the @code{asm} spec. This is used to compute the
24756 switches to be passed to the assembler.
24757
24758 @item %A
24759 Process the @code{asm_final} spec. This is a spec string for
24760 passing switches to an assembler post-processor, if such a program is
24761 needed.
24762
24763 @item %l
24764 Process the @code{link} spec. This is the spec for computing the
24765 command line passed to the linker. Typically it makes use of the
24766 @samp{%L %G %S %D and %E} sequences.
24767
24768 @item %D
24769 Dump out a @option{-L} option for each directory that GCC believes might
24770 contain startup files. If the target supports multilibs then the
24771 current multilib directory is prepended to each of these paths.
24772
24773 @item %L
24774 Process the @code{lib} spec. This is a spec string for deciding which
24775 libraries are included on the command line to the linker.
24776
24777 @item %G
24778 Process the @code{libgcc} spec. This is a spec string for deciding
24779 which GCC support library is included on the command line to the linker.
24780
24781 @item %S
24782 Process the @code{startfile} spec. This is a spec for deciding which
24783 object files are the first ones passed to the linker. Typically
24784 this might be a file named @file{crt0.o}.
24785
24786 @item %E
24787 Process the @code{endfile} spec. This is a spec string that specifies
24788 the last object files that are passed to the linker.
24789
24790 @item %C
24791 Process the @code{cpp} spec. This is used to construct the arguments
24792 to be passed to the C preprocessor.
24793
24794 @item %1
24795 Process the @code{cc1} spec. This is used to construct the options to be
24796 passed to the actual C compiler (@command{cc1}).
24797
24798 @item %2
24799 Process the @code{cc1plus} spec. This is used to construct the options to be
24800 passed to the actual C++ compiler (@command{cc1plus}).
24801
24802 @item %*
24803 Substitute the variable part of a matched option. See below.
24804 Note that each comma in the substituted string is replaced by
24805 a single space.
24806
24807 @item %<@code{S}
24808 Remove all occurrences of @code{-S} from the command line. Note---this
24809 command is position dependent. @samp{%} commands in the spec string
24810 before this one see @code{-S}, @samp{%} commands in the spec string
24811 after this one do not.
24812
24813 @item %:@var{function}(@var{args})
24814 Call the named function @var{function}, passing it @var{args}.
24815 @var{args} is first processed as a nested spec string, then split
24816 into an argument vector in the usual fashion. The function returns
24817 a string which is processed as if it had appeared literally as part
24818 of the current spec.
24819
24820 The following built-in spec functions are provided:
24821
24822 @table @code
24823 @item @code{getenv}
24824 The @code{getenv} spec function takes two arguments: an environment
24825 variable name and a string. If the environment variable is not
24826 defined, a fatal error is issued. Otherwise, the return value is the
24827 value of the environment variable concatenated with the string. For
24828 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
24829
24830 @smallexample
24831 %:getenv(TOPDIR /include)
24832 @end smallexample
24833
24834 expands to @file{/path/to/top/include}.
24835
24836 @item @code{if-exists}
24837 The @code{if-exists} spec function takes one argument, an absolute
24838 pathname to a file. If the file exists, @code{if-exists} returns the
24839 pathname. Here is a small example of its usage:
24840
24841 @smallexample
24842 *startfile:
24843 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
24844 @end smallexample
24845
24846 @item @code{if-exists-else}
24847 The @code{if-exists-else} spec function is similar to the @code{if-exists}
24848 spec function, except that it takes two arguments. The first argument is
24849 an absolute pathname to a file. If the file exists, @code{if-exists-else}
24850 returns the pathname. If it does not exist, it returns the second argument.
24851 This way, @code{if-exists-else} can be used to select one file or another,
24852 based on the existence of the first. Here is a small example of its usage:
24853
24854 @smallexample
24855 *startfile:
24856 crt0%O%s %:if-exists(crti%O%s) \
24857 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
24858 @end smallexample
24859
24860 @item @code{replace-outfile}
24861 The @code{replace-outfile} spec function takes two arguments. It looks for the
24862 first argument in the outfiles array and replaces it with the second argument. Here
24863 is a small example of its usage:
24864
24865 @smallexample
24866 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
24867 @end smallexample
24868
24869 @item @code{remove-outfile}
24870 The @code{remove-outfile} spec function takes one argument. It looks for the
24871 first argument in the outfiles array and removes it. Here is a small example
24872 its usage:
24873
24874 @smallexample
24875 %:remove-outfile(-lm)
24876 @end smallexample
24877
24878 @item @code{pass-through-libs}
24879 The @code{pass-through-libs} spec function takes any number of arguments. It
24880 finds any @option{-l} options and any non-options ending in @file{.a} (which it
24881 assumes are the names of linker input library archive files) and returns a
24882 result containing all the found arguments each prepended by
24883 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
24884 intended to be passed to the LTO linker plugin.
24885
24886 @smallexample
24887 %:pass-through-libs(%G %L %G)
24888 @end smallexample
24889
24890 @item @code{print-asm-header}
24891 The @code{print-asm-header} function takes no arguments and simply
24892 prints a banner like:
24893
24894 @smallexample
24895 Assembler options
24896 =================
24897
24898 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
24899 @end smallexample
24900
24901 It is used to separate compiler options from assembler options
24902 in the @option{--target-help} output.
24903 @end table
24904
24905 @item %@{@code{S}@}
24906 Substitutes the @code{-S} switch, if that switch is given to GCC@.
24907 If that switch is not specified, this substitutes nothing. Note that
24908 the leading dash is omitted when specifying this option, and it is
24909 automatically inserted if the substitution is performed. Thus the spec
24910 string @samp{%@{foo@}} matches the command-line option @option{-foo}
24911 and outputs the command-line option @option{-foo}.
24912
24913 @item %W@{@code{S}@}
24914 Like %@{@code{S}@} but mark last argument supplied within as a file to be
24915 deleted on failure.
24916
24917 @item %@{@code{S}*@}
24918 Substitutes all the switches specified to GCC whose names start
24919 with @code{-S}, but which also take an argument. This is used for
24920 switches like @option{-o}, @option{-D}, @option{-I}, etc.
24921 GCC considers @option{-o foo} as being
24922 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
24923 text, including the space. Thus two arguments are generated.
24924
24925 @item %@{@code{S}*&@code{T}*@}
24926 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
24927 (the order of @code{S} and @code{T} in the spec is not significant).
24928 There can be any number of ampersand-separated variables; for each the
24929 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
24930
24931 @item %@{@code{S}:@code{X}@}
24932 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
24933
24934 @item %@{!@code{S}:@code{X}@}
24935 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
24936
24937 @item %@{@code{S}*:@code{X}@}
24938 Substitutes @code{X} if one or more switches whose names start with
24939 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
24940 once, no matter how many such switches appeared. However, if @code{%*}
24941 appears somewhere in @code{X}, then @code{X} is substituted once
24942 for each matching switch, with the @code{%*} replaced by the part of
24943 that switch matching the @code{*}.
24944
24945 If @code{%*} appears as the last part of a spec sequence then a space
24946 is added after the end of the last substitution. If there is more
24947 text in the sequence, however, then a space is not generated. This
24948 allows the @code{%*} substitution to be used as part of a larger
24949 string. For example, a spec string like this:
24950
24951 @smallexample
24952 %@{mcu=*:--script=%*/memory.ld@}
24953 @end smallexample
24954
24955 @noindent
24956 when matching an option like @option{-mcu=newchip} produces:
24957
24958 @smallexample
24959 --script=newchip/memory.ld
24960 @end smallexample
24961
24962 @item %@{.@code{S}:@code{X}@}
24963 Substitutes @code{X}, if processing a file with suffix @code{S}.
24964
24965 @item %@{!.@code{S}:@code{X}@}
24966 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
24967
24968 @item %@{,@code{S}:@code{X}@}
24969 Substitutes @code{X}, if processing a file for language @code{S}.
24970
24971 @item %@{!,@code{S}:@code{X}@}
24972 Substitutes @code{X}, if not processing a file for language @code{S}.
24973
24974 @item %@{@code{S}|@code{P}:@code{X}@}
24975 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
24976 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
24977 @code{*} sequences as well, although they have a stronger binding than
24978 the @samp{|}. If @code{%*} appears in @code{X}, all of the
24979 alternatives must be starred, and only the first matching alternative
24980 is substituted.
24981
24982 For example, a spec string like this:
24983
24984 @smallexample
24985 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
24986 @end smallexample
24987
24988 @noindent
24989 outputs the following command-line options from the following input
24990 command-line options:
24991
24992 @smallexample
24993 fred.c -foo -baz
24994 jim.d -bar -boggle
24995 -d fred.c -foo -baz -boggle
24996 -d jim.d -bar -baz -boggle
24997 @end smallexample
24998
24999 @item %@{S:X; T:Y; :D@}
25000
25001 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
25002 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
25003 be as many clauses as you need. This may be combined with @code{.},
25004 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
25005
25006
25007 @end table
25008
25009 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
25010 construct may contain other nested @samp{%} constructs or spaces, or
25011 even newlines. They are processed as usual, as described above.
25012 Trailing white space in @code{X} is ignored. White space may also
25013 appear anywhere on the left side of the colon in these constructs,
25014 except between @code{.} or @code{*} and the corresponding word.
25015
25016 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
25017 handled specifically in these constructs. If another value of
25018 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
25019 @option{-W} switch is found later in the command line, the earlier
25020 switch value is ignored, except with @{@code{S}*@} where @code{S} is
25021 just one letter, which passes all matching options.
25022
25023 The character @samp{|} at the beginning of the predicate text is used to
25024 indicate that a command should be piped to the following command, but
25025 only if @option{-pipe} is specified.
25026
25027 It is built into GCC which switches take arguments and which do not.
25028 (You might think it would be useful to generalize this to allow each
25029 compiler's spec to say which switches take arguments. But this cannot
25030 be done in a consistent fashion. GCC cannot even decide which input
25031 files have been specified without knowing which switches take arguments,
25032 and it must know which input files to compile in order to tell which
25033 compilers to run).
25034
25035 GCC also knows implicitly that arguments starting in @option{-l} are to be
25036 treated as compiler output files, and passed to the linker in their
25037 proper position among the other output files.
25038
25039 @node Environment Variables
25040 @section Environment Variables Affecting GCC
25041 @cindex environment variables
25042
25043 @c man begin ENVIRONMENT
25044 This section describes several environment variables that affect how GCC
25045 operates. Some of them work by specifying directories or prefixes to use
25046 when searching for various kinds of files. Some are used to specify other
25047 aspects of the compilation environment.
25048
25049 Note that you can also specify places to search using options such as
25050 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
25051 take precedence over places specified using environment variables, which
25052 in turn take precedence over those specified by the configuration of GCC@.
25053 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
25054 GNU Compiler Collection (GCC) Internals}.
25055
25056 @table @env
25057 @item LANG
25058 @itemx LC_CTYPE
25059 @c @itemx LC_COLLATE
25060 @itemx LC_MESSAGES
25061 @c @itemx LC_MONETARY
25062 @c @itemx LC_NUMERIC
25063 @c @itemx LC_TIME
25064 @itemx LC_ALL
25065 @findex LANG
25066 @findex LC_CTYPE
25067 @c @findex LC_COLLATE
25068 @findex LC_MESSAGES
25069 @c @findex LC_MONETARY
25070 @c @findex LC_NUMERIC
25071 @c @findex LC_TIME
25072 @findex LC_ALL
25073 @cindex locale
25074 These environment variables control the way that GCC uses
25075 localization information which allows GCC to work with different
25076 national conventions. GCC inspects the locale categories
25077 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
25078 so. These locale categories can be set to any value supported by your
25079 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
25080 Kingdom encoded in UTF-8.
25081
25082 The @env{LC_CTYPE} environment variable specifies character
25083 classification. GCC uses it to determine the character boundaries in
25084 a string; this is needed for some multibyte encodings that contain quote
25085 and escape characters that are otherwise interpreted as a string
25086 end or escape.
25087
25088 The @env{LC_MESSAGES} environment variable specifies the language to
25089 use in diagnostic messages.
25090
25091 If the @env{LC_ALL} environment variable is set, it overrides the value
25092 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
25093 and @env{LC_MESSAGES} default to the value of the @env{LANG}
25094 environment variable. If none of these variables are set, GCC
25095 defaults to traditional C English behavior.
25096
25097 @item TMPDIR
25098 @findex TMPDIR
25099 If @env{TMPDIR} is set, it specifies the directory to use for temporary
25100 files. GCC uses temporary files to hold the output of one stage of
25101 compilation which is to be used as input to the next stage: for example,
25102 the output of the preprocessor, which is the input to the compiler
25103 proper.
25104
25105 @item GCC_COMPARE_DEBUG
25106 @findex GCC_COMPARE_DEBUG
25107 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
25108 @option{-fcompare-debug} to the compiler driver. See the documentation
25109 of this option for more details.
25110
25111 @item GCC_EXEC_PREFIX
25112 @findex GCC_EXEC_PREFIX
25113 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
25114 names of the subprograms executed by the compiler. No slash is added
25115 when this prefix is combined with the name of a subprogram, but you can
25116 specify a prefix that ends with a slash if you wish.
25117
25118 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
25119 an appropriate prefix to use based on the pathname it is invoked with.
25120
25121 If GCC cannot find the subprogram using the specified prefix, it
25122 tries looking in the usual places for the subprogram.
25123
25124 The default value of @env{GCC_EXEC_PREFIX} is
25125 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
25126 the installed compiler. In many cases @var{prefix} is the value
25127 of @code{prefix} when you ran the @file{configure} script.
25128
25129 Other prefixes specified with @option{-B} take precedence over this prefix.
25130
25131 This prefix is also used for finding files such as @file{crt0.o} that are
25132 used for linking.
25133
25134 In addition, the prefix is used in an unusual way in finding the
25135 directories to search for header files. For each of the standard
25136 directories whose name normally begins with @samp{/usr/local/lib/gcc}
25137 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
25138 replacing that beginning with the specified prefix to produce an
25139 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
25140 @file{foo/bar} just before it searches the standard directory
25141 @file{/usr/local/lib/bar}.
25142 If a standard directory begins with the configured
25143 @var{prefix} then the value of @var{prefix} is replaced by
25144 @env{GCC_EXEC_PREFIX} when looking for header files.
25145
25146 @item COMPILER_PATH
25147 @findex COMPILER_PATH
25148 The value of @env{COMPILER_PATH} is a colon-separated list of
25149 directories, much like @env{PATH}. GCC tries the directories thus
25150 specified when searching for subprograms, if it can't find the
25151 subprograms using @env{GCC_EXEC_PREFIX}.
25152
25153 @item LIBRARY_PATH
25154 @findex LIBRARY_PATH
25155 The value of @env{LIBRARY_PATH} is a colon-separated list of
25156 directories, much like @env{PATH}. When configured as a native compiler,
25157 GCC tries the directories thus specified when searching for special
25158 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
25159 using GCC also uses these directories when searching for ordinary
25160 libraries for the @option{-l} option (but directories specified with
25161 @option{-L} come first).
25162
25163 @item LANG
25164 @findex LANG
25165 @cindex locale definition
25166 This variable is used to pass locale information to the compiler. One way in
25167 which this information is used is to determine the character set to be used
25168 when character literals, string literals and comments are parsed in C and C++.
25169 When the compiler is configured to allow multibyte characters,
25170 the following values for @env{LANG} are recognized:
25171
25172 @table @samp
25173 @item C-JIS
25174 Recognize JIS characters.
25175 @item C-SJIS
25176 Recognize SJIS characters.
25177 @item C-EUCJP
25178 Recognize EUCJP characters.
25179 @end table
25180
25181 If @env{LANG} is not defined, or if it has some other value, then the
25182 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
25183 recognize and translate multibyte characters.
25184 @end table
25185
25186 @noindent
25187 Some additional environment variables affect the behavior of the
25188 preprocessor.
25189
25190 @include cppenv.texi
25191
25192 @c man end
25193
25194 @node Precompiled Headers
25195 @section Using Precompiled Headers
25196 @cindex precompiled headers
25197 @cindex speed of compilation
25198
25199 Often large projects have many header files that are included in every
25200 source file. The time the compiler takes to process these header files
25201 over and over again can account for nearly all of the time required to
25202 build the project. To make builds faster, GCC allows you to
25203 @dfn{precompile} a header file.
25204
25205 To create a precompiled header file, simply compile it as you would any
25206 other file, if necessary using the @option{-x} option to make the driver
25207 treat it as a C or C++ header file. You may want to use a
25208 tool like @command{make} to keep the precompiled header up-to-date when
25209 the headers it contains change.
25210
25211 A precompiled header file is searched for when @code{#include} is
25212 seen in the compilation. As it searches for the included file
25213 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
25214 compiler looks for a precompiled header in each directory just before it
25215 looks for the include file in that directory. The name searched for is
25216 the name specified in the @code{#include} with @samp{.gch} appended. If
25217 the precompiled header file can't be used, it is ignored.
25218
25219 For instance, if you have @code{#include "all.h"}, and you have
25220 @file{all.h.gch} in the same directory as @file{all.h}, then the
25221 precompiled header file is used if possible, and the original
25222 header is used otherwise.
25223
25224 Alternatively, you might decide to put the precompiled header file in a
25225 directory and use @option{-I} to ensure that directory is searched
25226 before (or instead of) the directory containing the original header.
25227 Then, if you want to check that the precompiled header file is always
25228 used, you can put a file of the same name as the original header in this
25229 directory containing an @code{#error} command.
25230
25231 This also works with @option{-include}. So yet another way to use
25232 precompiled headers, good for projects not designed with precompiled
25233 header files in mind, is to simply take most of the header files used by
25234 a project, include them from another header file, precompile that header
25235 file, and @option{-include} the precompiled header. If the header files
25236 have guards against multiple inclusion, they are skipped because
25237 they've already been included (in the precompiled header).
25238
25239 If you need to precompile the same header file for different
25240 languages, targets, or compiler options, you can instead make a
25241 @emph{directory} named like @file{all.h.gch}, and put each precompiled
25242 header in the directory, perhaps using @option{-o}. It doesn't matter
25243 what you call the files in the directory; every precompiled header in
25244 the directory is considered. The first precompiled header
25245 encountered in the directory that is valid for this compilation is
25246 used; they're searched in no particular order.
25247
25248 There are many other possibilities, limited only by your imagination,
25249 good sense, and the constraints of your build system.
25250
25251 A precompiled header file can be used only when these conditions apply:
25252
25253 @itemize
25254 @item
25255 Only one precompiled header can be used in a particular compilation.
25256
25257 @item
25258 A precompiled header can't be used once the first C token is seen. You
25259 can have preprocessor directives before a precompiled header; you cannot
25260 include a precompiled header from inside another header.
25261
25262 @item
25263 The precompiled header file must be produced for the same language as
25264 the current compilation. You can't use a C precompiled header for a C++
25265 compilation.
25266
25267 @item
25268 The precompiled header file must have been produced by the same compiler
25269 binary as the current compilation is using.
25270
25271 @item
25272 Any macros defined before the precompiled header is included must
25273 either be defined in the same way as when the precompiled header was
25274 generated, or must not affect the precompiled header, which usually
25275 means that they don't appear in the precompiled header at all.
25276
25277 The @option{-D} option is one way to define a macro before a
25278 precompiled header is included; using a @code{#define} can also do it.
25279 There are also some options that define macros implicitly, like
25280 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
25281 defined this way.
25282
25283 @item If debugging information is output when using the precompiled
25284 header, using @option{-g} or similar, the same kind of debugging information
25285 must have been output when building the precompiled header. However,
25286 a precompiled header built using @option{-g} can be used in a compilation
25287 when no debugging information is being output.
25288
25289 @item The same @option{-m} options must generally be used when building
25290 and using the precompiled header. @xref{Submodel Options},
25291 for any cases where this rule is relaxed.
25292
25293 @item Each of the following options must be the same when building and using
25294 the precompiled header:
25295
25296 @gccoptlist{-fexceptions}
25297
25298 @item
25299 Some other command-line options starting with @option{-f},
25300 @option{-p}, or @option{-O} must be defined in the same way as when
25301 the precompiled header was generated. At present, it's not clear
25302 which options are safe to change and which are not; the safest choice
25303 is to use exactly the same options when generating and using the
25304 precompiled header. The following are known to be safe:
25305
25306 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
25307 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
25308 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
25309 -pedantic-errors}
25310
25311 @end itemize
25312
25313 For all of these except the last, the compiler automatically
25314 ignores the precompiled header if the conditions aren't met. If you
25315 find an option combination that doesn't work and doesn't cause the
25316 precompiled header to be ignored, please consider filing a bug report,
25317 see @ref{Bugs}.
25318
25319 If you do use differing options when generating and using the
25320 precompiled header, the actual behavior is a mixture of the
25321 behavior for the options. For instance, if you use @option{-g} to
25322 generate the precompiled header but not when using it, you may or may
25323 not get debugging information for routines in the precompiled header.
This page took 1.180386 seconds and 5 git commands to generate.