Implement -Wimplicit-fallthrough.
[gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2016 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2016 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included in the gfdl(7) man page.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43 Only the most useful options are listed here; see below for the
44 remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
76
77 Other options are passed on to one or more stages of processing. Some options
78 control the preprocessor and others the compiler itself. Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
81
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly. If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
88
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++}
98 instead. @xref{Invoking G++,,Compiling C++ Programs},
99 for information about the differences in behavior between @command{gcc}
100 and @code{g++} when compiling C++ programs.
101
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands. Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
108
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments. For the most part, the order
112 you use doesn't matter. Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified. Also,
115 the placement of the @option{-l} option is significant.
116
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}. This manual documents
122 only one of these two forms, whichever one is not the default.
123
124 @c man end
125
126 @xref{Option Index}, for an index to GCC's options.
127
128 @menu
129 * Option Summary:: Brief list of all options, without explanations.
130 * Overall Options:: Controlling the kind of output:
131 an executable, object files, assembler files,
132 or preprocessed source.
133 * Invoking G++:: Compiling C++ programs.
134 * C Dialect Options:: Controlling the variant of C language compiled.
135 * C++ Dialect Options:: Variations on C++.
136 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
137 and Objective-C++.
138 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
139 be formatted.
140 * Warning Options:: How picky should the compiler be?
141 * Debugging Options:: Producing debuggable code.
142 * Optimize Options:: How much optimization?
143 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
144 * Preprocessor Options:: Controlling header files and macro definitions.
145 Also, getting dependency information for Make.
146 * Assembler Options:: Passing options to the assembler.
147 * Link Options:: Specifying libraries and so on.
148 * Directory Options:: Where to find header files and libraries.
149 Where to find the compiler executable files.
150 * Code Gen Options:: Specifying conventions for function calls, data layout
151 and register usage.
152 * Developer Options:: Printing GCC configuration info, statistics, and
153 debugging dumps.
154 * Submodel Options:: Target-specific options, such as compiling for a
155 specific processor variant.
156 * Spec Files:: How to pass switches to sub-processes.
157 * Environment Variables:: Env vars that affect GCC.
158 * Precompiled Headers:: Compiling a header once, and using it many times.
159 @end menu
160
161 @c man begin OPTIONS
162
163 @node Option Summary
164 @section Option Summary
165
166 Here is a summary of all the options, grouped by type. Explanations are
167 in the following sections.
168
169 @table @emph
170 @item Overall Options
171 @xref{Overall Options,,Options Controlling the Kind of Output}.
172 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
173 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
174 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
175 @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
176 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
177
178 @item C Language Options
179 @xref{C Dialect Options,,Options Controlling C Dialect}.
180 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
181 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
182 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
183 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
184 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness}
185 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
186 -fsigned-bitfields -fsigned-char @gol
187 -funsigned-bitfields -funsigned-char @gol
188 -trigraphs -traditional -traditional-cpp}
189
190 @item C++ Language Options
191 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
192 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
193 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
194 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
195 -ffriend-injection @gol
196 -fno-elide-constructors @gol
197 -fno-enforce-eh-specs @gol
198 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
199 -fno-implicit-templates @gol
200 -fno-implicit-inline-templates @gol
201 -fno-implement-inlines -fms-extensions @gol
202 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
203 -fno-optional-diags -fpermissive @gol
204 -fno-pretty-templates @gol
205 -frepo -fno-rtti -fsized-deallocation @gol
206 -ftemplate-backtrace-limit=@var{n} @gol
207 -ftemplate-depth=@var{n} @gol
208 -fno-threadsafe-statics -fuse-cxa-atexit @gol
209 -fno-weak -nostdinc++ @gol
210 -fvisibility-inlines-hidden @gol
211 -fvisibility-ms-compat @gol
212 -fext-numeric-literals @gol
213 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
214 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
215 -Wnamespaces -Wnarrowing @gol
216 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
217 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
218 -Wno-non-template-friend -Wold-style-cast @gol
219 -Woverloaded-virtual -Wno-pmf-conversions @gol
220 -Wsign-promo -Wvirtual-inheritance}
221
222 @item Objective-C and Objective-C++ Language Options
223 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
224 Objective-C and Objective-C++ Dialects}.
225 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
226 -fgnu-runtime -fnext-runtime @gol
227 -fno-nil-receivers @gol
228 -fobjc-abi-version=@var{n} @gol
229 -fobjc-call-cxx-cdtors @gol
230 -fobjc-direct-dispatch @gol
231 -fobjc-exceptions @gol
232 -fobjc-gc @gol
233 -fobjc-nilcheck @gol
234 -fobjc-std=objc1 @gol
235 -fno-local-ivars @gol
236 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
237 -freplace-objc-classes @gol
238 -fzero-link @gol
239 -gen-decls @gol
240 -Wassign-intercept @gol
241 -Wno-protocol -Wselector @gol
242 -Wstrict-selector-match @gol
243 -Wundeclared-selector}
244
245 @item Diagnostic Message Formatting Options
246 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
247 @gccoptlist{-fmessage-length=@var{n} @gol
248 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
249 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
250 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
251 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch}
252
253 @item Warning Options
254 @xref{Warning Options,,Options to Request or Suppress Warnings}.
255 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
256 -pedantic-errors @gol
257 -w -Wextra -Wall -Waddress -Waggregate-return @gol
258 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
259 -Wno-attributes -Wbool-compare -Wbool-operation @gol
260 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
261 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
262 -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
263 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
264 -Wdelete-incomplete @gol
265 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
266 -Wdisabled-optimization @gol
267 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
268 -Wno-div-by-zero -Wdouble-promotion -Wduplicated-cond @gol
269 -Wempty-body -Wenum-compare -Wno-endif-labels @gol
270 -Werror -Werror=* -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
271 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-length=@var{n} @gol
272 -Wformat-nonliteral @gol
273 -Wformat-security -Wformat-signedness -Wformat-y2k -Wframe-address @gol
274 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
275 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
276 -Wimplicit -Wimplicit-fallthrough -Wimplicit-function-declaration @gol
277 -Wimplicit-int @gol
278 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
279 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
280 -Winvalid-pch -Wlarger-than=@var{len} @gol
281 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
282 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
283 -Wmisleading-indentation -Wmissing-braces @gol
284 -Wmissing-field-initializers -Wmissing-include-dirs @gol
285 -Wno-multichar -Wnonnull -Wnonnull-compare @gol
286 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
287 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
288 -Woverride-init-side-effects -Woverlength-strings @gol
289 -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
290 -Wparentheses -Wno-pedantic-ms-format @gol
291 -Wplacement-new -Wplacement-new=@var{n} @gol
292 -Wpointer-arith -Wno-pointer-to-int-cast @gol
293 -Wno-pragmas -Wredundant-decls -Wno-return-local-addr @gol
294 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
295 -Wshift-overflow -Wshift-overflow=@var{n} @gol
296 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
297 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
298 -Wno-scalar-storage-order @gol
299 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
300 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
301 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
302 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
303 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
304 -Wmissing-format-attribute -Wsubobject-linkage @gol
305 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
306 -Wswitch-unreachable -Wsync-nand @gol
307 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
308 -Wtype-limits -Wundef @gol
309 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
310 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
311 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
312 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
313 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
314 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
315 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
316 -Wvla -Wvolatile-register-var -Wwrite-strings @gol
317 -Wzero-as-null-pointer-constant -Whsa}
318
319 @item C and Objective-C-only Warning Options
320 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
321 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
322 -Wold-style-declaration -Wold-style-definition @gol
323 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
324 -Wdeclaration-after-statement -Wpointer-sign}
325
326 @item Debugging Options
327 @xref{Debugging Options,,Options for Debugging Your Program}.
328 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
329 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
330 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
331 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
332 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
333 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
334 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
335 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
336 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
337 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
338 -fvar-tracking -fvar-tracking-assignments}
339
340 @item Optimization Options
341 @xref{Optimize Options,,Options that Control Optimization}.
342 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
343 -falign-jumps[=@var{n}] @gol
344 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
345 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
346 -fauto-inc-dec -fbranch-probabilities @gol
347 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
348 -fbtr-bb-exclusive -fcaller-saves @gol
349 -fcombine-stack-adjustments -fconserve-stack @gol
350 -fcompare-elim -fcprop-registers -fcrossjumping @gol
351 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
352 -fcx-limited-range @gol
353 -fdata-sections -fdce -fdelayed-branch @gol
354 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
355 -fdevirtualize-at-ltrans -fdse @gol
356 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
357 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
358 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
359 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
360 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
361 -fif-conversion2 -findirect-inlining @gol
362 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
363 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment -fipa-bit-cp @gol
364 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
365 -fira-algorithm=@var{algorithm} @gol
366 -fira-region=@var{region} -fira-hoist-pressure @gol
367 -fira-loop-pressure -fno-ira-share-save-slots @gol
368 -fno-ira-share-spill-slots @gol
369 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
370 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
371 -fkeep-static-consts -flive-range-shrinkage @gol
372 -floop-block -floop-interchange -floop-strip-mine @gol
373 -floop-unroll-and-jam -floop-nest-optimize @gol
374 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
375 -flto-partition=@var{alg} -fmerge-all-constants @gol
376 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
377 -fmove-loop-invariants -fno-branch-count-reg @gol
378 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
379 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
380 -fno-peephole2 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
381 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
382 -fomit-frame-pointer -foptimize-sibling-calls @gol
383 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
384 -fprefetch-loop-arrays -fprintf-return-value @gol
385 -fprofile-correction @gol
386 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
387 -fprofile-reorder-functions @gol
388 -freciprocal-math -free -frename-registers -freorder-blocks @gol
389 -freorder-blocks-algorithm=@var{algorithm} @gol
390 -freorder-blocks-and-partition -freorder-functions @gol
391 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
392 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
393 -fsched-spec-load -fsched-spec-load-dangerous @gol
394 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
395 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
396 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
397 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
398 -fschedule-fusion @gol
399 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
400 -fselective-scheduling -fselective-scheduling2 @gol
401 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
402 -fsemantic-interposition -fshrink-wrap -fsignaling-nans @gol
403 -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
404 -fsplit-paths @gol
405 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
406 -fstdarg-opt -fstrict-aliasing @gol
407 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
408 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
409 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
410 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting -ftree-loop-if-convert @gol
411 -ftree-loop-if-convert-stores -ftree-loop-im @gol
412 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
413 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
414 -ftree-loop-vectorize @gol
415 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
416 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
417 -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
418 -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
419 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
420 -funsafe-math-optimizations -funswitch-loops @gol
421 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
422 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
423 --param @var{name}=@var{value}
424 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
425
426 @item Program Instrumentation Options
427 @xref{Instrumentation Options,,Program Instrumentation Options}.
428 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
429 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
430 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
431 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
432 -fsanitize-undefined-trap-on-error -fbounds-check @gol
433 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
434 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
435 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
436 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
437 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
438 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
439 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
440 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
441 -fchkp-use-wrappers @gol
442 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
443 -fstack-protector-explicit -fstack-check @gol
444 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
445 -fno-stack-limit -fsplit-stack @gol
446 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
447 -fvtv-counts -fvtv-debug @gol
448 -finstrument-functions @gol
449 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
450 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
451
452 @item Preprocessor Options
453 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
454 @gccoptlist{-A@var{question}=@var{answer} @gol
455 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
456 -C -dD -dI -dM -dN @gol
457 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
458 -idirafter @var{dir} @gol
459 -include @var{file} -imacros @var{file} @gol
460 -iprefix @var{file} -iwithprefix @var{dir} @gol
461 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
462 -imultilib @var{dir} -isysroot @var{dir} @gol
463 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
464 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
465 -remap -trigraphs -undef -U@var{macro} @gol
466 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
467
468 @item Assembler Option
469 @xref{Assembler Options,,Passing Options to the Assembler}.
470 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
471
472 @item Linker Options
473 @xref{Link Options,,Options for Linking}.
474 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
475 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
476 -s -static -static-libgcc -static-libstdc++ @gol
477 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
478 -static-libmpx -static-libmpxwrappers @gol
479 -shared -shared-libgcc -symbolic @gol
480 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
481 -u @var{symbol} -z @var{keyword}}
482
483 @item Directory Options
484 @xref{Directory Options,,Options for Directory Search}.
485 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
486 -iquote@var{dir} -L@var{dir} -no-canonical-prefixes -I- @gol
487 --sysroot=@var{dir} --no-sysroot-suffix}
488
489 @item Code Generation Options
490 @xref{Code Gen Options,,Options for Code Generation Conventions}.
491 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
492 -ffixed-@var{reg} -fexceptions @gol
493 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
494 -fasynchronous-unwind-tables @gol
495 -fno-gnu-unique @gol
496 -finhibit-size-directive -fno-common -fno-ident @gol
497 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
498 -fno-jump-tables @gol
499 -frecord-gcc-switches @gol
500 -freg-struct-return -fshort-enums -fshort-wchar @gol
501 -fverbose-asm -fpack-struct[=@var{n}] @gol
502 -fleading-underscore -ftls-model=@var{model} @gol
503 -fstack-reuse=@var{reuse_level} @gol
504 -ftrapv -fwrapv @gol
505 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
506 -fstrict-volatile-bitfields -fsync-libcalls}
507
508 @item Developer Options
509 @xref{Developer Options,,GCC Developer Options}.
510 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
511 -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
512 -fdbg-cnt=@var{counter-value-list} @gol
513 -fdisable-ipa-@var{pass_name} @gol
514 -fdisable-rtl-@var{pass_name} @gol
515 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
516 -fdisable-tree-@var{pass_name} @gol
517 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
518 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
519 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
520 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
521 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
522 -fdump-passes @gol
523 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
524 -fdump-statistics @gol
525 -fdump-tree-all @gol
526 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
527 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
528 -fdump-tree-cfg -fdump-tree-alias @gol
529 -fdump-tree-ch @gol
530 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
531 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
532 -fdump-tree-gimple@r{[}-raw@r{]} @gol
533 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
534 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
535 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
536 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
537 -fdump-tree-backprop@r{[}-@var{n}@r{]} @gol
538 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
539 -fdump-tree-nrv -fdump-tree-vect @gol
540 -fdump-tree-sink @gol
541 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
542 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
543 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
544 -fdump-tree-vtable-verify @gol
545 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
546 -fdump-tree-split-paths@r{[}-@var{n}@r{]} @gol
547 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
548 -fdump-final-insns=@var{file} @gol
549 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
550 -fenable-@var{kind}-@var{pass} @gol
551 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
552 -fira-verbose=@var{n} @gol
553 -flto-report -flto-report-wpa -fmem-report-wpa @gol
554 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
555 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
556 -fprofile-report @gol
557 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
558 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
559 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
560 -fvar-tracking-assignments-toggle -gtoggle @gol
561 -print-file-name=@var{library} -print-libgcc-file-name @gol
562 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
563 -print-prog-name=@var{program} -print-search-dirs -Q @gol
564 -print-sysroot -print-sysroot-headers-suffix @gol
565 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
566
567 @item Machine-Dependent Options
568 @xref{Submodel Options,,Machine-Dependent Options}.
569 @c This list is ordered alphanumerically by subsection name.
570 @c Try and put the significant identifier (CPU or system) first,
571 @c so users have a clue at guessing where the ones they want will be.
572
573 @emph{AArch64 Options}
574 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
575 -mgeneral-regs-only @gol
576 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
577 -mstrict-align @gol
578 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
579 -mtls-dialect=desc -mtls-dialect=traditional @gol
580 -mtls-size=@var{size} @gol
581 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
582 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol
583 -mlow-precision-recip-sqrt -mno-low-precision-recip-sqrt@gol
584 -mlow-precision-sqrt -mno-low-precision-sqrt@gol
585 -mlow-precision-div -mno-low-precision-div @gol
586 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
587
588 @emph{Adapteva Epiphany Options}
589 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
590 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
591 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
592 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
593 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
594 -msplit-vecmove-early -m1reg-@var{reg}}
595
596 @emph{ARC Options}
597 @gccoptlist{-mbarrel-shifter @gol
598 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
599 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
600 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
601 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
602 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
603 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
604 -mlong-calls -mmedium-calls -msdata @gol
605 -mucb-mcount -mvolatile-cache -mtp-regno=@var{regno} @gol
606 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
607 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
608 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
609 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
610 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
611 -mtune=@var{cpu} -mmultcost=@var{num} @gol
612 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
613 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
614
615 @emph{ARM Options}
616 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
617 -mabi=@var{name} @gol
618 -mapcs-stack-check -mno-apcs-stack-check @gol
619 -mapcs-float -mno-apcs-float @gol
620 -mapcs-reentrant -mno-apcs-reentrant @gol
621 -msched-prolog -mno-sched-prolog @gol
622 -mlittle-endian -mbig-endian @gol
623 -mfloat-abi=@var{name} @gol
624 -mfp16-format=@var{name}
625 -mthumb-interwork -mno-thumb-interwork @gol
626 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
627 -mtune=@var{name} -mprint-tune-info @gol
628 -mstructure-size-boundary=@var{n} @gol
629 -mabort-on-noreturn @gol
630 -mlong-calls -mno-long-calls @gol
631 -msingle-pic-base -mno-single-pic-base @gol
632 -mpic-register=@var{reg} @gol
633 -mnop-fun-dllimport @gol
634 -mpoke-function-name @gol
635 -mthumb -marm @gol
636 -mtpcs-frame -mtpcs-leaf-frame @gol
637 -mcaller-super-interworking -mcallee-super-interworking @gol
638 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
639 -mword-relocations @gol
640 -mfix-cortex-m3-ldrd @gol
641 -munaligned-access @gol
642 -mneon-for-64bits @gol
643 -mslow-flash-data @gol
644 -masm-syntax-unified @gol
645 -mrestrict-it @gol
646 -mpure-code}
647
648 @emph{AVR Options}
649 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
650 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
651 -mrelax -mrmw -mstrict-X -mtiny-stack -mfract-convert-truncate -nodevicelib @gol
652 -Waddr-space-convert -Wmisspelled-isr}
653
654 @emph{Blackfin Options}
655 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
656 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
657 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
658 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
659 -mno-id-shared-library -mshared-library-id=@var{n} @gol
660 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
661 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
662 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
663 -micplb}
664
665 @emph{C6X Options}
666 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
667 -msim -msdata=@var{sdata-type}}
668
669 @emph{CRIS Options}
670 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
671 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
672 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
673 -mstack-align -mdata-align -mconst-align @gol
674 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
675 -melf -maout -melinux -mlinux -sim -sim2 @gol
676 -mmul-bug-workaround -mno-mul-bug-workaround}
677
678 @emph{CR16 Options}
679 @gccoptlist{-mmac @gol
680 -mcr16cplus -mcr16c @gol
681 -msim -mint32 -mbit-ops
682 -mdata-model=@var{model}}
683
684 @emph{Darwin Options}
685 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
686 -arch_only -bind_at_load -bundle -bundle_loader @gol
687 -client_name -compatibility_version -current_version @gol
688 -dead_strip @gol
689 -dependency-file -dylib_file -dylinker_install_name @gol
690 -dynamic -dynamiclib -exported_symbols_list @gol
691 -filelist -flat_namespace -force_cpusubtype_ALL @gol
692 -force_flat_namespace -headerpad_max_install_names @gol
693 -iframework @gol
694 -image_base -init -install_name -keep_private_externs @gol
695 -multi_module -multiply_defined -multiply_defined_unused @gol
696 -noall_load -no_dead_strip_inits_and_terms @gol
697 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
698 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
699 -private_bundle -read_only_relocs -sectalign @gol
700 -sectobjectsymbols -whyload -seg1addr @gol
701 -sectcreate -sectobjectsymbols -sectorder @gol
702 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
703 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
704 -segprot -segs_read_only_addr -segs_read_write_addr @gol
705 -single_module -static -sub_library -sub_umbrella @gol
706 -twolevel_namespace -umbrella -undefined @gol
707 -unexported_symbols_list -weak_reference_mismatches @gol
708 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
709 -mkernel -mone-byte-bool}
710
711 @emph{DEC Alpha Options}
712 @gccoptlist{-mno-fp-regs -msoft-float @gol
713 -mieee -mieee-with-inexact -mieee-conformant @gol
714 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
715 -mtrap-precision=@var{mode} -mbuild-constants @gol
716 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
717 -mbwx -mmax -mfix -mcix @gol
718 -mfloat-vax -mfloat-ieee @gol
719 -mexplicit-relocs -msmall-data -mlarge-data @gol
720 -msmall-text -mlarge-text @gol
721 -mmemory-latency=@var{time}}
722
723 @emph{FR30 Options}
724 @gccoptlist{-msmall-model -mno-lsim}
725
726 @emph{FT32 Options}
727 @gccoptlist{-msim -mlra -mnodiv}
728
729 @emph{FRV Options}
730 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
731 -mhard-float -msoft-float @gol
732 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
733 -mdouble -mno-double @gol
734 -mmedia -mno-media -mmuladd -mno-muladd @gol
735 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
736 -mlinked-fp -mlong-calls -malign-labels @gol
737 -mlibrary-pic -macc-4 -macc-8 @gol
738 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
739 -moptimize-membar -mno-optimize-membar @gol
740 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
741 -mvliw-branch -mno-vliw-branch @gol
742 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
743 -mno-nested-cond-exec -mtomcat-stats @gol
744 -mTLS -mtls @gol
745 -mcpu=@var{cpu}}
746
747 @emph{GNU/Linux Options}
748 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
749 -tno-android-cc -tno-android-ld}
750
751 @emph{H8/300 Options}
752 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
753
754 @emph{HPPA Options}
755 @gccoptlist{-march=@var{architecture-type} @gol
756 -mdisable-fpregs -mdisable-indexing @gol
757 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
758 -mfixed-range=@var{register-range} @gol
759 -mjump-in-delay -mlinker-opt -mlong-calls @gol
760 -mlong-load-store -mno-disable-fpregs @gol
761 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
762 -mno-jump-in-delay -mno-long-load-store @gol
763 -mno-portable-runtime -mno-soft-float @gol
764 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
765 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
766 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
767 -munix=@var{unix-std} -nolibdld -static -threads}
768
769 @emph{IA-64 Options}
770 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
771 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
772 -mconstant-gp -mauto-pic -mfused-madd @gol
773 -minline-float-divide-min-latency @gol
774 -minline-float-divide-max-throughput @gol
775 -mno-inline-float-divide @gol
776 -minline-int-divide-min-latency @gol
777 -minline-int-divide-max-throughput @gol
778 -mno-inline-int-divide @gol
779 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
780 -mno-inline-sqrt @gol
781 -mdwarf2-asm -mearly-stop-bits @gol
782 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
783 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
784 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
785 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
786 -msched-spec-ldc -msched-spec-control-ldc @gol
787 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
788 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
789 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
790 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
791
792 @emph{LM32 Options}
793 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
794 -msign-extend-enabled -muser-enabled}
795
796 @emph{M32R/D Options}
797 @gccoptlist{-m32r2 -m32rx -m32r @gol
798 -mdebug @gol
799 -malign-loops -mno-align-loops @gol
800 -missue-rate=@var{number} @gol
801 -mbranch-cost=@var{number} @gol
802 -mmodel=@var{code-size-model-type} @gol
803 -msdata=@var{sdata-type} @gol
804 -mno-flush-func -mflush-func=@var{name} @gol
805 -mno-flush-trap -mflush-trap=@var{number} @gol
806 -G @var{num}}
807
808 @emph{M32C Options}
809 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
810
811 @emph{M680x0 Options}
812 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
813 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
814 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
815 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
816 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
817 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
818 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
819 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
820 -mxgot -mno-xgot}
821
822 @emph{MCore Options}
823 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
824 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
825 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
826 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
827 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
828
829 @emph{MeP Options}
830 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
831 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
832 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
833 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
834 -mtiny=@var{n}}
835
836 @emph{MicroBlaze Options}
837 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
838 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
839 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
840 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
841 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
842
843 @emph{MIPS Options}
844 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
845 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
846 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
847 -mips16 -mno-mips16 -mflip-mips16 @gol
848 -minterlink-compressed -mno-interlink-compressed @gol
849 -minterlink-mips16 -mno-interlink-mips16 @gol
850 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
851 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
852 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
853 -mno-float -msingle-float -mdouble-float @gol
854 -modd-spreg -mno-odd-spreg @gol
855 -mabs=@var{mode} -mnan=@var{encoding} @gol
856 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
857 -mmcu -mmno-mcu @gol
858 -meva -mno-eva @gol
859 -mvirt -mno-virt @gol
860 -mxpa -mno-xpa @gol
861 -mmicromips -mno-micromips @gol
862 -mmsa -mno-msa @gol
863 -mfpu=@var{fpu-type} @gol
864 -msmartmips -mno-smartmips @gol
865 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
866 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
867 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
868 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
869 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
870 -membedded-data -mno-embedded-data @gol
871 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
872 -mcode-readable=@var{setting} @gol
873 -msplit-addresses -mno-split-addresses @gol
874 -mexplicit-relocs -mno-explicit-relocs @gol
875 -mcheck-zero-division -mno-check-zero-division @gol
876 -mdivide-traps -mdivide-breaks @gol
877 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
878 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
879 -mfix-24k -mno-fix-24k @gol
880 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
881 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
882 -mfix-vr4120 -mno-fix-vr4120 @gol
883 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
884 -mflush-func=@var{func} -mno-flush-func @gol
885 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
886 -mcompact-branches=@var{policy} @gol
887 -mfp-exceptions -mno-fp-exceptions @gol
888 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
889 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
890 -mframe-header-opt -mno-frame-header-opt}
891
892 @emph{MMIX Options}
893 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
894 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
895 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
896 -mno-base-addresses -msingle-exit -mno-single-exit}
897
898 @emph{MN10300 Options}
899 @gccoptlist{-mmult-bug -mno-mult-bug @gol
900 -mno-am33 -mam33 -mam33-2 -mam34 @gol
901 -mtune=@var{cpu-type} @gol
902 -mreturn-pointer-on-d0 @gol
903 -mno-crt0 -mrelax -mliw -msetlb}
904
905 @emph{Moxie Options}
906 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
907
908 @emph{MSP430 Options}
909 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
910 -mwarn-mcu @gol
911 -mcode-region= -mdata-region= @gol
912 -msilicon-errata= -msilicon-errata-warn= @gol
913 -mhwmult= -minrt}
914
915 @emph{NDS32 Options}
916 @gccoptlist{-mbig-endian -mlittle-endian @gol
917 -mreduced-regs -mfull-regs @gol
918 -mcmov -mno-cmov @gol
919 -mperf-ext -mno-perf-ext @gol
920 -mv3push -mno-v3push @gol
921 -m16bit -mno-16bit @gol
922 -misr-vector-size=@var{num} @gol
923 -mcache-block-size=@var{num} @gol
924 -march=@var{arch} @gol
925 -mcmodel=@var{code-model} @gol
926 -mctor-dtor -mrelax}
927
928 @emph{Nios II Options}
929 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
930 -mel -meb @gol
931 -mno-bypass-cache -mbypass-cache @gol
932 -mno-cache-volatile -mcache-volatile @gol
933 -mno-fast-sw-div -mfast-sw-div @gol
934 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
935 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
936 -mcustom-fpu-cfg=@var{name} @gol
937 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
938 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
939
940 @emph{Nvidia PTX Options}
941 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
942
943 @emph{PDP-11 Options}
944 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
945 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
946 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
947 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
948 -mbranch-expensive -mbranch-cheap @gol
949 -munix-asm -mdec-asm}
950
951 @emph{picoChip Options}
952 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
953 -msymbol-as-address -mno-inefficient-warnings}
954
955 @emph{PowerPC Options}
956 See RS/6000 and PowerPC Options.
957
958 @emph{RL78 Options}
959 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
960 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
961 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
962
963 @emph{RS/6000 and PowerPC Options}
964 @gccoptlist{-mcpu=@var{cpu-type} @gol
965 -mtune=@var{cpu-type} @gol
966 -mcmodel=@var{code-model} @gol
967 -mpowerpc64 @gol
968 -maltivec -mno-altivec @gol
969 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
970 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
971 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
972 -mfprnd -mno-fprnd @gol
973 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
974 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
975 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
976 -malign-power -malign-natural @gol
977 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
978 -msingle-float -mdouble-float -msimple-fpu @gol
979 -mstring -mno-string -mupdate -mno-update @gol
980 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
981 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
982 -mstrict-align -mno-strict-align -mrelocatable @gol
983 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
984 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
985 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
986 -mprioritize-restricted-insns=@var{priority} @gol
987 -msched-costly-dep=@var{dependence_type} @gol
988 -minsert-sched-nops=@var{scheme} @gol
989 -mcall-sysv -mcall-netbsd @gol
990 -maix-struct-return -msvr4-struct-return @gol
991 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
992 -mblock-move-inline-limit=@var{num} @gol
993 -misel -mno-isel @gol
994 -misel=yes -misel=no @gol
995 -mspe -mno-spe @gol
996 -mspe=yes -mspe=no @gol
997 -mpaired @gol
998 -mgen-cell-microcode -mwarn-cell-microcode @gol
999 -mvrsave -mno-vrsave @gol
1000 -mmulhw -mno-mulhw @gol
1001 -mdlmzb -mno-dlmzb @gol
1002 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1003 -mprototype -mno-prototype @gol
1004 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1005 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
1006 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1007 -mno-recip-precision @gol
1008 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1009 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1010 -msave-toc-indirect -mno-save-toc-indirect @gol
1011 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1012 -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol
1013 -mquad-memory -mno-quad-memory @gol
1014 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1015 -mcompat-align-parm -mno-compat-align-parm @gol
1016 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
1017 -mupper-regs-di -mno-upper-regs-di @gol
1018 -mupper-regs -mno-upper-regs @gol
1019 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1020 -mlra -mno-lra}
1021
1022 @emph{RX Options}
1023 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1024 -mcpu=@gol
1025 -mbig-endian-data -mlittle-endian-data @gol
1026 -msmall-data @gol
1027 -msim -mno-sim@gol
1028 -mas100-syntax -mno-as100-syntax@gol
1029 -mrelax@gol
1030 -mmax-constant-size=@gol
1031 -mint-register=@gol
1032 -mpid@gol
1033 -mallow-string-insns -mno-allow-string-insns@gol
1034 -mjsr@gol
1035 -mno-warn-multiple-fast-interrupts@gol
1036 -msave-acc-in-interrupts}
1037
1038 @emph{S/390 and zSeries Options}
1039 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1040 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1041 -mlong-double-64 -mlong-double-128 @gol
1042 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1043 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1044 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1045 -mhtm -mvx -mzvector @gol
1046 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1047 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1048 -mhotpatch=@var{halfwords},@var{halfwords}}
1049
1050 @emph{Score Options}
1051 @gccoptlist{-meb -mel @gol
1052 -mnhwloop @gol
1053 -muls @gol
1054 -mmac @gol
1055 -mscore5 -mscore5u -mscore7 -mscore7d}
1056
1057 @emph{SH Options}
1058 @gccoptlist{-m1 -m2 -m2e @gol
1059 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1060 -m3 -m3e @gol
1061 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1062 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1063 -mb -ml -mdalign -mrelax @gol
1064 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1065 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1066 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1067 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1068 -maccumulate-outgoing-args @gol
1069 -matomic-model=@var{atomic-model} @gol
1070 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1071 -mcbranch-force-delay-slot @gol
1072 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1073 -mpretend-cmove -mtas}
1074
1075 @emph{Solaris 2 Options}
1076 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1077 -pthreads -pthread}
1078
1079 @emph{SPARC Options}
1080 @gccoptlist{-mcpu=@var{cpu-type} @gol
1081 -mtune=@var{cpu-type} @gol
1082 -mcmodel=@var{code-model} @gol
1083 -mmemory-model=@var{mem-model} @gol
1084 -m32 -m64 -mapp-regs -mno-app-regs @gol
1085 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1086 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1087 -mhard-quad-float -msoft-quad-float @gol
1088 -mstack-bias -mno-stack-bias @gol
1089 -mstd-struct-return -mno-std-struct-return @gol
1090 -munaligned-doubles -mno-unaligned-doubles @gol
1091 -muser-mode -mno-user-mode @gol
1092 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1093 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1094 -mcbcond -mno-cbcond @gol
1095 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
1096 -mfix-at697f -mfix-ut699}
1097
1098 @emph{SPU Options}
1099 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1100 -msafe-dma -munsafe-dma @gol
1101 -mbranch-hints @gol
1102 -msmall-mem -mlarge-mem -mstdmain @gol
1103 -mfixed-range=@var{register-range} @gol
1104 -mea32 -mea64 @gol
1105 -maddress-space-conversion -mno-address-space-conversion @gol
1106 -mcache-size=@var{cache-size} @gol
1107 -matomic-updates -mno-atomic-updates}
1108
1109 @emph{System V Options}
1110 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1111
1112 @emph{TILE-Gx Options}
1113 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1114 -mcmodel=@var{code-model}}
1115
1116 @emph{TILEPro Options}
1117 @gccoptlist{-mcpu=@var{cpu} -m32}
1118
1119 @emph{V850 Options}
1120 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1121 -mprolog-function -mno-prolog-function -mspace @gol
1122 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1123 -mapp-regs -mno-app-regs @gol
1124 -mdisable-callt -mno-disable-callt @gol
1125 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1126 -mv850e -mv850 -mv850e3v5 @gol
1127 -mloop @gol
1128 -mrelax @gol
1129 -mlong-jumps @gol
1130 -msoft-float @gol
1131 -mhard-float @gol
1132 -mgcc-abi @gol
1133 -mrh850-abi @gol
1134 -mbig-switch}
1135
1136 @emph{VAX Options}
1137 @gccoptlist{-mg -mgnu -munix}
1138
1139 @emph{Visium Options}
1140 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1141 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1142
1143 @emph{VMS Options}
1144 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1145 -mpointer-size=@var{size}}
1146
1147 @emph{VxWorks Options}
1148 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1149 -Xbind-lazy -Xbind-now}
1150
1151 @emph{x86 Options}
1152 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1153 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1154 -mfpmath=@var{unit} @gol
1155 -masm=@var{dialect} -mno-fancy-math-387 @gol
1156 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1157 -mno-wide-multiply -mrtd -malign-double @gol
1158 -mpreferred-stack-boundary=@var{num} @gol
1159 -mincoming-stack-boundary=@var{num} @gol
1160 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1161 -mrecip -mrecip=@var{opt} @gol
1162 -mvzeroupper -mprefer-avx128 @gol
1163 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1164 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1165 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1166 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1167 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1168 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
1169 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mclzero
1170 -mpku -mthreads @gol
1171 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1172 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1173 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1174 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1175 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1176 -mregparm=@var{num} -msseregparm @gol
1177 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1178 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1179 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1180 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1181 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1182 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1183 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1184 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1185 -mmitigate-rop -mgeneral-regs-only}
1186
1187 @emph{x86 Windows Options}
1188 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1189 -mnop-fun-dllimport -mthread @gol
1190 -municode -mwin32 -mwindows -fno-set-stack-executable}
1191
1192 @emph{Xstormy16 Options}
1193 @gccoptlist{-msim}
1194
1195 @emph{Xtensa Options}
1196 @gccoptlist{-mconst16 -mno-const16 @gol
1197 -mfused-madd -mno-fused-madd @gol
1198 -mforce-no-pic @gol
1199 -mserialize-volatile -mno-serialize-volatile @gol
1200 -mtext-section-literals -mno-text-section-literals @gol
1201 -mauto-litpools -mno-auto-litpools @gol
1202 -mtarget-align -mno-target-align @gol
1203 -mlongcalls -mno-longcalls}
1204
1205 @emph{zSeries Options}
1206 See S/390 and zSeries Options.
1207 @end table
1208
1209
1210 @node Overall Options
1211 @section Options Controlling the Kind of Output
1212
1213 Compilation can involve up to four stages: preprocessing, compilation
1214 proper, assembly and linking, always in that order. GCC is capable of
1215 preprocessing and compiling several files either into several
1216 assembler input files, or into one assembler input file; then each
1217 assembler input file produces an object file, and linking combines all
1218 the object files (those newly compiled, and those specified as input)
1219 into an executable file.
1220
1221 @cindex file name suffix
1222 For any given input file, the file name suffix determines what kind of
1223 compilation is done:
1224
1225 @table @gcctabopt
1226 @item @var{file}.c
1227 C source code that must be preprocessed.
1228
1229 @item @var{file}.i
1230 C source code that should not be preprocessed.
1231
1232 @item @var{file}.ii
1233 C++ source code that should not be preprocessed.
1234
1235 @item @var{file}.m
1236 Objective-C source code. Note that you must link with the @file{libobjc}
1237 library to make an Objective-C program work.
1238
1239 @item @var{file}.mi
1240 Objective-C source code that should not be preprocessed.
1241
1242 @item @var{file}.mm
1243 @itemx @var{file}.M
1244 Objective-C++ source code. Note that you must link with the @file{libobjc}
1245 library to make an Objective-C++ program work. Note that @samp{.M} refers
1246 to a literal capital M@.
1247
1248 @item @var{file}.mii
1249 Objective-C++ source code that should not be preprocessed.
1250
1251 @item @var{file}.h
1252 C, C++, Objective-C or Objective-C++ header file to be turned into a
1253 precompiled header (default), or C, C++ header file to be turned into an
1254 Ada spec (via the @option{-fdump-ada-spec} switch).
1255
1256 @item @var{file}.cc
1257 @itemx @var{file}.cp
1258 @itemx @var{file}.cxx
1259 @itemx @var{file}.cpp
1260 @itemx @var{file}.CPP
1261 @itemx @var{file}.c++
1262 @itemx @var{file}.C
1263 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1264 the last two letters must both be literally @samp{x}. Likewise,
1265 @samp{.C} refers to a literal capital C@.
1266
1267 @item @var{file}.mm
1268 @itemx @var{file}.M
1269 Objective-C++ source code that must be preprocessed.
1270
1271 @item @var{file}.mii
1272 Objective-C++ source code that should not be preprocessed.
1273
1274 @item @var{file}.hh
1275 @itemx @var{file}.H
1276 @itemx @var{file}.hp
1277 @itemx @var{file}.hxx
1278 @itemx @var{file}.hpp
1279 @itemx @var{file}.HPP
1280 @itemx @var{file}.h++
1281 @itemx @var{file}.tcc
1282 C++ header file to be turned into a precompiled header or Ada spec.
1283
1284 @item @var{file}.f
1285 @itemx @var{file}.for
1286 @itemx @var{file}.ftn
1287 Fixed form Fortran source code that should not be preprocessed.
1288
1289 @item @var{file}.F
1290 @itemx @var{file}.FOR
1291 @itemx @var{file}.fpp
1292 @itemx @var{file}.FPP
1293 @itemx @var{file}.FTN
1294 Fixed form Fortran source code that must be preprocessed (with the traditional
1295 preprocessor).
1296
1297 @item @var{file}.f90
1298 @itemx @var{file}.f95
1299 @itemx @var{file}.f03
1300 @itemx @var{file}.f08
1301 Free form Fortran source code that should not be preprocessed.
1302
1303 @item @var{file}.F90
1304 @itemx @var{file}.F95
1305 @itemx @var{file}.F03
1306 @itemx @var{file}.F08
1307 Free form Fortran source code that must be preprocessed (with the
1308 traditional preprocessor).
1309
1310 @item @var{file}.go
1311 Go source code.
1312
1313 @c FIXME: Descriptions of Java file types.
1314 @c @var{file}.java
1315 @c @var{file}.class
1316 @c @var{file}.zip
1317 @c @var{file}.jar
1318
1319 @item @var{file}.ads
1320 Ada source code file that contains a library unit declaration (a
1321 declaration of a package, subprogram, or generic, or a generic
1322 instantiation), or a library unit renaming declaration (a package,
1323 generic, or subprogram renaming declaration). Such files are also
1324 called @dfn{specs}.
1325
1326 @item @var{file}.adb
1327 Ada source code file containing a library unit body (a subprogram or
1328 package body). Such files are also called @dfn{bodies}.
1329
1330 @c GCC also knows about some suffixes for languages not yet included:
1331 @c Pascal:
1332 @c @var{file}.p
1333 @c @var{file}.pas
1334 @c Ratfor:
1335 @c @var{file}.r
1336
1337 @item @var{file}.s
1338 Assembler code.
1339
1340 @item @var{file}.S
1341 @itemx @var{file}.sx
1342 Assembler code that must be preprocessed.
1343
1344 @item @var{other}
1345 An object file to be fed straight into linking.
1346 Any file name with no recognized suffix is treated this way.
1347 @end table
1348
1349 @opindex x
1350 You can specify the input language explicitly with the @option{-x} option:
1351
1352 @table @gcctabopt
1353 @item -x @var{language}
1354 Specify explicitly the @var{language} for the following input files
1355 (rather than letting the compiler choose a default based on the file
1356 name suffix). This option applies to all following input files until
1357 the next @option{-x} option. Possible values for @var{language} are:
1358 @smallexample
1359 c c-header cpp-output
1360 c++ c++-header c++-cpp-output
1361 objective-c objective-c-header objective-c-cpp-output
1362 objective-c++ objective-c++-header objective-c++-cpp-output
1363 assembler assembler-with-cpp
1364 ada
1365 f77 f77-cpp-input f95 f95-cpp-input
1366 go
1367 java
1368 @end smallexample
1369
1370 @item -x none
1371 Turn off any specification of a language, so that subsequent files are
1372 handled according to their file name suffixes (as they are if @option{-x}
1373 has not been used at all).
1374 @end table
1375
1376 If you only want some of the stages of compilation, you can use
1377 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1378 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1379 @command{gcc} is to stop. Note that some combinations (for example,
1380 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1381
1382 @table @gcctabopt
1383 @item -c
1384 @opindex c
1385 Compile or assemble the source files, but do not link. The linking
1386 stage simply is not done. The ultimate output is in the form of an
1387 object file for each source file.
1388
1389 By default, the object file name for a source file is made by replacing
1390 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1391
1392 Unrecognized input files, not requiring compilation or assembly, are
1393 ignored.
1394
1395 @item -S
1396 @opindex S
1397 Stop after the stage of compilation proper; do not assemble. The output
1398 is in the form of an assembler code file for each non-assembler input
1399 file specified.
1400
1401 By default, the assembler file name for a source file is made by
1402 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1403
1404 Input files that don't require compilation are ignored.
1405
1406 @item -E
1407 @opindex E
1408 Stop after the preprocessing stage; do not run the compiler proper. The
1409 output is in the form of preprocessed source code, which is sent to the
1410 standard output.
1411
1412 Input files that don't require preprocessing are ignored.
1413
1414 @cindex output file option
1415 @item -o @var{file}
1416 @opindex o
1417 Place output in file @var{file}. This applies to whatever
1418 sort of output is being produced, whether it be an executable file,
1419 an object file, an assembler file or preprocessed C code.
1420
1421 If @option{-o} is not specified, the default is to put an executable
1422 file in @file{a.out}, the object file for
1423 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1424 assembler file in @file{@var{source}.s}, a precompiled header file in
1425 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1426 standard output.
1427
1428 @item -v
1429 @opindex v
1430 Print (on standard error output) the commands executed to run the stages
1431 of compilation. Also print the version number of the compiler driver
1432 program and of the preprocessor and the compiler proper.
1433
1434 @item -###
1435 @opindex ###
1436 Like @option{-v} except the commands are not executed and arguments
1437 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1438 This is useful for shell scripts to capture the driver-generated command lines.
1439
1440 @item --help
1441 @opindex help
1442 Print (on the standard output) a description of the command-line options
1443 understood by @command{gcc}. If the @option{-v} option is also specified
1444 then @option{--help} is also passed on to the various processes
1445 invoked by @command{gcc}, so that they can display the command-line options
1446 they accept. If the @option{-Wextra} option has also been specified
1447 (prior to the @option{--help} option), then command-line options that
1448 have no documentation associated with them are also displayed.
1449
1450 @item --target-help
1451 @opindex target-help
1452 Print (on the standard output) a description of target-specific command-line
1453 options for each tool. For some targets extra target-specific
1454 information may also be printed.
1455
1456 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1457 Print (on the standard output) a description of the command-line
1458 options understood by the compiler that fit into all specified classes
1459 and qualifiers. These are the supported classes:
1460
1461 @table @asis
1462 @item @samp{optimizers}
1463 Display all of the optimization options supported by the
1464 compiler.
1465
1466 @item @samp{warnings}
1467 Display all of the options controlling warning messages
1468 produced by the compiler.
1469
1470 @item @samp{target}
1471 Display target-specific options. Unlike the
1472 @option{--target-help} option however, target-specific options of the
1473 linker and assembler are not displayed. This is because those
1474 tools do not currently support the extended @option{--help=} syntax.
1475
1476 @item @samp{params}
1477 Display the values recognized by the @option{--param}
1478 option.
1479
1480 @item @var{language}
1481 Display the options supported for @var{language}, where
1482 @var{language} is the name of one of the languages supported in this
1483 version of GCC@.
1484
1485 @item @samp{common}
1486 Display the options that are common to all languages.
1487 @end table
1488
1489 These are the supported qualifiers:
1490
1491 @table @asis
1492 @item @samp{undocumented}
1493 Display only those options that are undocumented.
1494
1495 @item @samp{joined}
1496 Display options taking an argument that appears after an equal
1497 sign in the same continuous piece of text, such as:
1498 @samp{--help=target}.
1499
1500 @item @samp{separate}
1501 Display options taking an argument that appears as a separate word
1502 following the original option, such as: @samp{-o output-file}.
1503 @end table
1504
1505 Thus for example to display all the undocumented target-specific
1506 switches supported by the compiler, use:
1507
1508 @smallexample
1509 --help=target,undocumented
1510 @end smallexample
1511
1512 The sense of a qualifier can be inverted by prefixing it with the
1513 @samp{^} character, so for example to display all binary warning
1514 options (i.e., ones that are either on or off and that do not take an
1515 argument) that have a description, use:
1516
1517 @smallexample
1518 --help=warnings,^joined,^undocumented
1519 @end smallexample
1520
1521 The argument to @option{--help=} should not consist solely of inverted
1522 qualifiers.
1523
1524 Combining several classes is possible, although this usually
1525 restricts the output so much that there is nothing to display. One
1526 case where it does work, however, is when one of the classes is
1527 @var{target}. For example, to display all the target-specific
1528 optimization options, use:
1529
1530 @smallexample
1531 --help=target,optimizers
1532 @end smallexample
1533
1534 The @option{--help=} option can be repeated on the command line. Each
1535 successive use displays its requested class of options, skipping
1536 those that have already been displayed.
1537
1538 If the @option{-Q} option appears on the command line before the
1539 @option{--help=} option, then the descriptive text displayed by
1540 @option{--help=} is changed. Instead of describing the displayed
1541 options, an indication is given as to whether the option is enabled,
1542 disabled or set to a specific value (assuming that the compiler
1543 knows this at the point where the @option{--help=} option is used).
1544
1545 Here is a truncated example from the ARM port of @command{gcc}:
1546
1547 @smallexample
1548 % gcc -Q -mabi=2 --help=target -c
1549 The following options are target specific:
1550 -mabi= 2
1551 -mabort-on-noreturn [disabled]
1552 -mapcs [disabled]
1553 @end smallexample
1554
1555 The output is sensitive to the effects of previous command-line
1556 options, so for example it is possible to find out which optimizations
1557 are enabled at @option{-O2} by using:
1558
1559 @smallexample
1560 -Q -O2 --help=optimizers
1561 @end smallexample
1562
1563 Alternatively you can discover which binary optimizations are enabled
1564 by @option{-O3} by using:
1565
1566 @smallexample
1567 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1568 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1569 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1570 @end smallexample
1571
1572 @item --version
1573 @opindex version
1574 Display the version number and copyrights of the invoked GCC@.
1575
1576 @item -pass-exit-codes
1577 @opindex pass-exit-codes
1578 Normally the @command{gcc} program exits with the code of 1 if any
1579 phase of the compiler returns a non-success return code. If you specify
1580 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1581 the numerically highest error produced by any phase returning an error
1582 indication. The C, C++, and Fortran front ends return 4 if an internal
1583 compiler error is encountered.
1584
1585 @item -pipe
1586 @opindex pipe
1587 Use pipes rather than temporary files for communication between the
1588 various stages of compilation. This fails to work on some systems where
1589 the assembler is unable to read from a pipe; but the GNU assembler has
1590 no trouble.
1591
1592 @item -specs=@var{file}
1593 @opindex specs
1594 Process @var{file} after the compiler reads in the standard @file{specs}
1595 file, in order to override the defaults which the @command{gcc} driver
1596 program uses when determining what switches to pass to @command{cc1},
1597 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1598 @option{-specs=@var{file}} can be specified on the command line, and they
1599 are processed in order, from left to right. @xref{Spec Files}, for
1600 information about the format of the @var{file}.
1601
1602 @item -wrapper
1603 @opindex wrapper
1604 Invoke all subcommands under a wrapper program. The name of the
1605 wrapper program and its parameters are passed as a comma separated
1606 list.
1607
1608 @smallexample
1609 gcc -c t.c -wrapper gdb,--args
1610 @end smallexample
1611
1612 @noindent
1613 This invokes all subprograms of @command{gcc} under
1614 @samp{gdb --args}, thus the invocation of @command{cc1} is
1615 @samp{gdb --args cc1 @dots{}}.
1616
1617 @item -fplugin=@var{name}.so
1618 @opindex fplugin
1619 Load the plugin code in file @var{name}.so, assumed to be a
1620 shared object to be dlopen'd by the compiler. The base name of
1621 the shared object file is used to identify the plugin for the
1622 purposes of argument parsing (See
1623 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1624 Each plugin should define the callback functions specified in the
1625 Plugins API.
1626
1627 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1628 @opindex fplugin-arg
1629 Define an argument called @var{key} with a value of @var{value}
1630 for the plugin called @var{name}.
1631
1632 @item -fdump-ada-spec@r{[}-slim@r{]}
1633 @opindex fdump-ada-spec
1634 For C and C++ source and include files, generate corresponding Ada specs.
1635 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1636 GNAT User's Guide}, which provides detailed documentation on this feature.
1637
1638 @item -fada-spec-parent=@var{unit}
1639 @opindex fada-spec-parent
1640 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1641 Ada specs as child units of parent @var{unit}.
1642
1643 @item -fdump-go-spec=@var{file}
1644 @opindex fdump-go-spec
1645 For input files in any language, generate corresponding Go
1646 declarations in @var{file}. This generates Go @code{const},
1647 @code{type}, @code{var}, and @code{func} declarations which may be a
1648 useful way to start writing a Go interface to code written in some
1649 other language.
1650
1651 @include @value{srcdir}/../libiberty/at-file.texi
1652 @end table
1653
1654 @node Invoking G++
1655 @section Compiling C++ Programs
1656
1657 @cindex suffixes for C++ source
1658 @cindex C++ source file suffixes
1659 C++ source files conventionally use one of the suffixes @samp{.C},
1660 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1661 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1662 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1663 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1664 files with these names and compiles them as C++ programs even if you
1665 call the compiler the same way as for compiling C programs (usually
1666 with the name @command{gcc}).
1667
1668 @findex g++
1669 @findex c++
1670 However, the use of @command{gcc} does not add the C++ library.
1671 @command{g++} is a program that calls GCC and automatically specifies linking
1672 against the C++ library. It treats @samp{.c},
1673 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1674 files unless @option{-x} is used. This program is also useful when
1675 precompiling a C header file with a @samp{.h} extension for use in C++
1676 compilations. On many systems, @command{g++} is also installed with
1677 the name @command{c++}.
1678
1679 @cindex invoking @command{g++}
1680 When you compile C++ programs, you may specify many of the same
1681 command-line options that you use for compiling programs in any
1682 language; or command-line options meaningful for C and related
1683 languages; or options that are meaningful only for C++ programs.
1684 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1685 explanations of options for languages related to C@.
1686 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1687 explanations of options that are meaningful only for C++ programs.
1688
1689 @node C Dialect Options
1690 @section Options Controlling C Dialect
1691 @cindex dialect options
1692 @cindex language dialect options
1693 @cindex options, dialect
1694
1695 The following options control the dialect of C (or languages derived
1696 from C, such as C++, Objective-C and Objective-C++) that the compiler
1697 accepts:
1698
1699 @table @gcctabopt
1700 @cindex ANSI support
1701 @cindex ISO support
1702 @item -ansi
1703 @opindex ansi
1704 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1705 equivalent to @option{-std=c++98}.
1706
1707 This turns off certain features of GCC that are incompatible with ISO
1708 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1709 such as the @code{asm} and @code{typeof} keywords, and
1710 predefined macros such as @code{unix} and @code{vax} that identify the
1711 type of system you are using. It also enables the undesirable and
1712 rarely used ISO trigraph feature. For the C compiler,
1713 it disables recognition of C++ style @samp{//} comments as well as
1714 the @code{inline} keyword.
1715
1716 The alternate keywords @code{__asm__}, @code{__extension__},
1717 @code{__inline__} and @code{__typeof__} continue to work despite
1718 @option{-ansi}. You would not want to use them in an ISO C program, of
1719 course, but it is useful to put them in header files that might be included
1720 in compilations done with @option{-ansi}. Alternate predefined macros
1721 such as @code{__unix__} and @code{__vax__} are also available, with or
1722 without @option{-ansi}.
1723
1724 The @option{-ansi} option does not cause non-ISO programs to be
1725 rejected gratuitously. For that, @option{-Wpedantic} is required in
1726 addition to @option{-ansi}. @xref{Warning Options}.
1727
1728 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1729 option is used. Some header files may notice this macro and refrain
1730 from declaring certain functions or defining certain macros that the
1731 ISO standard doesn't call for; this is to avoid interfering with any
1732 programs that might use these names for other things.
1733
1734 Functions that are normally built in but do not have semantics
1735 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1736 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1737 built-in functions provided by GCC}, for details of the functions
1738 affected.
1739
1740 @item -std=
1741 @opindex std
1742 Determine the language standard. @xref{Standards,,Language Standards
1743 Supported by GCC}, for details of these standard versions. This option
1744 is currently only supported when compiling C or C++.
1745
1746 The compiler can accept several base standards, such as @samp{c90} or
1747 @samp{c++98}, and GNU dialects of those standards, such as
1748 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1749 compiler accepts all programs following that standard plus those
1750 using GNU extensions that do not contradict it. For example,
1751 @option{-std=c90} turns off certain features of GCC that are
1752 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1753 keywords, but not other GNU extensions that do not have a meaning in
1754 ISO C90, such as omitting the middle term of a @code{?:}
1755 expression. On the other hand, when a GNU dialect of a standard is
1756 specified, all features supported by the compiler are enabled, even when
1757 those features change the meaning of the base standard. As a result, some
1758 strict-conforming programs may be rejected. The particular standard
1759 is used by @option{-Wpedantic} to identify which features are GNU
1760 extensions given that version of the standard. For example
1761 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1762 comments, while @option{-std=gnu99 -Wpedantic} does not.
1763
1764 A value for this option must be provided; possible values are
1765
1766 @table @samp
1767 @item c90
1768 @itemx c89
1769 @itemx iso9899:1990
1770 Support all ISO C90 programs (certain GNU extensions that conflict
1771 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1772
1773 @item iso9899:199409
1774 ISO C90 as modified in amendment 1.
1775
1776 @item c99
1777 @itemx c9x
1778 @itemx iso9899:1999
1779 @itemx iso9899:199x
1780 ISO C99. This standard is substantially completely supported, modulo
1781 bugs and floating-point issues
1782 (mainly but not entirely relating to optional C99 features from
1783 Annexes F and G). See
1784 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1785 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1786
1787 @item c11
1788 @itemx c1x
1789 @itemx iso9899:2011
1790 ISO C11, the 2011 revision of the ISO C standard. This standard is
1791 substantially completely supported, modulo bugs, floating-point issues
1792 (mainly but not entirely relating to optional C11 features from
1793 Annexes F and G) and the optional Annexes K (Bounds-checking
1794 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1795
1796 @item gnu90
1797 @itemx gnu89
1798 GNU dialect of ISO C90 (including some C99 features).
1799
1800 @item gnu99
1801 @itemx gnu9x
1802 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1803
1804 @item gnu11
1805 @itemx gnu1x
1806 GNU dialect of ISO C11. This is the default for C code.
1807 The name @samp{gnu1x} is deprecated.
1808
1809 @item c++98
1810 @itemx c++03
1811 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1812 additional defect reports. Same as @option{-ansi} for C++ code.
1813
1814 @item gnu++98
1815 @itemx gnu++03
1816 GNU dialect of @option{-std=c++98}.
1817
1818 @item c++11
1819 @itemx c++0x
1820 The 2011 ISO C++ standard plus amendments.
1821 The name @samp{c++0x} is deprecated.
1822
1823 @item gnu++11
1824 @itemx gnu++0x
1825 GNU dialect of @option{-std=c++11}.
1826 The name @samp{gnu++0x} is deprecated.
1827
1828 @item c++14
1829 @itemx c++1y
1830 The 2014 ISO C++ standard plus amendments.
1831 The name @samp{c++1y} is deprecated.
1832
1833 @item gnu++14
1834 @itemx gnu++1y
1835 GNU dialect of @option{-std=c++14}.
1836 This is the default for C++ code.
1837 The name @samp{gnu++1y} is deprecated.
1838
1839 @item c++1z
1840 The next revision of the ISO C++ standard, tentatively planned for
1841 2017. Support is highly experimental, and will almost certainly
1842 change in incompatible ways in future releases.
1843
1844 @item gnu++1z
1845 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1846 and will almost certainly change in incompatible ways in future
1847 releases.
1848 @end table
1849
1850 @item -fgnu89-inline
1851 @opindex fgnu89-inline
1852 The option @option{-fgnu89-inline} tells GCC to use the traditional
1853 GNU semantics for @code{inline} functions when in C99 mode.
1854 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1855 Using this option is roughly equivalent to adding the
1856 @code{gnu_inline} function attribute to all inline functions
1857 (@pxref{Function Attributes}).
1858
1859 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1860 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1861 specifies the default behavior).
1862 This option is not supported in @option{-std=c90} or
1863 @option{-std=gnu90} mode.
1864
1865 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1866 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1867 in effect for @code{inline} functions. @xref{Common Predefined
1868 Macros,,,cpp,The C Preprocessor}.
1869
1870 @item -aux-info @var{filename}
1871 @opindex aux-info
1872 Output to the given filename prototyped declarations for all functions
1873 declared and/or defined in a translation unit, including those in header
1874 files. This option is silently ignored in any language other than C@.
1875
1876 Besides declarations, the file indicates, in comments, the origin of
1877 each declaration (source file and line), whether the declaration was
1878 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1879 @samp{O} for old, respectively, in the first character after the line
1880 number and the colon), and whether it came from a declaration or a
1881 definition (@samp{C} or @samp{F}, respectively, in the following
1882 character). In the case of function definitions, a K&R-style list of
1883 arguments followed by their declarations is also provided, inside
1884 comments, after the declaration.
1885
1886 @item -fallow-parameterless-variadic-functions
1887 @opindex fallow-parameterless-variadic-functions
1888 Accept variadic functions without named parameters.
1889
1890 Although it is possible to define such a function, this is not very
1891 useful as it is not possible to read the arguments. This is only
1892 supported for C as this construct is allowed by C++.
1893
1894 @item -fno-asm
1895 @opindex fno-asm
1896 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1897 keyword, so that code can use these words as identifiers. You can use
1898 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1899 instead. @option{-ansi} implies @option{-fno-asm}.
1900
1901 In C++, this switch only affects the @code{typeof} keyword, since
1902 @code{asm} and @code{inline} are standard keywords. You may want to
1903 use the @option{-fno-gnu-keywords} flag instead, which has the same
1904 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1905 switch only affects the @code{asm} and @code{typeof} keywords, since
1906 @code{inline} is a standard keyword in ISO C99.
1907
1908 @item -fno-builtin
1909 @itemx -fno-builtin-@var{function}
1910 @opindex fno-builtin
1911 @cindex built-in functions
1912 Don't recognize built-in functions that do not begin with
1913 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1914 functions provided by GCC}, for details of the functions affected,
1915 including those which are not built-in functions when @option{-ansi} or
1916 @option{-std} options for strict ISO C conformance are used because they
1917 do not have an ISO standard meaning.
1918
1919 GCC normally generates special code to handle certain built-in functions
1920 more efficiently; for instance, calls to @code{alloca} may become single
1921 instructions which adjust the stack directly, and calls to @code{memcpy}
1922 may become inline copy loops. The resulting code is often both smaller
1923 and faster, but since the function calls no longer appear as such, you
1924 cannot set a breakpoint on those calls, nor can you change the behavior
1925 of the functions by linking with a different library. In addition,
1926 when a function is recognized as a built-in function, GCC may use
1927 information about that function to warn about problems with calls to
1928 that function, or to generate more efficient code, even if the
1929 resulting code still contains calls to that function. For example,
1930 warnings are given with @option{-Wformat} for bad calls to
1931 @code{printf} when @code{printf} is built in and @code{strlen} is
1932 known not to modify global memory.
1933
1934 With the @option{-fno-builtin-@var{function}} option
1935 only the built-in function @var{function} is
1936 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1937 function is named that is not built-in in this version of GCC, this
1938 option is ignored. There is no corresponding
1939 @option{-fbuiltin-@var{function}} option; if you wish to enable
1940 built-in functions selectively when using @option{-fno-builtin} or
1941 @option{-ffreestanding}, you may define macros such as:
1942
1943 @smallexample
1944 #define abs(n) __builtin_abs ((n))
1945 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1946 @end smallexample
1947
1948 @item -fhosted
1949 @opindex fhosted
1950 @cindex hosted environment
1951
1952 Assert that compilation targets a hosted environment. This implies
1953 @option{-fbuiltin}. A hosted environment is one in which the
1954 entire standard library is available, and in which @code{main} has a return
1955 type of @code{int}. Examples are nearly everything except a kernel.
1956 This is equivalent to @option{-fno-freestanding}.
1957
1958 @item -ffreestanding
1959 @opindex ffreestanding
1960 @cindex hosted environment
1961
1962 Assert that compilation targets a freestanding environment. This
1963 implies @option{-fno-builtin}. A freestanding environment
1964 is one in which the standard library may not exist, and program startup may
1965 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1966 This is equivalent to @option{-fno-hosted}.
1967
1968 @xref{Standards,,Language Standards Supported by GCC}, for details of
1969 freestanding and hosted environments.
1970
1971 @item -fopenacc
1972 @opindex fopenacc
1973 @cindex OpenACC accelerator programming
1974 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
1975 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
1976 compiler generates accelerated code according to the OpenACC Application
1977 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
1978 implies @option{-pthread}, and thus is only supported on targets that
1979 have support for @option{-pthread}.
1980
1981 @item -fopenacc-dim=@var{geom}
1982 @opindex fopenacc-dim
1983 @cindex OpenACC accelerator programming
1984 Specify default compute dimensions for parallel offload regions that do
1985 not explicitly specify. The @var{geom} value is a triple of
1986 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
1987 can be omitted, to use a target-specific default value.
1988
1989 @item -fopenmp
1990 @opindex fopenmp
1991 @cindex OpenMP parallel
1992 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1993 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1994 compiler generates parallel code according to the OpenMP Application
1995 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
1996 implies @option{-pthread}, and thus is only supported on targets that
1997 have support for @option{-pthread}. @option{-fopenmp} implies
1998 @option{-fopenmp-simd}.
1999
2000 @item -fopenmp-simd
2001 @opindex fopenmp-simd
2002 @cindex OpenMP SIMD
2003 @cindex SIMD
2004 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2005 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2006 are ignored.
2007
2008 @item -fcilkplus
2009 @opindex fcilkplus
2010 @cindex Enable Cilk Plus
2011 Enable the usage of Cilk Plus language extension features for C/C++.
2012 When the option @option{-fcilkplus} is specified, enable the usage of
2013 the Cilk Plus Language extension features for C/C++. The present
2014 implementation follows ABI version 1.2. This is an experimental
2015 feature that is only partially complete, and whose interface may
2016 change in future versions of GCC as the official specification
2017 changes. Currently, all features but @code{_Cilk_for} have been
2018 implemented.
2019
2020 @item -fgnu-tm
2021 @opindex fgnu-tm
2022 When the option @option{-fgnu-tm} is specified, the compiler
2023 generates code for the Linux variant of Intel's current Transactional
2024 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2025 an experimental feature whose interface may change in future versions
2026 of GCC, as the official specification changes. Please note that not
2027 all architectures are supported for this feature.
2028
2029 For more information on GCC's support for transactional memory,
2030 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2031 Transactional Memory Library}.
2032
2033 Note that the transactional memory feature is not supported with
2034 non-call exceptions (@option{-fnon-call-exceptions}).
2035
2036 @item -fms-extensions
2037 @opindex fms-extensions
2038 Accept some non-standard constructs used in Microsoft header files.
2039
2040 In C++ code, this allows member names in structures to be similar
2041 to previous types declarations.
2042
2043 @smallexample
2044 typedef int UOW;
2045 struct ABC @{
2046 UOW UOW;
2047 @};
2048 @end smallexample
2049
2050 Some cases of unnamed fields in structures and unions are only
2051 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2052 fields within structs/unions}, for details.
2053
2054 Note that this option is off for all targets but x86
2055 targets using ms-abi.
2056
2057 @item -fplan9-extensions
2058 @opindex fplan9-extensions
2059 Accept some non-standard constructs used in Plan 9 code.
2060
2061 This enables @option{-fms-extensions}, permits passing pointers to
2062 structures with anonymous fields to functions that expect pointers to
2063 elements of the type of the field, and permits referring to anonymous
2064 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2065 struct/union fields within structs/unions}, for details. This is only
2066 supported for C, not C++.
2067
2068 @item -trigraphs
2069 @opindex trigraphs
2070 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
2071 options for strict ISO C conformance) implies @option{-trigraphs}.
2072
2073 @cindex traditional C language
2074 @cindex C language, traditional
2075 @item -traditional
2076 @itemx -traditional-cpp
2077 @opindex traditional-cpp
2078 @opindex traditional
2079 Formerly, these options caused GCC to attempt to emulate a pre-standard
2080 C compiler. They are now only supported with the @option{-E} switch.
2081 The preprocessor continues to support a pre-standard mode. See the GNU
2082 CPP manual for details.
2083
2084 @item -fcond-mismatch
2085 @opindex fcond-mismatch
2086 Allow conditional expressions with mismatched types in the second and
2087 third arguments. The value of such an expression is void. This option
2088 is not supported for C++.
2089
2090 @item -flax-vector-conversions
2091 @opindex flax-vector-conversions
2092 Allow implicit conversions between vectors with differing numbers of
2093 elements and/or incompatible element types. This option should not be
2094 used for new code.
2095
2096 @item -funsigned-char
2097 @opindex funsigned-char
2098 Let the type @code{char} be unsigned, like @code{unsigned char}.
2099
2100 Each kind of machine has a default for what @code{char} should
2101 be. It is either like @code{unsigned char} by default or like
2102 @code{signed char} by default.
2103
2104 Ideally, a portable program should always use @code{signed char} or
2105 @code{unsigned char} when it depends on the signedness of an object.
2106 But many programs have been written to use plain @code{char} and
2107 expect it to be signed, or expect it to be unsigned, depending on the
2108 machines they were written for. This option, and its inverse, let you
2109 make such a program work with the opposite default.
2110
2111 The type @code{char} is always a distinct type from each of
2112 @code{signed char} or @code{unsigned char}, even though its behavior
2113 is always just like one of those two.
2114
2115 @item -fsigned-char
2116 @opindex fsigned-char
2117 Let the type @code{char} be signed, like @code{signed char}.
2118
2119 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2120 the negative form of @option{-funsigned-char}. Likewise, the option
2121 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2122
2123 @item -fsigned-bitfields
2124 @itemx -funsigned-bitfields
2125 @itemx -fno-signed-bitfields
2126 @itemx -fno-unsigned-bitfields
2127 @opindex fsigned-bitfields
2128 @opindex funsigned-bitfields
2129 @opindex fno-signed-bitfields
2130 @opindex fno-unsigned-bitfields
2131 These options control whether a bit-field is signed or unsigned, when the
2132 declaration does not use either @code{signed} or @code{unsigned}. By
2133 default, such a bit-field is signed, because this is consistent: the
2134 basic integer types such as @code{int} are signed types.
2135
2136 @item -fsso-struct=@var{endianness}
2137 @opindex fsso-struct
2138 Set the default scalar storage order of structures and unions to the
2139 specified endianness. The accepted values are @samp{big-endian} and
2140 @samp{little-endian}. If the option is not passed, the compiler uses
2141 the native endianness of the target. This option is not supported for C++.
2142
2143 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2144 code that is not binary compatible with code generated without it if the
2145 specified endianness is not the native endianness of the target.
2146 @end table
2147
2148 @node C++ Dialect Options
2149 @section Options Controlling C++ Dialect
2150
2151 @cindex compiler options, C++
2152 @cindex C++ options, command-line
2153 @cindex options, C++
2154 This section describes the command-line options that are only meaningful
2155 for C++ programs. You can also use most of the GNU compiler options
2156 regardless of what language your program is in. For example, you
2157 might compile a file @file{firstClass.C} like this:
2158
2159 @smallexample
2160 g++ -g -fstrict-enums -O -c firstClass.C
2161 @end smallexample
2162
2163 @noindent
2164 In this example, only @option{-fstrict-enums} is an option meant
2165 only for C++ programs; you can use the other options with any
2166 language supported by GCC@.
2167
2168 Some options for compiling C programs, such as @option{-std}, are also
2169 relevant for C++ programs.
2170 @xref{C Dialect Options,,Options Controlling C Dialect}.
2171
2172 Here is a list of options that are @emph{only} for compiling C++ programs:
2173
2174 @table @gcctabopt
2175
2176 @item -fabi-version=@var{n}
2177 @opindex fabi-version
2178 Use version @var{n} of the C++ ABI@. The default is version 0.
2179
2180 Version 0 refers to the version conforming most closely to
2181 the C++ ABI specification. Therefore, the ABI obtained using version 0
2182 will change in different versions of G++ as ABI bugs are fixed.
2183
2184 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2185
2186 Version 2 is the version of the C++ ABI that first appeared in G++
2187 3.4, and was the default through G++ 4.9.
2188
2189 Version 3 corrects an error in mangling a constant address as a
2190 template argument.
2191
2192 Version 4, which first appeared in G++ 4.5, implements a standard
2193 mangling for vector types.
2194
2195 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2196 attribute const/volatile on function pointer types, decltype of a
2197 plain decl, and use of a function parameter in the declaration of
2198 another parameter.
2199
2200 Version 6, which first appeared in G++ 4.7, corrects the promotion
2201 behavior of C++11 scoped enums and the mangling of template argument
2202 packs, const/static_cast, prefix ++ and --, and a class scope function
2203 used as a template argument.
2204
2205 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2206 builtin type and corrects the mangling of lambdas in default argument
2207 scope.
2208
2209 Version 8, which first appeared in G++ 4.9, corrects the substitution
2210 behavior of function types with function-cv-qualifiers.
2211
2212 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2213 @code{nullptr_t}.
2214
2215 Version 10, which first appeared in G++ 6.1, adds mangling of
2216 attributes that affect type identity, such as ia32 calling convention
2217 attributes (e.g. @samp{stdcall}).
2218
2219 See also @option{-Wabi}.
2220
2221 @item -fabi-compat-version=@var{n}
2222 @opindex fabi-compat-version
2223 On targets that support strong aliases, G++
2224 works around mangling changes by creating an alias with the correct
2225 mangled name when defining a symbol with an incorrect mangled name.
2226 This switch specifies which ABI version to use for the alias.
2227
2228 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2229 compatibility). If another ABI version is explicitly selected, this
2230 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2231 use @option{-fabi-compat-version=2}.
2232
2233 If this option is not provided but @option{-Wabi=@var{n}} is, that
2234 version is used for compatibility aliases. If this option is provided
2235 along with @option{-Wabi} (without the version), the version from this
2236 option is used for the warning.
2237
2238 @item -fno-access-control
2239 @opindex fno-access-control
2240 Turn off all access checking. This switch is mainly useful for working
2241 around bugs in the access control code.
2242
2243 @item -faligned-new
2244 @opindex faligned-new
2245 Enable support for C++17 @code{new} of types that require more
2246 alignment than @code{void* ::operator new(std::size_t)} provides. A
2247 numeric argument such as @code{-faligned-new=32} can be used to
2248 specify how much alignment (in bytes) is provided by that function,
2249 but few users will need to override the default of
2250 @code{alignof(std::max_align_t)}.
2251
2252 @item -fcheck-new
2253 @opindex fcheck-new
2254 Check that the pointer returned by @code{operator new} is non-null
2255 before attempting to modify the storage allocated. This check is
2256 normally unnecessary because the C++ standard specifies that
2257 @code{operator new} only returns @code{0} if it is declared
2258 @code{throw()}, in which case the compiler always checks the
2259 return value even without this option. In all other cases, when
2260 @code{operator new} has a non-empty exception specification, memory
2261 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2262 @samp{new (nothrow)}.
2263
2264 @item -fconcepts
2265 @opindex fconcepts
2266 Enable support for the C++ Extensions for Concepts Technical
2267 Specification, ISO 19217 (2015), which allows code like
2268
2269 @smallexample
2270 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2271 template <Addable T> T add (T a, T b) @{ return a + b; @}
2272 @end smallexample
2273
2274 @item -fconstexpr-depth=@var{n}
2275 @opindex fconstexpr-depth
2276 Set the maximum nested evaluation depth for C++11 constexpr functions
2277 to @var{n}. A limit is needed to detect endless recursion during
2278 constant expression evaluation. The minimum specified by the standard
2279 is 512.
2280
2281 @item -fconstexpr-loop-limit=@var{n}
2282 @opindex fconstexpr-loop-limit
2283 Set the maximum number of iterations for a loop in C++14 constexpr functions
2284 to @var{n}. A limit is needed to detect infinite loops during
2285 constant expression evaluation. The default is 262144 (1<<18).
2286
2287 @item -fdeduce-init-list
2288 @opindex fdeduce-init-list
2289 Enable deduction of a template type parameter as
2290 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2291
2292 @smallexample
2293 template <class T> auto forward(T t) -> decltype (realfn (t))
2294 @{
2295 return realfn (t);
2296 @}
2297
2298 void f()
2299 @{
2300 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2301 @}
2302 @end smallexample
2303
2304 This deduction was implemented as a possible extension to the
2305 originally proposed semantics for the C++11 standard, but was not part
2306 of the final standard, so it is disabled by default. This option is
2307 deprecated, and may be removed in a future version of G++.
2308
2309 @item -ffriend-injection
2310 @opindex ffriend-injection
2311 Inject friend functions into the enclosing namespace, so that they are
2312 visible outside the scope of the class in which they are declared.
2313 Friend functions were documented to work this way in the old Annotated
2314 C++ Reference Manual.
2315 However, in ISO C++ a friend function that is not declared
2316 in an enclosing scope can only be found using argument dependent
2317 lookup. GCC defaults to the standard behavior.
2318
2319 This option is for compatibility, and may be removed in a future
2320 release of G++.
2321
2322 @item -fno-elide-constructors
2323 @opindex fno-elide-constructors
2324 The C++ standard allows an implementation to omit creating a temporary
2325 that is only used to initialize another object of the same type.
2326 Specifying this option disables that optimization, and forces G++ to
2327 call the copy constructor in all cases.
2328
2329 @item -fno-enforce-eh-specs
2330 @opindex fno-enforce-eh-specs
2331 Don't generate code to check for violation of exception specifications
2332 at run time. This option violates the C++ standard, but may be useful
2333 for reducing code size in production builds, much like defining
2334 @code{NDEBUG}. This does not give user code permission to throw
2335 exceptions in violation of the exception specifications; the compiler
2336 still optimizes based on the specifications, so throwing an
2337 unexpected exception results in undefined behavior at run time.
2338
2339 @item -fextern-tls-init
2340 @itemx -fno-extern-tls-init
2341 @opindex fextern-tls-init
2342 @opindex fno-extern-tls-init
2343 The C++11 and OpenMP standards allow @code{thread_local} and
2344 @code{threadprivate} variables to have dynamic (runtime)
2345 initialization. To support this, any use of such a variable goes
2346 through a wrapper function that performs any necessary initialization.
2347 When the use and definition of the variable are in the same
2348 translation unit, this overhead can be optimized away, but when the
2349 use is in a different translation unit there is significant overhead
2350 even if the variable doesn't actually need dynamic initialization. If
2351 the programmer can be sure that no use of the variable in a
2352 non-defining TU needs to trigger dynamic initialization (either
2353 because the variable is statically initialized, or a use of the
2354 variable in the defining TU will be executed before any uses in
2355 another TU), they can avoid this overhead with the
2356 @option{-fno-extern-tls-init} option.
2357
2358 On targets that support symbol aliases, the default is
2359 @option{-fextern-tls-init}. On targets that do not support symbol
2360 aliases, the default is @option{-fno-extern-tls-init}.
2361
2362 @item -ffor-scope
2363 @itemx -fno-for-scope
2364 @opindex ffor-scope
2365 @opindex fno-for-scope
2366 If @option{-ffor-scope} is specified, the scope of variables declared in
2367 a @i{for-init-statement} is limited to the @code{for} loop itself,
2368 as specified by the C++ standard.
2369 If @option{-fno-for-scope} is specified, the scope of variables declared in
2370 a @i{for-init-statement} extends to the end of the enclosing scope,
2371 as was the case in old versions of G++, and other (traditional)
2372 implementations of C++.
2373
2374 If neither flag is given, the default is to follow the standard,
2375 but to allow and give a warning for old-style code that would
2376 otherwise be invalid, or have different behavior.
2377
2378 @item -fno-gnu-keywords
2379 @opindex fno-gnu-keywords
2380 Do not recognize @code{typeof} as a keyword, so that code can use this
2381 word as an identifier. You can use the keyword @code{__typeof__} instead.
2382 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2383 @option{-std=c++98}, @option{-std=c++11}, etc.
2384
2385 @item -fno-implicit-templates
2386 @opindex fno-implicit-templates
2387 Never emit code for non-inline templates that are instantiated
2388 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2389 @xref{Template Instantiation}, for more information.
2390
2391 @item -fno-implicit-inline-templates
2392 @opindex fno-implicit-inline-templates
2393 Don't emit code for implicit instantiations of inline templates, either.
2394 The default is to handle inlines differently so that compiles with and
2395 without optimization need the same set of explicit instantiations.
2396
2397 @item -fno-implement-inlines
2398 @opindex fno-implement-inlines
2399 To save space, do not emit out-of-line copies of inline functions
2400 controlled by @code{#pragma implementation}. This causes linker
2401 errors if these functions are not inlined everywhere they are called.
2402
2403 @item -fms-extensions
2404 @opindex fms-extensions
2405 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2406 int and getting a pointer to member function via non-standard syntax.
2407
2408 @item -fno-nonansi-builtins
2409 @opindex fno-nonansi-builtins
2410 Disable built-in declarations of functions that are not mandated by
2411 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2412 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2413
2414 @item -fnothrow-opt
2415 @opindex fnothrow-opt
2416 Treat a @code{throw()} exception specification as if it were a
2417 @code{noexcept} specification to reduce or eliminate the text size
2418 overhead relative to a function with no exception specification. If
2419 the function has local variables of types with non-trivial
2420 destructors, the exception specification actually makes the
2421 function smaller because the EH cleanups for those variables can be
2422 optimized away. The semantic effect is that an exception thrown out of
2423 a function with such an exception specification results in a call
2424 to @code{terminate} rather than @code{unexpected}.
2425
2426 @item -fno-operator-names
2427 @opindex fno-operator-names
2428 Do not treat the operator name keywords @code{and}, @code{bitand},
2429 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2430 synonyms as keywords.
2431
2432 @item -fno-optional-diags
2433 @opindex fno-optional-diags
2434 Disable diagnostics that the standard says a compiler does not need to
2435 issue. Currently, the only such diagnostic issued by G++ is the one for
2436 a name having multiple meanings within a class.
2437
2438 @item -fpermissive
2439 @opindex fpermissive
2440 Downgrade some diagnostics about nonconformant code from errors to
2441 warnings. Thus, using @option{-fpermissive} allows some
2442 nonconforming code to compile.
2443
2444 @item -fno-pretty-templates
2445 @opindex fno-pretty-templates
2446 When an error message refers to a specialization of a function
2447 template, the compiler normally prints the signature of the
2448 template followed by the template arguments and any typedefs or
2449 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2450 rather than @code{void f(int)}) so that it's clear which template is
2451 involved. When an error message refers to a specialization of a class
2452 template, the compiler omits any template arguments that match
2453 the default template arguments for that template. If either of these
2454 behaviors make it harder to understand the error message rather than
2455 easier, you can use @option{-fno-pretty-templates} to disable them.
2456
2457 @item -frepo
2458 @opindex frepo
2459 Enable automatic template instantiation at link time. This option also
2460 implies @option{-fno-implicit-templates}. @xref{Template
2461 Instantiation}, for more information.
2462
2463 @item -fno-rtti
2464 @opindex fno-rtti
2465 Disable generation of information about every class with virtual
2466 functions for use by the C++ run-time type identification features
2467 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2468 of the language, you can save some space by using this flag. Note that
2469 exception handling uses the same information, but G++ generates it as
2470 needed. The @code{dynamic_cast} operator can still be used for casts that
2471 do not require run-time type information, i.e.@: casts to @code{void *} or to
2472 unambiguous base classes.
2473
2474 @item -fsized-deallocation
2475 @opindex fsized-deallocation
2476 Enable the built-in global declarations
2477 @smallexample
2478 void operator delete (void *, std::size_t) noexcept;
2479 void operator delete[] (void *, std::size_t) noexcept;
2480 @end smallexample
2481 as introduced in C++14. This is useful for user-defined replacement
2482 deallocation functions that, for example, use the size of the object
2483 to make deallocation faster. Enabled by default under
2484 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2485 warns about places that might want to add a definition.
2486
2487 @item -fstrict-enums
2488 @opindex fstrict-enums
2489 Allow the compiler to optimize using the assumption that a value of
2490 enumerated type can only be one of the values of the enumeration (as
2491 defined in the C++ standard; basically, a value that can be
2492 represented in the minimum number of bits needed to represent all the
2493 enumerators). This assumption may not be valid if the program uses a
2494 cast to convert an arbitrary integer value to the enumerated type.
2495
2496 @item -fstrong-eval-order
2497 @opindex fstrong-eval-order
2498 Evaluate member access, array subscripting, and shift expressions in
2499 left-to-right order, and evaluate assignment in right-to-left order,
2500 as adopted for C++17. Enabled by default with @option{-std=c++1z}.
2501 @option{-fstrong-eval-order=some} enables just the ordering of member
2502 access and shift expressions, and is the default without
2503 @option{-std=c++1z}.
2504
2505 @item -ftemplate-backtrace-limit=@var{n}
2506 @opindex ftemplate-backtrace-limit
2507 Set the maximum number of template instantiation notes for a single
2508 warning or error to @var{n}. The default value is 10.
2509
2510 @item -ftemplate-depth=@var{n}
2511 @opindex ftemplate-depth
2512 Set the maximum instantiation depth for template classes to @var{n}.
2513 A limit on the template instantiation depth is needed to detect
2514 endless recursions during template class instantiation. ANSI/ISO C++
2515 conforming programs must not rely on a maximum depth greater than 17
2516 (changed to 1024 in C++11). The default value is 900, as the compiler
2517 can run out of stack space before hitting 1024 in some situations.
2518
2519 @item -fno-threadsafe-statics
2520 @opindex fno-threadsafe-statics
2521 Do not emit the extra code to use the routines specified in the C++
2522 ABI for thread-safe initialization of local statics. You can use this
2523 option to reduce code size slightly in code that doesn't need to be
2524 thread-safe.
2525
2526 @item -fuse-cxa-atexit
2527 @opindex fuse-cxa-atexit
2528 Register destructors for objects with static storage duration with the
2529 @code{__cxa_atexit} function rather than the @code{atexit} function.
2530 This option is required for fully standards-compliant handling of static
2531 destructors, but only works if your C library supports
2532 @code{__cxa_atexit}.
2533
2534 @item -fno-use-cxa-get-exception-ptr
2535 @opindex fno-use-cxa-get-exception-ptr
2536 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2537 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2538 if the runtime routine is not available.
2539
2540 @item -fvisibility-inlines-hidden
2541 @opindex fvisibility-inlines-hidden
2542 This switch declares that the user does not attempt to compare
2543 pointers to inline functions or methods where the addresses of the two functions
2544 are taken in different shared objects.
2545
2546 The effect of this is that GCC may, effectively, mark inline methods with
2547 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2548 appear in the export table of a DSO and do not require a PLT indirection
2549 when used within the DSO@. Enabling this option can have a dramatic effect
2550 on load and link times of a DSO as it massively reduces the size of the
2551 dynamic export table when the library makes heavy use of templates.
2552
2553 The behavior of this switch is not quite the same as marking the
2554 methods as hidden directly, because it does not affect static variables
2555 local to the function or cause the compiler to deduce that
2556 the function is defined in only one shared object.
2557
2558 You may mark a method as having a visibility explicitly to negate the
2559 effect of the switch for that method. For example, if you do want to
2560 compare pointers to a particular inline method, you might mark it as
2561 having default visibility. Marking the enclosing class with explicit
2562 visibility has no effect.
2563
2564 Explicitly instantiated inline methods are unaffected by this option
2565 as their linkage might otherwise cross a shared library boundary.
2566 @xref{Template Instantiation}.
2567
2568 @item -fvisibility-ms-compat
2569 @opindex fvisibility-ms-compat
2570 This flag attempts to use visibility settings to make GCC's C++
2571 linkage model compatible with that of Microsoft Visual Studio.
2572
2573 The flag makes these changes to GCC's linkage model:
2574
2575 @enumerate
2576 @item
2577 It sets the default visibility to @code{hidden}, like
2578 @option{-fvisibility=hidden}.
2579
2580 @item
2581 Types, but not their members, are not hidden by default.
2582
2583 @item
2584 The One Definition Rule is relaxed for types without explicit
2585 visibility specifications that are defined in more than one
2586 shared object: those declarations are permitted if they are
2587 permitted when this option is not used.
2588 @end enumerate
2589
2590 In new code it is better to use @option{-fvisibility=hidden} and
2591 export those classes that are intended to be externally visible.
2592 Unfortunately it is possible for code to rely, perhaps accidentally,
2593 on the Visual Studio behavior.
2594
2595 Among the consequences of these changes are that static data members
2596 of the same type with the same name but defined in different shared
2597 objects are different, so changing one does not change the other;
2598 and that pointers to function members defined in different shared
2599 objects may not compare equal. When this flag is given, it is a
2600 violation of the ODR to define types with the same name differently.
2601
2602 @item -fno-weak
2603 @opindex fno-weak
2604 Do not use weak symbol support, even if it is provided by the linker.
2605 By default, G++ uses weak symbols if they are available. This
2606 option exists only for testing, and should not be used by end-users;
2607 it results in inferior code and has no benefits. This option may
2608 be removed in a future release of G++.
2609
2610 @item -nostdinc++
2611 @opindex nostdinc++
2612 Do not search for header files in the standard directories specific to
2613 C++, but do still search the other standard directories. (This option
2614 is used when building the C++ library.)
2615 @end table
2616
2617 In addition, these optimization, warning, and code generation options
2618 have meanings only for C++ programs:
2619
2620 @table @gcctabopt
2621 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2622 @opindex Wabi
2623 @opindex Wno-abi
2624 Warn when G++ it generates code that is probably not compatible with
2625 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2626 ABI with each major release, normally @option{-Wabi} will warn only if
2627 there is a check added later in a release series for an ABI issue
2628 discovered since the initial release. @option{-Wabi} will warn about
2629 more things if an older ABI version is selected (with
2630 @option{-fabi-version=@var{n}}).
2631
2632 @option{-Wabi} can also be used with an explicit version number to
2633 warn about compatibility with a particular @option{-fabi-version}
2634 level, e.g. @option{-Wabi=2} to warn about changes relative to
2635 @option{-fabi-version=2}.
2636
2637 If an explicit version number is provided and
2638 @option{-fabi-compat-version} is not specified, the version number
2639 from this option is used for compatibility aliases. If no explicit
2640 version number is provided with this option, but
2641 @option{-fabi-compat-version} is specified, that version number is
2642 used for ABI warnings.
2643
2644 Although an effort has been made to warn about
2645 all such cases, there are probably some cases that are not warned about,
2646 even though G++ is generating incompatible code. There may also be
2647 cases where warnings are emitted even though the code that is generated
2648 is compatible.
2649
2650 You should rewrite your code to avoid these warnings if you are
2651 concerned about the fact that code generated by G++ may not be binary
2652 compatible with code generated by other compilers.
2653
2654 Known incompatibilities in @option{-fabi-version=2} (which was the
2655 default from GCC 3.4 to 4.9) include:
2656
2657 @itemize @bullet
2658
2659 @item
2660 A template with a non-type template parameter of reference type was
2661 mangled incorrectly:
2662 @smallexample
2663 extern int N;
2664 template <int &> struct S @{@};
2665 void n (S<N>) @{2@}
2666 @end smallexample
2667
2668 This was fixed in @option{-fabi-version=3}.
2669
2670 @item
2671 SIMD vector types declared using @code{__attribute ((vector_size))} were
2672 mangled in a non-standard way that does not allow for overloading of
2673 functions taking vectors of different sizes.
2674
2675 The mangling was changed in @option{-fabi-version=4}.
2676
2677 @item
2678 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2679 qualifiers, and @code{decltype} of a plain declaration was folded away.
2680
2681 These mangling issues were fixed in @option{-fabi-version=5}.
2682
2683 @item
2684 Scoped enumerators passed as arguments to a variadic function are
2685 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2686 On most targets this does not actually affect the parameter passing
2687 ABI, as there is no way to pass an argument smaller than @code{int}.
2688
2689 Also, the ABI changed the mangling of template argument packs,
2690 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2691 a class scope function used as a template argument.
2692
2693 These issues were corrected in @option{-fabi-version=6}.
2694
2695 @item
2696 Lambdas in default argument scope were mangled incorrectly, and the
2697 ABI changed the mangling of @code{nullptr_t}.
2698
2699 These issues were corrected in @option{-fabi-version=7}.
2700
2701 @item
2702 When mangling a function type with function-cv-qualifiers, the
2703 un-qualified function type was incorrectly treated as a substitution
2704 candidate.
2705
2706 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2707
2708 @item
2709 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2710 unaligned accesses. Note that this did not affect the ABI of a
2711 function with a @code{nullptr_t} parameter, as parameters have a
2712 minimum alignment.
2713
2714 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2715
2716 @item
2717 Target-specific attributes that affect the identity of a type, such as
2718 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2719 did not affect the mangled name, leading to name collisions when
2720 function pointers were used as template arguments.
2721
2722 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2723
2724 @end itemize
2725
2726 It also warns about psABI-related changes. The known psABI changes at this
2727 point include:
2728
2729 @itemize @bullet
2730
2731 @item
2732 For SysV/x86-64, unions with @code{long double} members are
2733 passed in memory as specified in psABI. For example:
2734
2735 @smallexample
2736 union U @{
2737 long double ld;
2738 int i;
2739 @};
2740 @end smallexample
2741
2742 @noindent
2743 @code{union U} is always passed in memory.
2744
2745 @end itemize
2746
2747 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2748 @opindex Wabi-tag
2749 @opindex -Wabi-tag
2750 Warn when a type with an ABI tag is used in a context that does not
2751 have that ABI tag. See @ref{C++ Attributes} for more information
2752 about ABI tags.
2753
2754 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2755 @opindex Wctor-dtor-privacy
2756 @opindex Wno-ctor-dtor-privacy
2757 Warn when a class seems unusable because all the constructors or
2758 destructors in that class are private, and it has neither friends nor
2759 public static member functions. Also warn if there are no non-private
2760 methods, and there's at least one private member function that isn't
2761 a constructor or destructor.
2762
2763 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2764 @opindex Wdelete-non-virtual-dtor
2765 @opindex Wno-delete-non-virtual-dtor
2766 Warn when @code{delete} is used to destroy an instance of a class that
2767 has virtual functions and non-virtual destructor. It is unsafe to delete
2768 an instance of a derived class through a pointer to a base class if the
2769 base class does not have a virtual destructor. This warning is enabled
2770 by @option{-Wall}.
2771
2772 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2773 @opindex Wliteral-suffix
2774 @opindex Wno-literal-suffix
2775 Warn when a string or character literal is followed by a ud-suffix which does
2776 not begin with an underscore. As a conforming extension, GCC treats such
2777 suffixes as separate preprocessing tokens in order to maintain backwards
2778 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2779 For example:
2780
2781 @smallexample
2782 #define __STDC_FORMAT_MACROS
2783 #include <inttypes.h>
2784 #include <stdio.h>
2785
2786 int main() @{
2787 int64_t i64 = 123;
2788 printf("My int64: %" PRId64"\n", i64);
2789 @}
2790 @end smallexample
2791
2792 In this case, @code{PRId64} is treated as a separate preprocessing token.
2793
2794 This warning is enabled by default.
2795
2796 @item -Wlto-type-mismatch
2797 @opindex Wlto-type-mismatch
2798 @opindex Wno-lto-type-mismatch
2799
2800 During the link-time optimization warn about type mismatches in
2801 global declarations from different compilation units.
2802 Requires @option{-flto} to be enabled. Enabled by default.
2803
2804 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2805 @opindex Wnarrowing
2806 @opindex Wno-narrowing
2807 With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing
2808 conversion prohibited by C++11 occurs within
2809 @samp{@{ @}}, e.g.
2810
2811 @smallexample
2812 int i = @{ 2.2 @}; // error: narrowing from double to int
2813 @end smallexample
2814
2815 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2816
2817 When a later standard is in effect, e.g. when using @option{-std=c++11},
2818 narrowing conversions are diagnosed by default, as required by the standard.
2819 A narrowing conversion from a constant produces an error,
2820 and a narrowing conversion from a non-constant produces a warning,
2821 but @option{-Wno-narrowing} suppresses the diagnostic.
2822 Note that this does not affect the meaning of well-formed code;
2823 narrowing conversions are still considered ill-formed in SFINAE contexts.
2824
2825 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2826 @opindex Wnoexcept
2827 @opindex Wno-noexcept
2828 Warn when a noexcept-expression evaluates to false because of a call
2829 to a function that does not have a non-throwing exception
2830 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2831 the compiler to never throw an exception.
2832
2833 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2834 @opindex Wnon-virtual-dtor
2835 @opindex Wno-non-virtual-dtor
2836 Warn when a class has virtual functions and an accessible non-virtual
2837 destructor itself or in an accessible polymorphic base class, in which
2838 case it is possible but unsafe to delete an instance of a derived
2839 class through a pointer to the class itself or base class. This
2840 warning is automatically enabled if @option{-Weffc++} is specified.
2841
2842 @item -Wreorder @r{(C++ and Objective-C++ only)}
2843 @opindex Wreorder
2844 @opindex Wno-reorder
2845 @cindex reordering, warning
2846 @cindex warning for reordering of member initializers
2847 Warn when the order of member initializers given in the code does not
2848 match the order in which they must be executed. For instance:
2849
2850 @smallexample
2851 struct A @{
2852 int i;
2853 int j;
2854 A(): j (0), i (1) @{ @}
2855 @};
2856 @end smallexample
2857
2858 @noindent
2859 The compiler rearranges the member initializers for @code{i}
2860 and @code{j} to match the declaration order of the members, emitting
2861 a warning to that effect. This warning is enabled by @option{-Wall}.
2862
2863 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2864 @opindex fext-numeric-literals
2865 @opindex fno-ext-numeric-literals
2866 Accept imaginary, fixed-point, or machine-defined
2867 literal number suffixes as GNU extensions.
2868 When this option is turned off these suffixes are treated
2869 as C++11 user-defined literal numeric suffixes.
2870 This is on by default for all pre-C++11 dialects and all GNU dialects:
2871 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2872 @option{-std=gnu++14}.
2873 This option is off by default
2874 for ISO C++11 onwards (@option{-std=c++11}, ...).
2875 @end table
2876
2877 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2878
2879 @table @gcctabopt
2880 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2881 @opindex Weffc++
2882 @opindex Wno-effc++
2883 Warn about violations of the following style guidelines from Scott Meyers'
2884 @cite{Effective C++} series of books:
2885
2886 @itemize @bullet
2887 @item
2888 Define a copy constructor and an assignment operator for classes
2889 with dynamically-allocated memory.
2890
2891 @item
2892 Prefer initialization to assignment in constructors.
2893
2894 @item
2895 Have @code{operator=} return a reference to @code{*this}.
2896
2897 @item
2898 Don't try to return a reference when you must return an object.
2899
2900 @item
2901 Distinguish between prefix and postfix forms of increment and
2902 decrement operators.
2903
2904 @item
2905 Never overload @code{&&}, @code{||}, or @code{,}.
2906
2907 @end itemize
2908
2909 This option also enables @option{-Wnon-virtual-dtor}, which is also
2910 one of the effective C++ recommendations. However, the check is
2911 extended to warn about the lack of virtual destructor in accessible
2912 non-polymorphic bases classes too.
2913
2914 When selecting this option, be aware that the standard library
2915 headers do not obey all of these guidelines; use @samp{grep -v}
2916 to filter out those warnings.
2917
2918 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2919 @opindex Wstrict-null-sentinel
2920 @opindex Wno-strict-null-sentinel
2921 Warn about the use of an uncasted @code{NULL} as sentinel. When
2922 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2923 to @code{__null}. Although it is a null pointer constant rather than a
2924 null pointer, it is guaranteed to be of the same size as a pointer.
2925 But this use is not portable across different compilers.
2926
2927 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2928 @opindex Wno-non-template-friend
2929 @opindex Wnon-template-friend
2930 Disable warnings when non-templatized friend functions are declared
2931 within a template. Since the advent of explicit template specification
2932 support in G++, if the name of the friend is an unqualified-id (i.e.,
2933 @samp{friend foo(int)}), the C++ language specification demands that the
2934 friend declare or define an ordinary, nontemplate function. (Section
2935 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2936 could be interpreted as a particular specialization of a templatized
2937 function. Because this non-conforming behavior is no longer the default
2938 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2939 check existing code for potential trouble spots and is on by default.
2940 This new compiler behavior can be turned off with
2941 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2942 but disables the helpful warning.
2943
2944 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2945 @opindex Wold-style-cast
2946 @opindex Wno-old-style-cast
2947 Warn if an old-style (C-style) cast to a non-void type is used within
2948 a C++ program. The new-style casts (@code{dynamic_cast},
2949 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
2950 less vulnerable to unintended effects and much easier to search for.
2951
2952 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2953 @opindex Woverloaded-virtual
2954 @opindex Wno-overloaded-virtual
2955 @cindex overloaded virtual function, warning
2956 @cindex warning for overloaded virtual function
2957 Warn when a function declaration hides virtual functions from a
2958 base class. For example, in:
2959
2960 @smallexample
2961 struct A @{
2962 virtual void f();
2963 @};
2964
2965 struct B: public A @{
2966 void f(int);
2967 @};
2968 @end smallexample
2969
2970 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2971 like:
2972
2973 @smallexample
2974 B* b;
2975 b->f();
2976 @end smallexample
2977
2978 @noindent
2979 fails to compile.
2980
2981 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2982 @opindex Wno-pmf-conversions
2983 @opindex Wpmf-conversions
2984 Disable the diagnostic for converting a bound pointer to member function
2985 to a plain pointer.
2986
2987 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2988 @opindex Wsign-promo
2989 @opindex Wno-sign-promo
2990 Warn when overload resolution chooses a promotion from unsigned or
2991 enumerated type to a signed type, over a conversion to an unsigned type of
2992 the same size. Previous versions of G++ tried to preserve
2993 unsignedness, but the standard mandates the current behavior.
2994
2995 @item -Wtemplates @r{(C++ and Objective-C++ only)}
2996 @opindex Wtemplates
2997 Warn when a primary template declaration is encountered. Some coding
2998 rules disallow templates, and this may be used to enforce that rule.
2999 The warning is inactive inside a system header file, such as the STL, so
3000 one can still use the STL. One may also instantiate or specialize
3001 templates.
3002
3003 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3004 @opindex Wmultiple-inheritance
3005 Warn when a class is defined with multiple direct base classes. Some
3006 coding rules disallow multiple inheritance, and this may be used to
3007 enforce that rule. The warning is inactive inside a system header file,
3008 such as the STL, so one can still use the STL. One may also define
3009 classes that indirectly use multiple inheritance.
3010
3011 @item -Wvirtual-inheritance
3012 @opindex Wvirtual-inheritance
3013 Warn when a class is defined with a virtual direct base classe. Some
3014 coding rules disallow multiple inheritance, and this may be used to
3015 enforce that rule. The warning is inactive inside a system header file,
3016 such as the STL, so one can still use the STL. One may also define
3017 classes that indirectly use virtual inheritance.
3018
3019 @item -Wnamespaces
3020 @opindex Wnamespaces
3021 Warn when a namespace definition is opened. Some coding rules disallow
3022 namespaces, and this may be used to enforce that rule. The warning is
3023 inactive inside a system header file, such as the STL, so one can still
3024 use the STL. One may also use using directives and qualified names.
3025
3026 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3027 @opindex Wterminate
3028 @opindex Wno-terminate
3029 Disable the warning about a throw-expression that will immediately
3030 result in a call to @code{terminate}.
3031 @end table
3032
3033 @node Objective-C and Objective-C++ Dialect Options
3034 @section Options Controlling Objective-C and Objective-C++ Dialects
3035
3036 @cindex compiler options, Objective-C and Objective-C++
3037 @cindex Objective-C and Objective-C++ options, command-line
3038 @cindex options, Objective-C and Objective-C++
3039 (NOTE: This manual does not describe the Objective-C and Objective-C++
3040 languages themselves. @xref{Standards,,Language Standards
3041 Supported by GCC}, for references.)
3042
3043 This section describes the command-line options that are only meaningful
3044 for Objective-C and Objective-C++ programs. You can also use most of
3045 the language-independent GNU compiler options.
3046 For example, you might compile a file @file{some_class.m} like this:
3047
3048 @smallexample
3049 gcc -g -fgnu-runtime -O -c some_class.m
3050 @end smallexample
3051
3052 @noindent
3053 In this example, @option{-fgnu-runtime} is an option meant only for
3054 Objective-C and Objective-C++ programs; you can use the other options with
3055 any language supported by GCC@.
3056
3057 Note that since Objective-C is an extension of the C language, Objective-C
3058 compilations may also use options specific to the C front-end (e.g.,
3059 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3060 C++-specific options (e.g., @option{-Wabi}).
3061
3062 Here is a list of options that are @emph{only} for compiling Objective-C
3063 and Objective-C++ programs:
3064
3065 @table @gcctabopt
3066 @item -fconstant-string-class=@var{class-name}
3067 @opindex fconstant-string-class
3068 Use @var{class-name} as the name of the class to instantiate for each
3069 literal string specified with the syntax @code{@@"@dots{}"}. The default
3070 class name is @code{NXConstantString} if the GNU runtime is being used, and
3071 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3072 @option{-fconstant-cfstrings} option, if also present, overrides the
3073 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3074 to be laid out as constant CoreFoundation strings.
3075
3076 @item -fgnu-runtime
3077 @opindex fgnu-runtime
3078 Generate object code compatible with the standard GNU Objective-C
3079 runtime. This is the default for most types of systems.
3080
3081 @item -fnext-runtime
3082 @opindex fnext-runtime
3083 Generate output compatible with the NeXT runtime. This is the default
3084 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3085 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3086 used.
3087
3088 @item -fno-nil-receivers
3089 @opindex fno-nil-receivers
3090 Assume that all Objective-C message dispatches (@code{[receiver
3091 message:arg]}) in this translation unit ensure that the receiver is
3092 not @code{nil}. This allows for more efficient entry points in the
3093 runtime to be used. This option is only available in conjunction with
3094 the NeXT runtime and ABI version 0 or 1.
3095
3096 @item -fobjc-abi-version=@var{n}
3097 @opindex fobjc-abi-version
3098 Use version @var{n} of the Objective-C ABI for the selected runtime.
3099 This option is currently supported only for the NeXT runtime. In that
3100 case, Version 0 is the traditional (32-bit) ABI without support for
3101 properties and other Objective-C 2.0 additions. Version 1 is the
3102 traditional (32-bit) ABI with support for properties and other
3103 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3104 nothing is specified, the default is Version 0 on 32-bit target
3105 machines, and Version 2 on 64-bit target machines.
3106
3107 @item -fobjc-call-cxx-cdtors
3108 @opindex fobjc-call-cxx-cdtors
3109 For each Objective-C class, check if any of its instance variables is a
3110 C++ object with a non-trivial default constructor. If so, synthesize a
3111 special @code{- (id) .cxx_construct} instance method which runs
3112 non-trivial default constructors on any such instance variables, in order,
3113 and then return @code{self}. Similarly, check if any instance variable
3114 is a C++ object with a non-trivial destructor, and if so, synthesize a
3115 special @code{- (void) .cxx_destruct} method which runs
3116 all such default destructors, in reverse order.
3117
3118 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3119 methods thusly generated only operate on instance variables
3120 declared in the current Objective-C class, and not those inherited
3121 from superclasses. It is the responsibility of the Objective-C
3122 runtime to invoke all such methods in an object's inheritance
3123 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3124 by the runtime immediately after a new object instance is allocated;
3125 the @code{- (void) .cxx_destruct} methods are invoked immediately
3126 before the runtime deallocates an object instance.
3127
3128 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3129 support for invoking the @code{- (id) .cxx_construct} and
3130 @code{- (void) .cxx_destruct} methods.
3131
3132 @item -fobjc-direct-dispatch
3133 @opindex fobjc-direct-dispatch
3134 Allow fast jumps to the message dispatcher. On Darwin this is
3135 accomplished via the comm page.
3136
3137 @item -fobjc-exceptions
3138 @opindex fobjc-exceptions
3139 Enable syntactic support for structured exception handling in
3140 Objective-C, similar to what is offered by C++ and Java. This option
3141 is required to use the Objective-C keywords @code{@@try},
3142 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3143 @code{@@synchronized}. This option is available with both the GNU
3144 runtime and the NeXT runtime (but not available in conjunction with
3145 the NeXT runtime on Mac OS X 10.2 and earlier).
3146
3147 @item -fobjc-gc
3148 @opindex fobjc-gc
3149 Enable garbage collection (GC) in Objective-C and Objective-C++
3150 programs. This option is only available with the NeXT runtime; the
3151 GNU runtime has a different garbage collection implementation that
3152 does not require special compiler flags.
3153
3154 @item -fobjc-nilcheck
3155 @opindex fobjc-nilcheck
3156 For the NeXT runtime with version 2 of the ABI, check for a nil
3157 receiver in method invocations before doing the actual method call.
3158 This is the default and can be disabled using
3159 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3160 checked for nil in this way no matter what this flag is set to.
3161 Currently this flag does nothing when the GNU runtime, or an older
3162 version of the NeXT runtime ABI, is used.
3163
3164 @item -fobjc-std=objc1
3165 @opindex fobjc-std
3166 Conform to the language syntax of Objective-C 1.0, the language
3167 recognized by GCC 4.0. This only affects the Objective-C additions to
3168 the C/C++ language; it does not affect conformance to C/C++ standards,
3169 which is controlled by the separate C/C++ dialect option flags. When
3170 this option is used with the Objective-C or Objective-C++ compiler,
3171 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3172 This is useful if you need to make sure that your Objective-C code can
3173 be compiled with older versions of GCC@.
3174
3175 @item -freplace-objc-classes
3176 @opindex freplace-objc-classes
3177 Emit a special marker instructing @command{ld(1)} not to statically link in
3178 the resulting object file, and allow @command{dyld(1)} to load it in at
3179 run time instead. This is used in conjunction with the Fix-and-Continue
3180 debugging mode, where the object file in question may be recompiled and
3181 dynamically reloaded in the course of program execution, without the need
3182 to restart the program itself. Currently, Fix-and-Continue functionality
3183 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3184 and later.
3185
3186 @item -fzero-link
3187 @opindex fzero-link
3188 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3189 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3190 compile time) with static class references that get initialized at load time,
3191 which improves run-time performance. Specifying the @option{-fzero-link} flag
3192 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3193 to be retained. This is useful in Zero-Link debugging mode, since it allows
3194 for individual class implementations to be modified during program execution.
3195 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3196 regardless of command-line options.
3197
3198 @item -fno-local-ivars
3199 @opindex fno-local-ivars
3200 @opindex flocal-ivars
3201 By default instance variables in Objective-C can be accessed as if
3202 they were local variables from within the methods of the class they're
3203 declared in. This can lead to shadowing between instance variables
3204 and other variables declared either locally inside a class method or
3205 globally with the same name. Specifying the @option{-fno-local-ivars}
3206 flag disables this behavior thus avoiding variable shadowing issues.
3207
3208 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3209 @opindex fivar-visibility
3210 Set the default instance variable visibility to the specified option
3211 so that instance variables declared outside the scope of any access
3212 modifier directives default to the specified visibility.
3213
3214 @item -gen-decls
3215 @opindex gen-decls
3216 Dump interface declarations for all classes seen in the source file to a
3217 file named @file{@var{sourcename}.decl}.
3218
3219 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3220 @opindex Wassign-intercept
3221 @opindex Wno-assign-intercept
3222 Warn whenever an Objective-C assignment is being intercepted by the
3223 garbage collector.
3224
3225 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3226 @opindex Wno-protocol
3227 @opindex Wprotocol
3228 If a class is declared to implement a protocol, a warning is issued for
3229 every method in the protocol that is not implemented by the class. The
3230 default behavior is to issue a warning for every method not explicitly
3231 implemented in the class, even if a method implementation is inherited
3232 from the superclass. If you use the @option{-Wno-protocol} option, then
3233 methods inherited from the superclass are considered to be implemented,
3234 and no warning is issued for them.
3235
3236 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3237 @opindex Wselector
3238 @opindex Wno-selector
3239 Warn if multiple methods of different types for the same selector are
3240 found during compilation. The check is performed on the list of methods
3241 in the final stage of compilation. Additionally, a check is performed
3242 for each selector appearing in a @code{@@selector(@dots{})}
3243 expression, and a corresponding method for that selector has been found
3244 during compilation. Because these checks scan the method table only at
3245 the end of compilation, these warnings are not produced if the final
3246 stage of compilation is not reached, for example because an error is
3247 found during compilation, or because the @option{-fsyntax-only} option is
3248 being used.
3249
3250 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3251 @opindex Wstrict-selector-match
3252 @opindex Wno-strict-selector-match
3253 Warn if multiple methods with differing argument and/or return types are
3254 found for a given selector when attempting to send a message using this
3255 selector to a receiver of type @code{id} or @code{Class}. When this flag
3256 is off (which is the default behavior), the compiler omits such warnings
3257 if any differences found are confined to types that share the same size
3258 and alignment.
3259
3260 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3261 @opindex Wundeclared-selector
3262 @opindex Wno-undeclared-selector
3263 Warn if a @code{@@selector(@dots{})} expression referring to an
3264 undeclared selector is found. A selector is considered undeclared if no
3265 method with that name has been declared before the
3266 @code{@@selector(@dots{})} expression, either explicitly in an
3267 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3268 an @code{@@implementation} section. This option always performs its
3269 checks as soon as a @code{@@selector(@dots{})} expression is found,
3270 while @option{-Wselector} only performs its checks in the final stage of
3271 compilation. This also enforces the coding style convention
3272 that methods and selectors must be declared before being used.
3273
3274 @item -print-objc-runtime-info
3275 @opindex print-objc-runtime-info
3276 Generate C header describing the largest structure that is passed by
3277 value, if any.
3278
3279 @end table
3280
3281 @node Diagnostic Message Formatting Options
3282 @section Options to Control Diagnostic Messages Formatting
3283 @cindex options to control diagnostics formatting
3284 @cindex diagnostic messages
3285 @cindex message formatting
3286
3287 Traditionally, diagnostic messages have been formatted irrespective of
3288 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3289 options described below
3290 to control the formatting algorithm for diagnostic messages,
3291 e.g.@: how many characters per line, how often source location
3292 information should be reported. Note that some language front ends may not
3293 honor these options.
3294
3295 @table @gcctabopt
3296 @item -fmessage-length=@var{n}
3297 @opindex fmessage-length
3298 Try to format error messages so that they fit on lines of about
3299 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3300 done; each error message appears on a single line. This is the
3301 default for all front ends.
3302
3303 @item -fdiagnostics-show-location=once
3304 @opindex fdiagnostics-show-location
3305 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3306 reporter to emit source location information @emph{once}; that is, in
3307 case the message is too long to fit on a single physical line and has to
3308 be wrapped, the source location won't be emitted (as prefix) again,
3309 over and over, in subsequent continuation lines. This is the default
3310 behavior.
3311
3312 @item -fdiagnostics-show-location=every-line
3313 Only meaningful in line-wrapping mode. Instructs the diagnostic
3314 messages reporter to emit the same source location information (as
3315 prefix) for physical lines that result from the process of breaking
3316 a message which is too long to fit on a single line.
3317
3318 @item -fdiagnostics-color[=@var{WHEN}]
3319 @itemx -fno-diagnostics-color
3320 @opindex fdiagnostics-color
3321 @cindex highlight, color
3322 @vindex GCC_COLORS @r{environment variable}
3323 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3324 or @samp{auto}. The default depends on how the compiler has been configured,
3325 it can be any of the above @var{WHEN} options or also @samp{never}
3326 if @env{GCC_COLORS} environment variable isn't present in the environment,
3327 and @samp{auto} otherwise.
3328 @samp{auto} means to use color only when the standard error is a terminal.
3329 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3330 aliases for @option{-fdiagnostics-color=always} and
3331 @option{-fdiagnostics-color=never}, respectively.
3332
3333 The colors are defined by the environment variable @env{GCC_COLORS}.
3334 Its value is a colon-separated list of capabilities and Select Graphic
3335 Rendition (SGR) substrings. SGR commands are interpreted by the
3336 terminal or terminal emulator. (See the section in the documentation
3337 of your text terminal for permitted values and their meanings as
3338 character attributes.) These substring values are integers in decimal
3339 representation and can be concatenated with semicolons.
3340 Common values to concatenate include
3341 @samp{1} for bold,
3342 @samp{4} for underline,
3343 @samp{5} for blink,
3344 @samp{7} for inverse,
3345 @samp{39} for default foreground color,
3346 @samp{30} to @samp{37} for foreground colors,
3347 @samp{90} to @samp{97} for 16-color mode foreground colors,
3348 @samp{38;5;0} to @samp{38;5;255}
3349 for 88-color and 256-color modes foreground colors,
3350 @samp{49} for default background color,
3351 @samp{40} to @samp{47} for background colors,
3352 @samp{100} to @samp{107} for 16-color mode background colors,
3353 and @samp{48;5;0} to @samp{48;5;255}
3354 for 88-color and 256-color modes background colors.
3355
3356 The default @env{GCC_COLORS} is
3357 @smallexample
3358 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:quote=01:\
3359 fixit-insert=32:fixit-delete=31:\
3360 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32
3361 @end smallexample
3362 @noindent
3363 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3364 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3365 @samp{01} is bold, and @samp{31} is red.
3366 Setting @env{GCC_COLORS} to the empty string disables colors.
3367 Supported capabilities are as follows.
3368
3369 @table @code
3370 @item error=
3371 @vindex error GCC_COLORS @r{capability}
3372 SGR substring for error: markers.
3373
3374 @item warning=
3375 @vindex warning GCC_COLORS @r{capability}
3376 SGR substring for warning: markers.
3377
3378 @item note=
3379 @vindex note GCC_COLORS @r{capability}
3380 SGR substring for note: markers.
3381
3382 @item range1=
3383 @vindex range1 GCC_COLORS @r{capability}
3384 SGR substring for first additional range.
3385
3386 @item range2=
3387 @vindex range2 GCC_COLORS @r{capability}
3388 SGR substring for second additional range.
3389
3390 @item locus=
3391 @vindex locus GCC_COLORS @r{capability}
3392 SGR substring for location information, @samp{file:line} or
3393 @samp{file:line:column} etc.
3394
3395 @item quote=
3396 @vindex quote GCC_COLORS @r{capability}
3397 SGR substring for information printed within quotes.
3398
3399 @item fixit-insert=
3400 @vindex fixit-insert GCC_COLORS @r{capability}
3401 SGR substring for fix-it hints suggesting text to
3402 be inserted or replaced.
3403
3404 @item fixit-delete=
3405 @vindex fixit-delete GCC_COLORS @r{capability}
3406 SGR substring for fix-it hints suggesting text to
3407 be deleted.
3408
3409 @item diff-filename=
3410 @vindex diff-filename GCC_COLORS @r{capability}
3411 SGR substring for filename headers within generated patches.
3412
3413 @item diff-hunk=
3414 @vindex diff-hunk GCC_COLORS @r{capability}
3415 SGR substring for the starts of hunks within generated patches.
3416
3417 @item diff-delete=
3418 @vindex diff-delete GCC_COLORS @r{capability}
3419 SGR substring for deleted lines within generated patches.
3420
3421 @item diff-insert=
3422 @vindex diff-insert GCC_COLORS @r{capability}
3423 SGR substring for inserted lines within generated patches.
3424 @end table
3425
3426 @item -fno-diagnostics-show-option
3427 @opindex fno-diagnostics-show-option
3428 @opindex fdiagnostics-show-option
3429 By default, each diagnostic emitted includes text indicating the
3430 command-line option that directly controls the diagnostic (if such an
3431 option is known to the diagnostic machinery). Specifying the
3432 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3433
3434 @item -fno-diagnostics-show-caret
3435 @opindex fno-diagnostics-show-caret
3436 @opindex fdiagnostics-show-caret
3437 By default, each diagnostic emitted includes the original source line
3438 and a caret @samp{^} indicating the column. This option suppresses this
3439 information. The source line is truncated to @var{n} characters, if
3440 the @option{-fmessage-length=n} option is given. When the output is done
3441 to the terminal, the width is limited to the width given by the
3442 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3443
3444 @item -fdiagnostics-parseable-fixits
3445 @opindex fdiagnostics-parseable-fixits
3446 Emit fix-it hints in a machine-parseable format, suitable for consumption
3447 by IDEs. For each fix-it, a line will be printed after the relevant
3448 diagnostic, starting with the string ``fix-it:''. For example:
3449
3450 @smallexample
3451 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3452 @end smallexample
3453
3454 The location is expressed as a half-open range, expressed as a count of
3455 bytes, starting at byte 1 for the initial column. In the above example,
3456 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3457 given string:
3458
3459 @smallexample
3460 00000000011111111112222222222
3461 12345678901234567890123456789
3462 gtk_widget_showall (dlg);
3463 ^^^^^^^^^^^^^^^^^^
3464 gtk_widget_show_all
3465 @end smallexample
3466
3467 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3468 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3469 (e.g. vertical tab as ``\013'').
3470
3471 An empty replacement string indicates that the given range is to be removed.
3472 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3473 be inserted at the given position.
3474
3475 @item -fdiagnostics-generate-patch
3476 @opindex fdiagnostics-generate-patch
3477 Print fix-it hints to stderr in unified diff format, after any diagnostics
3478 are printed. For example:
3479
3480 @smallexample
3481 --- test.c
3482 +++ test.c
3483 @@ -42,5 +42,5 @@
3484
3485 void show_cb(GtkDialog *dlg)
3486 @{
3487 - gtk_widget_showall(dlg);
3488 + gtk_widget_show_all(dlg);
3489 @}
3490
3491 @end smallexample
3492
3493 The diff may or may not be colorized, following the same rules
3494 as for diagnostics (see @option{-fdiagnostics-color}).
3495
3496 @end table
3497
3498 @node Warning Options
3499 @section Options to Request or Suppress Warnings
3500 @cindex options to control warnings
3501 @cindex warning messages
3502 @cindex messages, warning
3503 @cindex suppressing warnings
3504
3505 Warnings are diagnostic messages that report constructions that
3506 are not inherently erroneous but that are risky or suggest there
3507 may have been an error.
3508
3509 The following language-independent options do not enable specific
3510 warnings but control the kinds of diagnostics produced by GCC@.
3511
3512 @table @gcctabopt
3513 @cindex syntax checking
3514 @item -fsyntax-only
3515 @opindex fsyntax-only
3516 Check the code for syntax errors, but don't do anything beyond that.
3517
3518 @item -fmax-errors=@var{n}
3519 @opindex fmax-errors
3520 Limits the maximum number of error messages to @var{n}, at which point
3521 GCC bails out rather than attempting to continue processing the source
3522 code. If @var{n} is 0 (the default), there is no limit on the number
3523 of error messages produced. If @option{-Wfatal-errors} is also
3524 specified, then @option{-Wfatal-errors} takes precedence over this
3525 option.
3526
3527 @item -w
3528 @opindex w
3529 Inhibit all warning messages.
3530
3531 @item -Werror
3532 @opindex Werror
3533 @opindex Wno-error
3534 Make all warnings into errors.
3535
3536 @item -Werror=
3537 @opindex Werror=
3538 @opindex Wno-error=
3539 Make the specified warning into an error. The specifier for a warning
3540 is appended; for example @option{-Werror=switch} turns the warnings
3541 controlled by @option{-Wswitch} into errors. This switch takes a
3542 negative form, to be used to negate @option{-Werror} for specific
3543 warnings; for example @option{-Wno-error=switch} makes
3544 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3545 is in effect.
3546
3547 The warning message for each controllable warning includes the
3548 option that controls the warning. That option can then be used with
3549 @option{-Werror=} and @option{-Wno-error=} as described above.
3550 (Printing of the option in the warning message can be disabled using the
3551 @option{-fno-diagnostics-show-option} flag.)
3552
3553 Note that specifying @option{-Werror=}@var{foo} automatically implies
3554 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3555 imply anything.
3556
3557 @item -Wfatal-errors
3558 @opindex Wfatal-errors
3559 @opindex Wno-fatal-errors
3560 This option causes the compiler to abort compilation on the first error
3561 occurred rather than trying to keep going and printing further error
3562 messages.
3563
3564 @end table
3565
3566 You can request many specific warnings with options beginning with
3567 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3568 implicit declarations. Each of these specific warning options also
3569 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3570 example, @option{-Wno-implicit}. This manual lists only one of the
3571 two forms, whichever is not the default. For further
3572 language-specific options also refer to @ref{C++ Dialect Options} and
3573 @ref{Objective-C and Objective-C++ Dialect Options}.
3574
3575 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3576 options, such as @option{-Wunused}, which may turn on further options,
3577 such as @option{-Wunused-value}. The combined effect of positive and
3578 negative forms is that more specific options have priority over less
3579 specific ones, independently of their position in the command-line. For
3580 options of the same specificity, the last one takes effect. Options
3581 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3582 as if they appeared at the end of the command-line.
3583
3584 When an unrecognized warning option is requested (e.g.,
3585 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3586 that the option is not recognized. However, if the @option{-Wno-} form
3587 is used, the behavior is slightly different: no diagnostic is
3588 produced for @option{-Wno-unknown-warning} unless other diagnostics
3589 are being produced. This allows the use of new @option{-Wno-} options
3590 with old compilers, but if something goes wrong, the compiler
3591 warns that an unrecognized option is present.
3592
3593 @table @gcctabopt
3594 @item -Wpedantic
3595 @itemx -pedantic
3596 @opindex pedantic
3597 @opindex Wpedantic
3598 Issue all the warnings demanded by strict ISO C and ISO C++;
3599 reject all programs that use forbidden extensions, and some other
3600 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3601 version of the ISO C standard specified by any @option{-std} option used.
3602
3603 Valid ISO C and ISO C++ programs should compile properly with or without
3604 this option (though a rare few require @option{-ansi} or a
3605 @option{-std} option specifying the required version of ISO C)@. However,
3606 without this option, certain GNU extensions and traditional C and C++
3607 features are supported as well. With this option, they are rejected.
3608
3609 @option{-Wpedantic} does not cause warning messages for use of the
3610 alternate keywords whose names begin and end with @samp{__}. Pedantic
3611 warnings are also disabled in the expression that follows
3612 @code{__extension__}. However, only system header files should use
3613 these escape routes; application programs should avoid them.
3614 @xref{Alternate Keywords}.
3615
3616 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3617 C conformance. They soon find that it does not do quite what they want:
3618 it finds some non-ISO practices, but not all---only those for which
3619 ISO C @emph{requires} a diagnostic, and some others for which
3620 diagnostics have been added.
3621
3622 A feature to report any failure to conform to ISO C might be useful in
3623 some instances, but would require considerable additional work and would
3624 be quite different from @option{-Wpedantic}. We don't have plans to
3625 support such a feature in the near future.
3626
3627 Where the standard specified with @option{-std} represents a GNU
3628 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3629 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3630 extended dialect is based. Warnings from @option{-Wpedantic} are given
3631 where they are required by the base standard. (It does not make sense
3632 for such warnings to be given only for features not in the specified GNU
3633 C dialect, since by definition the GNU dialects of C include all
3634 features the compiler supports with the given option, and there would be
3635 nothing to warn about.)
3636
3637 @item -pedantic-errors
3638 @opindex pedantic-errors
3639 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3640 requires a diagnostic, in some cases where there is undefined behavior
3641 at compile-time and in some other cases that do not prevent compilation
3642 of programs that are valid according to the standard. This is not
3643 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3644 by this option and not enabled by the latter and vice versa.
3645
3646 @item -Wall
3647 @opindex Wall
3648 @opindex Wno-all
3649 This enables all the warnings about constructions that some users
3650 consider questionable, and that are easy to avoid (or modify to
3651 prevent the warning), even in conjunction with macros. This also
3652 enables some language-specific warnings described in @ref{C++ Dialect
3653 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3654
3655 @option{-Wall} turns on the following warning flags:
3656
3657 @gccoptlist{-Waddress @gol
3658 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3659 -Wbool-compare @gol
3660 -Wbool-operation @gol
3661 -Wc++11-compat -Wc++14-compat@gol
3662 -Wchar-subscripts @gol
3663 -Wcomment @gol
3664 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3665 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3666 -Wformat @gol
3667 -Wint-in-bool-context @gol
3668 -Wimplicit @r{(C and Objective-C only)} @gol
3669 -Wimplicit-int @r{(C and Objective-C only)} @gol
3670 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3671 -Winit-self @r{(only for C++)} @gol
3672 -Wlogical-not-parentheses
3673 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3674 -Wmaybe-uninitialized @gol
3675 -Wmemset-elt-size @gol
3676 -Wmemset-transposed-args @gol
3677 -Wmisleading-indentation @r{(only for C/C++)} @gol
3678 -Wmissing-braces @r{(only for C/ObjC)} @gol
3679 -Wnarrowing @r{(only for C++)} @gol
3680 -Wnonnull @gol
3681 -Wnonnull-compare @gol
3682 -Wopenmp-simd @gol
3683 -Wparentheses @gol
3684 -Wpointer-sign @gol
3685 -Wreorder @gol
3686 -Wreturn-type @gol
3687 -Wsequence-point @gol
3688 -Wsign-compare @r{(only in C++)} @gol
3689 -Wsizeof-pointer-memaccess @gol
3690 -Wstrict-aliasing @gol
3691 -Wstrict-overflow=1 @gol
3692 -Wswitch @gol
3693 -Wtautological-compare @gol
3694 -Wtrigraphs @gol
3695 -Wuninitialized @gol
3696 -Wunknown-pragmas @gol
3697 -Wunused-function @gol
3698 -Wunused-label @gol
3699 -Wunused-value @gol
3700 -Wunused-variable @gol
3701 -Wvolatile-register-var @gol
3702 }
3703
3704 Note that some warning flags are not implied by @option{-Wall}. Some of
3705 them warn about constructions that users generally do not consider
3706 questionable, but which occasionally you might wish to check for;
3707 others warn about constructions that are necessary or hard to avoid in
3708 some cases, and there is no simple way to modify the code to suppress
3709 the warning. Some of them are enabled by @option{-Wextra} but many of
3710 them must be enabled individually.
3711
3712 @item -Wextra
3713 @opindex W
3714 @opindex Wextra
3715 @opindex Wno-extra
3716 This enables some extra warning flags that are not enabled by
3717 @option{-Wall}. (This option used to be called @option{-W}. The older
3718 name is still supported, but the newer name is more descriptive.)
3719
3720 @gccoptlist{-Wclobbered @gol
3721 -Wempty-body @gol
3722 -Wignored-qualifiers @gol
3723 -Wimplicit-fallthrough @gol
3724 -Wmissing-field-initializers @gol
3725 -Wmissing-parameter-type @r{(C only)} @gol
3726 -Wold-style-declaration @r{(C only)} @gol
3727 -Woverride-init @gol
3728 -Wsign-compare @r{(C only)} @gol
3729 -Wtype-limits @gol
3730 -Wuninitialized @gol
3731 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3732 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3733 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3734 }
3735
3736 The option @option{-Wextra} also prints warning messages for the
3737 following cases:
3738
3739 @itemize @bullet
3740
3741 @item
3742 A pointer is compared against integer zero with @code{<}, @code{<=},
3743 @code{>}, or @code{>=}.
3744
3745 @item
3746 (C++ only) An enumerator and a non-enumerator both appear in a
3747 conditional expression.
3748
3749 @item
3750 (C++ only) Ambiguous virtual bases.
3751
3752 @item
3753 (C++ only) Subscripting an array that has been declared @code{register}.
3754
3755 @item
3756 (C++ only) Taking the address of a variable that has been declared
3757 @code{register}.
3758
3759 @item
3760 (C++ only) A base class is not initialized in the copy constructor
3761 of a derived class.
3762
3763 @end itemize
3764
3765 @item -Wchar-subscripts
3766 @opindex Wchar-subscripts
3767 @opindex Wno-char-subscripts
3768 Warn if an array subscript has type @code{char}. This is a common cause
3769 of error, as programmers often forget that this type is signed on some
3770 machines.
3771 This warning is enabled by @option{-Wall}.
3772
3773 @item -Wcomment
3774 @opindex Wcomment
3775 @opindex Wno-comment
3776 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3777 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3778 This warning is enabled by @option{-Wall}.
3779
3780 @item -Wno-coverage-mismatch
3781 @opindex Wno-coverage-mismatch
3782 Warn if feedback profiles do not match when using the
3783 @option{-fprofile-use} option.
3784 If a source file is changed between compiling with @option{-fprofile-gen} and
3785 with @option{-fprofile-use}, the files with the profile feedback can fail
3786 to match the source file and GCC cannot use the profile feedback
3787 information. By default, this warning is enabled and is treated as an
3788 error. @option{-Wno-coverage-mismatch} can be used to disable the
3789 warning or @option{-Wno-error=coverage-mismatch} can be used to
3790 disable the error. Disabling the error for this warning can result in
3791 poorly optimized code and is useful only in the
3792 case of very minor changes such as bug fixes to an existing code-base.
3793 Completely disabling the warning is not recommended.
3794
3795 @item -Wno-cpp
3796 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3797
3798 Suppress warning messages emitted by @code{#warning} directives.
3799
3800 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3801 @opindex Wdouble-promotion
3802 @opindex Wno-double-promotion
3803 Give a warning when a value of type @code{float} is implicitly
3804 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3805 floating-point unit implement @code{float} in hardware, but emulate
3806 @code{double} in software. On such a machine, doing computations
3807 using @code{double} values is much more expensive because of the
3808 overhead required for software emulation.
3809
3810 It is easy to accidentally do computations with @code{double} because
3811 floating-point literals are implicitly of type @code{double}. For
3812 example, in:
3813 @smallexample
3814 @group
3815 float area(float radius)
3816 @{
3817 return 3.14159 * radius * radius;
3818 @}
3819 @end group
3820 @end smallexample
3821 the compiler performs the entire computation with @code{double}
3822 because the floating-point literal is a @code{double}.
3823
3824 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
3825 @opindex Wduplicate-decl-specifier
3826 @opindex Wno-duplicate-decl-specifier
3827 Warn if a declaration has duplicate @code{const}, @code{volatile},
3828 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
3829 @option{-Wall}.
3830
3831 @item -Wformat
3832 @itemx -Wformat=@var{n}
3833 @opindex Wformat
3834 @opindex Wno-format
3835 @opindex ffreestanding
3836 @opindex fno-builtin
3837 @opindex Wformat=
3838 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3839 the arguments supplied have types appropriate to the format string
3840 specified, and that the conversions specified in the format string make
3841 sense. This includes standard functions, and others specified by format
3842 attributes (@pxref{Function Attributes}), in the @code{printf},
3843 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3844 not in the C standard) families (or other target-specific families).
3845 Which functions are checked without format attributes having been
3846 specified depends on the standard version selected, and such checks of
3847 functions without the attribute specified are disabled by
3848 @option{-ffreestanding} or @option{-fno-builtin}.
3849
3850 The formats are checked against the format features supported by GNU
3851 libc version 2.2. These include all ISO C90 and C99 features, as well
3852 as features from the Single Unix Specification and some BSD and GNU
3853 extensions. Other library implementations may not support all these
3854 features; GCC does not support warning about features that go beyond a
3855 particular library's limitations. However, if @option{-Wpedantic} is used
3856 with @option{-Wformat}, warnings are given about format features not
3857 in the selected standard version (but not for @code{strfmon} formats,
3858 since those are not in any version of the C standard). @xref{C Dialect
3859 Options,,Options Controlling C Dialect}.
3860
3861 @table @gcctabopt
3862 @item -Wformat=1
3863 @itemx -Wformat
3864 @opindex Wformat
3865 @opindex Wformat=1
3866 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3867 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3868 @option{-Wformat} also checks for null format arguments for several
3869 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3870 aspects of this level of format checking can be disabled by the
3871 options: @option{-Wno-format-contains-nul},
3872 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3873 @option{-Wformat} is enabled by @option{-Wall}.
3874
3875 @item -Wno-format-contains-nul
3876 @opindex Wno-format-contains-nul
3877 @opindex Wformat-contains-nul
3878 If @option{-Wformat} is specified, do not warn about format strings that
3879 contain NUL bytes.
3880
3881 @item -Wno-format-extra-args
3882 @opindex Wno-format-extra-args
3883 @opindex Wformat-extra-args
3884 If @option{-Wformat} is specified, do not warn about excess arguments to a
3885 @code{printf} or @code{scanf} format function. The C standard specifies
3886 that such arguments are ignored.
3887
3888 Where the unused arguments lie between used arguments that are
3889 specified with @samp{$} operand number specifications, normally
3890 warnings are still given, since the implementation could not know what
3891 type to pass to @code{va_arg} to skip the unused arguments. However,
3892 in the case of @code{scanf} formats, this option suppresses the
3893 warning if the unused arguments are all pointers, since the Single
3894 Unix Specification says that such unused arguments are allowed.
3895
3896 @item -Wformat-length
3897 @itemx -Wformat-length=@var{level}
3898 @opindex Wformat-length
3899 @opindex Wno-format-length
3900 Warn about calls to formatted input/output functions such as @code{sprintf}
3901 that might overflow the destination buffer, or about bounded functions such
3902 as @code{snprintf} that might result in output truncation. When the exact
3903 number of bytes written by a format directive cannot be determined at
3904 compile-time it is estimated based on heuristics that depend on the
3905 @var{level} argument and on optimization. While enabling optimization
3906 will in most cases improve the accuracy of the warning, it may also
3907 result in false positives.
3908
3909 @table @gcctabopt
3910 @item -Wformat-length
3911 @item -Wformat-length=1
3912 @opindex Wformat-length
3913 @opindex Wno-format-length
3914 Level @var{1} of @option{-Wformat-length} enabled by @option{-Wformat}
3915 employs a conservative approach that warns only about calls that most
3916 likely overflow the buffer or result in output truncation. At this
3917 level, numeric arguments to format directives with unknown values are
3918 assumed to have the value of one, and strings of unknown length to be
3919 empty. Numeric arguments that are known to be bounded to a subrange
3920 of their type, or string arguments whose output is bounded either by
3921 their directive's precision or by a finite set of string literals, are
3922 assumed to take on the value within the range that results in the most
3923 bytes on output. For example, the call to @code{sprintf} below is
3924 diagnosed because even with both @var{a} and @var{b} equal to zero,
3925 the terminating NUL character (@code{'\0'}) appended by the function
3926 to the destination buffer will be written past its end. Increasing
3927 the size of the buffer by a single byte is sufficient to avoid the
3928 warning, though it may not be sufficient to avoid the overflow.
3929
3930 @smallexample
3931 void f (int a, int b)
3932 @{
3933 char buf [12];
3934 sprintf (buf, "a = %i, b = %i\n", a, b);
3935 @}
3936 @end smallexample
3937
3938 @item -Wformat-length=2
3939 Level @var{2} warns also about calls that might overflow the destination
3940 buffer or result in truncation given an argument of sufficient length
3941 or magnitude. At level @var{2}, unknown numeric arguments are assumed
3942 to have the minimum representable value for signed types with a precision
3943 greater than 1, and the maximum representable value otherwise. Unknown
3944 string arguments whose length cannot be assumed to be bounded either by
3945 the directive's precision, or by a finite set of string literals they
3946 may evaluate to, or the character array they may point to, are assumed
3947 to be 1 character long.
3948
3949 At level @var{2}, the call in the example above is again diagnosed, but
3950 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
3951 @code{%i} directive will write some of its digits beyond the end of
3952 the destination buffer. To make the call safe regardless of the values
3953 of the two variables, the size of the destination buffer must be increased
3954 to at least 34 bytes. GCC includes the minimum size of the buffer in
3955 an informational note following the warning.
3956
3957 An alternative to increasing the size of the destination buffer is to
3958 constrain the range of formatted values. The maximum length of string
3959 arguments can be bounded by specifying the precision in the format
3960 directive. When numeric arguments of format directives can be assumed
3961 to be bounded by less than the precision of their type, choosing
3962 an appropriate length modifier to the format specifier will reduce
3963 the required buffer size. For example, if @var{a} and @var{b} in the
3964 example above can be assumed to be within the precision of
3965 the @code{short int} type then using either the @code{%hi} format
3966 directive or casting the argument to @code{short} reduces the maximum
3967 required size of the buffer to 24 bytes.
3968
3969 @smallexample
3970 void f (int a, int b)
3971 @{
3972 char buf [23];
3973 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
3974 @}
3975 @end smallexample
3976 @end table
3977
3978 @item -Wno-format-zero-length
3979 @opindex Wno-format-zero-length
3980 @opindex Wformat-zero-length
3981 If @option{-Wformat} is specified, do not warn about zero-length formats.
3982 The C standard specifies that zero-length formats are allowed.
3983
3984
3985 @item -Wformat=2
3986 @opindex Wformat=2
3987 Enable @option{-Wformat} plus additional format checks. Currently
3988 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3989 -Wformat-y2k}.
3990
3991 @item -Wformat-nonliteral
3992 @opindex Wformat-nonliteral
3993 @opindex Wno-format-nonliteral
3994 If @option{-Wformat} is specified, also warn if the format string is not a
3995 string literal and so cannot be checked, unless the format function
3996 takes its format arguments as a @code{va_list}.
3997
3998 @item -Wformat-security
3999 @opindex Wformat-security
4000 @opindex Wno-format-security
4001 If @option{-Wformat} is specified, also warn about uses of format
4002 functions that represent possible security problems. At present, this
4003 warns about calls to @code{printf} and @code{scanf} functions where the
4004 format string is not a string literal and there are no format arguments,
4005 as in @code{printf (foo);}. This may be a security hole if the format
4006 string came from untrusted input and contains @samp{%n}. (This is
4007 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4008 in future warnings may be added to @option{-Wformat-security} that are not
4009 included in @option{-Wformat-nonliteral}.)
4010
4011 @item -Wformat-signedness
4012 @opindex Wformat-signedness
4013 @opindex Wno-format-signedness
4014 If @option{-Wformat} is specified, also warn if the format string
4015 requires an unsigned argument and the argument is signed and vice versa.
4016
4017 @item -Wformat-y2k
4018 @opindex Wformat-y2k
4019 @opindex Wno-format-y2k
4020 If @option{-Wformat} is specified, also warn about @code{strftime}
4021 formats that may yield only a two-digit year.
4022 @end table
4023
4024 @item -Wnonnull
4025 @opindex Wnonnull
4026 @opindex Wno-nonnull
4027 Warn about passing a null pointer for arguments marked as
4028 requiring a non-null value by the @code{nonnull} function attribute.
4029
4030 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4031 can be disabled with the @option{-Wno-nonnull} option.
4032
4033 @item -Wnonnull-compare
4034 @opindex Wnonnull-compare
4035 @opindex Wno-nonnull-compare
4036 Warn when comparing an argument marked with the @code{nonnull}
4037 function attribute against null inside the function.
4038
4039 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4040 can be disabled with the @option{-Wno-nonnull-compare} option.
4041
4042 @item -Wnull-dereference
4043 @opindex Wnull-dereference
4044 @opindex Wno-null-dereference
4045 Warn if the compiler detects paths that trigger erroneous or
4046 undefined behavior due to dereferencing a null pointer. This option
4047 is only active when @option{-fdelete-null-pointer-checks} is active,
4048 which is enabled by optimizations in most targets. The precision of
4049 the warnings depends on the optimization options used.
4050
4051 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4052 @opindex Winit-self
4053 @opindex Wno-init-self
4054 Warn about uninitialized variables that are initialized with themselves.
4055 Note this option can only be used with the @option{-Wuninitialized} option.
4056
4057 For example, GCC warns about @code{i} being uninitialized in the
4058 following snippet only when @option{-Winit-self} has been specified:
4059 @smallexample
4060 @group
4061 int f()
4062 @{
4063 int i = i;
4064 return i;
4065 @}
4066 @end group
4067 @end smallexample
4068
4069 This warning is enabled by @option{-Wall} in C++.
4070
4071 @item -Wimplicit-int @r{(C and Objective-C only)}
4072 @opindex Wimplicit-int
4073 @opindex Wno-implicit-int
4074 Warn when a declaration does not specify a type.
4075 This warning is enabled by @option{-Wall}.
4076
4077 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4078 @opindex Wimplicit-function-declaration
4079 @opindex Wno-implicit-function-declaration
4080 Give a warning whenever a function is used before being declared. In
4081 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4082 enabled by default and it is made into an error by
4083 @option{-pedantic-errors}. This warning is also enabled by
4084 @option{-Wall}.
4085
4086 @item -Wimplicit @r{(C and Objective-C only)}
4087 @opindex Wimplicit
4088 @opindex Wno-implicit
4089 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4090 This warning is enabled by @option{-Wall}.
4091
4092 @item -Wimplicit-fallthrough
4093 @opindex Wimplicit-fallthrough
4094 @opindex Wno-implicit-fallthrough
4095 Warn when a switch case falls through. For example:
4096
4097 @smallexample
4098 @group
4099 switch (cond)
4100 @{
4101 case 1:
4102 a = 1;
4103 break;
4104 case 2:
4105 a = 2;
4106 case 3:
4107 a = 3;
4108 break;
4109 @}
4110 @end group
4111 @end smallexample
4112
4113 This warning does not warn when the last statement of a case cannot
4114 fall through, e.g. when there is a return statement or a call to function
4115 declared with the noreturn attribute. @option{-Wimplicit-fallthrough}
4116 also takes into account control flow statements, such as ifs, and only
4117 warns when appropriate. E.g.@:
4118
4119 @smallexample
4120 @group
4121 switch (cond)
4122 @{
4123 case 1:
4124 if (i > 3) @{
4125 bar (5);
4126 break;
4127 @} else if (i < 1) @{
4128 bar (0);
4129 @} else
4130 return;
4131 default:
4132 @dots{}
4133 @}
4134 @end group
4135 @end smallexample
4136
4137 Since there are occasions where a switch case fall through is desirable,
4138 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4139 to be used along with a null statement to suppress this warning that
4140 would normally occur:
4141
4142 @smallexample
4143 @group
4144 switch (cond)
4145 @{
4146 case 1:
4147 bar (0);
4148 __attribute__ ((fallthrough));
4149 default:
4150 @dots{}
4151 @}
4152 @end group
4153 @end smallexample
4154
4155 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4156 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4157 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4158 Instead of the these attributes, it is also possible to add a "falls through"
4159 comment to silence the warning. GCC accepts a wide range of such comments,
4160 for example all of "Falls through.", "fallthru", "FALLS-THROUGH" work. This
4161 comment needs to consist of two words merely, optionally followed by periods
4162 or whitespaces.
4163
4164 @smallexample
4165 @group
4166 switch (cond)
4167 @{
4168 case 1:
4169 bar (0);
4170 /* FALLTHRU */
4171 default:
4172 @dots{}
4173 @}
4174 @end group
4175 @end smallexample
4176
4177 This warning is enabled by @option{-Wextra}.
4178
4179 @item -Wignored-qualifiers @r{(C and C++ only)}
4180 @opindex Wignored-qualifiers
4181 @opindex Wno-ignored-qualifiers
4182 Warn if the return type of a function has a type qualifier
4183 such as @code{const}. For ISO C such a type qualifier has no effect,
4184 since the value returned by a function is not an lvalue.
4185 For C++, the warning is only emitted for scalar types or @code{void}.
4186 ISO C prohibits qualified @code{void} return types on function
4187 definitions, so such return types always receive a warning
4188 even without this option.
4189
4190 This warning is also enabled by @option{-Wextra}.
4191
4192 @item -Wignored-attributes @r{(C and C++ only)}
4193 @opindex Wignored-attributes
4194 @opindex Wno-ignored-attributes
4195 Warn when an attribute is ignored. This is different from the
4196 @option{-Wattributes} option in that it warns whenever the compiler decides
4197 to drop an attribute, not that the attribute is either unknown, used in a
4198 wrong place, etc. This warning is enabled by default.
4199
4200 @item -Wmain
4201 @opindex Wmain
4202 @opindex Wno-main
4203 Warn if the type of @code{main} is suspicious. @code{main} should be
4204 a function with external linkage, returning int, taking either zero
4205 arguments, two, or three arguments of appropriate types. This warning
4206 is enabled by default in C++ and is enabled by either @option{-Wall}
4207 or @option{-Wpedantic}.
4208
4209 @item -Wmisleading-indentation @r{(C and C++ only)}
4210 @opindex Wmisleading-indentation
4211 @opindex Wno-misleading-indentation
4212 Warn when the indentation of the code does not reflect the block structure.
4213 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4214 @code{for} clauses with a guarded statement that does not use braces,
4215 followed by an unguarded statement with the same indentation.
4216
4217 In the following example, the call to ``bar'' is misleadingly indented as
4218 if it were guarded by the ``if'' conditional.
4219
4220 @smallexample
4221 if (some_condition ())
4222 foo ();
4223 bar (); /* Gotcha: this is not guarded by the "if". */
4224 @end smallexample
4225
4226 In the case of mixed tabs and spaces, the warning uses the
4227 @option{-ftabstop=} option to determine if the statements line up
4228 (defaulting to 8).
4229
4230 The warning is not issued for code involving multiline preprocessor logic
4231 such as the following example.
4232
4233 @smallexample
4234 if (flagA)
4235 foo (0);
4236 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4237 if (flagB)
4238 #endif
4239 foo (1);
4240 @end smallexample
4241
4242 The warning is not issued after a @code{#line} directive, since this
4243 typically indicates autogenerated code, and no assumptions can be made
4244 about the layout of the file that the directive references.
4245
4246 This warning is enabled by @option{-Wall} in C and C++.
4247
4248 @item -Wmissing-braces
4249 @opindex Wmissing-braces
4250 @opindex Wno-missing-braces
4251 Warn if an aggregate or union initializer is not fully bracketed. In
4252 the following example, the initializer for @code{a} is not fully
4253 bracketed, but that for @code{b} is fully bracketed. This warning is
4254 enabled by @option{-Wall} in C.
4255
4256 @smallexample
4257 int a[2][2] = @{ 0, 1, 2, 3 @};
4258 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4259 @end smallexample
4260
4261 This warning is enabled by @option{-Wall}.
4262
4263 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4264 @opindex Wmissing-include-dirs
4265 @opindex Wno-missing-include-dirs
4266 Warn if a user-supplied include directory does not exist.
4267
4268 @item -Wparentheses
4269 @opindex Wparentheses
4270 @opindex Wno-parentheses
4271 Warn if parentheses are omitted in certain contexts, such
4272 as when there is an assignment in a context where a truth value
4273 is expected, or when operators are nested whose precedence people
4274 often get confused about.
4275
4276 Also warn if a comparison like @code{x<=y<=z} appears; this is
4277 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4278 interpretation from that of ordinary mathematical notation.
4279
4280 Also warn for dangerous uses of the GNU extension to
4281 @code{?:} with omitted middle operand. When the condition
4282 in the @code{?}: operator is a boolean expression, the omitted value is
4283 always 1. Often programmers expect it to be a value computed
4284 inside the conditional expression instead.
4285
4286 This warning is enabled by @option{-Wall}.
4287
4288 @item -Wsequence-point
4289 @opindex Wsequence-point
4290 @opindex Wno-sequence-point
4291 Warn about code that may have undefined semantics because of violations
4292 of sequence point rules in the C and C++ standards.
4293
4294 The C and C++ standards define the order in which expressions in a C/C++
4295 program are evaluated in terms of @dfn{sequence points}, which represent
4296 a partial ordering between the execution of parts of the program: those
4297 executed before the sequence point, and those executed after it. These
4298 occur after the evaluation of a full expression (one which is not part
4299 of a larger expression), after the evaluation of the first operand of a
4300 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4301 function is called (but after the evaluation of its arguments and the
4302 expression denoting the called function), and in certain other places.
4303 Other than as expressed by the sequence point rules, the order of
4304 evaluation of subexpressions of an expression is not specified. All
4305 these rules describe only a partial order rather than a total order,
4306 since, for example, if two functions are called within one expression
4307 with no sequence point between them, the order in which the functions
4308 are called is not specified. However, the standards committee have
4309 ruled that function calls do not overlap.
4310
4311 It is not specified when between sequence points modifications to the
4312 values of objects take effect. Programs whose behavior depends on this
4313 have undefined behavior; the C and C++ standards specify that ``Between
4314 the previous and next sequence point an object shall have its stored
4315 value modified at most once by the evaluation of an expression.
4316 Furthermore, the prior value shall be read only to determine the value
4317 to be stored.''. If a program breaks these rules, the results on any
4318 particular implementation are entirely unpredictable.
4319
4320 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4321 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4322 diagnosed by this option, and it may give an occasional false positive
4323 result, but in general it has been found fairly effective at detecting
4324 this sort of problem in programs.
4325
4326 The C++17 standard will define the order of evaluation of operands in
4327 more cases: in particular it requires that the right-hand side of an
4328 assignment be evaluated before the left-hand side, so the above
4329 examples are no longer undefined. But this warning will still warn
4330 about them, to help people avoid writing code that is undefined in C
4331 and earlier revisions of C++.
4332
4333 The standard is worded confusingly, therefore there is some debate
4334 over the precise meaning of the sequence point rules in subtle cases.
4335 Links to discussions of the problem, including proposed formal
4336 definitions, may be found on the GCC readings page, at
4337 @uref{http://gcc.gnu.org/@/readings.html}.
4338
4339 This warning is enabled by @option{-Wall} for C and C++.
4340
4341 @item -Wno-return-local-addr
4342 @opindex Wno-return-local-addr
4343 @opindex Wreturn-local-addr
4344 Do not warn about returning a pointer (or in C++, a reference) to a
4345 variable that goes out of scope after the function returns.
4346
4347 @item -Wreturn-type
4348 @opindex Wreturn-type
4349 @opindex Wno-return-type
4350 Warn whenever a function is defined with a return type that defaults
4351 to @code{int}. Also warn about any @code{return} statement with no
4352 return value in a function whose return type is not @code{void}
4353 (falling off the end of the function body is considered returning
4354 without a value).
4355
4356 For C only, warn about a @code{return} statement with an expression in a
4357 function whose return type is @code{void}, unless the expression type is
4358 also @code{void}. As a GNU extension, the latter case is accepted
4359 without a warning unless @option{-Wpedantic} is used.
4360
4361 For C++, a function without return type always produces a diagnostic
4362 message, even when @option{-Wno-return-type} is specified. The only
4363 exceptions are @code{main} and functions defined in system headers.
4364
4365 This warning is enabled by @option{-Wall}.
4366
4367 @item -Wshift-count-negative
4368 @opindex Wshift-count-negative
4369 @opindex Wno-shift-count-negative
4370 Warn if shift count is negative. This warning is enabled by default.
4371
4372 @item -Wshift-count-overflow
4373 @opindex Wshift-count-overflow
4374 @opindex Wno-shift-count-overflow
4375 Warn if shift count >= width of type. This warning is enabled by default.
4376
4377 @item -Wshift-negative-value
4378 @opindex Wshift-negative-value
4379 @opindex Wno-shift-negative-value
4380 Warn if left shifting a negative value. This warning is enabled by
4381 @option{-Wextra} in C99 and C++11 modes (and newer).
4382
4383 @item -Wshift-overflow
4384 @itemx -Wshift-overflow=@var{n}
4385 @opindex Wshift-overflow
4386 @opindex Wno-shift-overflow
4387 Warn about left shift overflows. This warning is enabled by
4388 default in C99 and C++11 modes (and newer).
4389
4390 @table @gcctabopt
4391 @item -Wshift-overflow=1
4392 This is the warning level of @option{-Wshift-overflow} and is enabled
4393 by default in C99 and C++11 modes (and newer). This warning level does
4394 not warn about left-shifting 1 into the sign bit. (However, in C, such
4395 an overflow is still rejected in contexts where an integer constant expression
4396 is required.)
4397
4398 @item -Wshift-overflow=2
4399 This warning level also warns about left-shifting 1 into the sign bit,
4400 unless C++14 mode is active.
4401 @end table
4402
4403 @item -Wswitch
4404 @opindex Wswitch
4405 @opindex Wno-switch
4406 Warn whenever a @code{switch} statement has an index of enumerated type
4407 and lacks a @code{case} for one or more of the named codes of that
4408 enumeration. (The presence of a @code{default} label prevents this
4409 warning.) @code{case} labels outside the enumeration range also
4410 provoke warnings when this option is used (even if there is a
4411 @code{default} label).
4412 This warning is enabled by @option{-Wall}.
4413
4414 @item -Wswitch-default
4415 @opindex Wswitch-default
4416 @opindex Wno-switch-default
4417 Warn whenever a @code{switch} statement does not have a @code{default}
4418 case.
4419
4420 @item -Wswitch-enum
4421 @opindex Wswitch-enum
4422 @opindex Wno-switch-enum
4423 Warn whenever a @code{switch} statement has an index of enumerated type
4424 and lacks a @code{case} for one or more of the named codes of that
4425 enumeration. @code{case} labels outside the enumeration range also
4426 provoke warnings when this option is used. The only difference
4427 between @option{-Wswitch} and this option is that this option gives a
4428 warning about an omitted enumeration code even if there is a
4429 @code{default} label.
4430
4431 @item -Wswitch-bool
4432 @opindex Wswitch-bool
4433 @opindex Wno-switch-bool
4434 Warn whenever a @code{switch} statement has an index of boolean type
4435 and the case values are outside the range of a boolean type.
4436 It is possible to suppress this warning by casting the controlling
4437 expression to a type other than @code{bool}. For example:
4438 @smallexample
4439 @group
4440 switch ((int) (a == 4))
4441 @{
4442 @dots{}
4443 @}
4444 @end group
4445 @end smallexample
4446 This warning is enabled by default for C and C++ programs.
4447
4448 @item -Wswitch-unreachable
4449 @opindex Wswitch-unreachable
4450 @opindex Wno-switch-unreachable
4451 Warn whenever a @code{switch} statement contains statements between the
4452 controlling expression and the first case label, which will never be
4453 executed. For example:
4454 @smallexample
4455 @group
4456 switch (cond)
4457 @{
4458 i = 15;
4459 @dots{}
4460 case 5:
4461 @dots{}
4462 @}
4463 @end group
4464 @end smallexample
4465 @option{-Wswitch-unreachable} does not warn if the statement between the
4466 controlling expression and the first case label is just a declaration:
4467 @smallexample
4468 @group
4469 switch (cond)
4470 @{
4471 int i;
4472 @dots{}
4473 case 5:
4474 i = 5;
4475 @dots{}
4476 @}
4477 @end group
4478 @end smallexample
4479 This warning is enabled by default for C and C++ programs.
4480
4481 @item -Wsync-nand @r{(C and C++ only)}
4482 @opindex Wsync-nand
4483 @opindex Wno-sync-nand
4484 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4485 built-in functions are used. These functions changed semantics in GCC 4.4.
4486
4487 @item -Wtrigraphs
4488 @opindex Wtrigraphs
4489 @opindex Wno-trigraphs
4490 Warn if any trigraphs are encountered that might change the meaning of
4491 the program (trigraphs within comments are not warned about).
4492 This warning is enabled by @option{-Wall}.
4493
4494 @item -Wunused-but-set-parameter
4495 @opindex Wunused-but-set-parameter
4496 @opindex Wno-unused-but-set-parameter
4497 Warn whenever a function parameter is assigned to, but otherwise unused
4498 (aside from its declaration).
4499
4500 To suppress this warning use the @code{unused} attribute
4501 (@pxref{Variable Attributes}).
4502
4503 This warning is also enabled by @option{-Wunused} together with
4504 @option{-Wextra}.
4505
4506 @item -Wunused-but-set-variable
4507 @opindex Wunused-but-set-variable
4508 @opindex Wno-unused-but-set-variable
4509 Warn whenever a local variable is assigned to, but otherwise unused
4510 (aside from its declaration).
4511 This warning is enabled by @option{-Wall}.
4512
4513 To suppress this warning use the @code{unused} attribute
4514 (@pxref{Variable Attributes}).
4515
4516 This warning is also enabled by @option{-Wunused}, which is enabled
4517 by @option{-Wall}.
4518
4519 @item -Wunused-function
4520 @opindex Wunused-function
4521 @opindex Wno-unused-function
4522 Warn whenever a static function is declared but not defined or a
4523 non-inline static function is unused.
4524 This warning is enabled by @option{-Wall}.
4525
4526 @item -Wunused-label
4527 @opindex Wunused-label
4528 @opindex Wno-unused-label
4529 Warn whenever a label is declared but not used.
4530 This warning is enabled by @option{-Wall}.
4531
4532 To suppress this warning use the @code{unused} attribute
4533 (@pxref{Variable Attributes}).
4534
4535 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4536 @opindex Wunused-local-typedefs
4537 Warn when a typedef locally defined in a function is not used.
4538 This warning is enabled by @option{-Wall}.
4539
4540 @item -Wunused-parameter
4541 @opindex Wunused-parameter
4542 @opindex Wno-unused-parameter
4543 Warn whenever a function parameter is unused aside from its declaration.
4544
4545 To suppress this warning use the @code{unused} attribute
4546 (@pxref{Variable Attributes}).
4547
4548 @item -Wno-unused-result
4549 @opindex Wunused-result
4550 @opindex Wno-unused-result
4551 Do not warn if a caller of a function marked with attribute
4552 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4553 its return value. The default is @option{-Wunused-result}.
4554
4555 @item -Wunused-variable
4556 @opindex Wunused-variable
4557 @opindex Wno-unused-variable
4558 Warn whenever a local or static variable is unused aside from its
4559 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4560 but not for C++. This warning is enabled by @option{-Wall}.
4561
4562 To suppress this warning use the @code{unused} attribute
4563 (@pxref{Variable Attributes}).
4564
4565 @item -Wunused-const-variable
4566 @itemx -Wunused-const-variable=@var{n}
4567 @opindex Wunused-const-variable
4568 @opindex Wno-unused-const-variable
4569 Warn whenever a constant static variable is unused aside from its declaration.
4570 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4571 for C, but not for C++. In C this declares variable storage, but in C++ this
4572 is not an error since const variables take the place of @code{#define}s.
4573
4574 To suppress this warning use the @code{unused} attribute
4575 (@pxref{Variable Attributes}).
4576
4577 @table @gcctabopt
4578 @item -Wunused-const-variable=1
4579 This is the warning level that is enabled by @option{-Wunused-variable} for
4580 C. It warns only about unused static const variables defined in the main
4581 compilation unit, but not about static const variables declared in any
4582 header included.
4583
4584 @item -Wunused-const-variable=2
4585 This warning level also warns for unused constant static variables in
4586 headers (excluding system headers). This is the warning level of
4587 @option{-Wunused-const-variable} and must be explicitly requested since
4588 in C++ this isn't an error and in C it might be harder to clean up all
4589 headers included.
4590 @end table
4591
4592 @item -Wunused-value
4593 @opindex Wunused-value
4594 @opindex Wno-unused-value
4595 Warn whenever a statement computes a result that is explicitly not
4596 used. To suppress this warning cast the unused expression to
4597 @code{void}. This includes an expression-statement or the left-hand
4598 side of a comma expression that contains no side effects. For example,
4599 an expression such as @code{x[i,j]} causes a warning, while
4600 @code{x[(void)i,j]} does not.
4601
4602 This warning is enabled by @option{-Wall}.
4603
4604 @item -Wunused
4605 @opindex Wunused
4606 @opindex Wno-unused
4607 All the above @option{-Wunused} options combined.
4608
4609 In order to get a warning about an unused function parameter, you must
4610 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4611 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4612
4613 @item -Wuninitialized
4614 @opindex Wuninitialized
4615 @opindex Wno-uninitialized
4616 Warn if an automatic variable is used without first being initialized
4617 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4618 warn if a non-static reference or non-static @code{const} member
4619 appears in a class without constructors.
4620
4621 If you want to warn about code that uses the uninitialized value of the
4622 variable in its own initializer, use the @option{-Winit-self} option.
4623
4624 These warnings occur for individual uninitialized or clobbered
4625 elements of structure, union or array variables as well as for
4626 variables that are uninitialized or clobbered as a whole. They do
4627 not occur for variables or elements declared @code{volatile}. Because
4628 these warnings depend on optimization, the exact variables or elements
4629 for which there are warnings depends on the precise optimization
4630 options and version of GCC used.
4631
4632 Note that there may be no warning about a variable that is used only
4633 to compute a value that itself is never used, because such
4634 computations may be deleted by data flow analysis before the warnings
4635 are printed.
4636
4637 @item -Winvalid-memory-model
4638 @opindex Winvalid-memory-model
4639 @opindex Wno-invalid-memory-model
4640 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4641 and the C11 atomic generic functions with a memory consistency argument
4642 that is either invalid for the operation or outside the range of values
4643 of the @code{memory_order} enumeration. For example, since the
4644 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4645 defined for the relaxed, release, and sequentially consistent memory
4646 orders the following code is diagnosed:
4647
4648 @smallexample
4649 void store (int *i)
4650 @{
4651 __atomic_store_n (i, 0, memory_order_consume);
4652 @}
4653 @end smallexample
4654
4655 @option{-Winvalid-memory-model} is enabled by default.
4656
4657 @item -Wmaybe-uninitialized
4658 @opindex Wmaybe-uninitialized
4659 @opindex Wno-maybe-uninitialized
4660 For an automatic variable, if there exists a path from the function
4661 entry to a use of the variable that is initialized, but there exist
4662 some other paths for which the variable is not initialized, the compiler
4663 emits a warning if it cannot prove the uninitialized paths are not
4664 executed at run time. These warnings are made optional because GCC is
4665 not smart enough to see all the reasons why the code might be correct
4666 in spite of appearing to have an error. Here is one example of how
4667 this can happen:
4668
4669 @smallexample
4670 @group
4671 @{
4672 int x;
4673 switch (y)
4674 @{
4675 case 1: x = 1;
4676 break;
4677 case 2: x = 4;
4678 break;
4679 case 3: x = 5;
4680 @}
4681 foo (x);
4682 @}
4683 @end group
4684 @end smallexample
4685
4686 @noindent
4687 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4688 always initialized, but GCC doesn't know this. To suppress the
4689 warning, you need to provide a default case with assert(0) or
4690 similar code.
4691
4692 @cindex @code{longjmp} warnings
4693 This option also warns when a non-volatile automatic variable might be
4694 changed by a call to @code{longjmp}. These warnings as well are possible
4695 only in optimizing compilation.
4696
4697 The compiler sees only the calls to @code{setjmp}. It cannot know
4698 where @code{longjmp} will be called; in fact, a signal handler could
4699 call it at any point in the code. As a result, you may get a warning
4700 even when there is in fact no problem because @code{longjmp} cannot
4701 in fact be called at the place that would cause a problem.
4702
4703 Some spurious warnings can be avoided if you declare all the functions
4704 you use that never return as @code{noreturn}. @xref{Function
4705 Attributes}.
4706
4707 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4708
4709 @item -Wunknown-pragmas
4710 @opindex Wunknown-pragmas
4711 @opindex Wno-unknown-pragmas
4712 @cindex warning for unknown pragmas
4713 @cindex unknown pragmas, warning
4714 @cindex pragmas, warning of unknown
4715 Warn when a @code{#pragma} directive is encountered that is not understood by
4716 GCC@. If this command-line option is used, warnings are even issued
4717 for unknown pragmas in system header files. This is not the case if
4718 the warnings are only enabled by the @option{-Wall} command-line option.
4719
4720 @item -Wno-pragmas
4721 @opindex Wno-pragmas
4722 @opindex Wpragmas
4723 Do not warn about misuses of pragmas, such as incorrect parameters,
4724 invalid syntax, or conflicts between pragmas. See also
4725 @option{-Wunknown-pragmas}.
4726
4727 @item -Wstrict-aliasing
4728 @opindex Wstrict-aliasing
4729 @opindex Wno-strict-aliasing
4730 This option is only active when @option{-fstrict-aliasing} is active.
4731 It warns about code that might break the strict aliasing rules that the
4732 compiler is using for optimization. The warning does not catch all
4733 cases, but does attempt to catch the more common pitfalls. It is
4734 included in @option{-Wall}.
4735 It is equivalent to @option{-Wstrict-aliasing=3}
4736
4737 @item -Wstrict-aliasing=n
4738 @opindex Wstrict-aliasing=n
4739 This option is only active when @option{-fstrict-aliasing} is active.
4740 It warns about code that might break the strict aliasing rules that the
4741 compiler is using for optimization.
4742 Higher levels correspond to higher accuracy (fewer false positives).
4743 Higher levels also correspond to more effort, similar to the way @option{-O}
4744 works.
4745 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4746
4747 Level 1: Most aggressive, quick, least accurate.
4748 Possibly useful when higher levels
4749 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4750 false negatives. However, it has many false positives.
4751 Warns for all pointer conversions between possibly incompatible types,
4752 even if never dereferenced. Runs in the front end only.
4753
4754 Level 2: Aggressive, quick, not too precise.
4755 May still have many false positives (not as many as level 1 though),
4756 and few false negatives (but possibly more than level 1).
4757 Unlike level 1, it only warns when an address is taken. Warns about
4758 incomplete types. Runs in the front end only.
4759
4760 Level 3 (default for @option{-Wstrict-aliasing}):
4761 Should have very few false positives and few false
4762 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4763 Takes care of the common pun+dereference pattern in the front end:
4764 @code{*(int*)&some_float}.
4765 If optimization is enabled, it also runs in the back end, where it deals
4766 with multiple statement cases using flow-sensitive points-to information.
4767 Only warns when the converted pointer is dereferenced.
4768 Does not warn about incomplete types.
4769
4770 @item -Wstrict-overflow
4771 @itemx -Wstrict-overflow=@var{n}
4772 @opindex Wstrict-overflow
4773 @opindex Wno-strict-overflow
4774 This option is only active when @option{-fstrict-overflow} is active.
4775 It warns about cases where the compiler optimizes based on the
4776 assumption that signed overflow does not occur. Note that it does not
4777 warn about all cases where the code might overflow: it only warns
4778 about cases where the compiler implements some optimization. Thus
4779 this warning depends on the optimization level.
4780
4781 An optimization that assumes that signed overflow does not occur is
4782 perfectly safe if the values of the variables involved are such that
4783 overflow never does, in fact, occur. Therefore this warning can
4784 easily give a false positive: a warning about code that is not
4785 actually a problem. To help focus on important issues, several
4786 warning levels are defined. No warnings are issued for the use of
4787 undefined signed overflow when estimating how many iterations a loop
4788 requires, in particular when determining whether a loop will be
4789 executed at all.
4790
4791 @table @gcctabopt
4792 @item -Wstrict-overflow=1
4793 Warn about cases that are both questionable and easy to avoid. For
4794 example, with @option{-fstrict-overflow}, the compiler simplifies
4795 @code{x + 1 > x} to @code{1}. This level of
4796 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4797 are not, and must be explicitly requested.
4798
4799 @item -Wstrict-overflow=2
4800 Also warn about other cases where a comparison is simplified to a
4801 constant. For example: @code{abs (x) >= 0}. This can only be
4802 simplified when @option{-fstrict-overflow} is in effect, because
4803 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4804 zero. @option{-Wstrict-overflow} (with no level) is the same as
4805 @option{-Wstrict-overflow=2}.
4806
4807 @item -Wstrict-overflow=3
4808 Also warn about other cases where a comparison is simplified. For
4809 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4810
4811 @item -Wstrict-overflow=4
4812 Also warn about other simplifications not covered by the above cases.
4813 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4814
4815 @item -Wstrict-overflow=5
4816 Also warn about cases where the compiler reduces the magnitude of a
4817 constant involved in a comparison. For example: @code{x + 2 > y} is
4818 simplified to @code{x + 1 >= y}. This is reported only at the
4819 highest warning level because this simplification applies to many
4820 comparisons, so this warning level gives a very large number of
4821 false positives.
4822 @end table
4823
4824 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4825 @opindex Wsuggest-attribute=
4826 @opindex Wno-suggest-attribute=
4827 Warn for cases where adding an attribute may be beneficial. The
4828 attributes currently supported are listed below.
4829
4830 @table @gcctabopt
4831 @item -Wsuggest-attribute=pure
4832 @itemx -Wsuggest-attribute=const
4833 @itemx -Wsuggest-attribute=noreturn
4834 @opindex Wsuggest-attribute=pure
4835 @opindex Wno-suggest-attribute=pure
4836 @opindex Wsuggest-attribute=const
4837 @opindex Wno-suggest-attribute=const
4838 @opindex Wsuggest-attribute=noreturn
4839 @opindex Wno-suggest-attribute=noreturn
4840
4841 Warn about functions that might be candidates for attributes
4842 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4843 functions visible in other compilation units or (in the case of @code{pure} and
4844 @code{const}) if it cannot prove that the function returns normally. A function
4845 returns normally if it doesn't contain an infinite loop or return abnormally
4846 by throwing, calling @code{abort} or trapping. This analysis requires option
4847 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4848 higher. Higher optimization levels improve the accuracy of the analysis.
4849
4850 @item -Wsuggest-attribute=format
4851 @itemx -Wmissing-format-attribute
4852 @opindex Wsuggest-attribute=format
4853 @opindex Wmissing-format-attribute
4854 @opindex Wno-suggest-attribute=format
4855 @opindex Wno-missing-format-attribute
4856 @opindex Wformat
4857 @opindex Wno-format
4858
4859 Warn about function pointers that might be candidates for @code{format}
4860 attributes. Note these are only possible candidates, not absolute ones.
4861 GCC guesses that function pointers with @code{format} attributes that
4862 are used in assignment, initialization, parameter passing or return
4863 statements should have a corresponding @code{format} attribute in the
4864 resulting type. I.e.@: the left-hand side of the assignment or
4865 initialization, the type of the parameter variable, or the return type
4866 of the containing function respectively should also have a @code{format}
4867 attribute to avoid the warning.
4868
4869 GCC also warns about function definitions that might be
4870 candidates for @code{format} attributes. Again, these are only
4871 possible candidates. GCC guesses that @code{format} attributes
4872 might be appropriate for any function that calls a function like
4873 @code{vprintf} or @code{vscanf}, but this might not always be the
4874 case, and some functions for which @code{format} attributes are
4875 appropriate may not be detected.
4876 @end table
4877
4878 @item -Wsuggest-final-types
4879 @opindex Wno-suggest-final-types
4880 @opindex Wsuggest-final-types
4881 Warn about types with virtual methods where code quality would be improved
4882 if the type were declared with the C++11 @code{final} specifier,
4883 or, if possible,
4884 declared in an anonymous namespace. This allows GCC to more aggressively
4885 devirtualize the polymorphic calls. This warning is more effective with link
4886 time optimization, where the information about the class hierarchy graph is
4887 more complete.
4888
4889 @item -Wsuggest-final-methods
4890 @opindex Wno-suggest-final-methods
4891 @opindex Wsuggest-final-methods
4892 Warn about virtual methods where code quality would be improved if the method
4893 were declared with the C++11 @code{final} specifier,
4894 or, if possible, its type were
4895 declared in an anonymous namespace or with the @code{final} specifier.
4896 This warning is
4897 more effective with link time optimization, where the information about the
4898 class hierarchy graph is more complete. It is recommended to first consider
4899 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4900 annotations.
4901
4902 @item -Wsuggest-override
4903 Warn about overriding virtual functions that are not marked with the override
4904 keyword.
4905
4906 @item -Warray-bounds
4907 @itemx -Warray-bounds=@var{n}
4908 @opindex Wno-array-bounds
4909 @opindex Warray-bounds
4910 This option is only active when @option{-ftree-vrp} is active
4911 (default for @option{-O2} and above). It warns about subscripts to arrays
4912 that are always out of bounds. This warning is enabled by @option{-Wall}.
4913
4914 @table @gcctabopt
4915 @item -Warray-bounds=1
4916 This is the warning level of @option{-Warray-bounds} and is enabled
4917 by @option{-Wall}; higher levels are not, and must be explicitly requested.
4918
4919 @item -Warray-bounds=2
4920 This warning level also warns about out of bounds access for
4921 arrays at the end of a struct and for arrays accessed through
4922 pointers. This warning level may give a larger number of
4923 false positives and is deactivated by default.
4924 @end table
4925
4926 @item -Wbool-compare
4927 @opindex Wno-bool-compare
4928 @opindex Wbool-compare
4929 Warn about boolean expression compared with an integer value different from
4930 @code{true}/@code{false}. For instance, the following comparison is
4931 always false:
4932 @smallexample
4933 int n = 5;
4934 @dots{}
4935 if ((n > 1) == 2) @{ @dots{} @}
4936 @end smallexample
4937 This warning is enabled by @option{-Wall}.
4938
4939 @item -Wbool-operation
4940 @opindex Wno-bool-operation
4941 @opindex Wbool-operation
4942 Warn about suspicious operations on expressions of a boolean type. For
4943 instance, bitwise negation of a boolean is very likely a bug in the program.
4944 For C, this warning also warns about incrementing or decrementing a boolean,
4945 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
4946 Incrementing a boolean is invalid in C++1z, and deprecated otherwise.)
4947
4948 This warning is enabled by @option{-Wall}.
4949
4950 @item -Wduplicated-cond
4951 @opindex Wno-duplicated-cond
4952 @opindex Wduplicated-cond
4953 Warn about duplicated conditions in an if-else-if chain. For instance,
4954 warn for the following code:
4955 @smallexample
4956 if (p->q != NULL) @{ @dots{} @}
4957 else if (p->q != NULL) @{ @dots{} @}
4958 @end smallexample
4959
4960 @item -Wframe-address
4961 @opindex Wno-frame-address
4962 @opindex Wframe-address
4963 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
4964 is called with an argument greater than 0. Such calls may return indeterminate
4965 values or crash the program. The warning is included in @option{-Wall}.
4966
4967 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
4968 @opindex Wno-discarded-qualifiers
4969 @opindex Wdiscarded-qualifiers
4970 Do not warn if type qualifiers on pointers are being discarded.
4971 Typically, the compiler warns if a @code{const char *} variable is
4972 passed to a function that takes a @code{char *} parameter. This option
4973 can be used to suppress such a warning.
4974
4975 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
4976 @opindex Wno-discarded-array-qualifiers
4977 @opindex Wdiscarded-array-qualifiers
4978 Do not warn if type qualifiers on arrays which are pointer targets
4979 are being discarded. Typically, the compiler warns if a
4980 @code{const int (*)[]} variable is passed to a function that
4981 takes a @code{int (*)[]} parameter. This option can be used to
4982 suppress such a warning.
4983
4984 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
4985 @opindex Wno-incompatible-pointer-types
4986 @opindex Wincompatible-pointer-types
4987 Do not warn when there is a conversion between pointers that have incompatible
4988 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
4989 which warns for pointer argument passing or assignment with different
4990 signedness.
4991
4992 @item -Wno-int-conversion @r{(C and Objective-C only)}
4993 @opindex Wno-int-conversion
4994 @opindex Wint-conversion
4995 Do not warn about incompatible integer to pointer and pointer to integer
4996 conversions. This warning is about implicit conversions; for explicit
4997 conversions the warnings @option{-Wno-int-to-pointer-cast} and
4998 @option{-Wno-pointer-to-int-cast} may be used.
4999
5000 @item -Wno-div-by-zero
5001 @opindex Wno-div-by-zero
5002 @opindex Wdiv-by-zero
5003 Do not warn about compile-time integer division by zero. Floating-point
5004 division by zero is not warned about, as it can be a legitimate way of
5005 obtaining infinities and NaNs.
5006
5007 @item -Wsystem-headers
5008 @opindex Wsystem-headers
5009 @opindex Wno-system-headers
5010 @cindex warnings from system headers
5011 @cindex system headers, warnings from
5012 Print warning messages for constructs found in system header files.
5013 Warnings from system headers are normally suppressed, on the assumption
5014 that they usually do not indicate real problems and would only make the
5015 compiler output harder to read. Using this command-line option tells
5016 GCC to emit warnings from system headers as if they occurred in user
5017 code. However, note that using @option{-Wall} in conjunction with this
5018 option does @emph{not} warn about unknown pragmas in system
5019 headers---for that, @option{-Wunknown-pragmas} must also be used.
5020
5021 @item -Wtautological-compare
5022 @opindex Wtautological-compare
5023 @opindex Wno-tautological-compare
5024 Warn if a self-comparison always evaluates to true or false. This
5025 warning detects various mistakes such as:
5026 @smallexample
5027 int i = 1;
5028 @dots{}
5029 if (i > i) @{ @dots{} @}
5030 @end smallexample
5031 This warning is enabled by @option{-Wall}.
5032
5033 @item -Wtrampolines
5034 @opindex Wtrampolines
5035 @opindex Wno-trampolines
5036 Warn about trampolines generated for pointers to nested functions.
5037 A trampoline is a small piece of data or code that is created at run
5038 time on the stack when the address of a nested function is taken, and is
5039 used to call the nested function indirectly. For some targets, it is
5040 made up of data only and thus requires no special treatment. But, for
5041 most targets, it is made up of code and thus requires the stack to be
5042 made executable in order for the program to work properly.
5043
5044 @item -Wfloat-equal
5045 @opindex Wfloat-equal
5046 @opindex Wno-float-equal
5047 Warn if floating-point values are used in equality comparisons.
5048
5049 The idea behind this is that sometimes it is convenient (for the
5050 programmer) to consider floating-point values as approximations to
5051 infinitely precise real numbers. If you are doing this, then you need
5052 to compute (by analyzing the code, or in some other way) the maximum or
5053 likely maximum error that the computation introduces, and allow for it
5054 when performing comparisons (and when producing output, but that's a
5055 different problem). In particular, instead of testing for equality, you
5056 should check to see whether the two values have ranges that overlap; and
5057 this is done with the relational operators, so equality comparisons are
5058 probably mistaken.
5059
5060 @item -Wtraditional @r{(C and Objective-C only)}
5061 @opindex Wtraditional
5062 @opindex Wno-traditional
5063 Warn about certain constructs that behave differently in traditional and
5064 ISO C@. Also warn about ISO C constructs that have no traditional C
5065 equivalent, and/or problematic constructs that should be avoided.
5066
5067 @itemize @bullet
5068 @item
5069 Macro parameters that appear within string literals in the macro body.
5070 In traditional C macro replacement takes place within string literals,
5071 but in ISO C it does not.
5072
5073 @item
5074 In traditional C, some preprocessor directives did not exist.
5075 Traditional preprocessors only considered a line to be a directive
5076 if the @samp{#} appeared in column 1 on the line. Therefore
5077 @option{-Wtraditional} warns about directives that traditional C
5078 understands but ignores because the @samp{#} does not appear as the
5079 first character on the line. It also suggests you hide directives like
5080 @code{#pragma} not understood by traditional C by indenting them. Some
5081 traditional implementations do not recognize @code{#elif}, so this option
5082 suggests avoiding it altogether.
5083
5084 @item
5085 A function-like macro that appears without arguments.
5086
5087 @item
5088 The unary plus operator.
5089
5090 @item
5091 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5092 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5093 constants.) Note, these suffixes appear in macros defined in the system
5094 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5095 Use of these macros in user code might normally lead to spurious
5096 warnings, however GCC's integrated preprocessor has enough context to
5097 avoid warning in these cases.
5098
5099 @item
5100 A function declared external in one block and then used after the end of
5101 the block.
5102
5103 @item
5104 A @code{switch} statement has an operand of type @code{long}.
5105
5106 @item
5107 A non-@code{static} function declaration follows a @code{static} one.
5108 This construct is not accepted by some traditional C compilers.
5109
5110 @item
5111 The ISO type of an integer constant has a different width or
5112 signedness from its traditional type. This warning is only issued if
5113 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5114 typically represent bit patterns, are not warned about.
5115
5116 @item
5117 Usage of ISO string concatenation is detected.
5118
5119 @item
5120 Initialization of automatic aggregates.
5121
5122 @item
5123 Identifier conflicts with labels. Traditional C lacks a separate
5124 namespace for labels.
5125
5126 @item
5127 Initialization of unions. If the initializer is zero, the warning is
5128 omitted. This is done under the assumption that the zero initializer in
5129 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
5130 initializer warnings and relies on default initialization to zero in the
5131 traditional C case.
5132
5133 @item
5134 Conversions by prototypes between fixed/floating-point values and vice
5135 versa. The absence of these prototypes when compiling with traditional
5136 C causes serious problems. This is a subset of the possible
5137 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
5138
5139 @item
5140 Use of ISO C style function definitions. This warning intentionally is
5141 @emph{not} issued for prototype declarations or variadic functions
5142 because these ISO C features appear in your code when using
5143 libiberty's traditional C compatibility macros, @code{PARAMS} and
5144 @code{VPARAMS}. This warning is also bypassed for nested functions
5145 because that feature is already a GCC extension and thus not relevant to
5146 traditional C compatibility.
5147 @end itemize
5148
5149 @item -Wtraditional-conversion @r{(C and Objective-C only)}
5150 @opindex Wtraditional-conversion
5151 @opindex Wno-traditional-conversion
5152 Warn if a prototype causes a type conversion that is different from what
5153 would happen to the same argument in the absence of a prototype. This
5154 includes conversions of fixed point to floating and vice versa, and
5155 conversions changing the width or signedness of a fixed-point argument
5156 except when the same as the default promotion.
5157
5158 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
5159 @opindex Wdeclaration-after-statement
5160 @opindex Wno-declaration-after-statement
5161 Warn when a declaration is found after a statement in a block. This
5162 construct, known from C++, was introduced with ISO C99 and is by default
5163 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
5164
5165 @item -Wundef
5166 @opindex Wundef
5167 @opindex Wno-undef
5168 Warn if an undefined identifier is evaluated in an @code{#if} directive.
5169
5170 @item -Wno-endif-labels
5171 @opindex Wno-endif-labels
5172 @opindex Wendif-labels
5173 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
5174
5175 @item -Wshadow
5176 @opindex Wshadow
5177 @opindex Wno-shadow
5178 Warn whenever a local variable or type declaration shadows another
5179 variable, parameter, type, class member (in C++), or instance variable
5180 (in Objective-C) or whenever a built-in function is shadowed. Note
5181 that in C++, the compiler warns if a local variable shadows an
5182 explicit typedef, but not if it shadows a struct/class/enum.
5183
5184 @item -Wno-shadow-ivar @r{(Objective-C only)}
5185 @opindex Wno-shadow-ivar
5186 @opindex Wshadow-ivar
5187 Do not warn whenever a local variable shadows an instance variable in an
5188 Objective-C method.
5189
5190 @item -Wlarger-than=@var{len}
5191 @opindex Wlarger-than=@var{len}
5192 @opindex Wlarger-than-@var{len}
5193 Warn whenever an object of larger than @var{len} bytes is defined.
5194
5195 @item -Wframe-larger-than=@var{len}
5196 @opindex Wframe-larger-than
5197 Warn if the size of a function frame is larger than @var{len} bytes.
5198 The computation done to determine the stack frame size is approximate
5199 and not conservative.
5200 The actual requirements may be somewhat greater than @var{len}
5201 even if you do not get a warning. In addition, any space allocated
5202 via @code{alloca}, variable-length arrays, or related constructs
5203 is not included by the compiler when determining
5204 whether or not to issue a warning.
5205
5206 @item -Wno-free-nonheap-object
5207 @opindex Wno-free-nonheap-object
5208 @opindex Wfree-nonheap-object
5209 Do not warn when attempting to free an object that was not allocated
5210 on the heap.
5211
5212 @item -Wstack-usage=@var{len}
5213 @opindex Wstack-usage
5214 Warn if the stack usage of a function might be larger than @var{len} bytes.
5215 The computation done to determine the stack usage is conservative.
5216 Any space allocated via @code{alloca}, variable-length arrays, or related
5217 constructs is included by the compiler when determining whether or not to
5218 issue a warning.
5219
5220 The message is in keeping with the output of @option{-fstack-usage}.
5221
5222 @itemize
5223 @item
5224 If the stack usage is fully static but exceeds the specified amount, it's:
5225
5226 @smallexample
5227 warning: stack usage is 1120 bytes
5228 @end smallexample
5229 @item
5230 If the stack usage is (partly) dynamic but bounded, it's:
5231
5232 @smallexample
5233 warning: stack usage might be 1648 bytes
5234 @end smallexample
5235 @item
5236 If the stack usage is (partly) dynamic and not bounded, it's:
5237
5238 @smallexample
5239 warning: stack usage might be unbounded
5240 @end smallexample
5241 @end itemize
5242
5243 @item -Wunsafe-loop-optimizations
5244 @opindex Wunsafe-loop-optimizations
5245 @opindex Wno-unsafe-loop-optimizations
5246 Warn if the loop cannot be optimized because the compiler cannot
5247 assume anything on the bounds of the loop indices. With
5248 @option{-funsafe-loop-optimizations} warn if the compiler makes
5249 such assumptions.
5250
5251 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
5252 @opindex Wno-pedantic-ms-format
5253 @opindex Wpedantic-ms-format
5254 When used in combination with @option{-Wformat}
5255 and @option{-pedantic} without GNU extensions, this option
5256 disables the warnings about non-ISO @code{printf} / @code{scanf} format
5257 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
5258 which depend on the MS runtime.
5259
5260 @item -Waligned-new
5261 @opindex Waligned-new
5262 @opindex Wno-aligned-new
5263 Warn about a new-expression of a type that requires greater alignment
5264 than the @code{alignof(std::max_align_t)} but uses an allocation
5265 function without an explicit alignment parameter. This option is
5266 enabled by @option{-Wall}.
5267
5268 Normally this only warns about global allocation functions, but
5269 @option{-Waligned-new=all} also warns about class member allocation
5270 functions.
5271
5272 @item -Wplacement-new
5273 @itemx -Wplacement-new=@var{n}
5274 @opindex Wplacement-new
5275 @opindex Wno-placement-new
5276 Warn about placement new expressions with undefined behavior, such as
5277 constructing an object in a buffer that is smaller than the type of
5278 the object. For example, the placement new expression below is diagnosed
5279 because it attempts to construct an array of 64 integers in a buffer only
5280 64 bytes large.
5281 @smallexample
5282 char buf [64];
5283 new (buf) int[64];
5284 @end smallexample
5285 This warning is enabled by default.
5286
5287 @table @gcctabopt
5288 @item -Wplacement-new=1
5289 This is the default warning level of @option{-Wplacement-new}. At this
5290 level the warning is not issued for some strictly undefined constructs that
5291 GCC allows as extensions for compatibility with legacy code. For example,
5292 the following @code{new} expression is not diagnosed at this level even
5293 though it has undefined behavior according to the C++ standard because
5294 it writes past the end of the one-element array.
5295 @smallexample
5296 struct S @{ int n, a[1]; @};
5297 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5298 new (s->a)int [32]();
5299 @end smallexample
5300
5301 @item -Wplacement-new=2
5302 At this level, in addition to diagnosing all the same constructs as at level
5303 1, a diagnostic is also issued for placement new expressions that construct
5304 an object in the last member of structure whose type is an array of a single
5305 element and whose size is less than the size of the object being constructed.
5306 While the previous example would be diagnosed, the following construct makes
5307 use of the flexible member array extension to avoid the warning at level 2.
5308 @smallexample
5309 struct S @{ int n, a[]; @};
5310 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5311 new (s->a)int [32]();
5312 @end smallexample
5313
5314 @end table
5315
5316 @item -Wpointer-arith
5317 @opindex Wpointer-arith
5318 @opindex Wno-pointer-arith
5319 Warn about anything that depends on the ``size of'' a function type or
5320 of @code{void}. GNU C assigns these types a size of 1, for
5321 convenience in calculations with @code{void *} pointers and pointers
5322 to functions. In C++, warn also when an arithmetic operation involves
5323 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
5324
5325 @item -Wtype-limits
5326 @opindex Wtype-limits
5327 @opindex Wno-type-limits
5328 Warn if a comparison is always true or always false due to the limited
5329 range of the data type, but do not warn for constant expressions. For
5330 example, warn if an unsigned variable is compared against zero with
5331 @code{<} or @code{>=}. This warning is also enabled by
5332 @option{-Wextra}.
5333
5334 @item -Wbad-function-cast @r{(C and Objective-C only)}
5335 @opindex Wbad-function-cast
5336 @opindex Wno-bad-function-cast
5337 Warn when a function call is cast to a non-matching type.
5338 For example, warn if a call to a function returning an integer type
5339 is cast to a pointer type.
5340
5341 @item -Wc90-c99-compat @r{(C and Objective-C only)}
5342 @opindex Wc90-c99-compat
5343 @opindex Wno-c90-c99-compat
5344 Warn about features not present in ISO C90, but present in ISO C99.
5345 For instance, warn about use of variable length arrays, @code{long long}
5346 type, @code{bool} type, compound literals, designated initializers, and so
5347 on. This option is independent of the standards mode. Warnings are disabled
5348 in the expression that follows @code{__extension__}.
5349
5350 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5351 @opindex Wc99-c11-compat
5352 @opindex Wno-c99-c11-compat
5353 Warn about features not present in ISO C99, but present in ISO C11.
5354 For instance, warn about use of anonymous structures and unions,
5355 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5356 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5357 and so on. This option is independent of the standards mode. Warnings are
5358 disabled in the expression that follows @code{__extension__}.
5359
5360 @item -Wc++-compat @r{(C and Objective-C only)}
5361 @opindex Wc++-compat
5362 Warn about ISO C constructs that are outside of the common subset of
5363 ISO C and ISO C++, e.g.@: request for implicit conversion from
5364 @code{void *} to a pointer to non-@code{void} type.
5365
5366 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5367 @opindex Wc++11-compat
5368 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5369 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5370 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5371 enabled by @option{-Wall}.
5372
5373 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5374 @opindex Wc++14-compat
5375 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5376 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5377
5378 @item -Wcast-qual
5379 @opindex Wcast-qual
5380 @opindex Wno-cast-qual
5381 Warn whenever a pointer is cast so as to remove a type qualifier from
5382 the target type. For example, warn if a @code{const char *} is cast
5383 to an ordinary @code{char *}.
5384
5385 Also warn when making a cast that introduces a type qualifier in an
5386 unsafe way. For example, casting @code{char **} to @code{const char **}
5387 is unsafe, as in this example:
5388
5389 @smallexample
5390 /* p is char ** value. */
5391 const char **q = (const char **) p;
5392 /* Assignment of readonly string to const char * is OK. */
5393 *q = "string";
5394 /* Now char** pointer points to read-only memory. */
5395 **p = 'b';
5396 @end smallexample
5397
5398 @item -Wcast-align
5399 @opindex Wcast-align
5400 @opindex Wno-cast-align
5401 Warn whenever a pointer is cast such that the required alignment of the
5402 target is increased. For example, warn if a @code{char *} is cast to
5403 an @code{int *} on machines where integers can only be accessed at
5404 two- or four-byte boundaries.
5405
5406 @item -Wwrite-strings
5407 @opindex Wwrite-strings
5408 @opindex Wno-write-strings
5409 When compiling C, give string constants the type @code{const
5410 char[@var{length}]} so that copying the address of one into a
5411 non-@code{const} @code{char *} pointer produces a warning. These
5412 warnings help you find at compile time code that can try to write
5413 into a string constant, but only if you have been very careful about
5414 using @code{const} in declarations and prototypes. Otherwise, it is
5415 just a nuisance. This is why we did not make @option{-Wall} request
5416 these warnings.
5417
5418 When compiling C++, warn about the deprecated conversion from string
5419 literals to @code{char *}. This warning is enabled by default for C++
5420 programs.
5421
5422 @item -Wclobbered
5423 @opindex Wclobbered
5424 @opindex Wno-clobbered
5425 Warn for variables that might be changed by @code{longjmp} or
5426 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5427
5428 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5429 @opindex Wconditionally-supported
5430 @opindex Wno-conditionally-supported
5431 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5432
5433 @item -Wconversion
5434 @opindex Wconversion
5435 @opindex Wno-conversion
5436 Warn for implicit conversions that may alter a value. This includes
5437 conversions between real and integer, like @code{abs (x)} when
5438 @code{x} is @code{double}; conversions between signed and unsigned,
5439 like @code{unsigned ui = -1}; and conversions to smaller types, like
5440 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5441 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5442 changed by the conversion like in @code{abs (2.0)}. Warnings about
5443 conversions between signed and unsigned integers can be disabled by
5444 using @option{-Wno-sign-conversion}.
5445
5446 For C++, also warn for confusing overload resolution for user-defined
5447 conversions; and conversions that never use a type conversion
5448 operator: conversions to @code{void}, the same type, a base class or a
5449 reference to them. Warnings about conversions between signed and
5450 unsigned integers are disabled by default in C++ unless
5451 @option{-Wsign-conversion} is explicitly enabled.
5452
5453 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5454 @opindex Wconversion-null
5455 @opindex Wno-conversion-null
5456 Do not warn for conversions between @code{NULL} and non-pointer
5457 types. @option{-Wconversion-null} is enabled by default.
5458
5459 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5460 @opindex Wzero-as-null-pointer-constant
5461 @opindex Wno-zero-as-null-pointer-constant
5462 Warn when a literal @samp{0} is used as null pointer constant. This can
5463 be useful to facilitate the conversion to @code{nullptr} in C++11.
5464
5465 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5466 @opindex Wsubobject-linkage
5467 @opindex Wno-subobject-linkage
5468 Warn if a class type has a base or a field whose type uses the anonymous
5469 namespace or depends on a type with no linkage. If a type A depends on
5470 a type B with no or internal linkage, defining it in multiple
5471 translation units would be an ODR violation because the meaning of B
5472 is different in each translation unit. If A only appears in a single
5473 translation unit, the best way to silence the warning is to give it
5474 internal linkage by putting it in an anonymous namespace as well. The
5475 compiler doesn't give this warning for types defined in the main .C
5476 file, as those are unlikely to have multiple definitions.
5477 @option{-Wsubobject-linkage} is enabled by default.
5478
5479 @item -Wdangling-else
5480 @opindex Wdangling-else
5481 @opindex Wno-dangling-else
5482 Warn about constructions where there may be confusion to which
5483 @code{if} statement an @code{else} branch belongs. Here is an example of
5484 such a case:
5485
5486 @smallexample
5487 @group
5488 @{
5489 if (a)
5490 if (b)
5491 foo ();
5492 else
5493 bar ();
5494 @}
5495 @end group
5496 @end smallexample
5497
5498 In C/C++, every @code{else} branch belongs to the innermost possible
5499 @code{if} statement, which in this example is @code{if (b)}. This is
5500 often not what the programmer expected, as illustrated in the above
5501 example by indentation the programmer chose. When there is the
5502 potential for this confusion, GCC issues a warning when this flag
5503 is specified. To eliminate the warning, add explicit braces around
5504 the innermost @code{if} statement so there is no way the @code{else}
5505 can belong to the enclosing @code{if}. The resulting code
5506 looks like this:
5507
5508 @smallexample
5509 @group
5510 @{
5511 if (a)
5512 @{
5513 if (b)
5514 foo ();
5515 else
5516 bar ();
5517 @}
5518 @}
5519 @end group
5520 @end smallexample
5521
5522 This warning is enabled by @option{-Wparentheses}.
5523
5524 @item -Wdate-time
5525 @opindex Wdate-time
5526 @opindex Wno-date-time
5527 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5528 are encountered as they might prevent bit-wise-identical reproducible
5529 compilations.
5530
5531 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5532 @opindex Wdelete-incomplete
5533 @opindex Wno-delete-incomplete
5534 Warn when deleting a pointer to incomplete type, which may cause
5535 undefined behavior at runtime. This warning is enabled by default.
5536
5537 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5538 @opindex Wuseless-cast
5539 @opindex Wno-useless-cast
5540 Warn when an expression is casted to its own type.
5541
5542 @item -Wempty-body
5543 @opindex Wempty-body
5544 @opindex Wno-empty-body
5545 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5546 while} statement. This warning is also enabled by @option{-Wextra}.
5547
5548 @item -Wenum-compare
5549 @opindex Wenum-compare
5550 @opindex Wno-enum-compare
5551 Warn about a comparison between values of different enumerated types.
5552 In C++ enumeral mismatches in conditional expressions are also
5553 diagnosed and the warning is enabled by default. In C this warning is
5554 enabled by @option{-Wall}.
5555
5556 @item -Wjump-misses-init @r{(C, Objective-C only)}
5557 @opindex Wjump-misses-init
5558 @opindex Wno-jump-misses-init
5559 Warn if a @code{goto} statement or a @code{switch} statement jumps
5560 forward across the initialization of a variable, or jumps backward to a
5561 label after the variable has been initialized. This only warns about
5562 variables that are initialized when they are declared. This warning is
5563 only supported for C and Objective-C; in C++ this sort of branch is an
5564 error in any case.
5565
5566 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5567 can be disabled with the @option{-Wno-jump-misses-init} option.
5568
5569 @item -Wsign-compare
5570 @opindex Wsign-compare
5571 @opindex Wno-sign-compare
5572 @cindex warning for comparison of signed and unsigned values
5573 @cindex comparison of signed and unsigned values, warning
5574 @cindex signed and unsigned values, comparison warning
5575 Warn when a comparison between signed and unsigned values could produce
5576 an incorrect result when the signed value is converted to unsigned.
5577 In C++, this warning is also enabled by @option{-Wall}. In C, it is
5578 also enabled by @option{-Wextra}.
5579
5580 @item -Wsign-conversion
5581 @opindex Wsign-conversion
5582 @opindex Wno-sign-conversion
5583 Warn for implicit conversions that may change the sign of an integer
5584 value, like assigning a signed integer expression to an unsigned
5585 integer variable. An explicit cast silences the warning. In C, this
5586 option is enabled also by @option{-Wconversion}.
5587
5588 @item -Wfloat-conversion
5589 @opindex Wfloat-conversion
5590 @opindex Wno-float-conversion
5591 Warn for implicit conversions that reduce the precision of a real value.
5592 This includes conversions from real to integer, and from higher precision
5593 real to lower precision real values. This option is also enabled by
5594 @option{-Wconversion}.
5595
5596 @item -Wno-scalar-storage-order
5597 @opindex -Wno-scalar-storage-order
5598 @opindex -Wscalar-storage-order
5599 Do not warn on suspicious constructs involving reverse scalar storage order.
5600
5601 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
5602 @opindex Wsized-deallocation
5603 @opindex Wno-sized-deallocation
5604 Warn about a definition of an unsized deallocation function
5605 @smallexample
5606 void operator delete (void *) noexcept;
5607 void operator delete[] (void *) noexcept;
5608 @end smallexample
5609 without a definition of the corresponding sized deallocation function
5610 @smallexample
5611 void operator delete (void *, std::size_t) noexcept;
5612 void operator delete[] (void *, std::size_t) noexcept;
5613 @end smallexample
5614 or vice versa. Enabled by @option{-Wextra} along with
5615 @option{-fsized-deallocation}.
5616
5617 @item -Wsizeof-pointer-memaccess
5618 @opindex Wsizeof-pointer-memaccess
5619 @opindex Wno-sizeof-pointer-memaccess
5620 Warn for suspicious length parameters to certain string and memory built-in
5621 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
5622 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
5623 but a pointer, and suggests a possible fix, or about
5624 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
5625 @option{-Wall}.
5626
5627 @item -Wsizeof-array-argument
5628 @opindex Wsizeof-array-argument
5629 @opindex Wno-sizeof-array-argument
5630 Warn when the @code{sizeof} operator is applied to a parameter that is
5631 declared as an array in a function definition. This warning is enabled by
5632 default for C and C++ programs.
5633
5634 @item -Wmemset-elt-size
5635 @opindex Wmemset-elt-size
5636 @opindex Wno-memset-elt-size
5637 Warn for suspicious calls to the @code{memset} built-in function, if the
5638 first argument references an array, and the third argument is a number
5639 equal to the number of elements, but not equal to the size of the array
5640 in memory. This indicates that the user has omitted a multiplication by
5641 the element size. This warning is enabled by @option{-Wall}.
5642
5643 @item -Wmemset-transposed-args
5644 @opindex Wmemset-transposed-args
5645 @opindex Wno-memset-transposed-args
5646 Warn for suspicious calls to the @code{memset} built-in function, if the
5647 second argument is not zero and the third argument is zero. This warns e.g.@
5648 about @code{memset (buf, sizeof buf, 0)} where most probably
5649 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
5650 is only emitted if the third argument is literal zero. If it is some
5651 expression that is folded to zero, a cast of zero to some type, etc.,
5652 it is far less likely that the user has mistakenly exchanged the arguments
5653 and no warning is emitted. This warning is enabled by @option{-Wall}.
5654
5655 @item -Waddress
5656 @opindex Waddress
5657 @opindex Wno-address
5658 Warn about suspicious uses of memory addresses. These include using
5659 the address of a function in a conditional expression, such as
5660 @code{void func(void); if (func)}, and comparisons against the memory
5661 address of a string literal, such as @code{if (x == "abc")}. Such
5662 uses typically indicate a programmer error: the address of a function
5663 always evaluates to true, so their use in a conditional usually
5664 indicate that the programmer forgot the parentheses in a function
5665 call; and comparisons against string literals result in unspecified
5666 behavior and are not portable in C, so they usually indicate that the
5667 programmer intended to use @code{strcmp}. This warning is enabled by
5668 @option{-Wall}.
5669
5670 @item -Wlogical-op
5671 @opindex Wlogical-op
5672 @opindex Wno-logical-op
5673 Warn about suspicious uses of logical operators in expressions.
5674 This includes using logical operators in contexts where a
5675 bit-wise operator is likely to be expected. Also warns when
5676 the operands of a logical operator are the same:
5677 @smallexample
5678 extern int a;
5679 if (a < 0 && a < 0) @{ @dots{} @}
5680 @end smallexample
5681
5682 @item -Wlogical-not-parentheses
5683 @opindex Wlogical-not-parentheses
5684 @opindex Wno-logical-not-parentheses
5685 Warn about logical not used on the left hand side operand of a comparison.
5686 This option does not warn if the right operand is considered to be a boolean
5687 expression. Its purpose is to detect suspicious code like the following:
5688 @smallexample
5689 int a;
5690 @dots{}
5691 if (!a > 1) @{ @dots{} @}
5692 @end smallexample
5693
5694 It is possible to suppress the warning by wrapping the LHS into
5695 parentheses:
5696 @smallexample
5697 if ((!a) > 1) @{ @dots{} @}
5698 @end smallexample
5699
5700 This warning is enabled by @option{-Wall}.
5701
5702 @item -Waggregate-return
5703 @opindex Waggregate-return
5704 @opindex Wno-aggregate-return
5705 Warn if any functions that return structures or unions are defined or
5706 called. (In languages where you can return an array, this also elicits
5707 a warning.)
5708
5709 @item -Wno-aggressive-loop-optimizations
5710 @opindex Wno-aggressive-loop-optimizations
5711 @opindex Waggressive-loop-optimizations
5712 Warn if in a loop with constant number of iterations the compiler detects
5713 undefined behavior in some statement during one or more of the iterations.
5714
5715 @item -Wno-attributes
5716 @opindex Wno-attributes
5717 @opindex Wattributes
5718 Do not warn if an unexpected @code{__attribute__} is used, such as
5719 unrecognized attributes, function attributes applied to variables,
5720 etc. This does not stop errors for incorrect use of supported
5721 attributes.
5722
5723 @item -Wno-builtin-macro-redefined
5724 @opindex Wno-builtin-macro-redefined
5725 @opindex Wbuiltin-macro-redefined
5726 Do not warn if certain built-in macros are redefined. This suppresses
5727 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
5728 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
5729
5730 @item -Wstrict-prototypes @r{(C and Objective-C only)}
5731 @opindex Wstrict-prototypes
5732 @opindex Wno-strict-prototypes
5733 Warn if a function is declared or defined without specifying the
5734 argument types. (An old-style function definition is permitted without
5735 a warning if preceded by a declaration that specifies the argument
5736 types.)
5737
5738 @item -Wold-style-declaration @r{(C and Objective-C only)}
5739 @opindex Wold-style-declaration
5740 @opindex Wno-old-style-declaration
5741 Warn for obsolescent usages, according to the C Standard, in a
5742 declaration. For example, warn if storage-class specifiers like
5743 @code{static} are not the first things in a declaration. This warning
5744 is also enabled by @option{-Wextra}.
5745
5746 @item -Wold-style-definition @r{(C and Objective-C only)}
5747 @opindex Wold-style-definition
5748 @opindex Wno-old-style-definition
5749 Warn if an old-style function definition is used. A warning is given
5750 even if there is a previous prototype.
5751
5752 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5753 @opindex Wmissing-parameter-type
5754 @opindex Wno-missing-parameter-type
5755 A function parameter is declared without a type specifier in K&R-style
5756 functions:
5757
5758 @smallexample
5759 void foo(bar) @{ @}
5760 @end smallexample
5761
5762 This warning is also enabled by @option{-Wextra}.
5763
5764 @item -Wmissing-prototypes @r{(C and Objective-C only)}
5765 @opindex Wmissing-prototypes
5766 @opindex Wno-missing-prototypes
5767 Warn if a global function is defined without a previous prototype
5768 declaration. This warning is issued even if the definition itself
5769 provides a prototype. Use this option to detect global functions
5770 that do not have a matching prototype declaration in a header file.
5771 This option is not valid for C++ because all function declarations
5772 provide prototypes and a non-matching declaration declares an
5773 overload rather than conflict with an earlier declaration.
5774 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
5775
5776 @item -Wmissing-declarations
5777 @opindex Wmissing-declarations
5778 @opindex Wno-missing-declarations
5779 Warn if a global function is defined without a previous declaration.
5780 Do so even if the definition itself provides a prototype.
5781 Use this option to detect global functions that are not declared in
5782 header files. In C, no warnings are issued for functions with previous
5783 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
5784 missing prototypes. In C++, no warnings are issued for function templates,
5785 or for inline functions, or for functions in anonymous namespaces.
5786
5787 @item -Wmissing-field-initializers
5788 @opindex Wmissing-field-initializers
5789 @opindex Wno-missing-field-initializers
5790 @opindex W
5791 @opindex Wextra
5792 @opindex Wno-extra
5793 Warn if a structure's initializer has some fields missing. For
5794 example, the following code causes such a warning, because
5795 @code{x.h} is implicitly zero:
5796
5797 @smallexample
5798 struct s @{ int f, g, h; @};
5799 struct s x = @{ 3, 4 @};
5800 @end smallexample
5801
5802 This option does not warn about designated initializers, so the following
5803 modification does not trigger a warning:
5804
5805 @smallexample
5806 struct s @{ int f, g, h; @};
5807 struct s x = @{ .f = 3, .g = 4 @};
5808 @end smallexample
5809
5810 In C++ this option does not warn either about the empty @{ @}
5811 initializer, for example:
5812
5813 @smallexample
5814 struct s @{ int f, g, h; @};
5815 s x = @{ @};
5816 @end smallexample
5817
5818 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
5819 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
5820
5821 @item -Wno-multichar
5822 @opindex Wno-multichar
5823 @opindex Wmultichar
5824 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
5825 Usually they indicate a typo in the user's code, as they have
5826 implementation-defined values, and should not be used in portable code.
5827
5828 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
5829 @opindex Wnormalized=
5830 @opindex Wnormalized
5831 @opindex Wno-normalized
5832 @cindex NFC
5833 @cindex NFKC
5834 @cindex character set, input normalization
5835 In ISO C and ISO C++, two identifiers are different if they are
5836 different sequences of characters. However, sometimes when characters
5837 outside the basic ASCII character set are used, you can have two
5838 different character sequences that look the same. To avoid confusion,
5839 the ISO 10646 standard sets out some @dfn{normalization rules} which
5840 when applied ensure that two sequences that look the same are turned into
5841 the same sequence. GCC can warn you if you are using identifiers that
5842 have not been normalized; this option controls that warning.
5843
5844 There are four levels of warning supported by GCC@. The default is
5845 @option{-Wnormalized=nfc}, which warns about any identifier that is
5846 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
5847 recommended form for most uses. It is equivalent to
5848 @option{-Wnormalized}.
5849
5850 Unfortunately, there are some characters allowed in identifiers by
5851 ISO C and ISO C++ that, when turned into NFC, are not allowed in
5852 identifiers. That is, there's no way to use these symbols in portable
5853 ISO C or C++ and have all your identifiers in NFC@.
5854 @option{-Wnormalized=id} suppresses the warning for these characters.
5855 It is hoped that future versions of the standards involved will correct
5856 this, which is why this option is not the default.
5857
5858 You can switch the warning off for all characters by writing
5859 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
5860 only do this if you are using some other normalization scheme (like
5861 ``D''), because otherwise you can easily create bugs that are
5862 literally impossible to see.
5863
5864 Some characters in ISO 10646 have distinct meanings but look identical
5865 in some fonts or display methodologies, especially once formatting has
5866 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
5867 LETTER N'', displays just like a regular @code{n} that has been
5868 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
5869 normalization scheme to convert all these into a standard form as
5870 well, and GCC warns if your code is not in NFKC if you use
5871 @option{-Wnormalized=nfkc}. This warning is comparable to warning
5872 about every identifier that contains the letter O because it might be
5873 confused with the digit 0, and so is not the default, but may be
5874 useful as a local coding convention if the programming environment
5875 cannot be fixed to display these characters distinctly.
5876
5877 @item -Wno-deprecated
5878 @opindex Wno-deprecated
5879 @opindex Wdeprecated
5880 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
5881
5882 @item -Wno-deprecated-declarations
5883 @opindex Wno-deprecated-declarations
5884 @opindex Wdeprecated-declarations
5885 Do not warn about uses of functions (@pxref{Function Attributes}),
5886 variables (@pxref{Variable Attributes}), and types (@pxref{Type
5887 Attributes}) marked as deprecated by using the @code{deprecated}
5888 attribute.
5889
5890 @item -Wno-overflow
5891 @opindex Wno-overflow
5892 @opindex Woverflow
5893 Do not warn about compile-time overflow in constant expressions.
5894
5895 @item -Wno-odr
5896 @opindex Wno-odr
5897 @opindex Wodr
5898 Warn about One Definition Rule violations during link-time optimization.
5899 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
5900
5901 @item -Wopenmp-simd
5902 @opindex Wopenm-simd
5903 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
5904 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
5905 option can be used to relax the cost model.
5906
5907 @item -Woverride-init @r{(C and Objective-C only)}
5908 @opindex Woverride-init
5909 @opindex Wno-override-init
5910 @opindex W
5911 @opindex Wextra
5912 @opindex Wno-extra
5913 Warn if an initialized field without side effects is overridden when
5914 using designated initializers (@pxref{Designated Inits, , Designated
5915 Initializers}).
5916
5917 This warning is included in @option{-Wextra}. To get other
5918 @option{-Wextra} warnings without this one, use @option{-Wextra
5919 -Wno-override-init}.
5920
5921 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
5922 @opindex Woverride-init-side-effects
5923 @opindex Wno-override-init-side-effects
5924 Warn if an initialized field with side effects is overridden when
5925 using designated initializers (@pxref{Designated Inits, , Designated
5926 Initializers}). This warning is enabled by default.
5927
5928 @item -Wpacked
5929 @opindex Wpacked
5930 @opindex Wno-packed
5931 Warn if a structure is given the packed attribute, but the packed
5932 attribute has no effect on the layout or size of the structure.
5933 Such structures may be mis-aligned for little benefit. For
5934 instance, in this code, the variable @code{f.x} in @code{struct bar}
5935 is misaligned even though @code{struct bar} does not itself
5936 have the packed attribute:
5937
5938 @smallexample
5939 @group
5940 struct foo @{
5941 int x;
5942 char a, b, c, d;
5943 @} __attribute__((packed));
5944 struct bar @{
5945 char z;
5946 struct foo f;
5947 @};
5948 @end group
5949 @end smallexample
5950
5951 @item -Wpacked-bitfield-compat
5952 @opindex Wpacked-bitfield-compat
5953 @opindex Wno-packed-bitfield-compat
5954 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
5955 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
5956 the change can lead to differences in the structure layout. GCC
5957 informs you when the offset of such a field has changed in GCC 4.4.
5958 For example there is no longer a 4-bit padding between field @code{a}
5959 and @code{b} in this structure:
5960
5961 @smallexample
5962 struct foo
5963 @{
5964 char a:4;
5965 char b:8;
5966 @} __attribute__ ((packed));
5967 @end smallexample
5968
5969 This warning is enabled by default. Use
5970 @option{-Wno-packed-bitfield-compat} to disable this warning.
5971
5972 @item -Wpadded
5973 @opindex Wpadded
5974 @opindex Wno-padded
5975 Warn if padding is included in a structure, either to align an element
5976 of the structure or to align the whole structure. Sometimes when this
5977 happens it is possible to rearrange the fields of the structure to
5978 reduce the padding and so make the structure smaller.
5979
5980 @item -Wredundant-decls
5981 @opindex Wredundant-decls
5982 @opindex Wno-redundant-decls
5983 Warn if anything is declared more than once in the same scope, even in
5984 cases where multiple declaration is valid and changes nothing.
5985
5986 @item -Wnested-externs @r{(C and Objective-C only)}
5987 @opindex Wnested-externs
5988 @opindex Wno-nested-externs
5989 Warn if an @code{extern} declaration is encountered within a function.
5990
5991 @item -Wno-inherited-variadic-ctor
5992 @opindex Winherited-variadic-ctor
5993 @opindex Wno-inherited-variadic-ctor
5994 Suppress warnings about use of C++11 inheriting constructors when the
5995 base class inherited from has a C variadic constructor; the warning is
5996 on by default because the ellipsis is not inherited.
5997
5998 @item -Winline
5999 @opindex Winline
6000 @opindex Wno-inline
6001 Warn if a function that is declared as inline cannot be inlined.
6002 Even with this option, the compiler does not warn about failures to
6003 inline functions declared in system headers.
6004
6005 The compiler uses a variety of heuristics to determine whether or not
6006 to inline a function. For example, the compiler takes into account
6007 the size of the function being inlined and the amount of inlining
6008 that has already been done in the current function. Therefore,
6009 seemingly insignificant changes in the source program can cause the
6010 warnings produced by @option{-Winline} to appear or disappear.
6011
6012 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
6013 @opindex Wno-invalid-offsetof
6014 @opindex Winvalid-offsetof
6015 Suppress warnings from applying the @code{offsetof} macro to a non-POD
6016 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
6017 to a non-standard-layout type is undefined. In existing C++ implementations,
6018 however, @code{offsetof} typically gives meaningful results.
6019 This flag is for users who are aware that they are
6020 writing nonportable code and who have deliberately chosen to ignore the
6021 warning about it.
6022
6023 The restrictions on @code{offsetof} may be relaxed in a future version
6024 of the C++ standard.
6025
6026 @item -Wint-in-bool-context
6027 @opindex Wint-in-bool-context
6028 @opindex Wno-int-in-bool-context
6029 Warn for suspicious use of integer values where boolean values are expected,
6030 such as conditional expressions (?:) using non-boolean integer constants in
6031 boolean context, like @code{if (a <= b ? 2 : 3)}.
6032 This warning is enabled by @option{-Wall}.
6033
6034 @item -Wno-int-to-pointer-cast
6035 @opindex Wno-int-to-pointer-cast
6036 @opindex Wint-to-pointer-cast
6037 Suppress warnings from casts to pointer type of an integer of a
6038 different size. In C++, casting to a pointer type of smaller size is
6039 an error. @option{Wint-to-pointer-cast} is enabled by default.
6040
6041
6042 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
6043 @opindex Wno-pointer-to-int-cast
6044 @opindex Wpointer-to-int-cast
6045 Suppress warnings from casts from a pointer to an integer type of a
6046 different size.
6047
6048 @item -Winvalid-pch
6049 @opindex Winvalid-pch
6050 @opindex Wno-invalid-pch
6051 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
6052 the search path but can't be used.
6053
6054 @item -Wlong-long
6055 @opindex Wlong-long
6056 @opindex Wno-long-long
6057 Warn if @code{long long} type is used. This is enabled by either
6058 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
6059 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
6060
6061 @item -Wvariadic-macros
6062 @opindex Wvariadic-macros
6063 @opindex Wno-variadic-macros
6064 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6065 alternate syntax is used in ISO C99 mode. This is enabled by either
6066 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
6067 messages, use @option{-Wno-variadic-macros}.
6068
6069 @item -Wvarargs
6070 @opindex Wvarargs
6071 @opindex Wno-varargs
6072 Warn upon questionable usage of the macros used to handle variable
6073 arguments like @code{va_start}. This is default. To inhibit the
6074 warning messages, use @option{-Wno-varargs}.
6075
6076 @item -Wvector-operation-performance
6077 @opindex Wvector-operation-performance
6078 @opindex Wno-vector-operation-performance
6079 Warn if vector operation is not implemented via SIMD capabilities of the
6080 architecture. Mainly useful for the performance tuning.
6081 Vector operation can be implemented @code{piecewise}, which means that the
6082 scalar operation is performed on every vector element;
6083 @code{in parallel}, which means that the vector operation is implemented
6084 using scalars of wider type, which normally is more performance efficient;
6085 and @code{as a single scalar}, which means that vector fits into a
6086 scalar type.
6087
6088 @item -Wno-virtual-move-assign
6089 @opindex Wvirtual-move-assign
6090 @opindex Wno-virtual-move-assign
6091 Suppress warnings about inheriting from a virtual base with a
6092 non-trivial C++11 move assignment operator. This is dangerous because
6093 if the virtual base is reachable along more than one path, it is
6094 moved multiple times, which can mean both objects end up in the
6095 moved-from state. If the move assignment operator is written to avoid
6096 moving from a moved-from object, this warning can be disabled.
6097
6098 @item -Wvla
6099 @opindex Wvla
6100 @opindex Wno-vla
6101 Warn if variable length array is used in the code.
6102 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
6103 the variable length array.
6104
6105 @item -Wvolatile-register-var
6106 @opindex Wvolatile-register-var
6107 @opindex Wno-volatile-register-var
6108 Warn if a register variable is declared volatile. The volatile
6109 modifier does not inhibit all optimizations that may eliminate reads
6110 and/or writes to register variables. This warning is enabled by
6111 @option{-Wall}.
6112
6113 @item -Wdisabled-optimization
6114 @opindex Wdisabled-optimization
6115 @opindex Wno-disabled-optimization
6116 Warn if a requested optimization pass is disabled. This warning does
6117 not generally indicate that there is anything wrong with your code; it
6118 merely indicates that GCC's optimizers are unable to handle the code
6119 effectively. Often, the problem is that your code is too big or too
6120 complex; GCC refuses to optimize programs when the optimization
6121 itself is likely to take inordinate amounts of time.
6122
6123 @item -Wpointer-sign @r{(C and Objective-C only)}
6124 @opindex Wpointer-sign
6125 @opindex Wno-pointer-sign
6126 Warn for pointer argument passing or assignment with different signedness.
6127 This option is only supported for C and Objective-C@. It is implied by
6128 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
6129 @option{-Wno-pointer-sign}.
6130
6131 @item -Wstack-protector
6132 @opindex Wstack-protector
6133 @opindex Wno-stack-protector
6134 This option is only active when @option{-fstack-protector} is active. It
6135 warns about functions that are not protected against stack smashing.
6136
6137 @item -Woverlength-strings
6138 @opindex Woverlength-strings
6139 @opindex Wno-overlength-strings
6140 Warn about string constants that are longer than the ``minimum
6141 maximum'' length specified in the C standard. Modern compilers
6142 generally allow string constants that are much longer than the
6143 standard's minimum limit, but very portable programs should avoid
6144 using longer strings.
6145
6146 The limit applies @emph{after} string constant concatenation, and does
6147 not count the trailing NUL@. In C90, the limit was 509 characters; in
6148 C99, it was raised to 4095. C++98 does not specify a normative
6149 minimum maximum, so we do not diagnose overlength strings in C++@.
6150
6151 This option is implied by @option{-Wpedantic}, and can be disabled with
6152 @option{-Wno-overlength-strings}.
6153
6154 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
6155 @opindex Wunsuffixed-float-constants
6156
6157 Issue a warning for any floating constant that does not have
6158 a suffix. When used together with @option{-Wsystem-headers} it
6159 warns about such constants in system header files. This can be useful
6160 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
6161 from the decimal floating-point extension to C99.
6162
6163 @item -Wno-designated-init @r{(C and Objective-C only)}
6164 Suppress warnings when a positional initializer is used to initialize
6165 a structure that has been marked with the @code{designated_init}
6166 attribute.
6167
6168 @item -Whsa
6169 Issue a warning when HSAIL cannot be emitted for the compiled function or
6170 OpenMP construct.
6171
6172 @end table
6173
6174 @node Debugging Options
6175 @section Options for Debugging Your Program
6176 @cindex options, debugging
6177 @cindex debugging information options
6178
6179 To tell GCC to emit extra information for use by a debugger, in almost
6180 all cases you need only to add @option{-g} to your other options.
6181
6182 GCC allows you to use @option{-g} with
6183 @option{-O}. The shortcuts taken by optimized code may occasionally
6184 be surprising: some variables you declared may not exist
6185 at all; flow of control may briefly move where you did not expect it;
6186 some statements may not be executed because they compute constant
6187 results or their values are already at hand; some statements may
6188 execute in different places because they have been moved out of loops.
6189 Nevertheless it is possible to debug optimized output. This makes
6190 it reasonable to use the optimizer for programs that might have bugs.
6191
6192 If you are not using some other optimization option, consider
6193 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
6194 With no @option{-O} option at all, some compiler passes that collect
6195 information useful for debugging do not run at all, so that
6196 @option{-Og} may result in a better debugging experience.
6197
6198 @table @gcctabopt
6199 @item -g
6200 @opindex g
6201 Produce debugging information in the operating system's native format
6202 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
6203 information.
6204
6205 On most systems that use stabs format, @option{-g} enables use of extra
6206 debugging information that only GDB can use; this extra information
6207 makes debugging work better in GDB but probably makes other debuggers
6208 crash or
6209 refuse to read the program. If you want to control for certain whether
6210 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
6211 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
6212
6213 @item -ggdb
6214 @opindex ggdb
6215 Produce debugging information for use by GDB@. This means to use the
6216 most expressive format available (DWARF, stabs, or the native format
6217 if neither of those are supported), including GDB extensions if at all
6218 possible.
6219
6220 @item -gdwarf
6221 @itemx -gdwarf-@var{version}
6222 @opindex gdwarf
6223 Produce debugging information in DWARF format (if that is supported).
6224 The value of @var{version} may be either 2, 3, 4 or 5; the default version
6225 for most targets is 4. DWARF Version 5 is only experimental.
6226
6227 Note that with DWARF Version 2, some ports require and always
6228 use some non-conflicting DWARF 3 extensions in the unwind tables.
6229
6230 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
6231 for maximum benefit.
6232
6233 GCC no longer supports DWARF Version 1, which is substantially
6234 different than Version 2 and later. For historical reasons, some
6235 other DWARF-related options (including @option{-feliminate-dwarf2-dups}
6236 and @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
6237 in their names, but apply to all currently-supported versions of DWARF.
6238
6239 @item -gstabs
6240 @opindex gstabs
6241 Produce debugging information in stabs format (if that is supported),
6242 without GDB extensions. This is the format used by DBX on most BSD
6243 systems. On MIPS, Alpha and System V Release 4 systems this option
6244 produces stabs debugging output that is not understood by DBX or SDB@.
6245 On System V Release 4 systems this option requires the GNU assembler.
6246
6247 @item -gstabs+
6248 @opindex gstabs+
6249 Produce debugging information in stabs format (if that is supported),
6250 using GNU extensions understood only by the GNU debugger (GDB)@. The
6251 use of these extensions is likely to make other debuggers crash or
6252 refuse to read the program.
6253
6254 @item -gcoff
6255 @opindex gcoff
6256 Produce debugging information in COFF format (if that is supported).
6257 This is the format used by SDB on most System V systems prior to
6258 System V Release 4.
6259
6260 @item -gxcoff
6261 @opindex gxcoff
6262 Produce debugging information in XCOFF format (if that is supported).
6263 This is the format used by the DBX debugger on IBM RS/6000 systems.
6264
6265 @item -gxcoff+
6266 @opindex gxcoff+
6267 Produce debugging information in XCOFF format (if that is supported),
6268 using GNU extensions understood only by the GNU debugger (GDB)@. The
6269 use of these extensions is likely to make other debuggers crash or
6270 refuse to read the program, and may cause assemblers other than the GNU
6271 assembler (GAS) to fail with an error.
6272
6273 @item -gvms
6274 @opindex gvms
6275 Produce debugging information in Alpha/VMS debug format (if that is
6276 supported). This is the format used by DEBUG on Alpha/VMS systems.
6277
6278 @item -g@var{level}
6279 @itemx -ggdb@var{level}
6280 @itemx -gstabs@var{level}
6281 @itemx -gcoff@var{level}
6282 @itemx -gxcoff@var{level}
6283 @itemx -gvms@var{level}
6284 Request debugging information and also use @var{level} to specify how
6285 much information. The default level is 2.
6286
6287 Level 0 produces no debug information at all. Thus, @option{-g0} negates
6288 @option{-g}.
6289
6290 Level 1 produces minimal information, enough for making backtraces in
6291 parts of the program that you don't plan to debug. This includes
6292 descriptions of functions and external variables, and line number
6293 tables, but no information about local variables.
6294
6295 Level 3 includes extra information, such as all the macro definitions
6296 present in the program. Some debuggers support macro expansion when
6297 you use @option{-g3}.
6298
6299 @option{-gdwarf} does not accept a concatenated debug level, to avoid
6300 confusion with @option{-gdwarf-@var{level}}.
6301 Instead use an additional @option{-g@var{level}} option to change the
6302 debug level for DWARF.
6303
6304 @item -feliminate-unused-debug-symbols
6305 @opindex feliminate-unused-debug-symbols
6306 Produce debugging information in stabs format (if that is supported),
6307 for only symbols that are actually used.
6308
6309 @item -femit-class-debug-always
6310 @opindex femit-class-debug-always
6311 Instead of emitting debugging information for a C++ class in only one
6312 object file, emit it in all object files using the class. This option
6313 should be used only with debuggers that are unable to handle the way GCC
6314 normally emits debugging information for classes because using this
6315 option increases the size of debugging information by as much as a
6316 factor of two.
6317
6318 @item -fno-merge-debug-strings
6319 @opindex fmerge-debug-strings
6320 @opindex fno-merge-debug-strings
6321 Direct the linker to not merge together strings in the debugging
6322 information that are identical in different object files. Merging is
6323 not supported by all assemblers or linkers. Merging decreases the size
6324 of the debug information in the output file at the cost of increasing
6325 link processing time. Merging is enabled by default.
6326
6327 @item -fdebug-prefix-map=@var{old}=@var{new}
6328 @opindex fdebug-prefix-map
6329 When compiling files in directory @file{@var{old}}, record debugging
6330 information describing them as in @file{@var{new}} instead.
6331
6332 @item -fvar-tracking
6333 @opindex fvar-tracking
6334 Run variable tracking pass. It computes where variables are stored at each
6335 position in code. Better debugging information is then generated
6336 (if the debugging information format supports this information).
6337
6338 It is enabled by default when compiling with optimization (@option{-Os},
6339 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6340 the debug info format supports it.
6341
6342 @item -fvar-tracking-assignments
6343 @opindex fvar-tracking-assignments
6344 @opindex fno-var-tracking-assignments
6345 Annotate assignments to user variables early in the compilation and
6346 attempt to carry the annotations over throughout the compilation all the
6347 way to the end, in an attempt to improve debug information while
6348 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6349
6350 It can be enabled even if var-tracking is disabled, in which case
6351 annotations are created and maintained, but discarded at the end.
6352 By default, this flag is enabled together with @option{-fvar-tracking},
6353 except when selective scheduling is enabled.
6354
6355 @item -gsplit-dwarf
6356 @opindex gsplit-dwarf
6357 Separate as much DWARF debugging information as possible into a
6358 separate output file with the extension @file{.dwo}. This option allows
6359 the build system to avoid linking files with debug information. To
6360 be useful, this option requires a debugger capable of reading @file{.dwo}
6361 files.
6362
6363 @item -gpubnames
6364 @opindex gpubnames
6365 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
6366
6367 @item -ggnu-pubnames
6368 @opindex ggnu-pubnames
6369 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
6370 suitable for conversion into a GDB@ index. This option is only useful
6371 with a linker that can produce GDB@ index version 7.
6372
6373 @item -fdebug-types-section
6374 @opindex fdebug-types-section
6375 @opindex fno-debug-types-section
6376 When using DWARF Version 4 or higher, type DIEs can be put into
6377 their own @code{.debug_types} section instead of making them part of the
6378 @code{.debug_info} section. It is more efficient to put them in a separate
6379 comdat sections since the linker can then remove duplicates.
6380 But not all DWARF consumers support @code{.debug_types} sections yet
6381 and on some objects @code{.debug_types} produces larger instead of smaller
6382 debugging information.
6383
6384 @item -grecord-gcc-switches
6385 @item -gno-record-gcc-switches
6386 @opindex grecord-gcc-switches
6387 @opindex gno-record-gcc-switches
6388 This switch causes the command-line options used to invoke the
6389 compiler that may affect code generation to be appended to the
6390 DW_AT_producer attribute in DWARF debugging information. The options
6391 are concatenated with spaces separating them from each other and from
6392 the compiler version.
6393 It is enabled by default.
6394 See also @option{-frecord-gcc-switches} for another
6395 way of storing compiler options into the object file.
6396
6397 @item -gstrict-dwarf
6398 @opindex gstrict-dwarf
6399 Disallow using extensions of later DWARF standard version than selected
6400 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
6401 DWARF extensions from later standard versions is allowed.
6402
6403 @item -gno-strict-dwarf
6404 @opindex gno-strict-dwarf
6405 Allow using extensions of later DWARF standard version than selected with
6406 @option{-gdwarf-@var{version}}.
6407
6408 @item -gz@r{[}=@var{type}@r{]}
6409 @opindex gz
6410 Produce compressed debug sections in DWARF format, if that is supported.
6411 If @var{type} is not given, the default type depends on the capabilities
6412 of the assembler and linker used. @var{type} may be one of
6413 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
6414 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
6415 compression in traditional GNU format). If the linker doesn't support
6416 writing compressed debug sections, the option is rejected. Otherwise,
6417 if the assembler does not support them, @option{-gz} is silently ignored
6418 when producing object files.
6419
6420 @item -feliminate-dwarf2-dups
6421 @opindex feliminate-dwarf2-dups
6422 Compress DWARF debugging information by eliminating duplicated
6423 information about each symbol. This option only makes sense when
6424 generating DWARF debugging information.
6425
6426 @item -femit-struct-debug-baseonly
6427 @opindex femit-struct-debug-baseonly
6428 Emit debug information for struct-like types
6429 only when the base name of the compilation source file
6430 matches the base name of file in which the struct is defined.
6431
6432 This option substantially reduces the size of debugging information,
6433 but at significant potential loss in type information to the debugger.
6434 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6435 See @option{-femit-struct-debug-detailed} for more detailed control.
6436
6437 This option works only with DWARF debug output.
6438
6439 @item -femit-struct-debug-reduced
6440 @opindex femit-struct-debug-reduced
6441 Emit debug information for struct-like types
6442 only when the base name of the compilation source file
6443 matches the base name of file in which the type is defined,
6444 unless the struct is a template or defined in a system header.
6445
6446 This option significantly reduces the size of debugging information,
6447 with some potential loss in type information to the debugger.
6448 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6449 See @option{-femit-struct-debug-detailed} for more detailed control.
6450
6451 This option works only with DWARF debug output.
6452
6453 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6454 @opindex femit-struct-debug-detailed
6455 Specify the struct-like types
6456 for which the compiler generates debug information.
6457 The intent is to reduce duplicate struct debug information
6458 between different object files within the same program.
6459
6460 This option is a detailed version of
6461 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6462 which serves for most needs.
6463
6464 A specification has the syntax@*
6465 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6466
6467 The optional first word limits the specification to
6468 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6469 A struct type is used directly when it is the type of a variable, member.
6470 Indirect uses arise through pointers to structs.
6471 That is, when use of an incomplete struct is valid, the use is indirect.
6472 An example is
6473 @samp{struct one direct; struct two * indirect;}.
6474
6475 The optional second word limits the specification to
6476 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6477 Generic structs are a bit complicated to explain.
6478 For C++, these are non-explicit specializations of template classes,
6479 or non-template classes within the above.
6480 Other programming languages have generics,
6481 but @option{-femit-struct-debug-detailed} does not yet implement them.
6482
6483 The third word specifies the source files for those
6484 structs for which the compiler should emit debug information.
6485 The values @samp{none} and @samp{any} have the normal meaning.
6486 The value @samp{base} means that
6487 the base of name of the file in which the type declaration appears
6488 must match the base of the name of the main compilation file.
6489 In practice, this means that when compiling @file{foo.c}, debug information
6490 is generated for types declared in that file and @file{foo.h},
6491 but not other header files.
6492 The value @samp{sys} means those types satisfying @samp{base}
6493 or declared in system or compiler headers.
6494
6495 You may need to experiment to determine the best settings for your application.
6496
6497 The default is @option{-femit-struct-debug-detailed=all}.
6498
6499 This option works only with DWARF debug output.
6500
6501 @item -fno-dwarf2-cfi-asm
6502 @opindex fdwarf2-cfi-asm
6503 @opindex fno-dwarf2-cfi-asm
6504 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
6505 instead of using GAS @code{.cfi_*} directives.
6506
6507 @item -fno-eliminate-unused-debug-types
6508 @opindex feliminate-unused-debug-types
6509 @opindex fno-eliminate-unused-debug-types
6510 Normally, when producing DWARF output, GCC avoids producing debug symbol
6511 output for types that are nowhere used in the source file being compiled.
6512 Sometimes it is useful to have GCC emit debugging
6513 information for all types declared in a compilation
6514 unit, regardless of whether or not they are actually used
6515 in that compilation unit, for example
6516 if, in the debugger, you want to cast a value to a type that is
6517 not actually used in your program (but is declared). More often,
6518 however, this results in a significant amount of wasted space.
6519 @end table
6520
6521 @node Optimize Options
6522 @section Options That Control Optimization
6523 @cindex optimize options
6524 @cindex options, optimization
6525
6526 These options control various sorts of optimizations.
6527
6528 Without any optimization option, the compiler's goal is to reduce the
6529 cost of compilation and to make debugging produce the expected
6530 results. Statements are independent: if you stop the program with a
6531 breakpoint between statements, you can then assign a new value to any
6532 variable or change the program counter to any other statement in the
6533 function and get exactly the results you expect from the source
6534 code.
6535
6536 Turning on optimization flags makes the compiler attempt to improve
6537 the performance and/or code size at the expense of compilation time
6538 and possibly the ability to debug the program.
6539
6540 The compiler performs optimization based on the knowledge it has of the
6541 program. Compiling multiple files at once to a single output file mode allows
6542 the compiler to use information gained from all of the files when compiling
6543 each of them.
6544
6545 Not all optimizations are controlled directly by a flag. Only
6546 optimizations that have a flag are listed in this section.
6547
6548 Most optimizations are only enabled if an @option{-O} level is set on
6549 the command line. Otherwise they are disabled, even if individual
6550 optimization flags are specified.
6551
6552 Depending on the target and how GCC was configured, a slightly different
6553 set of optimizations may be enabled at each @option{-O} level than
6554 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6555 to find out the exact set of optimizations that are enabled at each level.
6556 @xref{Overall Options}, for examples.
6557
6558 @table @gcctabopt
6559 @item -O
6560 @itemx -O1
6561 @opindex O
6562 @opindex O1
6563 Optimize. Optimizing compilation takes somewhat more time, and a lot
6564 more memory for a large function.
6565
6566 With @option{-O}, the compiler tries to reduce code size and execution
6567 time, without performing any optimizations that take a great deal of
6568 compilation time.
6569
6570 @option{-O} turns on the following optimization flags:
6571 @gccoptlist{
6572 -fauto-inc-dec @gol
6573 -fbranch-count-reg @gol
6574 -fcombine-stack-adjustments @gol
6575 -fcompare-elim @gol
6576 -fcprop-registers @gol
6577 -fdce @gol
6578 -fdefer-pop @gol
6579 -fdelayed-branch @gol
6580 -fdse @gol
6581 -fforward-propagate @gol
6582 -fguess-branch-probability @gol
6583 -fif-conversion2 @gol
6584 -fif-conversion @gol
6585 -finline-functions-called-once @gol
6586 -fipa-pure-const @gol
6587 -fipa-profile @gol
6588 -fipa-reference @gol
6589 -fmerge-constants @gol
6590 -fmove-loop-invariants @gol
6591 -freorder-blocks @gol
6592 -fshrink-wrap @gol
6593 -fsplit-wide-types @gol
6594 -fssa-backprop @gol
6595 -fssa-phiopt @gol
6596 -ftree-bit-ccp @gol
6597 -ftree-ccp @gol
6598 -ftree-ch @gol
6599 -ftree-coalesce-vars @gol
6600 -ftree-copy-prop @gol
6601 -ftree-dce @gol
6602 -ftree-dominator-opts @gol
6603 -ftree-dse @gol
6604 -ftree-forwprop @gol
6605 -ftree-fre @gol
6606 -ftree-phiprop @gol
6607 -ftree-sink @gol
6608 -ftree-slsr @gol
6609 -ftree-sra @gol
6610 -ftree-pta @gol
6611 -ftree-ter @gol
6612 -funit-at-a-time}
6613
6614 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6615 where doing so does not interfere with debugging.
6616
6617 @item -O2
6618 @opindex O2
6619 Optimize even more. GCC performs nearly all supported optimizations
6620 that do not involve a space-speed tradeoff.
6621 As compared to @option{-O}, this option increases both compilation time
6622 and the performance of the generated code.
6623
6624 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6625 also turns on the following optimization flags:
6626 @gccoptlist{-fthread-jumps @gol
6627 -falign-functions -falign-jumps @gol
6628 -falign-loops -falign-labels @gol
6629 -fcaller-saves @gol
6630 -fcrossjumping @gol
6631 -fcse-follow-jumps -fcse-skip-blocks @gol
6632 -fdelete-null-pointer-checks @gol
6633 -fdevirtualize -fdevirtualize-speculatively @gol
6634 -fexpensive-optimizations @gol
6635 -fgcse -fgcse-lm @gol
6636 -fhoist-adjacent-loads @gol
6637 -finline-small-functions @gol
6638 -findirect-inlining @gol
6639 -fipa-cp @gol
6640 -fipa-cp-alignment @gol
6641 -fipa-bit-cp @gol
6642 -fipa-sra @gol
6643 -fipa-icf @gol
6644 -fisolate-erroneous-paths-dereference @gol
6645 -flra-remat @gol
6646 -foptimize-sibling-calls @gol
6647 -foptimize-strlen @gol
6648 -fpartial-inlining @gol
6649 -fpeephole2 @gol
6650 -freorder-blocks-algorithm=stc @gol
6651 -freorder-blocks-and-partition -freorder-functions @gol
6652 -frerun-cse-after-loop @gol
6653 -fsched-interblock -fsched-spec @gol
6654 -fschedule-insns -fschedule-insns2 @gol
6655 -fstrict-aliasing -fstrict-overflow @gol
6656 -ftree-builtin-call-dce @gol
6657 -ftree-switch-conversion -ftree-tail-merge @gol
6658 -fcode-hoisting @gol
6659 -ftree-pre @gol
6660 -ftree-vrp @gol
6661 -fipa-ra}
6662
6663 Please note the warning under @option{-fgcse} about
6664 invoking @option{-O2} on programs that use computed gotos.
6665
6666 @item -O3
6667 @opindex O3
6668 Optimize yet more. @option{-O3} turns on all optimizations specified
6669 by @option{-O2} and also turns on the @option{-finline-functions},
6670 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6671 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
6672 @option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
6673 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
6674 @option{-ftree-partial-pre}, @option{-fpeel-loops}
6675 and @option{-fipa-cp-clone} options.
6676
6677 @item -O0
6678 @opindex O0
6679 Reduce compilation time and make debugging produce the expected
6680 results. This is the default.
6681
6682 @item -Os
6683 @opindex Os
6684 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6685 do not typically increase code size. It also performs further
6686 optimizations designed to reduce code size.
6687
6688 @option{-Os} disables the following optimization flags:
6689 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6690 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
6691 -freorder-blocks-and-partition -fprefetch-loop-arrays}
6692
6693 @item -Ofast
6694 @opindex Ofast
6695 Disregard strict standards compliance. @option{-Ofast} enables all
6696 @option{-O3} optimizations. It also enables optimizations that are not
6697 valid for all standard-compliant programs.
6698 It turns on @option{-ffast-math} and the Fortran-specific
6699 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6700
6701 @item -Og
6702 @opindex Og
6703 Optimize debugging experience. @option{-Og} enables optimizations
6704 that do not interfere with debugging. It should be the optimization
6705 level of choice for the standard edit-compile-debug cycle, offering
6706 a reasonable level of optimization while maintaining fast compilation
6707 and a good debugging experience.
6708 @end table
6709
6710 If you use multiple @option{-O} options, with or without level numbers,
6711 the last such option is the one that is effective.
6712
6713 Options of the form @option{-f@var{flag}} specify machine-independent
6714 flags. Most flags have both positive and negative forms; the negative
6715 form of @option{-ffoo} is @option{-fno-foo}. In the table
6716 below, only one of the forms is listed---the one you typically
6717 use. You can figure out the other form by either removing @samp{no-}
6718 or adding it.
6719
6720 The following options control specific optimizations. They are either
6721 activated by @option{-O} options or are related to ones that are. You
6722 can use the following flags in the rare cases when ``fine-tuning'' of
6723 optimizations to be performed is desired.
6724
6725 @table @gcctabopt
6726 @item -fno-defer-pop
6727 @opindex fno-defer-pop
6728 Always pop the arguments to each function call as soon as that function
6729 returns. For machines that must pop arguments after a function call,
6730 the compiler normally lets arguments accumulate on the stack for several
6731 function calls and pops them all at once.
6732
6733 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6734
6735 @item -fforward-propagate
6736 @opindex fforward-propagate
6737 Perform a forward propagation pass on RTL@. The pass tries to combine two
6738 instructions and checks if the result can be simplified. If loop unrolling
6739 is active, two passes are performed and the second is scheduled after
6740 loop unrolling.
6741
6742 This option is enabled by default at optimization levels @option{-O},
6743 @option{-O2}, @option{-O3}, @option{-Os}.
6744
6745 @item -ffp-contract=@var{style}
6746 @opindex ffp-contract
6747 @option{-ffp-contract=off} disables floating-point expression contraction.
6748 @option{-ffp-contract=fast} enables floating-point expression contraction
6749 such as forming of fused multiply-add operations if the target has
6750 native support for them.
6751 @option{-ffp-contract=on} enables floating-point expression contraction
6752 if allowed by the language standard. This is currently not implemented
6753 and treated equal to @option{-ffp-contract=off}.
6754
6755 The default is @option{-ffp-contract=fast}.
6756
6757 @item -fomit-frame-pointer
6758 @opindex fomit-frame-pointer
6759 Don't keep the frame pointer in a register for functions that
6760 don't need one. This avoids the instructions to save, set up and
6761 restore frame pointers; it also makes an extra register available
6762 in many functions. @strong{It also makes debugging impossible on
6763 some machines.}
6764
6765 On some machines, such as the VAX, this flag has no effect, because
6766 the standard calling sequence automatically handles the frame pointer
6767 and nothing is saved by pretending it doesn't exist. The
6768 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6769 whether a target machine supports this flag. @xref{Registers,,Register
6770 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6771
6772 The default setting (when not optimizing for
6773 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
6774 @option{-fomit-frame-pointer}. You can configure GCC with the
6775 @option{--enable-frame-pointer} configure option to change the default.
6776
6777 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6778
6779 @item -foptimize-sibling-calls
6780 @opindex foptimize-sibling-calls
6781 Optimize sibling and tail recursive calls.
6782
6783 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6784
6785 @item -foptimize-strlen
6786 @opindex foptimize-strlen
6787 Optimize various standard C string functions (e.g. @code{strlen},
6788 @code{strchr} or @code{strcpy}) and
6789 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
6790
6791 Enabled at levels @option{-O2}, @option{-O3}.
6792
6793 @item -fno-inline
6794 @opindex fno-inline
6795 Do not expand any functions inline apart from those marked with
6796 the @code{always_inline} attribute. This is the default when not
6797 optimizing.
6798
6799 Single functions can be exempted from inlining by marking them
6800 with the @code{noinline} attribute.
6801
6802 @item -finline-small-functions
6803 @opindex finline-small-functions
6804 Integrate functions into their callers when their body is smaller than expected
6805 function call code (so overall size of program gets smaller). The compiler
6806 heuristically decides which functions are simple enough to be worth integrating
6807 in this way. This inlining applies to all functions, even those not declared
6808 inline.
6809
6810 Enabled at level @option{-O2}.
6811
6812 @item -findirect-inlining
6813 @opindex findirect-inlining
6814 Inline also indirect calls that are discovered to be known at compile
6815 time thanks to previous inlining. This option has any effect only
6816 when inlining itself is turned on by the @option{-finline-functions}
6817 or @option{-finline-small-functions} options.
6818
6819 Enabled at level @option{-O2}.
6820
6821 @item -finline-functions
6822 @opindex finline-functions
6823 Consider all functions for inlining, even if they are not declared inline.
6824 The compiler heuristically decides which functions are worth integrating
6825 in this way.
6826
6827 If all calls to a given function are integrated, and the function is
6828 declared @code{static}, then the function is normally not output as
6829 assembler code in its own right.
6830
6831 Enabled at level @option{-O3}.
6832
6833 @item -finline-functions-called-once
6834 @opindex finline-functions-called-once
6835 Consider all @code{static} functions called once for inlining into their
6836 caller even if they are not marked @code{inline}. If a call to a given
6837 function is integrated, then the function is not output as assembler code
6838 in its own right.
6839
6840 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6841
6842 @item -fearly-inlining
6843 @opindex fearly-inlining
6844 Inline functions marked by @code{always_inline} and functions whose body seems
6845 smaller than the function call overhead early before doing
6846 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
6847 makes profiling significantly cheaper and usually inlining faster on programs
6848 having large chains of nested wrapper functions.
6849
6850 Enabled by default.
6851
6852 @item -fipa-sra
6853 @opindex fipa-sra
6854 Perform interprocedural scalar replacement of aggregates, removal of
6855 unused parameters and replacement of parameters passed by reference
6856 by parameters passed by value.
6857
6858 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6859
6860 @item -finline-limit=@var{n}
6861 @opindex finline-limit
6862 By default, GCC limits the size of functions that can be inlined. This flag
6863 allows coarse control of this limit. @var{n} is the size of functions that
6864 can be inlined in number of pseudo instructions.
6865
6866 Inlining is actually controlled by a number of parameters, which may be
6867 specified individually by using @option{--param @var{name}=@var{value}}.
6868 The @option{-finline-limit=@var{n}} option sets some of these parameters
6869 as follows:
6870
6871 @table @gcctabopt
6872 @item max-inline-insns-single
6873 is set to @var{n}/2.
6874 @item max-inline-insns-auto
6875 is set to @var{n}/2.
6876 @end table
6877
6878 See below for a documentation of the individual
6879 parameters controlling inlining and for the defaults of these parameters.
6880
6881 @emph{Note:} there may be no value to @option{-finline-limit} that results
6882 in default behavior.
6883
6884 @emph{Note:} pseudo instruction represents, in this particular context, an
6885 abstract measurement of function's size. In no way does it represent a count
6886 of assembly instructions and as such its exact meaning might change from one
6887 release to an another.
6888
6889 @item -fno-keep-inline-dllexport
6890 @opindex fno-keep-inline-dllexport
6891 This is a more fine-grained version of @option{-fkeep-inline-functions},
6892 which applies only to functions that are declared using the @code{dllexport}
6893 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6894 Functions}.)
6895
6896 @item -fkeep-inline-functions
6897 @opindex fkeep-inline-functions
6898 In C, emit @code{static} functions that are declared @code{inline}
6899 into the object file, even if the function has been inlined into all
6900 of its callers. This switch does not affect functions using the
6901 @code{extern inline} extension in GNU C90@. In C++, emit any and all
6902 inline functions into the object file.
6903
6904 @item -fkeep-static-functions
6905 @opindex fkeep-static-functions
6906 Emit @code{static} functions into the object file, even if the function
6907 is never used.
6908
6909 @item -fkeep-static-consts
6910 @opindex fkeep-static-consts
6911 Emit variables declared @code{static const} when optimization isn't turned
6912 on, even if the variables aren't referenced.
6913
6914 GCC enables this option by default. If you want to force the compiler to
6915 check if a variable is referenced, regardless of whether or not
6916 optimization is turned on, use the @option{-fno-keep-static-consts} option.
6917
6918 @item -fmerge-constants
6919 @opindex fmerge-constants
6920 Attempt to merge identical constants (string constants and floating-point
6921 constants) across compilation units.
6922
6923 This option is the default for optimized compilation if the assembler and
6924 linker support it. Use @option{-fno-merge-constants} to inhibit this
6925 behavior.
6926
6927 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6928
6929 @item -fmerge-all-constants
6930 @opindex fmerge-all-constants
6931 Attempt to merge identical constants and identical variables.
6932
6933 This option implies @option{-fmerge-constants}. In addition to
6934 @option{-fmerge-constants} this considers e.g.@: even constant initialized
6935 arrays or initialized constant variables with integral or floating-point
6936 types. Languages like C or C++ require each variable, including multiple
6937 instances of the same variable in recursive calls, to have distinct locations,
6938 so using this option results in non-conforming
6939 behavior.
6940
6941 @item -fmodulo-sched
6942 @opindex fmodulo-sched
6943 Perform swing modulo scheduling immediately before the first scheduling
6944 pass. This pass looks at innermost loops and reorders their
6945 instructions by overlapping different iterations.
6946
6947 @item -fmodulo-sched-allow-regmoves
6948 @opindex fmodulo-sched-allow-regmoves
6949 Perform more aggressive SMS-based modulo scheduling with register moves
6950 allowed. By setting this flag certain anti-dependences edges are
6951 deleted, which triggers the generation of reg-moves based on the
6952 life-range analysis. This option is effective only with
6953 @option{-fmodulo-sched} enabled.
6954
6955 @item -fno-branch-count-reg
6956 @opindex fno-branch-count-reg
6957 Avoid running a pass scanning for opportunities to use ``decrement and
6958 branch'' instructions on a count register instead of generating sequences
6959 of instructions that decrement a register, compare it against zero, and
6960 then branch based upon the result. This option is only meaningful on
6961 architectures that support such instructions, which include x86, PowerPC,
6962 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
6963 doesn't remove the decrement and branch instructions from the generated
6964 instruction stream introduced by other optimization passes.
6965
6966 Enabled by default at @option{-O1} and higher.
6967
6968 The default is @option{-fbranch-count-reg}.
6969
6970 @item -fno-function-cse
6971 @opindex fno-function-cse
6972 Do not put function addresses in registers; make each instruction that
6973 calls a constant function contain the function's address explicitly.
6974
6975 This option results in less efficient code, but some strange hacks
6976 that alter the assembler output may be confused by the optimizations
6977 performed when this option is not used.
6978
6979 The default is @option{-ffunction-cse}
6980
6981 @item -fno-zero-initialized-in-bss
6982 @opindex fno-zero-initialized-in-bss
6983 If the target supports a BSS section, GCC by default puts variables that
6984 are initialized to zero into BSS@. This can save space in the resulting
6985 code.
6986
6987 This option turns off this behavior because some programs explicitly
6988 rely on variables going to the data section---e.g., so that the
6989 resulting executable can find the beginning of that section and/or make
6990 assumptions based on that.
6991
6992 The default is @option{-fzero-initialized-in-bss}.
6993
6994 @item -fthread-jumps
6995 @opindex fthread-jumps
6996 Perform optimizations that check to see if a jump branches to a
6997 location where another comparison subsumed by the first is found. If
6998 so, the first branch is redirected to either the destination of the
6999 second branch or a point immediately following it, depending on whether
7000 the condition is known to be true or false.
7001
7002 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7003
7004 @item -fsplit-wide-types
7005 @opindex fsplit-wide-types
7006 When using a type that occupies multiple registers, such as @code{long
7007 long} on a 32-bit system, split the registers apart and allocate them
7008 independently. This normally generates better code for those types,
7009 but may make debugging more difficult.
7010
7011 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7012 @option{-Os}.
7013
7014 @item -fcse-follow-jumps
7015 @opindex fcse-follow-jumps
7016 In common subexpression elimination (CSE), scan through jump instructions
7017 when the target of the jump is not reached by any other path. For
7018 example, when CSE encounters an @code{if} statement with an
7019 @code{else} clause, CSE follows the jump when the condition
7020 tested is false.
7021
7022 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7023
7024 @item -fcse-skip-blocks
7025 @opindex fcse-skip-blocks
7026 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7027 follow jumps that conditionally skip over blocks. When CSE
7028 encounters a simple @code{if} statement with no else clause,
7029 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7030 body of the @code{if}.
7031
7032 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7033
7034 @item -frerun-cse-after-loop
7035 @opindex frerun-cse-after-loop
7036 Re-run common subexpression elimination after loop optimizations are
7037 performed.
7038
7039 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7040
7041 @item -fgcse
7042 @opindex fgcse
7043 Perform a global common subexpression elimination pass.
7044 This pass also performs global constant and copy propagation.
7045
7046 @emph{Note:} When compiling a program using computed gotos, a GCC
7047 extension, you may get better run-time performance if you disable
7048 the global common subexpression elimination pass by adding
7049 @option{-fno-gcse} to the command line.
7050
7051 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7052
7053 @item -fgcse-lm
7054 @opindex fgcse-lm
7055 When @option{-fgcse-lm} is enabled, global common subexpression elimination
7056 attempts to move loads that are only killed by stores into themselves. This
7057 allows a loop containing a load/store sequence to be changed to a load outside
7058 the loop, and a copy/store within the loop.
7059
7060 Enabled by default when @option{-fgcse} is enabled.
7061
7062 @item -fgcse-sm
7063 @opindex fgcse-sm
7064 When @option{-fgcse-sm} is enabled, a store motion pass is run after
7065 global common subexpression elimination. This pass attempts to move
7066 stores out of loops. When used in conjunction with @option{-fgcse-lm},
7067 loops containing a load/store sequence can be changed to a load before
7068 the loop and a store after the loop.
7069
7070 Not enabled at any optimization level.
7071
7072 @item -fgcse-las
7073 @opindex fgcse-las
7074 When @option{-fgcse-las} is enabled, the global common subexpression
7075 elimination pass eliminates redundant loads that come after stores to the
7076 same memory location (both partial and full redundancies).
7077
7078 Not enabled at any optimization level.
7079
7080 @item -fgcse-after-reload
7081 @opindex fgcse-after-reload
7082 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7083 pass is performed after reload. The purpose of this pass is to clean up
7084 redundant spilling.
7085
7086 @item -faggressive-loop-optimizations
7087 @opindex faggressive-loop-optimizations
7088 This option tells the loop optimizer to use language constraints to
7089 derive bounds for the number of iterations of a loop. This assumes that
7090 loop code does not invoke undefined behavior by for example causing signed
7091 integer overflows or out-of-bound array accesses. The bounds for the
7092 number of iterations of a loop are used to guide loop unrolling and peeling
7093 and loop exit test optimizations.
7094 This option is enabled by default.
7095
7096 @item -funconstrained-commons
7097 @opindex funconstrained-commons
7098 This option tells the compiler that variables declared in common blocks
7099 (e.g. Fortran) may later be overridden with longer trailing arrays. This
7100 prevents certain optimizations that depend on knowing the array bounds.
7101
7102 @item -fcrossjumping
7103 @opindex fcrossjumping
7104 Perform cross-jumping transformation.
7105 This transformation unifies equivalent code and saves code size. The
7106 resulting code may or may not perform better than without cross-jumping.
7107
7108 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7109
7110 @item -fauto-inc-dec
7111 @opindex fauto-inc-dec
7112 Combine increments or decrements of addresses with memory accesses.
7113 This pass is always skipped on architectures that do not have
7114 instructions to support this. Enabled by default at @option{-O} and
7115 higher on architectures that support this.
7116
7117 @item -fdce
7118 @opindex fdce
7119 Perform dead code elimination (DCE) on RTL@.
7120 Enabled by default at @option{-O} and higher.
7121
7122 @item -fdse
7123 @opindex fdse
7124 Perform dead store elimination (DSE) on RTL@.
7125 Enabled by default at @option{-O} and higher.
7126
7127 @item -fif-conversion
7128 @opindex fif-conversion
7129 Attempt to transform conditional jumps into branch-less equivalents. This
7130 includes use of conditional moves, min, max, set flags and abs instructions, and
7131 some tricks doable by standard arithmetics. The use of conditional execution
7132 on chips where it is available is controlled by @option{-fif-conversion2}.
7133
7134 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7135
7136 @item -fif-conversion2
7137 @opindex fif-conversion2
7138 Use conditional execution (where available) to transform conditional jumps into
7139 branch-less equivalents.
7140
7141 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7142
7143 @item -fdeclone-ctor-dtor
7144 @opindex fdeclone-ctor-dtor
7145 The C++ ABI requires multiple entry points for constructors and
7146 destructors: one for a base subobject, one for a complete object, and
7147 one for a virtual destructor that calls operator delete afterwards.
7148 For a hierarchy with virtual bases, the base and complete variants are
7149 clones, which means two copies of the function. With this option, the
7150 base and complete variants are changed to be thunks that call a common
7151 implementation.
7152
7153 Enabled by @option{-Os}.
7154
7155 @item -fdelete-null-pointer-checks
7156 @opindex fdelete-null-pointer-checks
7157 Assume that programs cannot safely dereference null pointers, and that
7158 no code or data element resides at address zero.
7159 This option enables simple constant
7160 folding optimizations at all optimization levels. In addition, other
7161 optimization passes in GCC use this flag to control global dataflow
7162 analyses that eliminate useless checks for null pointers; these assume
7163 that a memory access to address zero always results in a trap, so
7164 that if a pointer is checked after it has already been dereferenced,
7165 it cannot be null.
7166
7167 Note however that in some environments this assumption is not true.
7168 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
7169 for programs that depend on that behavior.
7170
7171 This option is enabled by default on most targets. On Nios II ELF, it
7172 defaults to off. On AVR and CR16, this option is completely disabled.
7173
7174 Passes that use the dataflow information
7175 are enabled independently at different optimization levels.
7176
7177 @item -fdevirtualize
7178 @opindex fdevirtualize
7179 Attempt to convert calls to virtual functions to direct calls. This
7180 is done both within a procedure and interprocedurally as part of
7181 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
7182 propagation (@option{-fipa-cp}).
7183 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7184
7185 @item -fdevirtualize-speculatively
7186 @opindex fdevirtualize-speculatively
7187 Attempt to convert calls to virtual functions to speculative direct calls.
7188 Based on the analysis of the type inheritance graph, determine for a given call
7189 the set of likely targets. If the set is small, preferably of size 1, change
7190 the call into a conditional deciding between direct and indirect calls. The
7191 speculative calls enable more optimizations, such as inlining. When they seem
7192 useless after further optimization, they are converted back into original form.
7193
7194 @item -fdevirtualize-at-ltrans
7195 @opindex fdevirtualize-at-ltrans
7196 Stream extra information needed for aggressive devirtualization when running
7197 the link-time optimizer in local transformation mode.
7198 This option enables more devirtualization but
7199 significantly increases the size of streamed data. For this reason it is
7200 disabled by default.
7201
7202 @item -fexpensive-optimizations
7203 @opindex fexpensive-optimizations
7204 Perform a number of minor optimizations that are relatively expensive.
7205
7206 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7207
7208 @item -free
7209 @opindex free
7210 Attempt to remove redundant extension instructions. This is especially
7211 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
7212 registers after writing to their lower 32-bit half.
7213
7214 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
7215 @option{-O3}, @option{-Os}.
7216
7217 @item -fno-lifetime-dse
7218 @opindex fno-lifetime-dse
7219 In C++ the value of an object is only affected by changes within its
7220 lifetime: when the constructor begins, the object has an indeterminate
7221 value, and any changes during the lifetime of the object are dead when
7222 the object is destroyed. Normally dead store elimination will take
7223 advantage of this; if your code relies on the value of the object
7224 storage persisting beyond the lifetime of the object, you can use this
7225 flag to disable this optimization. To preserve stores before the
7226 constructor starts (e.g. because your operator new clears the object
7227 storage) but still treat the object as dead after the destructor you,
7228 can use @option{-flifetime-dse=1}. The default behavior can be
7229 explicitly selected with @option{-flifetime-dse=2}.
7230 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
7231
7232 @item -flive-range-shrinkage
7233 @opindex flive-range-shrinkage
7234 Attempt to decrease register pressure through register live range
7235 shrinkage. This is helpful for fast processors with small or moderate
7236 size register sets.
7237
7238 @item -fira-algorithm=@var{algorithm}
7239 @opindex fira-algorithm
7240 Use the specified coloring algorithm for the integrated register
7241 allocator. The @var{algorithm} argument can be @samp{priority}, which
7242 specifies Chow's priority coloring, or @samp{CB}, which specifies
7243 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
7244 for all architectures, but for those targets that do support it, it is
7245 the default because it generates better code.
7246
7247 @item -fira-region=@var{region}
7248 @opindex fira-region
7249 Use specified regions for the integrated register allocator. The
7250 @var{region} argument should be one of the following:
7251
7252 @table @samp
7253
7254 @item all
7255 Use all loops as register allocation regions.
7256 This can give the best results for machines with a small and/or
7257 irregular register set.
7258
7259 @item mixed
7260 Use all loops except for loops with small register pressure
7261 as the regions. This value usually gives
7262 the best results in most cases and for most architectures,
7263 and is enabled by default when compiling with optimization for speed
7264 (@option{-O}, @option{-O2}, @dots{}).
7265
7266 @item one
7267 Use all functions as a single region.
7268 This typically results in the smallest code size, and is enabled by default for
7269 @option{-Os} or @option{-O0}.
7270
7271 @end table
7272
7273 @item -fira-hoist-pressure
7274 @opindex fira-hoist-pressure
7275 Use IRA to evaluate register pressure in the code hoisting pass for
7276 decisions to hoist expressions. This option usually results in smaller
7277 code, but it can slow the compiler down.
7278
7279 This option is enabled at level @option{-Os} for all targets.
7280
7281 @item -fira-loop-pressure
7282 @opindex fira-loop-pressure
7283 Use IRA to evaluate register pressure in loops for decisions to move
7284 loop invariants. This option usually results in generation
7285 of faster and smaller code on machines with large register files (>= 32
7286 registers), but it can slow the compiler down.
7287
7288 This option is enabled at level @option{-O3} for some targets.
7289
7290 @item -fno-ira-share-save-slots
7291 @opindex fno-ira-share-save-slots
7292 Disable sharing of stack slots used for saving call-used hard
7293 registers living through a call. Each hard register gets a
7294 separate stack slot, and as a result function stack frames are
7295 larger.
7296
7297 @item -fno-ira-share-spill-slots
7298 @opindex fno-ira-share-spill-slots
7299 Disable sharing of stack slots allocated for pseudo-registers. Each
7300 pseudo-register that does not get a hard register gets a separate
7301 stack slot, and as a result function stack frames are larger.
7302
7303 @item -flra-remat
7304 @opindex flra-remat
7305 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7306 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7307 values if it is profitable.
7308
7309 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7310
7311 @item -fdelayed-branch
7312 @opindex fdelayed-branch
7313 If supported for the target machine, attempt to reorder instructions
7314 to exploit instruction slots available after delayed branch
7315 instructions.
7316
7317 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7318
7319 @item -fschedule-insns
7320 @opindex fschedule-insns
7321 If supported for the target machine, attempt to reorder instructions to
7322 eliminate execution stalls due to required data being unavailable. This
7323 helps machines that have slow floating point or memory load instructions
7324 by allowing other instructions to be issued until the result of the load
7325 or floating-point instruction is required.
7326
7327 Enabled at levels @option{-O2}, @option{-O3}.
7328
7329 @item -fschedule-insns2
7330 @opindex fschedule-insns2
7331 Similar to @option{-fschedule-insns}, but requests an additional pass of
7332 instruction scheduling after register allocation has been done. This is
7333 especially useful on machines with a relatively small number of
7334 registers and where memory load instructions take more than one cycle.
7335
7336 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7337
7338 @item -fno-sched-interblock
7339 @opindex fno-sched-interblock
7340 Don't schedule instructions across basic blocks. This is normally
7341 enabled by default when scheduling before register allocation, i.e.@:
7342 with @option{-fschedule-insns} or at @option{-O2} or higher.
7343
7344 @item -fno-sched-spec
7345 @opindex fno-sched-spec
7346 Don't allow speculative motion of non-load instructions. This is normally
7347 enabled by default when scheduling before register allocation, i.e.@:
7348 with @option{-fschedule-insns} or at @option{-O2} or higher.
7349
7350 @item -fsched-pressure
7351 @opindex fsched-pressure
7352 Enable register pressure sensitive insn scheduling before register
7353 allocation. This only makes sense when scheduling before register
7354 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7355 @option{-O2} or higher. Usage of this option can improve the
7356 generated code and decrease its size by preventing register pressure
7357 increase above the number of available hard registers and subsequent
7358 spills in register allocation.
7359
7360 @item -fsched-spec-load
7361 @opindex fsched-spec-load
7362 Allow speculative motion of some load instructions. This only makes
7363 sense when scheduling before register allocation, i.e.@: with
7364 @option{-fschedule-insns} or at @option{-O2} or higher.
7365
7366 @item -fsched-spec-load-dangerous
7367 @opindex fsched-spec-load-dangerous
7368 Allow speculative motion of more load instructions. This only makes
7369 sense when scheduling before register allocation, i.e.@: with
7370 @option{-fschedule-insns} or at @option{-O2} or higher.
7371
7372 @item -fsched-stalled-insns
7373 @itemx -fsched-stalled-insns=@var{n}
7374 @opindex fsched-stalled-insns
7375 Define how many insns (if any) can be moved prematurely from the queue
7376 of stalled insns into the ready list during the second scheduling pass.
7377 @option{-fno-sched-stalled-insns} means that no insns are moved
7378 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7379 on how many queued insns can be moved prematurely.
7380 @option{-fsched-stalled-insns} without a value is equivalent to
7381 @option{-fsched-stalled-insns=1}.
7382
7383 @item -fsched-stalled-insns-dep
7384 @itemx -fsched-stalled-insns-dep=@var{n}
7385 @opindex fsched-stalled-insns-dep
7386 Define how many insn groups (cycles) are examined for a dependency
7387 on a stalled insn that is a candidate for premature removal from the queue
7388 of stalled insns. This has an effect only during the second scheduling pass,
7389 and only if @option{-fsched-stalled-insns} is used.
7390 @option{-fno-sched-stalled-insns-dep} is equivalent to
7391 @option{-fsched-stalled-insns-dep=0}.
7392 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7393 @option{-fsched-stalled-insns-dep=1}.
7394
7395 @item -fsched2-use-superblocks
7396 @opindex fsched2-use-superblocks
7397 When scheduling after register allocation, use superblock scheduling.
7398 This allows motion across basic block boundaries,
7399 resulting in faster schedules. This option is experimental, as not all machine
7400 descriptions used by GCC model the CPU closely enough to avoid unreliable
7401 results from the algorithm.
7402
7403 This only makes sense when scheduling after register allocation, i.e.@: with
7404 @option{-fschedule-insns2} or at @option{-O2} or higher.
7405
7406 @item -fsched-group-heuristic
7407 @opindex fsched-group-heuristic
7408 Enable the group heuristic in the scheduler. This heuristic favors
7409 the instruction that belongs to a schedule group. This is enabled
7410 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7411 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7412
7413 @item -fsched-critical-path-heuristic
7414 @opindex fsched-critical-path-heuristic
7415 Enable the critical-path heuristic in the scheduler. This heuristic favors
7416 instructions on the critical path. This is enabled by default when
7417 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7418 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7419
7420 @item -fsched-spec-insn-heuristic
7421 @opindex fsched-spec-insn-heuristic
7422 Enable the speculative instruction heuristic in the scheduler. This
7423 heuristic favors speculative instructions with greater dependency weakness.
7424 This is enabled by default when scheduling is enabled, i.e.@:
7425 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7426 or at @option{-O2} or higher.
7427
7428 @item -fsched-rank-heuristic
7429 @opindex fsched-rank-heuristic
7430 Enable the rank heuristic in the scheduler. This heuristic favors
7431 the instruction belonging to a basic block with greater size or frequency.
7432 This is enabled by default when scheduling is enabled, i.e.@:
7433 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7434 at @option{-O2} or higher.
7435
7436 @item -fsched-last-insn-heuristic
7437 @opindex fsched-last-insn-heuristic
7438 Enable the last-instruction heuristic in the scheduler. This heuristic
7439 favors the instruction that is less dependent on the last instruction
7440 scheduled. This is enabled by default when scheduling is enabled,
7441 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7442 at @option{-O2} or higher.
7443
7444 @item -fsched-dep-count-heuristic
7445 @opindex fsched-dep-count-heuristic
7446 Enable the dependent-count heuristic in the scheduler. This heuristic
7447 favors the instruction that has more instructions depending on it.
7448 This is enabled by default when scheduling is enabled, i.e.@:
7449 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7450 at @option{-O2} or higher.
7451
7452 @item -freschedule-modulo-scheduled-loops
7453 @opindex freschedule-modulo-scheduled-loops
7454 Modulo scheduling is performed before traditional scheduling. If a loop
7455 is modulo scheduled, later scheduling passes may change its schedule.
7456 Use this option to control that behavior.
7457
7458 @item -fselective-scheduling
7459 @opindex fselective-scheduling
7460 Schedule instructions using selective scheduling algorithm. Selective
7461 scheduling runs instead of the first scheduler pass.
7462
7463 @item -fselective-scheduling2
7464 @opindex fselective-scheduling2
7465 Schedule instructions using selective scheduling algorithm. Selective
7466 scheduling runs instead of the second scheduler pass.
7467
7468 @item -fsel-sched-pipelining
7469 @opindex fsel-sched-pipelining
7470 Enable software pipelining of innermost loops during selective scheduling.
7471 This option has no effect unless one of @option{-fselective-scheduling} or
7472 @option{-fselective-scheduling2} is turned on.
7473
7474 @item -fsel-sched-pipelining-outer-loops
7475 @opindex fsel-sched-pipelining-outer-loops
7476 When pipelining loops during selective scheduling, also pipeline outer loops.
7477 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7478
7479 @item -fsemantic-interposition
7480 @opindex fsemantic-interposition
7481 Some object formats, like ELF, allow interposing of symbols by the
7482 dynamic linker.
7483 This means that for symbols exported from the DSO, the compiler cannot perform
7484 interprocedural propagation, inlining and other optimizations in anticipation
7485 that the function or variable in question may change. While this feature is
7486 useful, for example, to rewrite memory allocation functions by a debugging
7487 implementation, it is expensive in the terms of code quality.
7488 With @option{-fno-semantic-interposition} the compiler assumes that
7489 if interposition happens for functions the overwriting function will have
7490 precisely the same semantics (and side effects).
7491 Similarly if interposition happens
7492 for variables, the constructor of the variable will be the same. The flag
7493 has no effect for functions explicitly declared inline
7494 (where it is never allowed for interposition to change semantics)
7495 and for symbols explicitly declared weak.
7496
7497 @item -fshrink-wrap
7498 @opindex fshrink-wrap
7499 Emit function prologues only before parts of the function that need it,
7500 rather than at the top of the function. This flag is enabled by default at
7501 @option{-O} and higher.
7502
7503 @item -fcaller-saves
7504 @opindex fcaller-saves
7505 Enable allocation of values to registers that are clobbered by
7506 function calls, by emitting extra instructions to save and restore the
7507 registers around such calls. Such allocation is done only when it
7508 seems to result in better code.
7509
7510 This option is always enabled by default on certain machines, usually
7511 those which have no call-preserved registers to use instead.
7512
7513 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7514
7515 @item -fcombine-stack-adjustments
7516 @opindex fcombine-stack-adjustments
7517 Tracks stack adjustments (pushes and pops) and stack memory references
7518 and then tries to find ways to combine them.
7519
7520 Enabled by default at @option{-O1} and higher.
7521
7522 @item -fipa-ra
7523 @opindex fipa-ra
7524 Use caller save registers for allocation if those registers are not used by
7525 any called function. In that case it is not necessary to save and restore
7526 them around calls. This is only possible if called functions are part of
7527 same compilation unit as current function and they are compiled before it.
7528
7529 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
7530 is disabled if generated code will be instrumented for profiling
7531 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
7532 exactly (this happens on targets that do not expose prologues
7533 and epilogues in RTL).
7534
7535 @item -fconserve-stack
7536 @opindex fconserve-stack
7537 Attempt to minimize stack usage. The compiler attempts to use less
7538 stack space, even if that makes the program slower. This option
7539 implies setting the @option{large-stack-frame} parameter to 100
7540 and the @option{large-stack-frame-growth} parameter to 400.
7541
7542 @item -ftree-reassoc
7543 @opindex ftree-reassoc
7544 Perform reassociation on trees. This flag is enabled by default
7545 at @option{-O} and higher.
7546
7547 @item -fcode-hoisting
7548 @opindex fcode-hoisting
7549 Perform code hoisting. Code hoisting tries to move the
7550 evaluation of expressions executed on all paths to the function exit
7551 as early as possible. This is especially useful as a code size
7552 optimization, but it often helps for code speed as well.
7553 This flag is enabled by default at @option{-O2} and higher.
7554
7555 @item -ftree-pre
7556 @opindex ftree-pre
7557 Perform partial redundancy elimination (PRE) on trees. This flag is
7558 enabled by default at @option{-O2} and @option{-O3}.
7559
7560 @item -ftree-partial-pre
7561 @opindex ftree-partial-pre
7562 Make partial redundancy elimination (PRE) more aggressive. This flag is
7563 enabled by default at @option{-O3}.
7564
7565 @item -ftree-forwprop
7566 @opindex ftree-forwprop
7567 Perform forward propagation on trees. This flag is enabled by default
7568 at @option{-O} and higher.
7569
7570 @item -ftree-fre
7571 @opindex ftree-fre
7572 Perform full redundancy elimination (FRE) on trees. The difference
7573 between FRE and PRE is that FRE only considers expressions
7574 that are computed on all paths leading to the redundant computation.
7575 This analysis is faster than PRE, though it exposes fewer redundancies.
7576 This flag is enabled by default at @option{-O} and higher.
7577
7578 @item -ftree-phiprop
7579 @opindex ftree-phiprop
7580 Perform hoisting of loads from conditional pointers on trees. This
7581 pass is enabled by default at @option{-O} and higher.
7582
7583 @item -fhoist-adjacent-loads
7584 @opindex fhoist-adjacent-loads
7585 Speculatively hoist loads from both branches of an if-then-else if the
7586 loads are from adjacent locations in the same structure and the target
7587 architecture has a conditional move instruction. This flag is enabled
7588 by default at @option{-O2} and higher.
7589
7590 @item -ftree-copy-prop
7591 @opindex ftree-copy-prop
7592 Perform copy propagation on trees. This pass eliminates unnecessary
7593 copy operations. This flag is enabled by default at @option{-O} and
7594 higher.
7595
7596 @item -fipa-pure-const
7597 @opindex fipa-pure-const
7598 Discover which functions are pure or constant.
7599 Enabled by default at @option{-O} and higher.
7600
7601 @item -fipa-reference
7602 @opindex fipa-reference
7603 Discover which static variables do not escape the
7604 compilation unit.
7605 Enabled by default at @option{-O} and higher.
7606
7607 @item -fipa-pta
7608 @opindex fipa-pta
7609 Perform interprocedural pointer analysis and interprocedural modification
7610 and reference analysis. This option can cause excessive memory and
7611 compile-time usage on large compilation units. It is not enabled by
7612 default at any optimization level.
7613
7614 @item -fipa-profile
7615 @opindex fipa-profile
7616 Perform interprocedural profile propagation. The functions called only from
7617 cold functions are marked as cold. Also functions executed once (such as
7618 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7619 functions and loop less parts of functions executed once are then optimized for
7620 size.
7621 Enabled by default at @option{-O} and higher.
7622
7623 @item -fipa-cp
7624 @opindex fipa-cp
7625 Perform interprocedural constant propagation.
7626 This optimization analyzes the program to determine when values passed
7627 to functions are constants and then optimizes accordingly.
7628 This optimization can substantially increase performance
7629 if the application has constants passed to functions.
7630 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7631
7632 @item -fipa-cp-clone
7633 @opindex fipa-cp-clone
7634 Perform function cloning to make interprocedural constant propagation stronger.
7635 When enabled, interprocedural constant propagation performs function cloning
7636 when externally visible function can be called with constant arguments.
7637 Because this optimization can create multiple copies of functions,
7638 it may significantly increase code size
7639 (see @option{--param ipcp-unit-growth=@var{value}}).
7640 This flag is enabled by default at @option{-O3}.
7641
7642 @item -fipa-cp-alignment
7643 @opindex -fipa-cp-alignment
7644 When enabled, this optimization propagates alignment of function
7645 parameters to support better vectorization and string operations.
7646
7647 This flag is enabled by default at @option{-O2} and @option{-Os}. It
7648 requires that @option{-fipa-cp} is enabled.
7649
7650 @item -fipa-bit-cp
7651 @opindex -fipa-bit-cp
7652 When enabled, perform ipa bitwise constant propagation. This flag is
7653 enabled by default at @option{-O2}. It requires that @option{-fipa-cp}
7654 is enabled.
7655
7656 @item -fipa-icf
7657 @opindex fipa-icf
7658 Perform Identical Code Folding for functions and read-only variables.
7659 The optimization reduces code size and may disturb unwind stacks by replacing
7660 a function by equivalent one with a different name. The optimization works
7661 more effectively with link time optimization enabled.
7662
7663 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
7664 works on different levels and thus the optimizations are not same - there are
7665 equivalences that are found only by GCC and equivalences found only by Gold.
7666
7667 This flag is enabled by default at @option{-O2} and @option{-Os}.
7668
7669 @item -fisolate-erroneous-paths-dereference
7670 @opindex fisolate-erroneous-paths-dereference
7671 Detect paths that trigger erroneous or undefined behavior due to
7672 dereferencing a null pointer. Isolate those paths from the main control
7673 flow and turn the statement with erroneous or undefined behavior into a trap.
7674 This flag is enabled by default at @option{-O2} and higher and depends on
7675 @option{-fdelete-null-pointer-checks} also being enabled.
7676
7677 @item -fisolate-erroneous-paths-attribute
7678 @opindex fisolate-erroneous-paths-attribute
7679 Detect paths that trigger erroneous or undefined behavior due a null value
7680 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
7681 attribute. Isolate those paths from the main control flow and turn the
7682 statement with erroneous or undefined behavior into a trap. This is not
7683 currently enabled, but may be enabled by @option{-O2} in the future.
7684
7685 @item -ftree-sink
7686 @opindex ftree-sink
7687 Perform forward store motion on trees. This flag is
7688 enabled by default at @option{-O} and higher.
7689
7690 @item -ftree-bit-ccp
7691 @opindex ftree-bit-ccp
7692 Perform sparse conditional bit constant propagation on trees and propagate
7693 pointer alignment information.
7694 This pass only operates on local scalar variables and is enabled by default
7695 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7696
7697 @item -ftree-ccp
7698 @opindex ftree-ccp
7699 Perform sparse conditional constant propagation (CCP) on trees. This
7700 pass only operates on local scalar variables and is enabled by default
7701 at @option{-O} and higher.
7702
7703 @item -fssa-backprop
7704 @opindex fssa-backprop
7705 Propagate information about uses of a value up the definition chain
7706 in order to simplify the definitions. For example, this pass strips
7707 sign operations if the sign of a value never matters. The flag is
7708 enabled by default at @option{-O} and higher.
7709
7710 @item -fssa-phiopt
7711 @opindex fssa-phiopt
7712 Perform pattern matching on SSA PHI nodes to optimize conditional
7713 code. This pass is enabled by default at @option{-O} and higher.
7714
7715 @item -ftree-switch-conversion
7716 @opindex ftree-switch-conversion
7717 Perform conversion of simple initializations in a switch to
7718 initializations from a scalar array. This flag is enabled by default
7719 at @option{-O2} and higher.
7720
7721 @item -ftree-tail-merge
7722 @opindex ftree-tail-merge
7723 Look for identical code sequences. When found, replace one with a jump to the
7724 other. This optimization is known as tail merging or cross jumping. This flag
7725 is enabled by default at @option{-O2} and higher. The compilation time
7726 in this pass can
7727 be limited using @option{max-tail-merge-comparisons} parameter and
7728 @option{max-tail-merge-iterations} parameter.
7729
7730 @item -ftree-dce
7731 @opindex ftree-dce
7732 Perform dead code elimination (DCE) on trees. This flag is enabled by
7733 default at @option{-O} and higher.
7734
7735 @item -ftree-builtin-call-dce
7736 @opindex ftree-builtin-call-dce
7737 Perform conditional dead code elimination (DCE) for calls to built-in functions
7738 that may set @code{errno} but are otherwise side-effect free. This flag is
7739 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7740 specified.
7741
7742 @item -ftree-dominator-opts
7743 @opindex ftree-dominator-opts
7744 Perform a variety of simple scalar cleanups (constant/copy
7745 propagation, redundancy elimination, range propagation and expression
7746 simplification) based on a dominator tree traversal. This also
7747 performs jump threading (to reduce jumps to jumps). This flag is
7748 enabled by default at @option{-O} and higher.
7749
7750 @item -ftree-dse
7751 @opindex ftree-dse
7752 Perform dead store elimination (DSE) on trees. A dead store is a store into
7753 a memory location that is later overwritten by another store without
7754 any intervening loads. In this case the earlier store can be deleted. This
7755 flag is enabled by default at @option{-O} and higher.
7756
7757 @item -ftree-ch
7758 @opindex ftree-ch
7759 Perform loop header copying on trees. This is beneficial since it increases
7760 effectiveness of code motion optimizations. It also saves one jump. This flag
7761 is enabled by default at @option{-O} and higher. It is not enabled
7762 for @option{-Os}, since it usually increases code size.
7763
7764 @item -ftree-loop-optimize
7765 @opindex ftree-loop-optimize
7766 Perform loop optimizations on trees. This flag is enabled by default
7767 at @option{-O} and higher.
7768
7769 @item -ftree-loop-linear
7770 @itemx -floop-interchange
7771 @itemx -floop-strip-mine
7772 @itemx -floop-block
7773 @itemx -floop-unroll-and-jam
7774 @opindex ftree-loop-linear
7775 @opindex floop-interchange
7776 @opindex floop-strip-mine
7777 @opindex floop-block
7778 @opindex floop-unroll-and-jam
7779 Perform loop nest optimizations. Same as
7780 @option{-floop-nest-optimize}. To use this code transformation, GCC has
7781 to be configured with @option{--with-isl} to enable the Graphite loop
7782 transformation infrastructure.
7783
7784 @item -fgraphite-identity
7785 @opindex fgraphite-identity
7786 Enable the identity transformation for graphite. For every SCoP we generate
7787 the polyhedral representation and transform it back to gimple. Using
7788 @option{-fgraphite-identity} we can check the costs or benefits of the
7789 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
7790 are also performed by the code generator isl, like index splitting and
7791 dead code elimination in loops.
7792
7793 @item -floop-nest-optimize
7794 @opindex floop-nest-optimize
7795 Enable the isl based loop nest optimizer. This is a generic loop nest
7796 optimizer based on the Pluto optimization algorithms. It calculates a loop
7797 structure optimized for data-locality and parallelism. This option
7798 is experimental.
7799
7800 @item -floop-parallelize-all
7801 @opindex floop-parallelize-all
7802 Use the Graphite data dependence analysis to identify loops that can
7803 be parallelized. Parallelize all the loops that can be analyzed to
7804 not contain loop carried dependences without checking that it is
7805 profitable to parallelize the loops.
7806
7807 @item -ftree-coalesce-vars
7808 @opindex ftree-coalesce-vars
7809 While transforming the program out of the SSA representation, attempt to
7810 reduce copying by coalescing versions of different user-defined
7811 variables, instead of just compiler temporaries. This may severely
7812 limit the ability to debug an optimized program compiled with
7813 @option{-fno-var-tracking-assignments}. In the negated form, this flag
7814 prevents SSA coalescing of user variables. This option is enabled by
7815 default if optimization is enabled, and it does very little otherwise.
7816
7817 @item -ftree-loop-if-convert
7818 @opindex ftree-loop-if-convert
7819 Attempt to transform conditional jumps in the innermost loops to
7820 branch-less equivalents. The intent is to remove control-flow from
7821 the innermost loops in order to improve the ability of the
7822 vectorization pass to handle these loops. This is enabled by default
7823 if vectorization is enabled.
7824
7825 @item -ftree-loop-if-convert-stores
7826 @opindex ftree-loop-if-convert-stores
7827 Attempt to also if-convert conditional jumps containing memory writes.
7828 This transformation can be unsafe for multi-threaded programs as it
7829 transforms conditional memory writes into unconditional memory writes.
7830 For example,
7831 @smallexample
7832 for (i = 0; i < N; i++)
7833 if (cond)
7834 A[i] = expr;
7835 @end smallexample
7836 is transformed to
7837 @smallexample
7838 for (i = 0; i < N; i++)
7839 A[i] = cond ? expr : A[i];
7840 @end smallexample
7841 potentially producing data races.
7842
7843 @item -ftree-loop-distribution
7844 @opindex ftree-loop-distribution
7845 Perform loop distribution. This flag can improve cache performance on
7846 big loop bodies and allow further loop optimizations, like
7847 parallelization or vectorization, to take place. For example, the loop
7848 @smallexample
7849 DO I = 1, N
7850 A(I) = B(I) + C
7851 D(I) = E(I) * F
7852 ENDDO
7853 @end smallexample
7854 is transformed to
7855 @smallexample
7856 DO I = 1, N
7857 A(I) = B(I) + C
7858 ENDDO
7859 DO I = 1, N
7860 D(I) = E(I) * F
7861 ENDDO
7862 @end smallexample
7863
7864 @item -ftree-loop-distribute-patterns
7865 @opindex ftree-loop-distribute-patterns
7866 Perform loop distribution of patterns that can be code generated with
7867 calls to a library. This flag is enabled by default at @option{-O3}.
7868
7869 This pass distributes the initialization loops and generates a call to
7870 memset zero. For example, the loop
7871 @smallexample
7872 DO I = 1, N
7873 A(I) = 0
7874 B(I) = A(I) + I
7875 ENDDO
7876 @end smallexample
7877 is transformed to
7878 @smallexample
7879 DO I = 1, N
7880 A(I) = 0
7881 ENDDO
7882 DO I = 1, N
7883 B(I) = A(I) + I
7884 ENDDO
7885 @end smallexample
7886 and the initialization loop is transformed into a call to memset zero.
7887
7888 @item -ftree-loop-im
7889 @opindex ftree-loop-im
7890 Perform loop invariant motion on trees. This pass moves only invariants that
7891 are hard to handle at RTL level (function calls, operations that expand to
7892 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
7893 operands of conditions that are invariant out of the loop, so that we can use
7894 just trivial invariantness analysis in loop unswitching. The pass also includes
7895 store motion.
7896
7897 @item -ftree-loop-ivcanon
7898 @opindex ftree-loop-ivcanon
7899 Create a canonical counter for number of iterations in loops for which
7900 determining number of iterations requires complicated analysis. Later
7901 optimizations then may determine the number easily. Useful especially
7902 in connection with unrolling.
7903
7904 @item -fivopts
7905 @opindex fivopts
7906 Perform induction variable optimizations (strength reduction, induction
7907 variable merging and induction variable elimination) on trees.
7908
7909 @item -ftree-parallelize-loops=n
7910 @opindex ftree-parallelize-loops
7911 Parallelize loops, i.e., split their iteration space to run in n threads.
7912 This is only possible for loops whose iterations are independent
7913 and can be arbitrarily reordered. The optimization is only
7914 profitable on multiprocessor machines, for loops that are CPU-intensive,
7915 rather than constrained e.g.@: by memory bandwidth. This option
7916 implies @option{-pthread}, and thus is only supported on targets
7917 that have support for @option{-pthread}.
7918
7919 @item -ftree-pta
7920 @opindex ftree-pta
7921 Perform function-local points-to analysis on trees. This flag is
7922 enabled by default at @option{-O} and higher.
7923
7924 @item -ftree-sra
7925 @opindex ftree-sra
7926 Perform scalar replacement of aggregates. This pass replaces structure
7927 references with scalars to prevent committing structures to memory too
7928 early. This flag is enabled by default at @option{-O} and higher.
7929
7930 @item -ftree-ter
7931 @opindex ftree-ter
7932 Perform temporary expression replacement during the SSA->normal phase. Single
7933 use/single def temporaries are replaced at their use location with their
7934 defining expression. This results in non-GIMPLE code, but gives the expanders
7935 much more complex trees to work on resulting in better RTL generation. This is
7936 enabled by default at @option{-O} and higher.
7937
7938 @item -ftree-slsr
7939 @opindex ftree-slsr
7940 Perform straight-line strength reduction on trees. This recognizes related
7941 expressions involving multiplications and replaces them by less expensive
7942 calculations when possible. This is enabled by default at @option{-O} and
7943 higher.
7944
7945 @item -ftree-vectorize
7946 @opindex ftree-vectorize
7947 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
7948 and @option{-ftree-slp-vectorize} if not explicitly specified.
7949
7950 @item -ftree-loop-vectorize
7951 @opindex ftree-loop-vectorize
7952 Perform loop vectorization on trees. This flag is enabled by default at
7953 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7954
7955 @item -ftree-slp-vectorize
7956 @opindex ftree-slp-vectorize
7957 Perform basic block vectorization on trees. This flag is enabled by default at
7958 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7959
7960 @item -fvect-cost-model=@var{model}
7961 @opindex fvect-cost-model
7962 Alter the cost model used for vectorization. The @var{model} argument
7963 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
7964 With the @samp{unlimited} model the vectorized code-path is assumed
7965 to be profitable while with the @samp{dynamic} model a runtime check
7966 guards the vectorized code-path to enable it only for iteration
7967 counts that will likely execute faster than when executing the original
7968 scalar loop. The @samp{cheap} model disables vectorization of
7969 loops where doing so would be cost prohibitive for example due to
7970 required runtime checks for data dependence or alignment but otherwise
7971 is equal to the @samp{dynamic} model.
7972 The default cost model depends on other optimization flags and is
7973 either @samp{dynamic} or @samp{cheap}.
7974
7975 @item -fsimd-cost-model=@var{model}
7976 @opindex fsimd-cost-model
7977 Alter the cost model used for vectorization of loops marked with the OpenMP
7978 or Cilk Plus simd directive. The @var{model} argument should be one of
7979 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
7980 have the same meaning as described in @option{-fvect-cost-model} and by
7981 default a cost model defined with @option{-fvect-cost-model} is used.
7982
7983 @item -ftree-vrp
7984 @opindex ftree-vrp
7985 Perform Value Range Propagation on trees. This is similar to the
7986 constant propagation pass, but instead of values, ranges of values are
7987 propagated. This allows the optimizers to remove unnecessary range
7988 checks like array bound checks and null pointer checks. This is
7989 enabled by default at @option{-O2} and higher. Null pointer check
7990 elimination is only done if @option{-fdelete-null-pointer-checks} is
7991 enabled.
7992
7993 @item -fsplit-paths
7994 @opindex fsplit-paths
7995 Split paths leading to loop backedges. This can improve dead code
7996 elimination and common subexpression elimination. This is enabled by
7997 default at @option{-O2} and above.
7998
7999 @item -fsplit-ivs-in-unroller
8000 @opindex fsplit-ivs-in-unroller
8001 Enables expression of values of induction variables in later iterations
8002 of the unrolled loop using the value in the first iteration. This breaks
8003 long dependency chains, thus improving efficiency of the scheduling passes.
8004
8005 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8006 same effect. However, that is not reliable in cases where the loop body
8007 is more complicated than a single basic block. It also does not work at all
8008 on some architectures due to restrictions in the CSE pass.
8009
8010 This optimization is enabled by default.
8011
8012 @item -fvariable-expansion-in-unroller
8013 @opindex fvariable-expansion-in-unroller
8014 With this option, the compiler creates multiple copies of some
8015 local variables when unrolling a loop, which can result in superior code.
8016
8017 @item -fpartial-inlining
8018 @opindex fpartial-inlining
8019 Inline parts of functions. This option has any effect only
8020 when inlining itself is turned on by the @option{-finline-functions}
8021 or @option{-finline-small-functions} options.
8022
8023 Enabled at level @option{-O2}.
8024
8025 @item -fpredictive-commoning
8026 @opindex fpredictive-commoning
8027 Perform predictive commoning optimization, i.e., reusing computations
8028 (especially memory loads and stores) performed in previous
8029 iterations of loops.
8030
8031 This option is enabled at level @option{-O3}.
8032
8033 @item -fprefetch-loop-arrays
8034 @opindex fprefetch-loop-arrays
8035 If supported by the target machine, generate instructions to prefetch
8036 memory to improve the performance of loops that access large arrays.
8037
8038 This option may generate better or worse code; results are highly
8039 dependent on the structure of loops within the source code.
8040
8041 Disabled at level @option{-Os}.
8042
8043 @item -fprintf-return-value
8044 @opindex fprintf-return-value
8045 Substitute constants for known return value of formatted output functions
8046 such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and @code{vsnprintf}
8047 (but not @code{printf} of @code{fprintf}). This transformation allows GCC
8048 to optimize or even eliminate branches based on the known return value of
8049 these functions called with arguments that are either constant, or whose
8050 values are known to be in a range that makes determining the exact return
8051 value possible. For example, both the branch and the body of the @code{if}
8052 statement (but not the call to @code{snprint}) can be optimized away when
8053 @code{i} is a 32-bit or smaller integer because the return value is guaranteed
8054 to be at most 8.
8055
8056 @smallexample
8057 char buf[9];
8058 if (snprintf (buf, "%08x", i) >= sizeof buf)
8059 @dots{}
8060 @end smallexample
8061
8062 The @option{-fprintf-return-value} option relies on other optimizations
8063 and yields best results with @option{-O2}. It works in tandem with the
8064 @option{-Wformat-length} option. The @option{-fprintf-return-value}
8065 option is disabled by default.
8066
8067 @item -fno-peephole
8068 @itemx -fno-peephole2
8069 @opindex fno-peephole
8070 @opindex fno-peephole2
8071 Disable any machine-specific peephole optimizations. The difference
8072 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
8073 are implemented in the compiler; some targets use one, some use the
8074 other, a few use both.
8075
8076 @option{-fpeephole} is enabled by default.
8077 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8078
8079 @item -fno-guess-branch-probability
8080 @opindex fno-guess-branch-probability
8081 Do not guess branch probabilities using heuristics.
8082
8083 GCC uses heuristics to guess branch probabilities if they are
8084 not provided by profiling feedback (@option{-fprofile-arcs}). These
8085 heuristics are based on the control flow graph. If some branch probabilities
8086 are specified by @code{__builtin_expect}, then the heuristics are
8087 used to guess branch probabilities for the rest of the control flow graph,
8088 taking the @code{__builtin_expect} info into account. The interactions
8089 between the heuristics and @code{__builtin_expect} can be complex, and in
8090 some cases, it may be useful to disable the heuristics so that the effects
8091 of @code{__builtin_expect} are easier to understand.
8092
8093 The default is @option{-fguess-branch-probability} at levels
8094 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8095
8096 @item -freorder-blocks
8097 @opindex freorder-blocks
8098 Reorder basic blocks in the compiled function in order to reduce number of
8099 taken branches and improve code locality.
8100
8101 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8102
8103 @item -freorder-blocks-algorithm=@var{algorithm}
8104 @opindex freorder-blocks-algorithm
8105 Use the specified algorithm for basic block reordering. The
8106 @var{algorithm} argument can be @samp{simple}, which does not increase
8107 code size (except sometimes due to secondary effects like alignment),
8108 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
8109 put all often executed code together, minimizing the number of branches
8110 executed by making extra copies of code.
8111
8112 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
8113 @samp{stc} at levels @option{-O2}, @option{-O3}.
8114
8115 @item -freorder-blocks-and-partition
8116 @opindex freorder-blocks-and-partition
8117 In addition to reordering basic blocks in the compiled function, in order
8118 to reduce number of taken branches, partitions hot and cold basic blocks
8119 into separate sections of the assembly and @file{.o} files, to improve
8120 paging and cache locality performance.
8121
8122 This optimization is automatically turned off in the presence of
8123 exception handling, for linkonce sections, for functions with a user-defined
8124 section attribute and on any architecture that does not support named
8125 sections.
8126
8127 Enabled for x86 at levels @option{-O2}, @option{-O3}.
8128
8129 @item -freorder-functions
8130 @opindex freorder-functions
8131 Reorder functions in the object file in order to
8132 improve code locality. This is implemented by using special
8133 subsections @code{.text.hot} for most frequently executed functions and
8134 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
8135 the linker so object file format must support named sections and linker must
8136 place them in a reasonable way.
8137
8138 Also profile feedback must be available to make this option effective. See
8139 @option{-fprofile-arcs} for details.
8140
8141 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8142
8143 @item -fstrict-aliasing
8144 @opindex fstrict-aliasing
8145 Allow the compiler to assume the strictest aliasing rules applicable to
8146 the language being compiled. For C (and C++), this activates
8147 optimizations based on the type of expressions. In particular, an
8148 object of one type is assumed never to reside at the same address as an
8149 object of a different type, unless the types are almost the same. For
8150 example, an @code{unsigned int} can alias an @code{int}, but not a
8151 @code{void*} or a @code{double}. A character type may alias any other
8152 type.
8153
8154 @anchor{Type-punning}Pay special attention to code like this:
8155 @smallexample
8156 union a_union @{
8157 int i;
8158 double d;
8159 @};
8160
8161 int f() @{
8162 union a_union t;
8163 t.d = 3.0;
8164 return t.i;
8165 @}
8166 @end smallexample
8167 The practice of reading from a different union member than the one most
8168 recently written to (called ``type-punning'') is common. Even with
8169 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
8170 is accessed through the union type. So, the code above works as
8171 expected. @xref{Structures unions enumerations and bit-fields
8172 implementation}. However, this code might not:
8173 @smallexample
8174 int f() @{
8175 union a_union t;
8176 int* ip;
8177 t.d = 3.0;
8178 ip = &t.i;
8179 return *ip;
8180 @}
8181 @end smallexample
8182
8183 Similarly, access by taking the address, casting the resulting pointer
8184 and dereferencing the result has undefined behavior, even if the cast
8185 uses a union type, e.g.:
8186 @smallexample
8187 int f() @{
8188 double d = 3.0;
8189 return ((union a_union *) &d)->i;
8190 @}
8191 @end smallexample
8192
8193 The @option{-fstrict-aliasing} option is enabled at levels
8194 @option{-O2}, @option{-O3}, @option{-Os}.
8195
8196 @item -fstrict-overflow
8197 @opindex fstrict-overflow
8198 Allow the compiler to assume strict signed overflow rules, depending
8199 on the language being compiled. For C (and C++) this means that
8200 overflow when doing arithmetic with signed numbers is undefined, which
8201 means that the compiler may assume that it does not happen. This
8202 permits various optimizations. For example, the compiler assumes
8203 that an expression like @code{i + 10 > i} is always true for
8204 signed @code{i}. This assumption is only valid if signed overflow is
8205 undefined, as the expression is false if @code{i + 10} overflows when
8206 using twos complement arithmetic. When this option is in effect any
8207 attempt to determine whether an operation on signed numbers
8208 overflows must be written carefully to not actually involve overflow.
8209
8210 This option also allows the compiler to assume strict pointer
8211 semantics: given a pointer to an object, if adding an offset to that
8212 pointer does not produce a pointer to the same object, the addition is
8213 undefined. This permits the compiler to conclude that @code{p + u >
8214 p} is always true for a pointer @code{p} and unsigned integer
8215 @code{u}. This assumption is only valid because pointer wraparound is
8216 undefined, as the expression is false if @code{p + u} overflows using
8217 twos complement arithmetic.
8218
8219 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
8220 that integer signed overflow is fully defined: it wraps. When
8221 @option{-fwrapv} is used, there is no difference between
8222 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
8223 integers. With @option{-fwrapv} certain types of overflow are
8224 permitted. For example, if the compiler gets an overflow when doing
8225 arithmetic on constants, the overflowed value can still be used with
8226 @option{-fwrapv}, but not otherwise.
8227
8228 The @option{-fstrict-overflow} option is enabled at levels
8229 @option{-O2}, @option{-O3}, @option{-Os}.
8230
8231 @item -falign-functions
8232 @itemx -falign-functions=@var{n}
8233 @opindex falign-functions
8234 Align the start of functions to the next power-of-two greater than
8235 @var{n}, skipping up to @var{n} bytes. For instance,
8236 @option{-falign-functions=32} aligns functions to the next 32-byte
8237 boundary, but @option{-falign-functions=24} aligns to the next
8238 32-byte boundary only if this can be done by skipping 23 bytes or less.
8239
8240 @option{-fno-align-functions} and @option{-falign-functions=1} are
8241 equivalent and mean that functions are not aligned.
8242
8243 Some assemblers only support this flag when @var{n} is a power of two;
8244 in that case, it is rounded up.
8245
8246 If @var{n} is not specified or is zero, use a machine-dependent default.
8247
8248 Enabled at levels @option{-O2}, @option{-O3}.
8249
8250 @item -falign-labels
8251 @itemx -falign-labels=@var{n}
8252 @opindex falign-labels
8253 Align all branch targets to a power-of-two boundary, skipping up to
8254 @var{n} bytes like @option{-falign-functions}. This option can easily
8255 make code slower, because it must insert dummy operations for when the
8256 branch target is reached in the usual flow of the code.
8257
8258 @option{-fno-align-labels} and @option{-falign-labels=1} are
8259 equivalent and mean that labels are not aligned.
8260
8261 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8262 are greater than this value, then their values are used instead.
8263
8264 If @var{n} is not specified or is zero, use a machine-dependent default
8265 which is very likely to be @samp{1}, meaning no alignment.
8266
8267 Enabled at levels @option{-O2}, @option{-O3}.
8268
8269 @item -falign-loops
8270 @itemx -falign-loops=@var{n}
8271 @opindex falign-loops
8272 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8273 like @option{-falign-functions}. If the loops are
8274 executed many times, this makes up for any execution of the dummy
8275 operations.
8276
8277 @option{-fno-align-loops} and @option{-falign-loops=1} are
8278 equivalent and mean that loops are not aligned.
8279
8280 If @var{n} is not specified or is zero, use a machine-dependent default.
8281
8282 Enabled at levels @option{-O2}, @option{-O3}.
8283
8284 @item -falign-jumps
8285 @itemx -falign-jumps=@var{n}
8286 @opindex falign-jumps
8287 Align branch targets to a power-of-two boundary, for branch targets
8288 where the targets can only be reached by jumping, skipping up to @var{n}
8289 bytes like @option{-falign-functions}. In this case, no dummy operations
8290 need be executed.
8291
8292 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
8293 equivalent and mean that loops are not aligned.
8294
8295 If @var{n} is not specified or is zero, use a machine-dependent default.
8296
8297 Enabled at levels @option{-O2}, @option{-O3}.
8298
8299 @item -funit-at-a-time
8300 @opindex funit-at-a-time
8301 This option is left for compatibility reasons. @option{-funit-at-a-time}
8302 has no effect, while @option{-fno-unit-at-a-time} implies
8303 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8304
8305 Enabled by default.
8306
8307 @item -fno-toplevel-reorder
8308 @opindex fno-toplevel-reorder
8309 Do not reorder top-level functions, variables, and @code{asm}
8310 statements. Output them in the same order that they appear in the
8311 input file. When this option is used, unreferenced static variables
8312 are not removed. This option is intended to support existing code
8313 that relies on a particular ordering. For new code, it is better to
8314 use attributes when possible.
8315
8316 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8317 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8318 targets.
8319
8320 @item -fweb
8321 @opindex fweb
8322 Constructs webs as commonly used for register allocation purposes and assign
8323 each web individual pseudo register. This allows the register allocation pass
8324 to operate on pseudos directly, but also strengthens several other optimization
8325 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8326 however, make debugging impossible, since variables no longer stay in a
8327 ``home register''.
8328
8329 Enabled by default with @option{-funroll-loops}.
8330
8331 @item -fwhole-program
8332 @opindex fwhole-program
8333 Assume that the current compilation unit represents the whole program being
8334 compiled. All public functions and variables with the exception of @code{main}
8335 and those merged by attribute @code{externally_visible} become static functions
8336 and in effect are optimized more aggressively by interprocedural optimizers.
8337
8338 This option should not be used in combination with @option{-flto}.
8339 Instead relying on a linker plugin should provide safer and more precise
8340 information.
8341
8342 @item -flto[=@var{n}]
8343 @opindex flto
8344 This option runs the standard link-time optimizer. When invoked
8345 with source code, it generates GIMPLE (one of GCC's internal
8346 representations) and writes it to special ELF sections in the object
8347 file. When the object files are linked together, all the function
8348 bodies are read from these ELF sections and instantiated as if they
8349 had been part of the same translation unit.
8350
8351 To use the link-time optimizer, @option{-flto} and optimization
8352 options should be specified at compile time and during the final link.
8353 It is recommended that you compile all the files participating in the
8354 same link with the same options and also specify those options at
8355 link time.
8356 For example:
8357
8358 @smallexample
8359 gcc -c -O2 -flto foo.c
8360 gcc -c -O2 -flto bar.c
8361 gcc -o myprog -flto -O2 foo.o bar.o
8362 @end smallexample
8363
8364 The first two invocations to GCC save a bytecode representation
8365 of GIMPLE into special ELF sections inside @file{foo.o} and
8366 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8367 @file{foo.o} and @file{bar.o}, merges the two files into a single
8368 internal image, and compiles the result as usual. Since both
8369 @file{foo.o} and @file{bar.o} are merged into a single image, this
8370 causes all the interprocedural analyses and optimizations in GCC to
8371 work across the two files as if they were a single one. This means,
8372 for example, that the inliner is able to inline functions in
8373 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8374
8375 Another (simpler) way to enable link-time optimization is:
8376
8377 @smallexample
8378 gcc -o myprog -flto -O2 foo.c bar.c
8379 @end smallexample
8380
8381 The above generates bytecode for @file{foo.c} and @file{bar.c},
8382 merges them together into a single GIMPLE representation and optimizes
8383 them as usual to produce @file{myprog}.
8384
8385 The only important thing to keep in mind is that to enable link-time
8386 optimizations you need to use the GCC driver to perform the link step.
8387 GCC then automatically performs link-time optimization if any of the
8388 objects involved were compiled with the @option{-flto} command-line option.
8389 You generally
8390 should specify the optimization options to be used for link-time
8391 optimization though GCC tries to be clever at guessing an
8392 optimization level to use from the options used at compile time
8393 if you fail to specify one at link time. You can always override
8394 the automatic decision to do link-time optimization at link time
8395 by passing @option{-fno-lto} to the link command.
8396
8397 To make whole program optimization effective, it is necessary to make
8398 certain whole program assumptions. The compiler needs to know
8399 what functions and variables can be accessed by libraries and runtime
8400 outside of the link-time optimized unit. When supported by the linker,
8401 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8402 to the compiler about used and externally visible symbols. When
8403 the linker plugin is not available, @option{-fwhole-program} should be
8404 used to allow the compiler to make these assumptions, which leads
8405 to more aggressive optimization decisions.
8406
8407 When @option{-fuse-linker-plugin} is not enabled, when a file is
8408 compiled with @option{-flto}, the generated object file is larger than
8409 a regular object file because it contains GIMPLE bytecodes and the usual
8410 final code (see @option{-ffat-lto-objects}. This means that
8411 object files with LTO information can be linked as normal object
8412 files; if @option{-fno-lto} is passed to the linker, no
8413 interprocedural optimizations are applied. Note that when
8414 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
8415 but you cannot perform a regular, non-LTO link on them.
8416
8417 Additionally, the optimization flags used to compile individual files
8418 are not necessarily related to those used at link time. For instance,
8419
8420 @smallexample
8421 gcc -c -O0 -ffat-lto-objects -flto foo.c
8422 gcc -c -O0 -ffat-lto-objects -flto bar.c
8423 gcc -o myprog -O3 foo.o bar.o
8424 @end smallexample
8425
8426 This produces individual object files with unoptimized assembler
8427 code, but the resulting binary @file{myprog} is optimized at
8428 @option{-O3}. If, instead, the final binary is generated with
8429 @option{-fno-lto}, then @file{myprog} is not optimized.
8430
8431 When producing the final binary, GCC only
8432 applies link-time optimizations to those files that contain bytecode.
8433 Therefore, you can mix and match object files and libraries with
8434 GIMPLE bytecodes and final object code. GCC automatically selects
8435 which files to optimize in LTO mode and which files to link without
8436 further processing.
8437
8438 There are some code generation flags preserved by GCC when
8439 generating bytecodes, as they need to be used during the final link
8440 stage. Generally options specified at link time override those
8441 specified at compile time.
8442
8443 If you do not specify an optimization level option @option{-O} at
8444 link time, then GCC uses the highest optimization level
8445 used when compiling the object files.
8446
8447 Currently, the following options and their settings are taken from
8448 the first object file that explicitly specifies them:
8449 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8450 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8451 and all the @option{-m} target flags.
8452
8453 Certain ABI-changing flags are required to match in all compilation units,
8454 and trying to override this at link time with a conflicting value
8455 is ignored. This includes options such as @option{-freg-struct-return}
8456 and @option{-fpcc-struct-return}.
8457
8458 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8459 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8460 are passed through to the link stage and merged conservatively for
8461 conflicting translation units. Specifically
8462 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8463 precedence; and for example @option{-ffp-contract=off} takes precedence
8464 over @option{-ffp-contract=fast}. You can override them at link time.
8465
8466 If LTO encounters objects with C linkage declared with incompatible
8467 types in separate translation units to be linked together (undefined
8468 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8469 issued. The behavior is still undefined at run time. Similar
8470 diagnostics may be raised for other languages.
8471
8472 Another feature of LTO is that it is possible to apply interprocedural
8473 optimizations on files written in different languages:
8474
8475 @smallexample
8476 gcc -c -flto foo.c
8477 g++ -c -flto bar.cc
8478 gfortran -c -flto baz.f90
8479 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8480 @end smallexample
8481
8482 Notice that the final link is done with @command{g++} to get the C++
8483 runtime libraries and @option{-lgfortran} is added to get the Fortran
8484 runtime libraries. In general, when mixing languages in LTO mode, you
8485 should use the same link command options as when mixing languages in a
8486 regular (non-LTO) compilation.
8487
8488 If object files containing GIMPLE bytecode are stored in a library archive, say
8489 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8490 are using a linker with plugin support. To create static libraries suitable
8491 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8492 and @command{ranlib};
8493 to show the symbols of object files with GIMPLE bytecode, use
8494 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8495 and @command{nm} have been compiled with plugin support. At link time, use the the
8496 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8497 the LTO optimization process:
8498
8499 @smallexample
8500 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8501 @end smallexample
8502
8503 With the linker plugin enabled, the linker extracts the needed
8504 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8505 to make them part of the aggregated GIMPLE image to be optimized.
8506
8507 If you are not using a linker with plugin support and/or do not
8508 enable the linker plugin, then the objects inside @file{libfoo.a}
8509 are extracted and linked as usual, but they do not participate
8510 in the LTO optimization process. In order to make a static library suitable
8511 for both LTO optimization and usual linkage, compile its object files with
8512 @option{-flto} @option{-ffat-lto-objects}.
8513
8514 Link-time optimizations do not require the presence of the whole program to
8515 operate. If the program does not require any symbols to be exported, it is
8516 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8517 the interprocedural optimizers to use more aggressive assumptions which may
8518 lead to improved optimization opportunities.
8519 Use of @option{-fwhole-program} is not needed when linker plugin is
8520 active (see @option{-fuse-linker-plugin}).
8521
8522 The current implementation of LTO makes no
8523 attempt to generate bytecode that is portable between different
8524 types of hosts. The bytecode files are versioned and there is a
8525 strict version check, so bytecode files generated in one version of
8526 GCC do not work with an older or newer version of GCC.
8527
8528 Link-time optimization does not work well with generation of debugging
8529 information. Combining @option{-flto} with
8530 @option{-g} is currently experimental and expected to produce unexpected
8531 results.
8532
8533 If you specify the optional @var{n}, the optimization and code
8534 generation done at link time is executed in parallel using @var{n}
8535 parallel jobs by utilizing an installed @command{make} program. The
8536 environment variable @env{MAKE} may be used to override the program
8537 used. The default value for @var{n} is 1.
8538
8539 You can also specify @option{-flto=jobserver} to use GNU make's
8540 job server mode to determine the number of parallel jobs. This
8541 is useful when the Makefile calling GCC is already executing in parallel.
8542 You must prepend a @samp{+} to the command recipe in the parent Makefile
8543 for this to work. This option likely only works if @env{MAKE} is
8544 GNU make.
8545
8546 @item -flto-partition=@var{alg}
8547 @opindex flto-partition
8548 Specify the partitioning algorithm used by the link-time optimizer.
8549 The value is either @samp{1to1} to specify a partitioning mirroring
8550 the original source files or @samp{balanced} to specify partitioning
8551 into equally sized chunks (whenever possible) or @samp{max} to create
8552 new partition for every symbol where possible. Specifying @samp{none}
8553 as an algorithm disables partitioning and streaming completely.
8554 The default value is @samp{balanced}. While @samp{1to1} can be used
8555 as an workaround for various code ordering issues, the @samp{max}
8556 partitioning is intended for internal testing only.
8557 The value @samp{one} specifies that exactly one partition should be
8558 used while the value @samp{none} bypasses partitioning and executes
8559 the link-time optimization step directly from the WPA phase.
8560
8561 @item -flto-odr-type-merging
8562 @opindex flto-odr-type-merging
8563 Enable streaming of mangled types names of C++ types and their unification
8564 at link time. This increases size of LTO object files, but enables
8565 diagnostics about One Definition Rule violations.
8566
8567 @item -flto-compression-level=@var{n}
8568 @opindex flto-compression-level
8569 This option specifies the level of compression used for intermediate
8570 language written to LTO object files, and is only meaningful in
8571 conjunction with LTO mode (@option{-flto}). Valid
8572 values are 0 (no compression) to 9 (maximum compression). Values
8573 outside this range are clamped to either 0 or 9. If the option is not
8574 given, a default balanced compression setting is used.
8575
8576 @item -fuse-linker-plugin
8577 @opindex fuse-linker-plugin
8578 Enables the use of a linker plugin during link-time optimization. This
8579 option relies on plugin support in the linker, which is available in gold
8580 or in GNU ld 2.21 or newer.
8581
8582 This option enables the extraction of object files with GIMPLE bytecode out
8583 of library archives. This improves the quality of optimization by exposing
8584 more code to the link-time optimizer. This information specifies what
8585 symbols can be accessed externally (by non-LTO object or during dynamic
8586 linking). Resulting code quality improvements on binaries (and shared
8587 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
8588 See @option{-flto} for a description of the effect of this flag and how to
8589 use it.
8590
8591 This option is enabled by default when LTO support in GCC is enabled
8592 and GCC was configured for use with
8593 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8594
8595 @item -ffat-lto-objects
8596 @opindex ffat-lto-objects
8597 Fat LTO objects are object files that contain both the intermediate language
8598 and the object code. This makes them usable for both LTO linking and normal
8599 linking. This option is effective only when compiling with @option{-flto}
8600 and is ignored at link time.
8601
8602 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8603 requires the complete toolchain to be aware of LTO. It requires a linker with
8604 linker plugin support for basic functionality. Additionally,
8605 @command{nm}, @command{ar} and @command{ranlib}
8606 need to support linker plugins to allow a full-featured build environment
8607 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
8608 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8609 to these tools. With non fat LTO makefiles need to be modified to use them.
8610
8611 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
8612 support.
8613
8614 @item -fcompare-elim
8615 @opindex fcompare-elim
8616 After register allocation and post-register allocation instruction splitting,
8617 identify arithmetic instructions that compute processor flags similar to a
8618 comparison operation based on that arithmetic. If possible, eliminate the
8619 explicit comparison operation.
8620
8621 This pass only applies to certain targets that cannot explicitly represent
8622 the comparison operation before register allocation is complete.
8623
8624 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8625
8626 @item -fcprop-registers
8627 @opindex fcprop-registers
8628 After register allocation and post-register allocation instruction splitting,
8629 perform a copy-propagation pass to try to reduce scheduling dependencies
8630 and occasionally eliminate the copy.
8631
8632 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8633
8634 @item -fprofile-correction
8635 @opindex fprofile-correction
8636 Profiles collected using an instrumented binary for multi-threaded programs may
8637 be inconsistent due to missed counter updates. When this option is specified,
8638 GCC uses heuristics to correct or smooth out such inconsistencies. By
8639 default, GCC emits an error message when an inconsistent profile is detected.
8640
8641 @item -fprofile-use
8642 @itemx -fprofile-use=@var{path}
8643 @opindex fprofile-use
8644 Enable profile feedback-directed optimizations,
8645 and the following optimizations
8646 which are generally profitable only with profile feedback available:
8647 @option{-fbranch-probabilities}, @option{-fvpt},
8648 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8649 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
8650
8651 Before you can use this option, you must first generate profiling information.
8652 @xref{Optimize Options}, for information about the @option{-fprofile-generate}
8653 option.
8654
8655 By default, GCC emits an error message if the feedback profiles do not
8656 match the source code. This error can be turned into a warning by using
8657 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8658 code.
8659
8660 If @var{path} is specified, GCC looks at the @var{path} to find
8661 the profile feedback data files. See @option{-fprofile-dir}.
8662
8663 @item -fauto-profile
8664 @itemx -fauto-profile=@var{path}
8665 @opindex fauto-profile
8666 Enable sampling-based feedback-directed optimizations,
8667 and the following optimizations
8668 which are generally profitable only with profile feedback available:
8669 @option{-fbranch-probabilities}, @option{-fvpt},
8670 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8671 @option{-ftree-vectorize},
8672 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
8673 @option{-fpredictive-commoning}, @option{-funswitch-loops},
8674 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
8675
8676 @var{path} is the name of a file containing AutoFDO profile information.
8677 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
8678
8679 Producing an AutoFDO profile data file requires running your program
8680 with the @command{perf} utility on a supported GNU/Linux target system.
8681 For more information, see @uref{https://perf.wiki.kernel.org/}.
8682
8683 E.g.
8684 @smallexample
8685 perf record -e br_inst_retired:near_taken -b -o perf.data \
8686 -- your_program
8687 @end smallexample
8688
8689 Then use the @command{create_gcov} tool to convert the raw profile data
8690 to a format that can be used by GCC.@ You must also supply the
8691 unstripped binary for your program to this tool.
8692 See @uref{https://github.com/google/autofdo}.
8693
8694 E.g.
8695 @smallexample
8696 create_gcov --binary=your_program.unstripped --profile=perf.data \
8697 --gcov=profile.afdo
8698 @end smallexample
8699 @end table
8700
8701 The following options control compiler behavior regarding floating-point
8702 arithmetic. These options trade off between speed and
8703 correctness. All must be specifically enabled.
8704
8705 @table @gcctabopt
8706 @item -ffloat-store
8707 @opindex ffloat-store
8708 Do not store floating-point variables in registers, and inhibit other
8709 options that might change whether a floating-point value is taken from a
8710 register or memory.
8711
8712 @cindex floating-point precision
8713 This option prevents undesirable excess precision on machines such as
8714 the 68000 where the floating registers (of the 68881) keep more
8715 precision than a @code{double} is supposed to have. Similarly for the
8716 x86 architecture. For most programs, the excess precision does only
8717 good, but a few programs rely on the precise definition of IEEE floating
8718 point. Use @option{-ffloat-store} for such programs, after modifying
8719 them to store all pertinent intermediate computations into variables.
8720
8721 @item -fexcess-precision=@var{style}
8722 @opindex fexcess-precision
8723 This option allows further control over excess precision on machines
8724 where floating-point registers have more precision than the IEEE
8725 @code{float} and @code{double} types and the processor does not
8726 support operations rounding to those types. By default,
8727 @option{-fexcess-precision=fast} is in effect; this means that
8728 operations are carried out in the precision of the registers and that
8729 it is unpredictable when rounding to the types specified in the source
8730 code takes place. When compiling C, if
8731 @option{-fexcess-precision=standard} is specified then excess
8732 precision follows the rules specified in ISO C99; in particular,
8733 both casts and assignments cause values to be rounded to their
8734 semantic types (whereas @option{-ffloat-store} only affects
8735 assignments). This option is enabled by default for C if a strict
8736 conformance option such as @option{-std=c99} is used.
8737
8738 @opindex mfpmath
8739 @option{-fexcess-precision=standard} is not implemented for languages
8740 other than C, and has no effect if
8741 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8742 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8743 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8744 semantics apply without excess precision, and in the latter, rounding
8745 is unpredictable.
8746
8747 @item -ffast-math
8748 @opindex ffast-math
8749 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8750 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8751 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8752
8753 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8754
8755 This option is not turned on by any @option{-O} option besides
8756 @option{-Ofast} since it can result in incorrect output for programs
8757 that depend on an exact implementation of IEEE or ISO rules/specifications
8758 for math functions. It may, however, yield faster code for programs
8759 that do not require the guarantees of these specifications.
8760
8761 @item -fno-math-errno
8762 @opindex fno-math-errno
8763 Do not set @code{errno} after calling math functions that are executed
8764 with a single instruction, e.g., @code{sqrt}. A program that relies on
8765 IEEE exceptions for math error handling may want to use this flag
8766 for speed while maintaining IEEE arithmetic compatibility.
8767
8768 This option is not turned on by any @option{-O} option since
8769 it can result in incorrect output for programs that depend on
8770 an exact implementation of IEEE or ISO rules/specifications for
8771 math functions. It may, however, yield faster code for programs
8772 that do not require the guarantees of these specifications.
8773
8774 The default is @option{-fmath-errno}.
8775
8776 On Darwin systems, the math library never sets @code{errno}. There is
8777 therefore no reason for the compiler to consider the possibility that
8778 it might, and @option{-fno-math-errno} is the default.
8779
8780 @item -funsafe-math-optimizations
8781 @opindex funsafe-math-optimizations
8782
8783 Allow optimizations for floating-point arithmetic that (a) assume
8784 that arguments and results are valid and (b) may violate IEEE or
8785 ANSI standards. When used at link time, it may include libraries
8786 or startup files that change the default FPU control word or other
8787 similar optimizations.
8788
8789 This option is not turned on by any @option{-O} option since
8790 it can result in incorrect output for programs that depend on
8791 an exact implementation of IEEE or ISO rules/specifications for
8792 math functions. It may, however, yield faster code for programs
8793 that do not require the guarantees of these specifications.
8794 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
8795 @option{-fassociative-math} and @option{-freciprocal-math}.
8796
8797 The default is @option{-fno-unsafe-math-optimizations}.
8798
8799 @item -fassociative-math
8800 @opindex fassociative-math
8801
8802 Allow re-association of operands in series of floating-point operations.
8803 This violates the ISO C and C++ language standard by possibly changing
8804 computation result. NOTE: re-ordering may change the sign of zero as
8805 well as ignore NaNs and inhibit or create underflow or overflow (and
8806 thus cannot be used on code that relies on rounding behavior like
8807 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
8808 and thus may not be used when ordered comparisons are required.
8809 This option requires that both @option{-fno-signed-zeros} and
8810 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
8811 much sense with @option{-frounding-math}. For Fortran the option
8812 is automatically enabled when both @option{-fno-signed-zeros} and
8813 @option{-fno-trapping-math} are in effect.
8814
8815 The default is @option{-fno-associative-math}.
8816
8817 @item -freciprocal-math
8818 @opindex freciprocal-math
8819
8820 Allow the reciprocal of a value to be used instead of dividing by
8821 the value if this enables optimizations. For example @code{x / y}
8822 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
8823 is subject to common subexpression elimination. Note that this loses
8824 precision and increases the number of flops operating on the value.
8825
8826 The default is @option{-fno-reciprocal-math}.
8827
8828 @item -ffinite-math-only
8829 @opindex ffinite-math-only
8830 Allow optimizations for floating-point arithmetic that assume
8831 that arguments and results are not NaNs or +-Infs.
8832
8833 This option is not turned on by any @option{-O} option since
8834 it can result in incorrect output for programs that depend on
8835 an exact implementation of IEEE or ISO rules/specifications for
8836 math functions. It may, however, yield faster code for programs
8837 that do not require the guarantees of these specifications.
8838
8839 The default is @option{-fno-finite-math-only}.
8840
8841 @item -fno-signed-zeros
8842 @opindex fno-signed-zeros
8843 Allow optimizations for floating-point arithmetic that ignore the
8844 signedness of zero. IEEE arithmetic specifies the behavior of
8845 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
8846 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
8847 This option implies that the sign of a zero result isn't significant.
8848
8849 The default is @option{-fsigned-zeros}.
8850
8851 @item -fno-trapping-math
8852 @opindex fno-trapping-math
8853 Compile code assuming that floating-point operations cannot generate
8854 user-visible traps. These traps include division by zero, overflow,
8855 underflow, inexact result and invalid operation. This option requires
8856 that @option{-fno-signaling-nans} be in effect. Setting this option may
8857 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
8858
8859 This option should never be turned on by any @option{-O} option since
8860 it can result in incorrect output for programs that depend on
8861 an exact implementation of IEEE or ISO rules/specifications for
8862 math functions.
8863
8864 The default is @option{-ftrapping-math}.
8865
8866 @item -frounding-math
8867 @opindex frounding-math
8868 Disable transformations and optimizations that assume default floating-point
8869 rounding behavior. This is round-to-zero for all floating point
8870 to integer conversions, and round-to-nearest for all other arithmetic
8871 truncations. This option should be specified for programs that change
8872 the FP rounding mode dynamically, or that may be executed with a
8873 non-default rounding mode. This option disables constant folding of
8874 floating-point expressions at compile time (which may be affected by
8875 rounding mode) and arithmetic transformations that are unsafe in the
8876 presence of sign-dependent rounding modes.
8877
8878 The default is @option{-fno-rounding-math}.
8879
8880 This option is experimental and does not currently guarantee to
8881 disable all GCC optimizations that are affected by rounding mode.
8882 Future versions of GCC may provide finer control of this setting
8883 using C99's @code{FENV_ACCESS} pragma. This command-line option
8884 will be used to specify the default state for @code{FENV_ACCESS}.
8885
8886 @item -fsignaling-nans
8887 @opindex fsignaling-nans
8888 Compile code assuming that IEEE signaling NaNs may generate user-visible
8889 traps during floating-point operations. Setting this option disables
8890 optimizations that may change the number of exceptions visible with
8891 signaling NaNs. This option implies @option{-ftrapping-math}.
8892
8893 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
8894 be defined.
8895
8896 The default is @option{-fno-signaling-nans}.
8897
8898 This option is experimental and does not currently guarantee to
8899 disable all GCC optimizations that affect signaling NaN behavior.
8900
8901 @item -fno-fp-int-builtin-inexact
8902 @opindex fno-fp-int-builtin-inexact
8903 Do not allow the built-in functions @code{ceil}, @code{floor},
8904 @code{round} and @code{trunc}, and their @code{float} and @code{long
8905 double} variants, to generate code that raises the ``inexact''
8906 floating-point exception for noninteger arguments. ISO C99 and C11
8907 allow these functions to raise the ``inexact'' exception, but ISO/IEC
8908 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
8909 functions to do so.
8910
8911 The default is @option{-ffp-int-builtin-inexact}, allowing the
8912 exception to be raised. This option does nothing unless
8913 @option{-ftrapping-math} is in effect.
8914
8915 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
8916 generate a call to a library function then the ``inexact'' exception
8917 may be raised if the library implementation does not follow TS 18661.
8918
8919 @item -fsingle-precision-constant
8920 @opindex fsingle-precision-constant
8921 Treat floating-point constants as single precision instead of
8922 implicitly converting them to double-precision constants.
8923
8924 @item -fcx-limited-range
8925 @opindex fcx-limited-range
8926 When enabled, this option states that a range reduction step is not
8927 needed when performing complex division. Also, there is no checking
8928 whether the result of a complex multiplication or division is @code{NaN
8929 + I*NaN}, with an attempt to rescue the situation in that case. The
8930 default is @option{-fno-cx-limited-range}, but is enabled by
8931 @option{-ffast-math}.
8932
8933 This option controls the default setting of the ISO C99
8934 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
8935 all languages.
8936
8937 @item -fcx-fortran-rules
8938 @opindex fcx-fortran-rules
8939 Complex multiplication and division follow Fortran rules. Range
8940 reduction is done as part of complex division, but there is no checking
8941 whether the result of a complex multiplication or division is @code{NaN
8942 + I*NaN}, with an attempt to rescue the situation in that case.
8943
8944 The default is @option{-fno-cx-fortran-rules}.
8945
8946 @end table
8947
8948 The following options control optimizations that may improve
8949 performance, but are not enabled by any @option{-O} options. This
8950 section includes experimental options that may produce broken code.
8951
8952 @table @gcctabopt
8953 @item -fbranch-probabilities
8954 @opindex fbranch-probabilities
8955 After running a program compiled with @option{-fprofile-arcs}
8956 (@pxref{Instrumentation Options}),
8957 you can compile it a second time using
8958 @option{-fbranch-probabilities}, to improve optimizations based on
8959 the number of times each branch was taken. When a program
8960 compiled with @option{-fprofile-arcs} exits, it saves arc execution
8961 counts to a file called @file{@var{sourcename}.gcda} for each source
8962 file. The information in this data file is very dependent on the
8963 structure of the generated code, so you must use the same source code
8964 and the same optimization options for both compilations.
8965
8966 With @option{-fbranch-probabilities}, GCC puts a
8967 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8968 These can be used to improve optimization. Currently, they are only
8969 used in one place: in @file{reorg.c}, instead of guessing which path a
8970 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8971 exactly determine which path is taken more often.
8972
8973 @item -fprofile-values
8974 @opindex fprofile-values
8975 If combined with @option{-fprofile-arcs}, it adds code so that some
8976 data about values of expressions in the program is gathered.
8977
8978 With @option{-fbranch-probabilities}, it reads back the data gathered
8979 from profiling values of expressions for usage in optimizations.
8980
8981 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8982
8983 @item -fprofile-reorder-functions
8984 @opindex fprofile-reorder-functions
8985 Function reordering based on profile instrumentation collects
8986 first time of execution of a function and orders these functions
8987 in ascending order.
8988
8989 Enabled with @option{-fprofile-use}.
8990
8991 @item -fvpt
8992 @opindex fvpt
8993 If combined with @option{-fprofile-arcs}, this option instructs the compiler
8994 to add code to gather information about values of expressions.
8995
8996 With @option{-fbranch-probabilities}, it reads back the data gathered
8997 and actually performs the optimizations based on them.
8998 Currently the optimizations include specialization of division operations
8999 using the knowledge about the value of the denominator.
9000
9001 @item -frename-registers
9002 @opindex frename-registers
9003 Attempt to avoid false dependencies in scheduled code by making use
9004 of registers left over after register allocation. This optimization
9005 most benefits processors with lots of registers. Depending on the
9006 debug information format adopted by the target, however, it can
9007 make debugging impossible, since variables no longer stay in
9008 a ``home register''.
9009
9010 Enabled by default with @option{-funroll-loops}.
9011
9012 @item -fschedule-fusion
9013 @opindex fschedule-fusion
9014 Performs a target dependent pass over the instruction stream to schedule
9015 instructions of same type together because target machine can execute them
9016 more efficiently if they are adjacent to each other in the instruction flow.
9017
9018 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9019
9020 @item -ftracer
9021 @opindex ftracer
9022 Perform tail duplication to enlarge superblock size. This transformation
9023 simplifies the control flow of the function allowing other optimizations to do
9024 a better job.
9025
9026 Enabled with @option{-fprofile-use}.
9027
9028 @item -funroll-loops
9029 @opindex funroll-loops
9030 Unroll loops whose number of iterations can be determined at compile time or
9031 upon entry to the loop. @option{-funroll-loops} implies
9032 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9033 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9034 a small constant number of iterations). This option makes code larger, and may
9035 or may not make it run faster.
9036
9037 Enabled with @option{-fprofile-use}.
9038
9039 @item -funroll-all-loops
9040 @opindex funroll-all-loops
9041 Unroll all loops, even if their number of iterations is uncertain when
9042 the loop is entered. This usually makes programs run more slowly.
9043 @option{-funroll-all-loops} implies the same options as
9044 @option{-funroll-loops}.
9045
9046 @item -fpeel-loops
9047 @opindex fpeel-loops
9048 Peels loops for which there is enough information that they do not
9049 roll much (from profile feedback or static analysis). It also turns on
9050 complete loop peeling (i.e.@: complete removal of loops with small constant
9051 number of iterations).
9052
9053 Enabled with @option{-O3} and/or @option{-fprofile-use}.
9054
9055 @item -fmove-loop-invariants
9056 @opindex fmove-loop-invariants
9057 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
9058 at level @option{-O1}
9059
9060 @item -funswitch-loops
9061 @opindex funswitch-loops
9062 Move branches with loop invariant conditions out of the loop, with duplicates
9063 of the loop on both branches (modified according to result of the condition).
9064
9065 @item -ffunction-sections
9066 @itemx -fdata-sections
9067 @opindex ffunction-sections
9068 @opindex fdata-sections
9069 Place each function or data item into its own section in the output
9070 file if the target supports arbitrary sections. The name of the
9071 function or the name of the data item determines the section's name
9072 in the output file.
9073
9074 Use these options on systems where the linker can perform optimizations
9075 to improve locality of reference in the instruction space. Most systems
9076 using the ELF object format and SPARC processors running Solaris 2 have
9077 linkers with such optimizations. AIX may have these optimizations in
9078 the future.
9079
9080 Only use these options when there are significant benefits from doing
9081 so. When you specify these options, the assembler and linker
9082 create larger object and executable files and are also slower.
9083 You cannot use @command{gprof} on all systems if you
9084 specify this option, and you may have problems with debugging if
9085 you specify both this option and @option{-g}.
9086
9087 @item -fbranch-target-load-optimize
9088 @opindex fbranch-target-load-optimize
9089 Perform branch target register load optimization before prologue / epilogue
9090 threading.
9091 The use of target registers can typically be exposed only during reload,
9092 thus hoisting loads out of loops and doing inter-block scheduling needs
9093 a separate optimization pass.
9094
9095 @item -fbranch-target-load-optimize2
9096 @opindex fbranch-target-load-optimize2
9097 Perform branch target register load optimization after prologue / epilogue
9098 threading.
9099
9100 @item -fbtr-bb-exclusive
9101 @opindex fbtr-bb-exclusive
9102 When performing branch target register load optimization, don't reuse
9103 branch target registers within any basic block.
9104
9105 @item -fstdarg-opt
9106 @opindex fstdarg-opt
9107 Optimize the prologue of variadic argument functions with respect to usage of
9108 those arguments.
9109
9110 @item -fsection-anchors
9111 @opindex fsection-anchors
9112 Try to reduce the number of symbolic address calculations by using
9113 shared ``anchor'' symbols to address nearby objects. This transformation
9114 can help to reduce the number of GOT entries and GOT accesses on some
9115 targets.
9116
9117 For example, the implementation of the following function @code{foo}:
9118
9119 @smallexample
9120 static int a, b, c;
9121 int foo (void) @{ return a + b + c; @}
9122 @end smallexample
9123
9124 @noindent
9125 usually calculates the addresses of all three variables, but if you
9126 compile it with @option{-fsection-anchors}, it accesses the variables
9127 from a common anchor point instead. The effect is similar to the
9128 following pseudocode (which isn't valid C):
9129
9130 @smallexample
9131 int foo (void)
9132 @{
9133 register int *xr = &x;
9134 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9135 @}
9136 @end smallexample
9137
9138 Not all targets support this option.
9139
9140 @item --param @var{name}=@var{value}
9141 @opindex param
9142 In some places, GCC uses various constants to control the amount of
9143 optimization that is done. For example, GCC does not inline functions
9144 that contain more than a certain number of instructions. You can
9145 control some of these constants on the command line using the
9146 @option{--param} option.
9147
9148 The names of specific parameters, and the meaning of the values, are
9149 tied to the internals of the compiler, and are subject to change
9150 without notice in future releases.
9151
9152 In each case, the @var{value} is an integer. The allowable choices for
9153 @var{name} are:
9154
9155 @table @gcctabopt
9156 @item predictable-branch-outcome
9157 When branch is predicted to be taken with probability lower than this threshold
9158 (in percent), then it is considered well predictable. The default is 10.
9159
9160 @item max-rtl-if-conversion-insns
9161 RTL if-conversion tries to remove conditional branches around a block and
9162 replace them with conditionally executed instructions. This parameter
9163 gives the maximum number of instructions in a block which should be
9164 considered for if-conversion. The default is 10, though the compiler will
9165 also use other heuristics to decide whether if-conversion is likely to be
9166 profitable.
9167
9168 @item max-rtl-if-conversion-predictable-cost
9169 @item max-rtl-if-conversion-unpredictable-cost
9170 RTL if-conversion will try to remove conditional branches around a block
9171 and replace them with conditionally executed instructions. These parameters
9172 give the maximum permissible cost for the sequence that would be generated
9173 by if-conversion depending on whether the branch is statically determined
9174 to be predictable or not. The units for this parameter are the same as
9175 those for the GCC internal seq_cost metric. The compiler will try to
9176 provide a reasonable default for this parameter using the BRANCH_COST
9177 target macro.
9178
9179 @item max-crossjump-edges
9180 The maximum number of incoming edges to consider for cross-jumping.
9181 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
9182 the number of edges incoming to each block. Increasing values mean
9183 more aggressive optimization, making the compilation time increase with
9184 probably small improvement in executable size.
9185
9186 @item min-crossjump-insns
9187 The minimum number of instructions that must be matched at the end
9188 of two blocks before cross-jumping is performed on them. This
9189 value is ignored in the case where all instructions in the block being
9190 cross-jumped from are matched. The default value is 5.
9191
9192 @item max-grow-copy-bb-insns
9193 The maximum code size expansion factor when copying basic blocks
9194 instead of jumping. The expansion is relative to a jump instruction.
9195 The default value is 8.
9196
9197 @item max-goto-duplication-insns
9198 The maximum number of instructions to duplicate to a block that jumps
9199 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
9200 passes, GCC factors computed gotos early in the compilation process,
9201 and unfactors them as late as possible. Only computed jumps at the
9202 end of a basic blocks with no more than max-goto-duplication-insns are
9203 unfactored. The default value is 8.
9204
9205 @item max-delay-slot-insn-search
9206 The maximum number of instructions to consider when looking for an
9207 instruction to fill a delay slot. If more than this arbitrary number of
9208 instructions are searched, the time savings from filling the delay slot
9209 are minimal, so stop searching. Increasing values mean more
9210 aggressive optimization, making the compilation time increase with probably
9211 small improvement in execution time.
9212
9213 @item max-delay-slot-live-search
9214 When trying to fill delay slots, the maximum number of instructions to
9215 consider when searching for a block with valid live register
9216 information. Increasing this arbitrarily chosen value means more
9217 aggressive optimization, increasing the compilation time. This parameter
9218 should be removed when the delay slot code is rewritten to maintain the
9219 control-flow graph.
9220
9221 @item max-gcse-memory
9222 The approximate maximum amount of memory that can be allocated in
9223 order to perform the global common subexpression elimination
9224 optimization. If more memory than specified is required, the
9225 optimization is not done.
9226
9227 @item max-gcse-insertion-ratio
9228 If the ratio of expression insertions to deletions is larger than this value
9229 for any expression, then RTL PRE inserts or removes the expression and thus
9230 leaves partially redundant computations in the instruction stream. The default value is 20.
9231
9232 @item max-pending-list-length
9233 The maximum number of pending dependencies scheduling allows
9234 before flushing the current state and starting over. Large functions
9235 with few branches or calls can create excessively large lists which
9236 needlessly consume memory and resources.
9237
9238 @item max-modulo-backtrack-attempts
9239 The maximum number of backtrack attempts the scheduler should make
9240 when modulo scheduling a loop. Larger values can exponentially increase
9241 compilation time.
9242
9243 @item max-inline-insns-single
9244 Several parameters control the tree inliner used in GCC@.
9245 This number sets the maximum number of instructions (counted in GCC's
9246 internal representation) in a single function that the tree inliner
9247 considers for inlining. This only affects functions declared
9248 inline and methods implemented in a class declaration (C++).
9249 The default value is 400.
9250
9251 @item max-inline-insns-auto
9252 When you use @option{-finline-functions} (included in @option{-O3}),
9253 a lot of functions that would otherwise not be considered for inlining
9254 by the compiler are investigated. To those functions, a different
9255 (more restrictive) limit compared to functions declared inline can
9256 be applied.
9257 The default value is 40.
9258
9259 @item inline-min-speedup
9260 When estimated performance improvement of caller + callee runtime exceeds this
9261 threshold (in precent), the function can be inlined regardless the limit on
9262 @option{--param max-inline-insns-single} and @option{--param
9263 max-inline-insns-auto}.
9264
9265 @item large-function-insns
9266 The limit specifying really large functions. For functions larger than this
9267 limit after inlining, inlining is constrained by
9268 @option{--param large-function-growth}. This parameter is useful primarily
9269 to avoid extreme compilation time caused by non-linear algorithms used by the
9270 back end.
9271 The default value is 2700.
9272
9273 @item large-function-growth
9274 Specifies maximal growth of large function caused by inlining in percents.
9275 The default value is 100 which limits large function growth to 2.0 times
9276 the original size.
9277
9278 @item large-unit-insns
9279 The limit specifying large translation unit. Growth caused by inlining of
9280 units larger than this limit is limited by @option{--param inline-unit-growth}.
9281 For small units this might be too tight.
9282 For example, consider a unit consisting of function A
9283 that is inline and B that just calls A three times. If B is small relative to
9284 A, the growth of unit is 300\% and yet such inlining is very sane. For very
9285 large units consisting of small inlineable functions, however, the overall unit
9286 growth limit is needed to avoid exponential explosion of code size. Thus for
9287 smaller units, the size is increased to @option{--param large-unit-insns}
9288 before applying @option{--param inline-unit-growth}. The default is 10000.
9289
9290 @item inline-unit-growth
9291 Specifies maximal overall growth of the compilation unit caused by inlining.
9292 The default value is 20 which limits unit growth to 1.2 times the original
9293 size. Cold functions (either marked cold via an attribute or by profile
9294 feedback) are not accounted into the unit size.
9295
9296 @item ipcp-unit-growth
9297 Specifies maximal overall growth of the compilation unit caused by
9298 interprocedural constant propagation. The default value is 10 which limits
9299 unit growth to 1.1 times the original size.
9300
9301 @item large-stack-frame
9302 The limit specifying large stack frames. While inlining the algorithm is trying
9303 to not grow past this limit too much. The default value is 256 bytes.
9304
9305 @item large-stack-frame-growth
9306 Specifies maximal growth of large stack frames caused by inlining in percents.
9307 The default value is 1000 which limits large stack frame growth to 11 times
9308 the original size.
9309
9310 @item max-inline-insns-recursive
9311 @itemx max-inline-insns-recursive-auto
9312 Specifies the maximum number of instructions an out-of-line copy of a
9313 self-recursive inline
9314 function can grow into by performing recursive inlining.
9315
9316 @option{--param max-inline-insns-recursive} applies to functions
9317 declared inline.
9318 For functions not declared inline, recursive inlining
9319 happens only when @option{-finline-functions} (included in @option{-O3}) is
9320 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
9321 default value is 450.
9322
9323 @item max-inline-recursive-depth
9324 @itemx max-inline-recursive-depth-auto
9325 Specifies the maximum recursion depth used for recursive inlining.
9326
9327 @option{--param max-inline-recursive-depth} applies to functions
9328 declared inline. For functions not declared inline, recursive inlining
9329 happens only when @option{-finline-functions} (included in @option{-O3}) is
9330 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
9331 default value is 8.
9332
9333 @item min-inline-recursive-probability
9334 Recursive inlining is profitable only for function having deep recursion
9335 in average and can hurt for function having little recursion depth by
9336 increasing the prologue size or complexity of function body to other
9337 optimizers.
9338
9339 When profile feedback is available (see @option{-fprofile-generate}) the actual
9340 recursion depth can be guessed from the probability that function recurses
9341 via a given call expression. This parameter limits inlining only to call
9342 expressions whose probability exceeds the given threshold (in percents).
9343 The default value is 10.
9344
9345 @item early-inlining-insns
9346 Specify growth that the early inliner can make. In effect it increases
9347 the amount of inlining for code having a large abstraction penalty.
9348 The default value is 14.
9349
9350 @item max-early-inliner-iterations
9351 Limit of iterations of the early inliner. This basically bounds
9352 the number of nested indirect calls the early inliner can resolve.
9353 Deeper chains are still handled by late inlining.
9354
9355 @item comdat-sharing-probability
9356 Probability (in percent) that C++ inline function with comdat visibility
9357 are shared across multiple compilation units. The default value is 20.
9358
9359 @item profile-func-internal-id
9360 A parameter to control whether to use function internal id in profile
9361 database lookup. If the value is 0, the compiler uses an id that
9362 is based on function assembler name and filename, which makes old profile
9363 data more tolerant to source changes such as function reordering etc.
9364 The default value is 0.
9365
9366 @item min-vect-loop-bound
9367 The minimum number of iterations under which loops are not vectorized
9368 when @option{-ftree-vectorize} is used. The number of iterations after
9369 vectorization needs to be greater than the value specified by this option
9370 to allow vectorization. The default value is 0.
9371
9372 @item gcse-cost-distance-ratio
9373 Scaling factor in calculation of maximum distance an expression
9374 can be moved by GCSE optimizations. This is currently supported only in the
9375 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9376 is with simple expressions, i.e., the expressions that have cost
9377 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9378 hoisting of simple expressions. The default value is 10.
9379
9380 @item gcse-unrestricted-cost
9381 Cost, roughly measured as the cost of a single typical machine
9382 instruction, at which GCSE optimizations do not constrain
9383 the distance an expression can travel. This is currently
9384 supported only in the code hoisting pass. The lesser the cost,
9385 the more aggressive code hoisting is. Specifying 0
9386 allows all expressions to travel unrestricted distances.
9387 The default value is 3.
9388
9389 @item max-hoist-depth
9390 The depth of search in the dominator tree for expressions to hoist.
9391 This is used to avoid quadratic behavior in hoisting algorithm.
9392 The value of 0 does not limit on the search, but may slow down compilation
9393 of huge functions. The default value is 30.
9394
9395 @item max-tail-merge-comparisons
9396 The maximum amount of similar bbs to compare a bb with. This is used to
9397 avoid quadratic behavior in tree tail merging. The default value is 10.
9398
9399 @item max-tail-merge-iterations
9400 The maximum amount of iterations of the pass over the function. This is used to
9401 limit compilation time in tree tail merging. The default value is 2.
9402
9403 @item max-unrolled-insns
9404 The maximum number of instructions that a loop may have to be unrolled.
9405 If a loop is unrolled, this parameter also determines how many times
9406 the loop code is unrolled.
9407
9408 @item max-average-unrolled-insns
9409 The maximum number of instructions biased by probabilities of their execution
9410 that a loop may have to be unrolled. If a loop is unrolled,
9411 this parameter also determines how many times the loop code is unrolled.
9412
9413 @item max-unroll-times
9414 The maximum number of unrollings of a single loop.
9415
9416 @item max-peeled-insns
9417 The maximum number of instructions that a loop may have to be peeled.
9418 If a loop is peeled, this parameter also determines how many times
9419 the loop code is peeled.
9420
9421 @item max-peel-times
9422 The maximum number of peelings of a single loop.
9423
9424 @item max-peel-branches
9425 The maximum number of branches on the hot path through the peeled sequence.
9426
9427 @item max-completely-peeled-insns
9428 The maximum number of insns of a completely peeled loop.
9429
9430 @item max-completely-peel-times
9431 The maximum number of iterations of a loop to be suitable for complete peeling.
9432
9433 @item max-completely-peel-loop-nest-depth
9434 The maximum depth of a loop nest suitable for complete peeling.
9435
9436 @item max-unswitch-insns
9437 The maximum number of insns of an unswitched loop.
9438
9439 @item max-unswitch-level
9440 The maximum number of branches unswitched in a single loop.
9441
9442 @item max-loop-headers-insns
9443 The maximum number of insns in loop header duplicated by he copy loop headers
9444 pass.
9445
9446 @item lim-expensive
9447 The minimum cost of an expensive expression in the loop invariant motion.
9448
9449 @item iv-consider-all-candidates-bound
9450 Bound on number of candidates for induction variables, below which
9451 all candidates are considered for each use in induction variable
9452 optimizations. If there are more candidates than this,
9453 only the most relevant ones are considered to avoid quadratic time complexity.
9454
9455 @item iv-max-considered-uses
9456 The induction variable optimizations give up on loops that contain more
9457 induction variable uses.
9458
9459 @item iv-always-prune-cand-set-bound
9460 If the number of candidates in the set is smaller than this value,
9461 always try to remove unnecessary ivs from the set
9462 when adding a new one.
9463
9464 @item avg-loop-niter
9465 Average number of iterations of a loop.
9466
9467 @item scev-max-expr-size
9468 Bound on size of expressions used in the scalar evolutions analyzer.
9469 Large expressions slow the analyzer.
9470
9471 @item scev-max-expr-complexity
9472 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9473 Complex expressions slow the analyzer.
9474
9475 @item max-tree-if-conversion-phi-args
9476 Maximum number of arguments in a PHI supported by TREE if conversion
9477 unless the loop is marked with simd pragma.
9478
9479 @item vect-max-version-for-alignment-checks
9480 The maximum number of run-time checks that can be performed when
9481 doing loop versioning for alignment in the vectorizer.
9482
9483 @item vect-max-version-for-alias-checks
9484 The maximum number of run-time checks that can be performed when
9485 doing loop versioning for alias in the vectorizer.
9486
9487 @item vect-max-peeling-for-alignment
9488 The maximum number of loop peels to enhance access alignment
9489 for vectorizer. Value -1 means no limit.
9490
9491 @item max-iterations-to-track
9492 The maximum number of iterations of a loop the brute-force algorithm
9493 for analysis of the number of iterations of the loop tries to evaluate.
9494
9495 @item hot-bb-count-ws-permille
9496 A basic block profile count is considered hot if it contributes to
9497 the given permillage (i.e. 0...1000) of the entire profiled execution.
9498
9499 @item hot-bb-frequency-fraction
9500 Select fraction of the entry block frequency of executions of basic block in
9501 function given basic block needs to have to be considered hot.
9502
9503 @item max-predicted-iterations
9504 The maximum number of loop iterations we predict statically. This is useful
9505 in cases where a function contains a single loop with known bound and
9506 another loop with unknown bound.
9507 The known number of iterations is predicted correctly, while
9508 the unknown number of iterations average to roughly 10. This means that the
9509 loop without bounds appears artificially cold relative to the other one.
9510
9511 @item builtin-expect-probability
9512 Control the probability of the expression having the specified value. This
9513 parameter takes a percentage (i.e. 0 ... 100) as input.
9514 The default probability of 90 is obtained empirically.
9515
9516 @item align-threshold
9517
9518 Select fraction of the maximal frequency of executions of a basic block in
9519 a function to align the basic block.
9520
9521 @item align-loop-iterations
9522
9523 A loop expected to iterate at least the selected number of iterations is
9524 aligned.
9525
9526 @item tracer-dynamic-coverage
9527 @itemx tracer-dynamic-coverage-feedback
9528
9529 This value is used to limit superblock formation once the given percentage of
9530 executed instructions is covered. This limits unnecessary code size
9531 expansion.
9532
9533 The @option{tracer-dynamic-coverage-feedback} parameter
9534 is used only when profile
9535 feedback is available. The real profiles (as opposed to statically estimated
9536 ones) are much less balanced allowing the threshold to be larger value.
9537
9538 @item tracer-max-code-growth
9539 Stop tail duplication once code growth has reached given percentage. This is
9540 a rather artificial limit, as most of the duplicates are eliminated later in
9541 cross jumping, so it may be set to much higher values than is the desired code
9542 growth.
9543
9544 @item tracer-min-branch-ratio
9545
9546 Stop reverse growth when the reverse probability of best edge is less than this
9547 threshold (in percent).
9548
9549 @item tracer-min-branch-probability
9550 @itemx tracer-min-branch-probability-feedback
9551
9552 Stop forward growth if the best edge has probability lower than this
9553 threshold.
9554
9555 Similarly to @option{tracer-dynamic-coverage} two parameters are
9556 provided. @option{tracer-min-branch-probability-feedback} is used for
9557 compilation with profile feedback and @option{tracer-min-branch-probability}
9558 compilation without. The value for compilation with profile feedback
9559 needs to be more conservative (higher) in order to make tracer
9560 effective.
9561
9562 @item max-cse-path-length
9563
9564 The maximum number of basic blocks on path that CSE considers.
9565 The default is 10.
9566
9567 @item max-cse-insns
9568 The maximum number of instructions CSE processes before flushing.
9569 The default is 1000.
9570
9571 @item ggc-min-expand
9572
9573 GCC uses a garbage collector to manage its own memory allocation. This
9574 parameter specifies the minimum percentage by which the garbage
9575 collector's heap should be allowed to expand between collections.
9576 Tuning this may improve compilation speed; it has no effect on code
9577 generation.
9578
9579 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9580 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9581 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9582 GCC is not able to calculate RAM on a particular platform, the lower
9583 bound of 30% is used. Setting this parameter and
9584 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9585 every opportunity. This is extremely slow, but can be useful for
9586 debugging.
9587
9588 @item ggc-min-heapsize
9589
9590 Minimum size of the garbage collector's heap before it begins bothering
9591 to collect garbage. The first collection occurs after the heap expands
9592 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9593 tuning this may improve compilation speed, and has no effect on code
9594 generation.
9595
9596 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9597 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9598 with a lower bound of 4096 (four megabytes) and an upper bound of
9599 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9600 particular platform, the lower bound is used. Setting this parameter
9601 very large effectively disables garbage collection. Setting this
9602 parameter and @option{ggc-min-expand} to zero causes a full collection
9603 to occur at every opportunity.
9604
9605 @item max-reload-search-insns
9606 The maximum number of instruction reload should look backward for equivalent
9607 register. Increasing values mean more aggressive optimization, making the
9608 compilation time increase with probably slightly better performance.
9609 The default value is 100.
9610
9611 @item max-cselib-memory-locations
9612 The maximum number of memory locations cselib should take into account.
9613 Increasing values mean more aggressive optimization, making the compilation time
9614 increase with probably slightly better performance. The default value is 500.
9615
9616 @item max-sched-ready-insns
9617 The maximum number of instructions ready to be issued the scheduler should
9618 consider at any given time during the first scheduling pass. Increasing
9619 values mean more thorough searches, making the compilation time increase
9620 with probably little benefit. The default value is 100.
9621
9622 @item max-sched-region-blocks
9623 The maximum number of blocks in a region to be considered for
9624 interblock scheduling. The default value is 10.
9625
9626 @item max-pipeline-region-blocks
9627 The maximum number of blocks in a region to be considered for
9628 pipelining in the selective scheduler. The default value is 15.
9629
9630 @item max-sched-region-insns
9631 The maximum number of insns in a region to be considered for
9632 interblock scheduling. The default value is 100.
9633
9634 @item max-pipeline-region-insns
9635 The maximum number of insns in a region to be considered for
9636 pipelining in the selective scheduler. The default value is 200.
9637
9638 @item min-spec-prob
9639 The minimum probability (in percents) of reaching a source block
9640 for interblock speculative scheduling. The default value is 40.
9641
9642 @item max-sched-extend-regions-iters
9643 The maximum number of iterations through CFG to extend regions.
9644 A value of 0 (the default) disables region extensions.
9645
9646 @item max-sched-insn-conflict-delay
9647 The maximum conflict delay for an insn to be considered for speculative motion.
9648 The default value is 3.
9649
9650 @item sched-spec-prob-cutoff
9651 The minimal probability of speculation success (in percents), so that
9652 speculative insns are scheduled.
9653 The default value is 40.
9654
9655 @item sched-state-edge-prob-cutoff
9656 The minimum probability an edge must have for the scheduler to save its
9657 state across it.
9658 The default value is 10.
9659
9660 @item sched-mem-true-dep-cost
9661 Minimal distance (in CPU cycles) between store and load targeting same
9662 memory locations. The default value is 1.
9663
9664 @item selsched-max-lookahead
9665 The maximum size of the lookahead window of selective scheduling. It is a
9666 depth of search for available instructions.
9667 The default value is 50.
9668
9669 @item selsched-max-sched-times
9670 The maximum number of times that an instruction is scheduled during
9671 selective scheduling. This is the limit on the number of iterations
9672 through which the instruction may be pipelined. The default value is 2.
9673
9674 @item selsched-insns-to-rename
9675 The maximum number of best instructions in the ready list that are considered
9676 for renaming in the selective scheduler. The default value is 2.
9677
9678 @item sms-min-sc
9679 The minimum value of stage count that swing modulo scheduler
9680 generates. The default value is 2.
9681
9682 @item max-last-value-rtl
9683 The maximum size measured as number of RTLs that can be recorded in an expression
9684 in combiner for a pseudo register as last known value of that register. The default
9685 is 10000.
9686
9687 @item max-combine-insns
9688 The maximum number of instructions the RTL combiner tries to combine.
9689 The default value is 2 at @option{-Og} and 4 otherwise.
9690
9691 @item integer-share-limit
9692 Small integer constants can use a shared data structure, reducing the
9693 compiler's memory usage and increasing its speed. This sets the maximum
9694 value of a shared integer constant. The default value is 256.
9695
9696 @item ssp-buffer-size
9697 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9698 protection when @option{-fstack-protection} is used.
9699
9700 @item min-size-for-stack-sharing
9701 The minimum size of variables taking part in stack slot sharing when not
9702 optimizing. The default value is 32.
9703
9704 @item max-jump-thread-duplication-stmts
9705 Maximum number of statements allowed in a block that needs to be
9706 duplicated when threading jumps.
9707
9708 @item max-fields-for-field-sensitive
9709 Maximum number of fields in a structure treated in
9710 a field sensitive manner during pointer analysis. The default is zero
9711 for @option{-O0} and @option{-O1},
9712 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9713
9714 @item prefetch-latency
9715 Estimate on average number of instructions that are executed before
9716 prefetch finishes. The distance prefetched ahead is proportional
9717 to this constant. Increasing this number may also lead to less
9718 streams being prefetched (see @option{simultaneous-prefetches}).
9719
9720 @item simultaneous-prefetches
9721 Maximum number of prefetches that can run at the same time.
9722
9723 @item l1-cache-line-size
9724 The size of cache line in L1 cache, in bytes.
9725
9726 @item l1-cache-size
9727 The size of L1 cache, in kilobytes.
9728
9729 @item l2-cache-size
9730 The size of L2 cache, in kilobytes.
9731
9732 @item min-insn-to-prefetch-ratio
9733 The minimum ratio between the number of instructions and the
9734 number of prefetches to enable prefetching in a loop.
9735
9736 @item prefetch-min-insn-to-mem-ratio
9737 The minimum ratio between the number of instructions and the
9738 number of memory references to enable prefetching in a loop.
9739
9740 @item use-canonical-types
9741 Whether the compiler should use the ``canonical'' type system. By
9742 default, this should always be 1, which uses a more efficient internal
9743 mechanism for comparing types in C++ and Objective-C++. However, if
9744 bugs in the canonical type system are causing compilation failures,
9745 set this value to 0 to disable canonical types.
9746
9747 @item switch-conversion-max-branch-ratio
9748 Switch initialization conversion refuses to create arrays that are
9749 bigger than @option{switch-conversion-max-branch-ratio} times the number of
9750 branches in the switch.
9751
9752 @item max-partial-antic-length
9753 Maximum length of the partial antic set computed during the tree
9754 partial redundancy elimination optimization (@option{-ftree-pre}) when
9755 optimizing at @option{-O3} and above. For some sorts of source code
9756 the enhanced partial redundancy elimination optimization can run away,
9757 consuming all of the memory available on the host machine. This
9758 parameter sets a limit on the length of the sets that are computed,
9759 which prevents the runaway behavior. Setting a value of 0 for
9760 this parameter allows an unlimited set length.
9761
9762 @item sccvn-max-scc-size
9763 Maximum size of a strongly connected component (SCC) during SCCVN
9764 processing. If this limit is hit, SCCVN processing for the whole
9765 function is not done and optimizations depending on it are
9766 disabled. The default maximum SCC size is 10000.
9767
9768 @item sccvn-max-alias-queries-per-access
9769 Maximum number of alias-oracle queries we perform when looking for
9770 redundancies for loads and stores. If this limit is hit the search
9771 is aborted and the load or store is not considered redundant. The
9772 number of queries is algorithmically limited to the number of
9773 stores on all paths from the load to the function entry.
9774 The default maximum number of queries is 1000.
9775
9776 @item ira-max-loops-num
9777 IRA uses regional register allocation by default. If a function
9778 contains more loops than the number given by this parameter, only at most
9779 the given number of the most frequently-executed loops form regions
9780 for regional register allocation. The default value of the
9781 parameter is 100.
9782
9783 @item ira-max-conflict-table-size
9784 Although IRA uses a sophisticated algorithm to compress the conflict
9785 table, the table can still require excessive amounts of memory for
9786 huge functions. If the conflict table for a function could be more
9787 than the size in MB given by this parameter, the register allocator
9788 instead uses a faster, simpler, and lower-quality
9789 algorithm that does not require building a pseudo-register conflict table.
9790 The default value of the parameter is 2000.
9791
9792 @item ira-loop-reserved-regs
9793 IRA can be used to evaluate more accurate register pressure in loops
9794 for decisions to move loop invariants (see @option{-O3}). The number
9795 of available registers reserved for some other purposes is given
9796 by this parameter. The default value of the parameter is 2, which is
9797 the minimal number of registers needed by typical instructions.
9798 This value is the best found from numerous experiments.
9799
9800 @item lra-inheritance-ebb-probability-cutoff
9801 LRA tries to reuse values reloaded in registers in subsequent insns.
9802 This optimization is called inheritance. EBB is used as a region to
9803 do this optimization. The parameter defines a minimal fall-through
9804 edge probability in percentage used to add BB to inheritance EBB in
9805 LRA. The default value of the parameter is 40. The value was chosen
9806 from numerous runs of SPEC2000 on x86-64.
9807
9808 @item loop-invariant-max-bbs-in-loop
9809 Loop invariant motion can be very expensive, both in compilation time and
9810 in amount of needed compile-time memory, with very large loops. Loops
9811 with more basic blocks than this parameter won't have loop invariant
9812 motion optimization performed on them. The default value of the
9813 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
9814
9815 @item loop-max-datarefs-for-datadeps
9816 Building data dependencies is expensive for very large loops. This
9817 parameter limits the number of data references in loops that are
9818 considered for data dependence analysis. These large loops are no
9819 handled by the optimizations using loop data dependencies.
9820 The default value is 1000.
9821
9822 @item max-vartrack-size
9823 Sets a maximum number of hash table slots to use during variable
9824 tracking dataflow analysis of any function. If this limit is exceeded
9825 with variable tracking at assignments enabled, analysis for that
9826 function is retried without it, after removing all debug insns from
9827 the function. If the limit is exceeded even without debug insns, var
9828 tracking analysis is completely disabled for the function. Setting
9829 the parameter to zero makes it unlimited.
9830
9831 @item max-vartrack-expr-depth
9832 Sets a maximum number of recursion levels when attempting to map
9833 variable names or debug temporaries to value expressions. This trades
9834 compilation time for more complete debug information. If this is set too
9835 low, value expressions that are available and could be represented in
9836 debug information may end up not being used; setting this higher may
9837 enable the compiler to find more complex debug expressions, but compile
9838 time and memory use may grow. The default is 12.
9839
9840 @item min-nondebug-insn-uid
9841 Use uids starting at this parameter for nondebug insns. The range below
9842 the parameter is reserved exclusively for debug insns created by
9843 @option{-fvar-tracking-assignments}, but debug insns may get
9844 (non-overlapping) uids above it if the reserved range is exhausted.
9845
9846 @item ipa-sra-ptr-growth-factor
9847 IPA-SRA replaces a pointer to an aggregate with one or more new
9848 parameters only when their cumulative size is less or equal to
9849 @option{ipa-sra-ptr-growth-factor} times the size of the original
9850 pointer parameter.
9851
9852 @item sra-max-scalarization-size-Ospeed
9853 @item sra-max-scalarization-size-Osize
9854 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
9855 replace scalar parts of aggregates with uses of independent scalar
9856 variables. These parameters control the maximum size, in storage units,
9857 of aggregate which is considered for replacement when compiling for
9858 speed
9859 (@option{sra-max-scalarization-size-Ospeed}) or size
9860 (@option{sra-max-scalarization-size-Osize}) respectively.
9861
9862 @item tm-max-aggregate-size
9863 When making copies of thread-local variables in a transaction, this
9864 parameter specifies the size in bytes after which variables are
9865 saved with the logging functions as opposed to save/restore code
9866 sequence pairs. This option only applies when using
9867 @option{-fgnu-tm}.
9868
9869 @item graphite-max-nb-scop-params
9870 To avoid exponential effects in the Graphite loop transforms, the
9871 number of parameters in a Static Control Part (SCoP) is bounded. The
9872 default value is 10 parameters. A variable whose value is unknown at
9873 compilation time and defined outside a SCoP is a parameter of the SCoP.
9874
9875 @item graphite-max-bbs-per-function
9876 To avoid exponential effects in the detection of SCoPs, the size of
9877 the functions analyzed by Graphite is bounded. The default value is
9878 100 basic blocks.
9879
9880 @item loop-block-tile-size
9881 Loop blocking or strip mining transforms, enabled with
9882 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
9883 loop in the loop nest by a given number of iterations. The strip
9884 length can be changed using the @option{loop-block-tile-size}
9885 parameter. The default value is 51 iterations.
9886
9887 @item loop-unroll-jam-size
9888 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
9889 default value is 4.
9890
9891 @item loop-unroll-jam-depth
9892 Specify the dimension to be unrolled (counting from the most inner loop)
9893 for the @option{-floop-unroll-and-jam}. The default value is 2.
9894
9895 @item ipa-cp-value-list-size
9896 IPA-CP attempts to track all possible values and types passed to a function's
9897 parameter in order to propagate them and perform devirtualization.
9898 @option{ipa-cp-value-list-size} is the maximum number of values and types it
9899 stores per one formal parameter of a function.
9900
9901 @item ipa-cp-eval-threshold
9902 IPA-CP calculates its own score of cloning profitability heuristics
9903 and performs those cloning opportunities with scores that exceed
9904 @option{ipa-cp-eval-threshold}.
9905
9906 @item ipa-cp-recursion-penalty
9907 Percentage penalty the recursive functions will receive when they
9908 are evaluated for cloning.
9909
9910 @item ipa-cp-single-call-penalty
9911 Percentage penalty functions containg a single call to another
9912 function will receive when they are evaluated for cloning.
9913
9914
9915 @item ipa-max-agg-items
9916 IPA-CP is also capable to propagate a number of scalar values passed
9917 in an aggregate. @option{ipa-max-agg-items} controls the maximum
9918 number of such values per one parameter.
9919
9920 @item ipa-cp-loop-hint-bonus
9921 When IPA-CP determines that a cloning candidate would make the number
9922 of iterations of a loop known, it adds a bonus of
9923 @option{ipa-cp-loop-hint-bonus} to the profitability score of
9924 the candidate.
9925
9926 @item ipa-cp-array-index-hint-bonus
9927 When IPA-CP determines that a cloning candidate would make the index of
9928 an array access known, it adds a bonus of
9929 @option{ipa-cp-array-index-hint-bonus} to the profitability
9930 score of the candidate.
9931
9932 @item ipa-max-aa-steps
9933 During its analysis of function bodies, IPA-CP employs alias analysis
9934 in order to track values pointed to by function parameters. In order
9935 not spend too much time analyzing huge functions, it gives up and
9936 consider all memory clobbered after examining
9937 @option{ipa-max-aa-steps} statements modifying memory.
9938
9939 @item lto-partitions
9940 Specify desired number of partitions produced during WHOPR compilation.
9941 The number of partitions should exceed the number of CPUs used for compilation.
9942 The default value is 32.
9943
9944 @item lto-min-partition
9945 Size of minimal partition for WHOPR (in estimated instructions).
9946 This prevents expenses of splitting very small programs into too many
9947 partitions.
9948
9949 @item lto-max-partition
9950 Size of max partition for WHOPR (in estimated instructions).
9951 to provide an upper bound for individual size of partition.
9952 Meant to be used only with balanced partitioning.
9953
9954 @item cxx-max-namespaces-for-diagnostic-help
9955 The maximum number of namespaces to consult for suggestions when C++
9956 name lookup fails for an identifier. The default is 1000.
9957
9958 @item sink-frequency-threshold
9959 The maximum relative execution frequency (in percents) of the target block
9960 relative to a statement's original block to allow statement sinking of a
9961 statement. Larger numbers result in more aggressive statement sinking.
9962 The default value is 75. A small positive adjustment is applied for
9963 statements with memory operands as those are even more profitable so sink.
9964
9965 @item max-stores-to-sink
9966 The maximum number of conditional store pairs that can be sunk. Set to 0
9967 if either vectorization (@option{-ftree-vectorize}) or if-conversion
9968 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
9969
9970 @item allow-store-data-races
9971 Allow optimizers to introduce new data races on stores.
9972 Set to 1 to allow, otherwise to 0. This option is enabled by default
9973 at optimization level @option{-Ofast}.
9974
9975 @item case-values-threshold
9976 The smallest number of different values for which it is best to use a
9977 jump-table instead of a tree of conditional branches. If the value is
9978 0, use the default for the machine. The default is 0.
9979
9980 @item tree-reassoc-width
9981 Set the maximum number of instructions executed in parallel in
9982 reassociated tree. This parameter overrides target dependent
9983 heuristics used by default if has non zero value.
9984
9985 @item sched-pressure-algorithm
9986 Choose between the two available implementations of
9987 @option{-fsched-pressure}. Algorithm 1 is the original implementation
9988 and is the more likely to prevent instructions from being reordered.
9989 Algorithm 2 was designed to be a compromise between the relatively
9990 conservative approach taken by algorithm 1 and the rather aggressive
9991 approach taken by the default scheduler. It relies more heavily on
9992 having a regular register file and accurate register pressure classes.
9993 See @file{haifa-sched.c} in the GCC sources for more details.
9994
9995 The default choice depends on the target.
9996
9997 @item max-slsr-cand-scan
9998 Set the maximum number of existing candidates that are considered when
9999 seeking a basis for a new straight-line strength reduction candidate.
10000
10001 @item asan-globals
10002 Enable buffer overflow detection for global objects. This kind
10003 of protection is enabled by default if you are using
10004 @option{-fsanitize=address} option.
10005 To disable global objects protection use @option{--param asan-globals=0}.
10006
10007 @item asan-stack
10008 Enable buffer overflow detection for stack objects. This kind of
10009 protection is enabled by default when using @option{-fsanitize=address}.
10010 To disable stack protection use @option{--param asan-stack=0} option.
10011
10012 @item asan-instrument-reads
10013 Enable buffer overflow detection for memory reads. This kind of
10014 protection is enabled by default when using @option{-fsanitize=address}.
10015 To disable memory reads protection use
10016 @option{--param asan-instrument-reads=0}.
10017
10018 @item asan-instrument-writes
10019 Enable buffer overflow detection for memory writes. This kind of
10020 protection is enabled by default when using @option{-fsanitize=address}.
10021 To disable memory writes protection use
10022 @option{--param asan-instrument-writes=0} option.
10023
10024 @item asan-memintrin
10025 Enable detection for built-in functions. This kind of protection
10026 is enabled by default when using @option{-fsanitize=address}.
10027 To disable built-in functions protection use
10028 @option{--param asan-memintrin=0}.
10029
10030 @item asan-use-after-return
10031 Enable detection of use-after-return. This kind of protection
10032 is enabled by default when using @option{-fsanitize=address} option.
10033 To disable use-after-return detection use
10034 @option{--param asan-use-after-return=0}.
10035
10036 @item asan-instrumentation-with-call-threshold
10037 If number of memory accesses in function being instrumented
10038 is greater or equal to this number, use callbacks instead of inline checks.
10039 E.g. to disable inline code use
10040 @option{--param asan-instrumentation-with-call-threshold=0}.
10041
10042 @item chkp-max-ctor-size
10043 Static constructors generated by Pointer Bounds Checker may become very
10044 large and significantly increase compile time at optimization level
10045 @option{-O1} and higher. This parameter is a maximum nubmer of statements
10046 in a single generated constructor. Default value is 5000.
10047
10048 @item max-fsm-thread-path-insns
10049 Maximum number of instructions to copy when duplicating blocks on a
10050 finite state automaton jump thread path. The default is 100.
10051
10052 @item max-fsm-thread-length
10053 Maximum number of basic blocks on a finite state automaton jump thread
10054 path. The default is 10.
10055
10056 @item max-fsm-thread-paths
10057 Maximum number of new jump thread paths to create for a finite state
10058 automaton. The default is 50.
10059
10060 @item parloops-chunk-size
10061 Chunk size of omp schedule for loops parallelized by parloops. The default
10062 is 0.
10063
10064 @item parloops-schedule
10065 Schedule type of omp schedule for loops parallelized by parloops (static,
10066 dynamic, guided, auto, runtime). The default is static.
10067
10068 @item max-ssa-name-query-depth
10069 Maximum depth of recursion when querying properties of SSA names in things
10070 like fold routines. One level of recursion corresponds to following a
10071 use-def chain.
10072
10073 @item hsa-gen-debug-stores
10074 Enable emission of special debug stores within HSA kernels which are
10075 then read and reported by libgomp plugin. Generation of these stores
10076 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
10077 enable it.
10078
10079 @item max-speculative-devirt-maydefs
10080 The maximum number of may-defs we analyze when looking for a must-def
10081 specifying the dynamic type of an object that invokes a virtual call
10082 we may be able to devirtualize speculatively.
10083
10084 @item max-vrp-switch-assertions
10085 The maximum number of assertions to add along the default edge of a switch
10086 statement during VRP. The default is 10.
10087 @end table
10088 @end table
10089
10090 @node Instrumentation Options
10091 @section Program Instrumentation Options
10092 @cindex instrumentation options
10093 @cindex program instrumentation options
10094 @cindex run-time error checking options
10095 @cindex profiling options
10096 @cindex options, program instrumentation
10097 @cindex options, run-time error checking
10098 @cindex options, profiling
10099
10100 GCC supports a number of command-line options that control adding
10101 run-time instrumentation to the code it normally generates.
10102 For example, one purpose of instrumentation is collect profiling
10103 statistics for use in finding program hot spots, code coverage
10104 analysis, or profile-guided optimizations.
10105 Another class of program instrumentation is adding run-time checking
10106 to detect programming errors like invalid pointer
10107 dereferences or out-of-bounds array accesses, as well as deliberately
10108 hostile attacks such as stack smashing or C++ vtable hijacking.
10109 There is also a general hook which can be used to implement other
10110 forms of tracing or function-level instrumentation for debug or
10111 program analysis purposes.
10112
10113 @table @gcctabopt
10114 @cindex @command{prof}
10115 @item -p
10116 @opindex p
10117 Generate extra code to write profile information suitable for the
10118 analysis program @command{prof}. You must use this option when compiling
10119 the source files you want data about, and you must also use it when
10120 linking.
10121
10122 @cindex @command{gprof}
10123 @item -pg
10124 @opindex pg
10125 Generate extra code to write profile information suitable for the
10126 analysis program @command{gprof}. You must use this option when compiling
10127 the source files you want data about, and you must also use it when
10128 linking.
10129
10130 @item -fprofile-arcs
10131 @opindex fprofile-arcs
10132 Add code so that program flow @dfn{arcs} are instrumented. During
10133 execution the program records how many times each branch and call is
10134 executed and how many times it is taken or returns. When the compiled
10135 program exits it saves this data to a file called
10136 @file{@var{auxname}.gcda} for each source file. The data may be used for
10137 profile-directed optimizations (@option{-fbranch-probabilities}), or for
10138 test coverage analysis (@option{-ftest-coverage}). Each object file's
10139 @var{auxname} is generated from the name of the output file, if
10140 explicitly specified and it is not the final executable, otherwise it is
10141 the basename of the source file. In both cases any suffix is removed
10142 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
10143 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
10144 @xref{Cross-profiling}.
10145
10146 @cindex @command{gcov}
10147 @item --coverage
10148 @opindex coverage
10149
10150 This option is used to compile and link code instrumented for coverage
10151 analysis. The option is a synonym for @option{-fprofile-arcs}
10152 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
10153 linking). See the documentation for those options for more details.
10154
10155 @itemize
10156
10157 @item
10158 Compile the source files with @option{-fprofile-arcs} plus optimization
10159 and code generation options. For test coverage analysis, use the
10160 additional @option{-ftest-coverage} option. You do not need to profile
10161 every source file in a program.
10162
10163 @item
10164 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
10165 (the latter implies the former).
10166
10167 @item
10168 Run the program on a representative workload to generate the arc profile
10169 information. This may be repeated any number of times. You can run
10170 concurrent instances of your program, and provided that the file system
10171 supports locking, the data files will be correctly updated. Also
10172 @code{fork} calls are detected and correctly handled (double counting
10173 will not happen).
10174
10175 @item
10176 For profile-directed optimizations, compile the source files again with
10177 the same optimization and code generation options plus
10178 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
10179 Control Optimization}).
10180
10181 @item
10182 For test coverage analysis, use @command{gcov} to produce human readable
10183 information from the @file{.gcno} and @file{.gcda} files. Refer to the
10184 @command{gcov} documentation for further information.
10185
10186 @end itemize
10187
10188 With @option{-fprofile-arcs}, for each function of your program GCC
10189 creates a program flow graph, then finds a spanning tree for the graph.
10190 Only arcs that are not on the spanning tree have to be instrumented: the
10191 compiler adds code to count the number of times that these arcs are
10192 executed. When an arc is the only exit or only entrance to a block, the
10193 instrumentation code can be added to the block; otherwise, a new basic
10194 block must be created to hold the instrumentation code.
10195
10196 @need 2000
10197 @item -ftest-coverage
10198 @opindex ftest-coverage
10199 Produce a notes file that the @command{gcov} code-coverage utility
10200 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
10201 show program coverage. Each source file's note file is called
10202 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
10203 above for a description of @var{auxname} and instructions on how to
10204 generate test coverage data. Coverage data matches the source files
10205 more closely if you do not optimize.
10206
10207 @item -fprofile-dir=@var{path}
10208 @opindex fprofile-dir
10209
10210 Set the directory to search for the profile data files in to @var{path}.
10211 This option affects only the profile data generated by
10212 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
10213 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
10214 and its related options. Both absolute and relative paths can be used.
10215 By default, GCC uses the current directory as @var{path}, thus the
10216 profile data file appears in the same directory as the object file.
10217
10218 @item -fprofile-generate
10219 @itemx -fprofile-generate=@var{path}
10220 @opindex fprofile-generate
10221
10222 Enable options usually used for instrumenting application to produce
10223 profile useful for later recompilation with profile feedback based
10224 optimization. You must use @option{-fprofile-generate} both when
10225 compiling and when linking your program.
10226
10227 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
10228
10229 If @var{path} is specified, GCC looks at the @var{path} to find
10230 the profile feedback data files. See @option{-fprofile-dir}.
10231
10232 To optimize the program based on the collected profile information, use
10233 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
10234
10235 @item -fprofile-update=@var{method}
10236 @opindex fprofile-update
10237
10238 Alter the update method for an application instrumented for profile
10239 feedback based optimization. The @var{method} argument should be one of
10240 @samp{single} or @samp{atomic}. The first one is useful for single-threaded
10241 applications, while the second one prevents profile corruption by emitting
10242 thread-safe code.
10243
10244 @strong{Warning:} When an application does not properly join all threads
10245 (or creates an detached thread), a profile file can be still corrupted.
10246
10247 @item -fsanitize=address
10248 @opindex fsanitize=address
10249 Enable AddressSanitizer, a fast memory error detector.
10250 Memory access instructions are instrumented to detect
10251 out-of-bounds and use-after-free bugs.
10252 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
10253 more details. The run-time behavior can be influenced using the
10254 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
10255 the available options are shown at startup of the instrumented program. See
10256 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
10257 for a list of supported options.
10258
10259 @item -fsanitize=kernel-address
10260 @opindex fsanitize=kernel-address
10261 Enable AddressSanitizer for Linux kernel.
10262 See @uref{https://github.com/google/kasan/wiki} for more details.
10263
10264 @item -fsanitize=thread
10265 @opindex fsanitize=thread
10266 Enable ThreadSanitizer, a fast data race detector.
10267 Memory access instructions are instrumented to detect
10268 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
10269 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
10270 environment variable; see
10271 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
10272 supported options.
10273
10274 @item -fsanitize=leak
10275 @opindex fsanitize=leak
10276 Enable LeakSanitizer, a memory leak detector.
10277 This option only matters for linking of executables and if neither
10278 @option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that
10279 case the executable is linked against a library that overrides @code{malloc}
10280 and other allocator functions. See
10281 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
10282 details. The run-time behavior can be influenced using the
10283 @env{LSAN_OPTIONS} environment variable.
10284
10285 @item -fsanitize=undefined
10286 @opindex fsanitize=undefined
10287 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
10288 Various computations are instrumented to detect undefined behavior
10289 at runtime. Current suboptions are:
10290
10291 @table @gcctabopt
10292
10293 @item -fsanitize=shift
10294 @opindex fsanitize=shift
10295 This option enables checking that the result of a shift operation is
10296 not undefined. Note that what exactly is considered undefined differs
10297 slightly between C and C++, as well as between ISO C90 and C99, etc.
10298
10299 @item -fsanitize=integer-divide-by-zero
10300 @opindex fsanitize=integer-divide-by-zero
10301 Detect integer division by zero as well as @code{INT_MIN / -1} division.
10302
10303 @item -fsanitize=unreachable
10304 @opindex fsanitize=unreachable
10305 With this option, the compiler turns the @code{__builtin_unreachable}
10306 call into a diagnostics message call instead. When reaching the
10307 @code{__builtin_unreachable} call, the behavior is undefined.
10308
10309 @item -fsanitize=vla-bound
10310 @opindex fsanitize=vla-bound
10311 This option instructs the compiler to check that the size of a variable
10312 length array is positive.
10313
10314 @item -fsanitize=null
10315 @opindex fsanitize=null
10316 This option enables pointer checking. Particularly, the application
10317 built with this option turned on will issue an error message when it
10318 tries to dereference a NULL pointer, or if a reference (possibly an
10319 rvalue reference) is bound to a NULL pointer, or if a method is invoked
10320 on an object pointed by a NULL pointer.
10321
10322 @item -fsanitize=return
10323 @opindex fsanitize=return
10324 This option enables return statement checking. Programs
10325 built with this option turned on will issue an error message
10326 when the end of a non-void function is reached without actually
10327 returning a value. This option works in C++ only.
10328
10329 @item -fsanitize=signed-integer-overflow
10330 @opindex fsanitize=signed-integer-overflow
10331 This option enables signed integer overflow checking. We check that
10332 the result of @code{+}, @code{*}, and both unary and binary @code{-}
10333 does not overflow in the signed arithmetics. Note, integer promotion
10334 rules must be taken into account. That is, the following is not an
10335 overflow:
10336 @smallexample
10337 signed char a = SCHAR_MAX;
10338 a++;
10339 @end smallexample
10340
10341 @item -fsanitize=bounds
10342 @opindex fsanitize=bounds
10343 This option enables instrumentation of array bounds. Various out of bounds
10344 accesses are detected. Flexible array members, flexible array member-like
10345 arrays, and initializers of variables with static storage are not instrumented.
10346
10347 @item -fsanitize=bounds-strict
10348 @opindex fsanitize=bounds-strict
10349 This option enables strict instrumentation of array bounds. Most out of bounds
10350 accesses are detected, including flexible array members and flexible array
10351 member-like arrays. Initializers of variables with static storage are not
10352 instrumented.
10353
10354 @item -fsanitize=alignment
10355 @opindex fsanitize=alignment
10356
10357 This option enables checking of alignment of pointers when they are
10358 dereferenced, or when a reference is bound to insufficiently aligned target,
10359 or when a method or constructor is invoked on insufficiently aligned object.
10360
10361 @item -fsanitize=object-size
10362 @opindex fsanitize=object-size
10363 This option enables instrumentation of memory references using the
10364 @code{__builtin_object_size} function. Various out of bounds pointer
10365 accesses are detected.
10366
10367 @item -fsanitize=float-divide-by-zero
10368 @opindex fsanitize=float-divide-by-zero
10369 Detect floating-point division by zero. Unlike other similar options,
10370 @option{-fsanitize=float-divide-by-zero} is not enabled by
10371 @option{-fsanitize=undefined}, since floating-point division by zero can
10372 be a legitimate way of obtaining infinities and NaNs.
10373
10374 @item -fsanitize=float-cast-overflow
10375 @opindex fsanitize=float-cast-overflow
10376 This option enables floating-point type to integer conversion checking.
10377 We check that the result of the conversion does not overflow.
10378 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
10379 not enabled by @option{-fsanitize=undefined}.
10380 This option does not work well with @code{FE_INVALID} exceptions enabled.
10381
10382 @item -fsanitize=nonnull-attribute
10383 @opindex fsanitize=nonnull-attribute
10384
10385 This option enables instrumentation of calls, checking whether null values
10386 are not passed to arguments marked as requiring a non-null value by the
10387 @code{nonnull} function attribute.
10388
10389 @item -fsanitize=returns-nonnull-attribute
10390 @opindex fsanitize=returns-nonnull-attribute
10391
10392 This option enables instrumentation of return statements in functions
10393 marked with @code{returns_nonnull} function attribute, to detect returning
10394 of null values from such functions.
10395
10396 @item -fsanitize=bool
10397 @opindex fsanitize=bool
10398
10399 This option enables instrumentation of loads from bool. If a value other
10400 than 0/1 is loaded, a run-time error is issued.
10401
10402 @item -fsanitize=enum
10403 @opindex fsanitize=enum
10404
10405 This option enables instrumentation of loads from an enum type. If
10406 a value outside the range of values for the enum type is loaded,
10407 a run-time error is issued.
10408
10409 @item -fsanitize=vptr
10410 @opindex fsanitize=vptr
10411
10412 This option enables instrumentation of C++ member function calls, member
10413 accesses and some conversions between pointers to base and derived classes,
10414 to verify the referenced object has the correct dynamic type.
10415
10416 @end table
10417
10418 While @option{-ftrapv} causes traps for signed overflows to be emitted,
10419 @option{-fsanitize=undefined} gives a diagnostic message.
10420 This currently works only for the C family of languages.
10421
10422 @item -fno-sanitize=all
10423 @opindex fno-sanitize=all
10424
10425 This option disables all previously enabled sanitizers.
10426 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
10427 together.
10428
10429 @item -fasan-shadow-offset=@var{number}
10430 @opindex fasan-shadow-offset
10431 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
10432 It is useful for experimenting with different shadow memory layouts in
10433 Kernel AddressSanitizer.
10434
10435 @item -fsanitize-sections=@var{s1},@var{s2},...
10436 @opindex fsanitize-sections
10437 Sanitize global variables in selected user-defined sections. @var{si} may
10438 contain wildcards.
10439
10440 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
10441 @opindex fsanitize-recover
10442 @opindex fno-sanitize-recover
10443 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
10444 mentioned in comma-separated list of @var{opts}. Enabling this option
10445 for a sanitizer component causes it to attempt to continue
10446 running the program as if no error happened. This means multiple
10447 runtime errors can be reported in a single program run, and the exit
10448 code of the program may indicate success even when errors
10449 have been reported. The @option{-fno-sanitize-recover=} option
10450 can be used to alter
10451 this behavior: only the first detected error is reported
10452 and program then exits with a non-zero exit code.
10453
10454 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
10455 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
10456 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
10457 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
10458 For these sanitizers error recovery is turned on by default, except @option{-fsanitize=address},
10459 for which this feature is experimental.
10460 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
10461 accepted, the former enables recovery for all sanitizers that support it,
10462 the latter disables recovery for all sanitizers that support it.
10463
10464 Even if a recovery mode is turned on the compiler side, it needs to be also
10465 enabled on the runtime library side, otherwise the failures are still fatal.
10466 The runtime library defaults to @code{halt_on_error=0} for
10467 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
10468 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
10469 setting the @code{halt_on_error} flag in the corresponding environment variable.
10470
10471 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
10472 @smallexample
10473 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10474 @end smallexample
10475 @noindent
10476 Similarly @option{-fno-sanitize-recover} is equivalent to
10477 @smallexample
10478 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10479 @end smallexample
10480
10481 @item -fsanitize-undefined-trap-on-error
10482 @opindex fsanitize-undefined-trap-on-error
10483 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
10484 report undefined behavior using @code{__builtin_trap} rather than
10485 a @code{libubsan} library routine. The advantage of this is that the
10486 @code{libubsan} library is not needed and is not linked in, so this
10487 is usable even in freestanding environments.
10488
10489 @item -fsanitize-coverage=trace-pc
10490 @opindex fsanitize-coverage=trace-pc
10491 Enable coverage-guided fuzzing code instrumentation.
10492 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
10493
10494 @item -fbounds-check
10495 @opindex fbounds-check
10496 For front ends that support it, generate additional code to check that
10497 indices used to access arrays are within the declared range. This is
10498 currently only supported by the Java and Fortran front ends, where
10499 this option defaults to true and false respectively.
10500
10501 @item -fcheck-pointer-bounds
10502 @opindex fcheck-pointer-bounds
10503 @opindex fno-check-pointer-bounds
10504 @cindex Pointer Bounds Checker options
10505 Enable Pointer Bounds Checker instrumentation. Each memory reference
10506 is instrumented with checks of the pointer used for memory access against
10507 bounds associated with that pointer.
10508
10509 Currently there
10510 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
10511 and @option{-mmpx} are required to enable this feature.
10512 MPX-based instrumentation requires
10513 a runtime library to enable MPX in hardware and handle bounds
10514 violation signals. By default when @option{-fcheck-pointer-bounds}
10515 and @option{-mmpx} options are used to link a program, the GCC driver
10516 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
10517 Bounds checking on calls to dynamic libraries requires a linker
10518 with @option{-z bndplt} support; if GCC was configured with a linker
10519 without support for this option (including the Gold linker and older
10520 versions of ld), a warning is given if you link with @option{-mmpx}
10521 without also specifying @option{-static}, since the overall effectiveness
10522 of the bounds checking protection is reduced.
10523 See also @option{-static-libmpxwrappers}.
10524
10525 MPX-based instrumentation
10526 may be used for debugging and also may be included in production code
10527 to increase program security. Depending on usage, you may
10528 have different requirements for the runtime library. The current version
10529 of the MPX runtime library is more oriented for use as a debugging
10530 tool. MPX runtime library usage implies @option{-lpthread}. See
10531 also @option{-static-libmpx}. The runtime library behavior can be
10532 influenced using various @env{CHKP_RT_*} environment variables. See
10533 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
10534 for more details.
10535
10536 Generated instrumentation may be controlled by various
10537 @option{-fchkp-*} options and by the @code{bnd_variable_size}
10538 structure field attribute (@pxref{Type Attributes}) and
10539 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
10540 (@pxref{Function Attributes}). GCC also provides a number of built-in
10541 functions for controlling the Pointer Bounds Checker. @xref{Pointer
10542 Bounds Checker builtins}, for more information.
10543
10544 @item -fchkp-check-incomplete-type
10545 @opindex fchkp-check-incomplete-type
10546 @opindex fno-chkp-check-incomplete-type
10547 Generate pointer bounds checks for variables with incomplete type.
10548 Enabled by default.
10549
10550 @item -fchkp-narrow-bounds
10551 @opindex fchkp-narrow-bounds
10552 @opindex fno-chkp-narrow-bounds
10553 Controls bounds used by Pointer Bounds Checker for pointers to object
10554 fields. If narrowing is enabled then field bounds are used. Otherwise
10555 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
10556 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
10557
10558 @item -fchkp-first-field-has-own-bounds
10559 @opindex fchkp-first-field-has-own-bounds
10560 @opindex fno-chkp-first-field-has-own-bounds
10561 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
10562 first field in the structure. By default a pointer to the first field has
10563 the same bounds as a pointer to the whole structure.
10564
10565 @item -fchkp-narrow-to-innermost-array
10566 @opindex fchkp-narrow-to-innermost-array
10567 @opindex fno-chkp-narrow-to-innermost-array
10568 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
10569 case of nested static array access. By default this option is disabled and
10570 bounds of the outermost array are used.
10571
10572 @item -fchkp-optimize
10573 @opindex fchkp-optimize
10574 @opindex fno-chkp-optimize
10575 Enables Pointer Bounds Checker optimizations. Enabled by default at
10576 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
10577
10578 @item -fchkp-use-fast-string-functions
10579 @opindex fchkp-use-fast-string-functions
10580 @opindex fno-chkp-use-fast-string-functions
10581 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
10582 by Pointer Bounds Checker. Disabled by default.
10583
10584 @item -fchkp-use-nochk-string-functions
10585 @opindex fchkp-use-nochk-string-functions
10586 @opindex fno-chkp-use-nochk-string-functions
10587 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
10588 by Pointer Bounds Checker. Disabled by default.
10589
10590 @item -fchkp-use-static-bounds
10591 @opindex fchkp-use-static-bounds
10592 @opindex fno-chkp-use-static-bounds
10593 Allow Pointer Bounds Checker to generate static bounds holding
10594 bounds of static variables. Enabled by default.
10595
10596 @item -fchkp-use-static-const-bounds
10597 @opindex fchkp-use-static-const-bounds
10598 @opindex fno-chkp-use-static-const-bounds
10599 Use statically-initialized bounds for constant bounds instead of
10600 generating them each time they are required. By default enabled when
10601 @option{-fchkp-use-static-bounds} is enabled.
10602
10603 @item -fchkp-treat-zero-dynamic-size-as-infinite
10604 @opindex fchkp-treat-zero-dynamic-size-as-infinite
10605 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
10606 With this option, objects with incomplete type whose
10607 dynamically-obtained size is zero are treated as having infinite size
10608 instead by Pointer Bounds
10609 Checker. This option may be helpful if a program is linked with a library
10610 missing size information for some symbols. Disabled by default.
10611
10612 @item -fchkp-check-read
10613 @opindex fchkp-check-read
10614 @opindex fno-chkp-check-read
10615 Instructs Pointer Bounds Checker to generate checks for all read
10616 accesses to memory. Enabled by default.
10617
10618 @item -fchkp-check-write
10619 @opindex fchkp-check-write
10620 @opindex fno-chkp-check-write
10621 Instructs Pointer Bounds Checker to generate checks for all write
10622 accesses to memory. Enabled by default.
10623
10624 @item -fchkp-store-bounds
10625 @opindex fchkp-store-bounds
10626 @opindex fno-chkp-store-bounds
10627 Instructs Pointer Bounds Checker to generate bounds stores for
10628 pointer writes. Enabled by default.
10629
10630 @item -fchkp-instrument-calls
10631 @opindex fchkp-instrument-calls
10632 @opindex fno-chkp-instrument-calls
10633 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
10634 Enabled by default.
10635
10636 @item -fchkp-instrument-marked-only
10637 @opindex fchkp-instrument-marked-only
10638 @opindex fno-chkp-instrument-marked-only
10639 Instructs Pointer Bounds Checker to instrument only functions
10640 marked with the @code{bnd_instrument} attribute
10641 (@pxref{Function Attributes}). Disabled by default.
10642
10643 @item -fchkp-use-wrappers
10644 @opindex fchkp-use-wrappers
10645 @opindex fno-chkp-use-wrappers
10646 Allows Pointer Bounds Checker to replace calls to built-in functions
10647 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
10648 is used to link a program, the GCC driver automatically links
10649 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
10650 Enabled by default.
10651
10652 @item -fstack-protector
10653 @opindex fstack-protector
10654 Emit extra code to check for buffer overflows, such as stack smashing
10655 attacks. This is done by adding a guard variable to functions with
10656 vulnerable objects. This includes functions that call @code{alloca}, and
10657 functions with buffers larger than 8 bytes. The guards are initialized
10658 when a function is entered and then checked when the function exits.
10659 If a guard check fails, an error message is printed and the program exits.
10660
10661 @item -fstack-protector-all
10662 @opindex fstack-protector-all
10663 Like @option{-fstack-protector} except that all functions are protected.
10664
10665 @item -fstack-protector-strong
10666 @opindex fstack-protector-strong
10667 Like @option{-fstack-protector} but includes additional functions to
10668 be protected --- those that have local array definitions, or have
10669 references to local frame addresses.
10670
10671 @item -fstack-protector-explicit
10672 @opindex fstack-protector-explicit
10673 Like @option{-fstack-protector} but only protects those functions which
10674 have the @code{stack_protect} attribute.
10675
10676 @item -fstack-check
10677 @opindex fstack-check
10678 Generate code to verify that you do not go beyond the boundary of the
10679 stack. You should specify this flag if you are running in an
10680 environment with multiple threads, but you only rarely need to specify it in
10681 a single-threaded environment since stack overflow is automatically
10682 detected on nearly all systems if there is only one stack.
10683
10684 Note that this switch does not actually cause checking to be done; the
10685 operating system or the language runtime must do that. The switch causes
10686 generation of code to ensure that they see the stack being extended.
10687
10688 You can additionally specify a string parameter: @samp{no} means no
10689 checking, @samp{generic} means force the use of old-style checking,
10690 @samp{specific} means use the best checking method and is equivalent
10691 to bare @option{-fstack-check}.
10692
10693 Old-style checking is a generic mechanism that requires no specific
10694 target support in the compiler but comes with the following drawbacks:
10695
10696 @enumerate
10697 @item
10698 Modified allocation strategy for large objects: they are always
10699 allocated dynamically if their size exceeds a fixed threshold.
10700
10701 @item
10702 Fixed limit on the size of the static frame of functions: when it is
10703 topped by a particular function, stack checking is not reliable and
10704 a warning is issued by the compiler.
10705
10706 @item
10707 Inefficiency: because of both the modified allocation strategy and the
10708 generic implementation, code performance is hampered.
10709 @end enumerate
10710
10711 Note that old-style stack checking is also the fallback method for
10712 @samp{specific} if no target support has been added in the compiler.
10713
10714 @item -fstack-limit-register=@var{reg}
10715 @itemx -fstack-limit-symbol=@var{sym}
10716 @itemx -fno-stack-limit
10717 @opindex fstack-limit-register
10718 @opindex fstack-limit-symbol
10719 @opindex fno-stack-limit
10720 Generate code to ensure that the stack does not grow beyond a certain value,
10721 either the value of a register or the address of a symbol. If a larger
10722 stack is required, a signal is raised at run time. For most targets,
10723 the signal is raised before the stack overruns the boundary, so
10724 it is possible to catch the signal without taking special precautions.
10725
10726 For instance, if the stack starts at absolute address @samp{0x80000000}
10727 and grows downwards, you can use the flags
10728 @option{-fstack-limit-symbol=__stack_limit} and
10729 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10730 of 128KB@. Note that this may only work with the GNU linker.
10731
10732 You can locally override stack limit checking by using the
10733 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
10734
10735 @item -fsplit-stack
10736 @opindex fsplit-stack
10737 Generate code to automatically split the stack before it overflows.
10738 The resulting program has a discontiguous stack which can only
10739 overflow if the program is unable to allocate any more memory. This
10740 is most useful when running threaded programs, as it is no longer
10741 necessary to calculate a good stack size to use for each thread. This
10742 is currently only implemented for the x86 targets running
10743 GNU/Linux.
10744
10745 When code compiled with @option{-fsplit-stack} calls code compiled
10746 without @option{-fsplit-stack}, there may not be much stack space
10747 available for the latter code to run. If compiling all code,
10748 including library code, with @option{-fsplit-stack} is not an option,
10749 then the linker can fix up these calls so that the code compiled
10750 without @option{-fsplit-stack} always has a large stack. Support for
10751 this is implemented in the gold linker in GNU binutils release 2.21
10752 and later.
10753
10754 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
10755 @opindex fvtable-verify
10756 This option is only available when compiling C++ code.
10757 It turns on (or off, if using @option{-fvtable-verify=none}) the security
10758 feature that verifies at run time, for every virtual call, that
10759 the vtable pointer through which the call is made is valid for the type of
10760 the object, and has not been corrupted or overwritten. If an invalid vtable
10761 pointer is detected at run time, an error is reported and execution of the
10762 program is immediately halted.
10763
10764 This option causes run-time data structures to be built at program startup,
10765 which are used for verifying the vtable pointers.
10766 The options @samp{std} and @samp{preinit}
10767 control the timing of when these data structures are built. In both cases the
10768 data structures are built before execution reaches @code{main}. Using
10769 @option{-fvtable-verify=std} causes the data structures to be built after
10770 shared libraries have been loaded and initialized.
10771 @option{-fvtable-verify=preinit} causes them to be built before shared
10772 libraries have been loaded and initialized.
10773
10774 If this option appears multiple times in the command line with different
10775 values specified, @samp{none} takes highest priority over both @samp{std} and
10776 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
10777
10778 @item -fvtv-debug
10779 @opindex fvtv-debug
10780 When used in conjunction with @option{-fvtable-verify=std} or
10781 @option{-fvtable-verify=preinit}, causes debug versions of the
10782 runtime functions for the vtable verification feature to be called.
10783 This flag also causes the compiler to log information about which
10784 vtable pointers it finds for each class.
10785 This information is written to a file named @file{vtv_set_ptr_data.log}
10786 in the directory named by the environment variable @env{VTV_LOGS_DIR}
10787 if that is defined or the current working directory otherwise.
10788
10789 Note: This feature @emph{appends} data to the log file. If you want a fresh log
10790 file, be sure to delete any existing one.
10791
10792 @item -fvtv-counts
10793 @opindex fvtv-counts
10794 This is a debugging flag. When used in conjunction with
10795 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
10796 causes the compiler to keep track of the total number of virtual calls
10797 it encounters and the number of verifications it inserts. It also
10798 counts the number of calls to certain run-time library functions
10799 that it inserts and logs this information for each compilation unit.
10800 The compiler writes this information to a file named
10801 @file{vtv_count_data.log} in the directory named by the environment
10802 variable @env{VTV_LOGS_DIR} if that is defined or the current working
10803 directory otherwise. It also counts the size of the vtable pointer sets
10804 for each class, and writes this information to @file{vtv_class_set_sizes.log}
10805 in the same directory.
10806
10807 Note: This feature @emph{appends} data to the log files. To get fresh log
10808 files, be sure to delete any existing ones.
10809
10810 @item -finstrument-functions
10811 @opindex finstrument-functions
10812 Generate instrumentation calls for entry and exit to functions. Just
10813 after function entry and just before function exit, the following
10814 profiling functions are called with the address of the current
10815 function and its call site. (On some platforms,
10816 @code{__builtin_return_address} does not work beyond the current
10817 function, so the call site information may not be available to the
10818 profiling functions otherwise.)
10819
10820 @smallexample
10821 void __cyg_profile_func_enter (void *this_fn,
10822 void *call_site);
10823 void __cyg_profile_func_exit (void *this_fn,
10824 void *call_site);
10825 @end smallexample
10826
10827 The first argument is the address of the start of the current function,
10828 which may be looked up exactly in the symbol table.
10829
10830 This instrumentation is also done for functions expanded inline in other
10831 functions. The profiling calls indicate where, conceptually, the
10832 inline function is entered and exited. This means that addressable
10833 versions of such functions must be available. If all your uses of a
10834 function are expanded inline, this may mean an additional expansion of
10835 code size. If you use @code{extern inline} in your C code, an
10836 addressable version of such functions must be provided. (This is
10837 normally the case anyway, but if you get lucky and the optimizer always
10838 expands the functions inline, you might have gotten away without
10839 providing static copies.)
10840
10841 A function may be given the attribute @code{no_instrument_function}, in
10842 which case this instrumentation is not done. This can be used, for
10843 example, for the profiling functions listed above, high-priority
10844 interrupt routines, and any functions from which the profiling functions
10845 cannot safely be called (perhaps signal handlers, if the profiling
10846 routines generate output or allocate memory).
10847
10848 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
10849 @opindex finstrument-functions-exclude-file-list
10850
10851 Set the list of functions that are excluded from instrumentation (see
10852 the description of @option{-finstrument-functions}). If the file that
10853 contains a function definition matches with one of @var{file}, then
10854 that function is not instrumented. The match is done on substrings:
10855 if the @var{file} parameter is a substring of the file name, it is
10856 considered to be a match.
10857
10858 For example:
10859
10860 @smallexample
10861 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
10862 @end smallexample
10863
10864 @noindent
10865 excludes any inline function defined in files whose pathnames
10866 contain @file{/bits/stl} or @file{include/sys}.
10867
10868 If, for some reason, you want to include letter @samp{,} in one of
10869 @var{sym}, write @samp{\,}. For example,
10870 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
10871 (note the single quote surrounding the option).
10872
10873 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
10874 @opindex finstrument-functions-exclude-function-list
10875
10876 This is similar to @option{-finstrument-functions-exclude-file-list},
10877 but this option sets the list of function names to be excluded from
10878 instrumentation. The function name to be matched is its user-visible
10879 name, such as @code{vector<int> blah(const vector<int> &)}, not the
10880 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
10881 match is done on substrings: if the @var{sym} parameter is a substring
10882 of the function name, it is considered to be a match. For C99 and C++
10883 extended identifiers, the function name must be given in UTF-8, not
10884 using universal character names.
10885
10886 @end table
10887
10888
10889 @node Preprocessor Options
10890 @section Options Controlling the Preprocessor
10891 @cindex preprocessor options
10892 @cindex options, preprocessor
10893
10894 These options control the C preprocessor, which is run on each C source
10895 file before actual compilation.
10896
10897 If you use the @option{-E} option, nothing is done except preprocessing.
10898 Some of these options make sense only together with @option{-E} because
10899 they cause the preprocessor output to be unsuitable for actual
10900 compilation.
10901
10902 @table @gcctabopt
10903 @item -Wp,@var{option}
10904 @opindex Wp
10905 You can use @option{-Wp,@var{option}} to bypass the compiler driver
10906 and pass @var{option} directly through to the preprocessor. If
10907 @var{option} contains commas, it is split into multiple options at the
10908 commas. However, many options are modified, translated or interpreted
10909 by the compiler driver before being passed to the preprocessor, and
10910 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
10911 interface is undocumented and subject to change, so whenever possible
10912 you should avoid using @option{-Wp} and let the driver handle the
10913 options instead.
10914
10915 @item -Xpreprocessor @var{option}
10916 @opindex Xpreprocessor
10917 Pass @var{option} as an option to the preprocessor. You can use this to
10918 supply system-specific preprocessor options that GCC does not
10919 recognize.
10920
10921 If you want to pass an option that takes an argument, you must use
10922 @option{-Xpreprocessor} twice, once for the option and once for the argument.
10923
10924 @item -no-integrated-cpp
10925 @opindex no-integrated-cpp
10926 Perform preprocessing as a separate pass before compilation.
10927 By default, GCC performs preprocessing as an integrated part of
10928 input tokenization and parsing.
10929 If this option is provided, the appropriate language front end
10930 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
10931 and Objective-C, respectively) is instead invoked twice,
10932 once for preprocessing only and once for actual compilation
10933 of the preprocessed input.
10934 This option may be useful in conjunction with the @option{-B} or
10935 @option{-wrapper} options to specify an alternate preprocessor or
10936 perform additional processing of the program source between
10937 normal preprocessing and compilation.
10938 @end table
10939
10940 @include cppopts.texi
10941
10942 @node Assembler Options
10943 @section Passing Options to the Assembler
10944
10945 @c prevent bad page break with this line
10946 You can pass options to the assembler.
10947
10948 @table @gcctabopt
10949 @item -Wa,@var{option}
10950 @opindex Wa
10951 Pass @var{option} as an option to the assembler. If @var{option}
10952 contains commas, it is split into multiple options at the commas.
10953
10954 @item -Xassembler @var{option}
10955 @opindex Xassembler
10956 Pass @var{option} as an option to the assembler. You can use this to
10957 supply system-specific assembler options that GCC does not
10958 recognize.
10959
10960 If you want to pass an option that takes an argument, you must use
10961 @option{-Xassembler} twice, once for the option and once for the argument.
10962
10963 @end table
10964
10965 @node Link Options
10966 @section Options for Linking
10967 @cindex link options
10968 @cindex options, linking
10969
10970 These options come into play when the compiler links object files into
10971 an executable output file. They are meaningless if the compiler is
10972 not doing a link step.
10973
10974 @table @gcctabopt
10975 @cindex file names
10976 @item @var{object-file-name}
10977 A file name that does not end in a special recognized suffix is
10978 considered to name an object file or library. (Object files are
10979 distinguished from libraries by the linker according to the file
10980 contents.) If linking is done, these object files are used as input
10981 to the linker.
10982
10983 @item -c
10984 @itemx -S
10985 @itemx -E
10986 @opindex c
10987 @opindex S
10988 @opindex E
10989 If any of these options is used, then the linker is not run, and
10990 object file names should not be used as arguments. @xref{Overall
10991 Options}.
10992
10993 @item -fuse-ld=bfd
10994 @opindex fuse-ld=bfd
10995 Use the @command{bfd} linker instead of the default linker.
10996
10997 @item -fuse-ld=gold
10998 @opindex fuse-ld=gold
10999 Use the @command{gold} linker instead of the default linker.
11000
11001 @cindex Libraries
11002 @item -l@var{library}
11003 @itemx -l @var{library}
11004 @opindex l
11005 Search the library named @var{library} when linking. (The second
11006 alternative with the library as a separate argument is only for
11007 POSIX compliance and is not recommended.)
11008
11009 It makes a difference where in the command you write this option; the
11010 linker searches and processes libraries and object files in the order they
11011 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
11012 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
11013 to functions in @samp{z}, those functions may not be loaded.
11014
11015 The linker searches a standard list of directories for the library,
11016 which is actually a file named @file{lib@var{library}.a}. The linker
11017 then uses this file as if it had been specified precisely by name.
11018
11019 The directories searched include several standard system directories
11020 plus any that you specify with @option{-L}.
11021
11022 Normally the files found this way are library files---archive files
11023 whose members are object files. The linker handles an archive file by
11024 scanning through it for members which define symbols that have so far
11025 been referenced but not defined. But if the file that is found is an
11026 ordinary object file, it is linked in the usual fashion. The only
11027 difference between using an @option{-l} option and specifying a file name
11028 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
11029 and searches several directories.
11030
11031 @item -lobjc
11032 @opindex lobjc
11033 You need this special case of the @option{-l} option in order to
11034 link an Objective-C or Objective-C++ program.
11035
11036 @item -nostartfiles
11037 @opindex nostartfiles
11038 Do not use the standard system startup files when linking.
11039 The standard system libraries are used normally, unless @option{-nostdlib}
11040 or @option{-nodefaultlibs} is used.
11041
11042 @item -nodefaultlibs
11043 @opindex nodefaultlibs
11044 Do not use the standard system libraries when linking.
11045 Only the libraries you specify are passed to the linker, and options
11046 specifying linkage of the system libraries, such as @option{-static-libgcc}
11047 or @option{-shared-libgcc}, are ignored.
11048 The standard startup files are used normally, unless @option{-nostartfiles}
11049 is used.
11050
11051 The compiler may generate calls to @code{memcmp},
11052 @code{memset}, @code{memcpy} and @code{memmove}.
11053 These entries are usually resolved by entries in
11054 libc. These entry points should be supplied through some other
11055 mechanism when this option is specified.
11056
11057 @item -nostdlib
11058 @opindex nostdlib
11059 Do not use the standard system startup files or libraries when linking.
11060 No startup files and only the libraries you specify are passed to
11061 the linker, and options specifying linkage of the system libraries, such as
11062 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
11063
11064 The compiler may generate calls to @code{memcmp}, @code{memset},
11065 @code{memcpy} and @code{memmove}.
11066 These entries are usually resolved by entries in
11067 libc. These entry points should be supplied through some other
11068 mechanism when this option is specified.
11069
11070 @cindex @option{-lgcc}, use with @option{-nostdlib}
11071 @cindex @option{-nostdlib} and unresolved references
11072 @cindex unresolved references and @option{-nostdlib}
11073 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
11074 @cindex @option{-nodefaultlibs} and unresolved references
11075 @cindex unresolved references and @option{-nodefaultlibs}
11076 One of the standard libraries bypassed by @option{-nostdlib} and
11077 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
11078 which GCC uses to overcome shortcomings of particular machines, or special
11079 needs for some languages.
11080 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
11081 Collection (GCC) Internals},
11082 for more discussion of @file{libgcc.a}.)
11083 In most cases, you need @file{libgcc.a} even when you want to avoid
11084 other standard libraries. In other words, when you specify @option{-nostdlib}
11085 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
11086 This ensures that you have no unresolved references to internal GCC
11087 library subroutines.
11088 (An example of such an internal subroutine is @code{__main}, used to ensure C++
11089 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
11090 GNU Compiler Collection (GCC) Internals}.)
11091
11092 @item -pie
11093 @opindex pie
11094 Produce a position independent executable on targets that support it.
11095 For predictable results, you must also specify the same set of options
11096 used for compilation (@option{-fpie}, @option{-fPIE},
11097 or model suboptions) when you specify this linker option.
11098
11099 @item -no-pie
11100 @opindex no-pie
11101 Don't produce a position independent executable.
11102
11103 @item -rdynamic
11104 @opindex rdynamic
11105 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
11106 that support it. This instructs the linker to add all symbols, not
11107 only used ones, to the dynamic symbol table. This option is needed
11108 for some uses of @code{dlopen} or to allow obtaining backtraces
11109 from within a program.
11110
11111 @item -s
11112 @opindex s
11113 Remove all symbol table and relocation information from the executable.
11114
11115 @item -static
11116 @opindex static
11117 On systems that support dynamic linking, this prevents linking with the shared
11118 libraries. On other systems, this option has no effect.
11119
11120 @item -shared
11121 @opindex shared
11122 Produce a shared object which can then be linked with other objects to
11123 form an executable. Not all systems support this option. For predictable
11124 results, you must also specify the same set of options used for compilation
11125 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
11126 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
11127 needs to build supplementary stub code for constructors to work. On
11128 multi-libbed systems, @samp{gcc -shared} must select the correct support
11129 libraries to link against. Failing to supply the correct flags may lead
11130 to subtle defects. Supplying them in cases where they are not necessary
11131 is innocuous.}
11132
11133 @item -shared-libgcc
11134 @itemx -static-libgcc
11135 @opindex shared-libgcc
11136 @opindex static-libgcc
11137 On systems that provide @file{libgcc} as a shared library, these options
11138 force the use of either the shared or static version, respectively.
11139 If no shared version of @file{libgcc} was built when the compiler was
11140 configured, these options have no effect.
11141
11142 There are several situations in which an application should use the
11143 shared @file{libgcc} instead of the static version. The most common
11144 of these is when the application wishes to throw and catch exceptions
11145 across different shared libraries. In that case, each of the libraries
11146 as well as the application itself should use the shared @file{libgcc}.
11147
11148 Therefore, the G++ and GCJ drivers automatically add
11149 @option{-shared-libgcc} whenever you build a shared library or a main
11150 executable, because C++ and Java programs typically use exceptions, so
11151 this is the right thing to do.
11152
11153 If, instead, you use the GCC driver to create shared libraries, you may
11154 find that they are not always linked with the shared @file{libgcc}.
11155 If GCC finds, at its configuration time, that you have a non-GNU linker
11156 or a GNU linker that does not support option @option{--eh-frame-hdr},
11157 it links the shared version of @file{libgcc} into shared libraries
11158 by default. Otherwise, it takes advantage of the linker and optimizes
11159 away the linking with the shared version of @file{libgcc}, linking with
11160 the static version of libgcc by default. This allows exceptions to
11161 propagate through such shared libraries, without incurring relocation
11162 costs at library load time.
11163
11164 However, if a library or main executable is supposed to throw or catch
11165 exceptions, you must link it using the G++ or GCJ driver, as appropriate
11166 for the languages used in the program, or using the option
11167 @option{-shared-libgcc}, such that it is linked with the shared
11168 @file{libgcc}.
11169
11170 @item -static-libasan
11171 @opindex static-libasan
11172 When the @option{-fsanitize=address} option is used to link a program,
11173 the GCC driver automatically links against @option{libasan}. If
11174 @file{libasan} is available as a shared library, and the @option{-static}
11175 option is not used, then this links against the shared version of
11176 @file{libasan}. The @option{-static-libasan} option directs the GCC
11177 driver to link @file{libasan} statically, without necessarily linking
11178 other libraries statically.
11179
11180 @item -static-libtsan
11181 @opindex static-libtsan
11182 When the @option{-fsanitize=thread} option is used to link a program,
11183 the GCC driver automatically links against @option{libtsan}. If
11184 @file{libtsan} is available as a shared library, and the @option{-static}
11185 option is not used, then this links against the shared version of
11186 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
11187 driver to link @file{libtsan} statically, without necessarily linking
11188 other libraries statically.
11189
11190 @item -static-liblsan
11191 @opindex static-liblsan
11192 When the @option{-fsanitize=leak} option is used to link a program,
11193 the GCC driver automatically links against @option{liblsan}. If
11194 @file{liblsan} is available as a shared library, and the @option{-static}
11195 option is not used, then this links against the shared version of
11196 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
11197 driver to link @file{liblsan} statically, without necessarily linking
11198 other libraries statically.
11199
11200 @item -static-libubsan
11201 @opindex static-libubsan
11202 When the @option{-fsanitize=undefined} option is used to link a program,
11203 the GCC driver automatically links against @option{libubsan}. If
11204 @file{libubsan} is available as a shared library, and the @option{-static}
11205 option is not used, then this links against the shared version of
11206 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
11207 driver to link @file{libubsan} statically, without necessarily linking
11208 other libraries statically.
11209
11210 @item -static-libmpx
11211 @opindex static-libmpx
11212 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
11213 used to link a program, the GCC driver automatically links against
11214 @file{libmpx}. If @file{libmpx} is available as a shared library,
11215 and the @option{-static} option is not used, then this links against
11216 the shared version of @file{libmpx}. The @option{-static-libmpx}
11217 option directs the GCC driver to link @file{libmpx} statically,
11218 without necessarily linking other libraries statically.
11219
11220 @item -static-libmpxwrappers
11221 @opindex static-libmpxwrappers
11222 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
11223 to link a program without also using @option{-fno-chkp-use-wrappers}, the
11224 GCC driver automatically links against @file{libmpxwrappers}. If
11225 @file{libmpxwrappers} is available as a shared library, and the
11226 @option{-static} option is not used, then this links against the shared
11227 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
11228 option directs the GCC driver to link @file{libmpxwrappers} statically,
11229 without necessarily linking other libraries statically.
11230
11231 @item -static-libstdc++
11232 @opindex static-libstdc++
11233 When the @command{g++} program is used to link a C++ program, it
11234 normally automatically links against @option{libstdc++}. If
11235 @file{libstdc++} is available as a shared library, and the
11236 @option{-static} option is not used, then this links against the
11237 shared version of @file{libstdc++}. That is normally fine. However, it
11238 is sometimes useful to freeze the version of @file{libstdc++} used by
11239 the program without going all the way to a fully static link. The
11240 @option{-static-libstdc++} option directs the @command{g++} driver to
11241 link @file{libstdc++} statically, without necessarily linking other
11242 libraries statically.
11243
11244 @item -symbolic
11245 @opindex symbolic
11246 Bind references to global symbols when building a shared object. Warn
11247 about any unresolved references (unless overridden by the link editor
11248 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
11249 this option.
11250
11251 @item -T @var{script}
11252 @opindex T
11253 @cindex linker script
11254 Use @var{script} as the linker script. This option is supported by most
11255 systems using the GNU linker. On some targets, such as bare-board
11256 targets without an operating system, the @option{-T} option may be required
11257 when linking to avoid references to undefined symbols.
11258
11259 @item -Xlinker @var{option}
11260 @opindex Xlinker
11261 Pass @var{option} as an option to the linker. You can use this to
11262 supply system-specific linker options that GCC does not recognize.
11263
11264 If you want to pass an option that takes a separate argument, you must use
11265 @option{-Xlinker} twice, once for the option and once for the argument.
11266 For example, to pass @option{-assert definitions}, you must write
11267 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
11268 @option{-Xlinker "-assert definitions"}, because this passes the entire
11269 string as a single argument, which is not what the linker expects.
11270
11271 When using the GNU linker, it is usually more convenient to pass
11272 arguments to linker options using the @option{@var{option}=@var{value}}
11273 syntax than as separate arguments. For example, you can specify
11274 @option{-Xlinker -Map=output.map} rather than
11275 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
11276 this syntax for command-line options.
11277
11278 @item -Wl,@var{option}
11279 @opindex Wl
11280 Pass @var{option} as an option to the linker. If @var{option} contains
11281 commas, it is split into multiple options at the commas. You can use this
11282 syntax to pass an argument to the option.
11283 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
11284 linker. When using the GNU linker, you can also get the same effect with
11285 @option{-Wl,-Map=output.map}.
11286
11287 @item -u @var{symbol}
11288 @opindex u
11289 Pretend the symbol @var{symbol} is undefined, to force linking of
11290 library modules to define it. You can use @option{-u} multiple times with
11291 different symbols to force loading of additional library modules.
11292
11293 @item -z @var{keyword}
11294 @opindex z
11295 @option{-z} is passed directly on to the linker along with the keyword
11296 @var{keyword}. See the section in the documentation of your linker for
11297 permitted values and their meanings.
11298 @end table
11299
11300 @node Directory Options
11301 @section Options for Directory Search
11302 @cindex directory options
11303 @cindex options, directory search
11304 @cindex search path
11305
11306 These options specify directories to search for header files, for
11307 libraries and for parts of the compiler:
11308
11309 @table @gcctabopt
11310 @item -I@var{dir}
11311 @opindex I
11312 Add the directory @var{dir} to the head of the list of directories to be
11313 searched for header files. This can be used to override a system header
11314 file, substituting your own version, since these directories are
11315 searched before the system header file directories. However, you should
11316 not use this option to add directories that contain vendor-supplied
11317 system header files (use @option{-isystem} for that). If you use more than
11318 one @option{-I} option, the directories are scanned in left-to-right
11319 order; the standard system directories come after.
11320
11321 If a standard system include directory, or a directory specified with
11322 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
11323 option is ignored. The directory is still searched but as a
11324 system directory at its normal position in the system include chain.
11325 This is to ensure that GCC's procedure to fix buggy system headers and
11326 the ordering for the @code{include_next} directive are not inadvertently changed.
11327 If you really need to change the search order for system directories,
11328 use the @option{-nostdinc} and/or @option{-isystem} options.
11329
11330 @item -iplugindir=@var{dir}
11331 @opindex iplugindir=
11332 Set the directory to search for plugins that are passed
11333 by @option{-fplugin=@var{name}} instead of
11334 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
11335 to be used by the user, but only passed by the driver.
11336
11337 @item -iquote@var{dir}
11338 @opindex iquote
11339 Add the directory @var{dir} to the head of the list of directories to
11340 be searched for header files only for the case of @code{#include
11341 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
11342 otherwise just like @option{-I}.
11343
11344 @item -L@var{dir}
11345 @opindex L
11346 Add directory @var{dir} to the list of directories to be searched
11347 for @option{-l}.
11348
11349 @item -B@var{prefix}
11350 @opindex B
11351 This option specifies where to find the executables, libraries,
11352 include files, and data files of the compiler itself.
11353
11354 The compiler driver program runs one or more of the subprograms
11355 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
11356 @var{prefix} as a prefix for each program it tries to run, both with and
11357 without @samp{@var{machine}/@var{version}/} for the corresponding target
11358 machine and compiler version.
11359
11360 For each subprogram to be run, the compiler driver first tries the
11361 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
11362 is not specified, the driver tries two standard prefixes,
11363 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
11364 those results in a file name that is found, the unmodified program
11365 name is searched for using the directories specified in your
11366 @env{PATH} environment variable.
11367
11368 The compiler checks to see if the path provided by @option{-B}
11369 refers to a directory, and if necessary it adds a directory
11370 separator character at the end of the path.
11371
11372 @option{-B} prefixes that effectively specify directory names also apply
11373 to libraries in the linker, because the compiler translates these
11374 options into @option{-L} options for the linker. They also apply to
11375 include files in the preprocessor, because the compiler translates these
11376 options into @option{-isystem} options for the preprocessor. In this case,
11377 the compiler appends @samp{include} to the prefix.
11378
11379 The runtime support file @file{libgcc.a} can also be searched for using
11380 the @option{-B} prefix, if needed. If it is not found there, the two
11381 standard prefixes above are tried, and that is all. The file is left
11382 out of the link if it is not found by those means.
11383
11384 Another way to specify a prefix much like the @option{-B} prefix is to use
11385 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
11386 Variables}.
11387
11388 As a special kludge, if the path provided by @option{-B} is
11389 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
11390 9, then it is replaced by @file{[dir/]include}. This is to help
11391 with boot-strapping the compiler.
11392
11393 @item -no-canonical-prefixes
11394 @opindex no-canonical-prefixes
11395 Do not expand any symbolic links, resolve references to @samp{/../}
11396 or @samp{/./}, or make the path absolute when generating a relative
11397 prefix.
11398
11399 @item --sysroot=@var{dir}
11400 @opindex sysroot
11401 Use @var{dir} as the logical root directory for headers and libraries.
11402 For example, if the compiler normally searches for headers in
11403 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
11404 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
11405
11406 If you use both this option and the @option{-isysroot} option, then
11407 the @option{--sysroot} option applies to libraries, but the
11408 @option{-isysroot} option applies to header files.
11409
11410 The GNU linker (beginning with version 2.16) has the necessary support
11411 for this option. If your linker does not support this option, the
11412 header file aspect of @option{--sysroot} still works, but the
11413 library aspect does not.
11414
11415 @item --no-sysroot-suffix
11416 @opindex no-sysroot-suffix
11417 For some targets, a suffix is added to the root directory specified
11418 with @option{--sysroot}, depending on the other options used, so that
11419 headers may for example be found in
11420 @file{@var{dir}/@var{suffix}/usr/include} instead of
11421 @file{@var{dir}/usr/include}. This option disables the addition of
11422 such a suffix.
11423
11424 @item -I-
11425 @opindex I-
11426 This option has been deprecated. Please use @option{-iquote} instead for
11427 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
11428 option.
11429 Any directories you specify with @option{-I} options before the @option{-I-}
11430 option are searched only for the case of @code{#include "@var{file}"};
11431 they are not searched for @code{#include <@var{file}>}.
11432
11433 If additional directories are specified with @option{-I} options after
11434 the @option{-I-} option, these directories are searched for all @code{#include}
11435 directives. (Ordinarily @emph{all} @option{-I} directories are used
11436 this way.)
11437
11438 In addition, the @option{-I-} option inhibits the use of the current
11439 directory (where the current input file came from) as the first search
11440 directory for @code{#include "@var{file}"}. There is no way to
11441 override this effect of @option{-I-}. With @option{-I.} you can specify
11442 searching the directory that is current when the compiler is
11443 invoked. That is not exactly the same as what the preprocessor does
11444 by default, but it is often satisfactory.
11445
11446 @option{-I-} does not inhibit the use of the standard system directories
11447 for header files. Thus, @option{-I-} and @option{-nostdinc} are
11448 independent.
11449 @end table
11450
11451 @node Code Gen Options
11452 @section Options for Code Generation Conventions
11453 @cindex code generation conventions
11454 @cindex options, code generation
11455 @cindex run-time options
11456
11457 These machine-independent options control the interface conventions
11458 used in code generation.
11459
11460 Most of them have both positive and negative forms; the negative form
11461 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
11462 one of the forms is listed---the one that is not the default. You
11463 can figure out the other form by either removing @samp{no-} or adding
11464 it.
11465
11466 @table @gcctabopt
11467 @item -fstack-reuse=@var{reuse-level}
11468 @opindex fstack_reuse
11469 This option controls stack space reuse for user declared local/auto variables
11470 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
11471 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
11472 local variables and temporaries, @samp{named_vars} enables the reuse only for
11473 user defined local variables with names, and @samp{none} disables stack reuse
11474 completely. The default value is @samp{all}. The option is needed when the
11475 program extends the lifetime of a scoped local variable or a compiler generated
11476 temporary beyond the end point defined by the language. When a lifetime of
11477 a variable ends, and if the variable lives in memory, the optimizing compiler
11478 has the freedom to reuse its stack space with other temporaries or scoped
11479 local variables whose live range does not overlap with it. Legacy code extending
11480 local lifetime is likely to break with the stack reuse optimization.
11481
11482 For example,
11483
11484 @smallexample
11485 int *p;
11486 @{
11487 int local1;
11488
11489 p = &local1;
11490 local1 = 10;
11491 ....
11492 @}
11493 @{
11494 int local2;
11495 local2 = 20;
11496 ...
11497 @}
11498
11499 if (*p == 10) // out of scope use of local1
11500 @{
11501
11502 @}
11503 @end smallexample
11504
11505 Another example:
11506 @smallexample
11507
11508 struct A
11509 @{
11510 A(int k) : i(k), j(k) @{ @}
11511 int i;
11512 int j;
11513 @};
11514
11515 A *ap;
11516
11517 void foo(const A& ar)
11518 @{
11519 ap = &ar;
11520 @}
11521
11522 void bar()
11523 @{
11524 foo(A(10)); // temp object's lifetime ends when foo returns
11525
11526 @{
11527 A a(20);
11528 ....
11529 @}
11530 ap->i+= 10; // ap references out of scope temp whose space
11531 // is reused with a. What is the value of ap->i?
11532 @}
11533
11534 @end smallexample
11535
11536 The lifetime of a compiler generated temporary is well defined by the C++
11537 standard. When a lifetime of a temporary ends, and if the temporary lives
11538 in memory, the optimizing compiler has the freedom to reuse its stack
11539 space with other temporaries or scoped local variables whose live range
11540 does not overlap with it. However some of the legacy code relies on
11541 the behavior of older compilers in which temporaries' stack space is
11542 not reused, the aggressive stack reuse can lead to runtime errors. This
11543 option is used to control the temporary stack reuse optimization.
11544
11545 @item -ftrapv
11546 @opindex ftrapv
11547 This option generates traps for signed overflow on addition, subtraction,
11548 multiplication operations.
11549 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11550 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11551 @option{-fwrapv} being effective. Note that only active options override, so
11552 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11553 results in @option{-ftrapv} being effective.
11554
11555 @item -fwrapv
11556 @opindex fwrapv
11557 This option instructs the compiler to assume that signed arithmetic
11558 overflow of addition, subtraction and multiplication wraps around
11559 using twos-complement representation. This flag enables some optimizations
11560 and disables others. This option is enabled by default for the Java
11561 front end, as required by the Java language specification.
11562 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11563 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11564 @option{-fwrapv} being effective. Note that only active options override, so
11565 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11566 results in @option{-ftrapv} being effective.
11567
11568 @item -fexceptions
11569 @opindex fexceptions
11570 Enable exception handling. Generates extra code needed to propagate
11571 exceptions. For some targets, this implies GCC generates frame
11572 unwind information for all functions, which can produce significant data
11573 size overhead, although it does not affect execution. If you do not
11574 specify this option, GCC enables it by default for languages like
11575 C++ that normally require exception handling, and disables it for
11576 languages like C that do not normally require it. However, you may need
11577 to enable this option when compiling C code that needs to interoperate
11578 properly with exception handlers written in C++. You may also wish to
11579 disable this option if you are compiling older C++ programs that don't
11580 use exception handling.
11581
11582 @item -fnon-call-exceptions
11583 @opindex fnon-call-exceptions
11584 Generate code that allows trapping instructions to throw exceptions.
11585 Note that this requires platform-specific runtime support that does
11586 not exist everywhere. Moreover, it only allows @emph{trapping}
11587 instructions to throw exceptions, i.e.@: memory references or floating-point
11588 instructions. It does not allow exceptions to be thrown from
11589 arbitrary signal handlers such as @code{SIGALRM}.
11590
11591 @item -fdelete-dead-exceptions
11592 @opindex fdelete-dead-exceptions
11593 Consider that instructions that may throw exceptions but don't otherwise
11594 contribute to the execution of the program can be optimized away.
11595 This option is enabled by default for the Ada front end, as permitted by
11596 the Ada language specification.
11597 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
11598
11599 @item -funwind-tables
11600 @opindex funwind-tables
11601 Similar to @option{-fexceptions}, except that it just generates any needed
11602 static data, but does not affect the generated code in any other way.
11603 You normally do not need to enable this option; instead, a language processor
11604 that needs this handling enables it on your behalf.
11605
11606 @item -fasynchronous-unwind-tables
11607 @opindex fasynchronous-unwind-tables
11608 Generate unwind table in DWARF format, if supported by target machine. The
11609 table is exact at each instruction boundary, so it can be used for stack
11610 unwinding from asynchronous events (such as debugger or garbage collector).
11611
11612 @item -fno-gnu-unique
11613 @opindex fno-gnu-unique
11614 On systems with recent GNU assembler and C library, the C++ compiler
11615 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
11616 of template static data members and static local variables in inline
11617 functions are unique even in the presence of @code{RTLD_LOCAL}; this
11618 is necessary to avoid problems with a library used by two different
11619 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
11620 therefore disagreeing with the other one about the binding of the
11621 symbol. But this causes @code{dlclose} to be ignored for affected
11622 DSOs; if your program relies on reinitialization of a DSO via
11623 @code{dlclose} and @code{dlopen}, you can use
11624 @option{-fno-gnu-unique}.
11625
11626 @item -fpcc-struct-return
11627 @opindex fpcc-struct-return
11628 Return ``short'' @code{struct} and @code{union} values in memory like
11629 longer ones, rather than in registers. This convention is less
11630 efficient, but it has the advantage of allowing intercallability between
11631 GCC-compiled files and files compiled with other compilers, particularly
11632 the Portable C Compiler (pcc).
11633
11634 The precise convention for returning structures in memory depends
11635 on the target configuration macros.
11636
11637 Short structures and unions are those whose size and alignment match
11638 that of some integer type.
11639
11640 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11641 switch is not binary compatible with code compiled with the
11642 @option{-freg-struct-return} switch.
11643 Use it to conform to a non-default application binary interface.
11644
11645 @item -freg-struct-return
11646 @opindex freg-struct-return
11647 Return @code{struct} and @code{union} values in registers when possible.
11648 This is more efficient for small structures than
11649 @option{-fpcc-struct-return}.
11650
11651 If you specify neither @option{-fpcc-struct-return} nor
11652 @option{-freg-struct-return}, GCC defaults to whichever convention is
11653 standard for the target. If there is no standard convention, GCC
11654 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11655 the principal compiler. In those cases, we can choose the standard, and
11656 we chose the more efficient register return alternative.
11657
11658 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11659 switch is not binary compatible with code compiled with the
11660 @option{-fpcc-struct-return} switch.
11661 Use it to conform to a non-default application binary interface.
11662
11663 @item -fshort-enums
11664 @opindex fshort-enums
11665 Allocate to an @code{enum} type only as many bytes as it needs for the
11666 declared range of possible values. Specifically, the @code{enum} type
11667 is equivalent to the smallest integer type that has enough room.
11668
11669 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11670 code that is not binary compatible with code generated without that switch.
11671 Use it to conform to a non-default application binary interface.
11672
11673 @item -fshort-wchar
11674 @opindex fshort-wchar
11675 Override the underlying type for @code{wchar_t} to be @code{short
11676 unsigned int} instead of the default for the target. This option is
11677 useful for building programs to run under WINE@.
11678
11679 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11680 code that is not binary compatible with code generated without that switch.
11681 Use it to conform to a non-default application binary interface.
11682
11683 @item -fno-common
11684 @opindex fno-common
11685 In C code, controls the placement of uninitialized global variables.
11686 Unix C compilers have traditionally permitted multiple definitions of
11687 such variables in different compilation units by placing the variables
11688 in a common block.
11689 This is the behavior specified by @option{-fcommon}, and is the default
11690 for GCC on most targets.
11691 On the other hand, this behavior is not required by ISO C, and on some
11692 targets may carry a speed or code size penalty on variable references.
11693 The @option{-fno-common} option specifies that the compiler should place
11694 uninitialized global variables in the data section of the object file,
11695 rather than generating them as common blocks.
11696 This has the effect that if the same variable is declared
11697 (without @code{extern}) in two different compilations,
11698 you get a multiple-definition error when you link them.
11699 In this case, you must compile with @option{-fcommon} instead.
11700 Compiling with @option{-fno-common} is useful on targets for which
11701 it provides better performance, or if you wish to verify that the
11702 program will work on other systems that always treat uninitialized
11703 variable declarations this way.
11704
11705 @item -fno-ident
11706 @opindex fno-ident
11707 Ignore the @code{#ident} directive.
11708
11709 @item -finhibit-size-directive
11710 @opindex finhibit-size-directive
11711 Don't output a @code{.size} assembler directive, or anything else that
11712 would cause trouble if the function is split in the middle, and the
11713 two halves are placed at locations far apart in memory. This option is
11714 used when compiling @file{crtstuff.c}; you should not need to use it
11715 for anything else.
11716
11717 @item -fverbose-asm
11718 @opindex fverbose-asm
11719 Put extra commentary information in the generated assembly code to
11720 make it more readable. This option is generally only of use to those
11721 who actually need to read the generated assembly code (perhaps while
11722 debugging the compiler itself).
11723
11724 @option{-fno-verbose-asm}, the default, causes the
11725 extra information to be omitted and is useful when comparing two assembler
11726 files.
11727
11728 The added comments include:
11729
11730 @itemize @bullet
11731
11732 @item
11733 information on the compiler version and command-line options,
11734
11735 @item
11736 the source code lines associated with the assembly instructions,
11737 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
11738
11739 @item
11740 hints on which high-level expressions correspond to
11741 the various assembly instruction operands.
11742
11743 @end itemize
11744
11745 For example, given this C source file:
11746
11747 @smallexample
11748 int test (int n)
11749 @{
11750 int i;
11751 int total = 0;
11752
11753 for (i = 0; i < n; i++)
11754 total += i * i;
11755
11756 return total;
11757 @}
11758 @end smallexample
11759
11760 compiling to (x86_64) assembly via @option{-S} and emitting the result
11761 direct to stdout via @option{-o} @option{-}
11762
11763 @smallexample
11764 gcc -S test.c -fverbose-asm -Os -o -
11765 @end smallexample
11766
11767 gives output similar to this:
11768
11769 @smallexample
11770 .file "test.c"
11771 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
11772 [...snip...]
11773 # options passed:
11774 [...snip...]
11775
11776 .text
11777 .globl test
11778 .type test, @@function
11779 test:
11780 .LFB0:
11781 .cfi_startproc
11782 # test.c:4: int total = 0;
11783 xorl %eax, %eax # <retval>
11784 # test.c:6: for (i = 0; i < n; i++)
11785 xorl %edx, %edx # i
11786 .L2:
11787 # test.c:6: for (i = 0; i < n; i++)
11788 cmpl %edi, %edx # n, i
11789 jge .L5 #,
11790 # test.c:7: total += i * i;
11791 movl %edx, %ecx # i, tmp92
11792 imull %edx, %ecx # i, tmp92
11793 # test.c:6: for (i = 0; i < n; i++)
11794 incl %edx # i
11795 # test.c:7: total += i * i;
11796 addl %ecx, %eax # tmp92, <retval>
11797 jmp .L2 #
11798 .L5:
11799 # test.c:10: @}
11800 ret
11801 .cfi_endproc
11802 .LFE0:
11803 .size test, .-test
11804 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
11805 .section .note.GNU-stack,"",@@progbits
11806 @end smallexample
11807
11808 The comments are intended for humans rather than machines and hence the
11809 precise format of the comments is subject to change.
11810
11811 @item -frecord-gcc-switches
11812 @opindex frecord-gcc-switches
11813 This switch causes the command line used to invoke the
11814 compiler to be recorded into the object file that is being created.
11815 This switch is only implemented on some targets and the exact format
11816 of the recording is target and binary file format dependent, but it
11817 usually takes the form of a section containing ASCII text. This
11818 switch is related to the @option{-fverbose-asm} switch, but that
11819 switch only records information in the assembler output file as
11820 comments, so it never reaches the object file.
11821 See also @option{-grecord-gcc-switches} for another
11822 way of storing compiler options into the object file.
11823
11824 @item -fpic
11825 @opindex fpic
11826 @cindex global offset table
11827 @cindex PIC
11828 Generate position-independent code (PIC) suitable for use in a shared
11829 library, if supported for the target machine. Such code accesses all
11830 constant addresses through a global offset table (GOT)@. The dynamic
11831 loader resolves the GOT entries when the program starts (the dynamic
11832 loader is not part of GCC; it is part of the operating system). If
11833 the GOT size for the linked executable exceeds a machine-specific
11834 maximum size, you get an error message from the linker indicating that
11835 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
11836 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
11837 on the m68k and RS/6000. The x86 has no such limit.)
11838
11839 Position-independent code requires special support, and therefore works
11840 only on certain machines. For the x86, GCC supports PIC for System V
11841 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
11842 position-independent.
11843
11844 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11845 are defined to 1.
11846
11847 @item -fPIC
11848 @opindex fPIC
11849 If supported for the target machine, emit position-independent code,
11850 suitable for dynamic linking and avoiding any limit on the size of the
11851 global offset table. This option makes a difference on AArch64, m68k,
11852 PowerPC and SPARC@.
11853
11854 Position-independent code requires special support, and therefore works
11855 only on certain machines.
11856
11857 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11858 are defined to 2.
11859
11860 @item -fpie
11861 @itemx -fPIE
11862 @opindex fpie
11863 @opindex fPIE
11864 These options are similar to @option{-fpic} and @option{-fPIC}, but
11865 generated position independent code can be only linked into executables.
11866 Usually these options are used when @option{-pie} GCC option is
11867 used during linking.
11868
11869 @option{-fpie} and @option{-fPIE} both define the macros
11870 @code{__pie__} and @code{__PIE__}. The macros have the value 1
11871 for @option{-fpie} and 2 for @option{-fPIE}.
11872
11873 @item -fno-plt
11874 @opindex fno-plt
11875 Do not use the PLT for external function calls in position-independent code.
11876 Instead, load the callee address at call sites from the GOT and branch to it.
11877 This leads to more efficient code by eliminating PLT stubs and exposing
11878 GOT loads to optimizations. On architectures such as 32-bit x86 where
11879 PLT stubs expect the GOT pointer in a specific register, this gives more
11880 register allocation freedom to the compiler.
11881 Lazy binding requires use of the PLT;
11882 with @option{-fno-plt} all external symbols are resolved at load time.
11883
11884 Alternatively, the function attribute @code{noplt} can be used to avoid calls
11885 through the PLT for specific external functions.
11886
11887 In position-dependent code, a few targets also convert calls to
11888 functions that are marked to not use the PLT to use the GOT instead.
11889
11890 @item -fno-jump-tables
11891 @opindex fno-jump-tables
11892 Do not use jump tables for switch statements even where it would be
11893 more efficient than other code generation strategies. This option is
11894 of use in conjunction with @option{-fpic} or @option{-fPIC} for
11895 building code that forms part of a dynamic linker and cannot
11896 reference the address of a jump table. On some targets, jump tables
11897 do not require a GOT and this option is not needed.
11898
11899 @item -ffixed-@var{reg}
11900 @opindex ffixed
11901 Treat the register named @var{reg} as a fixed register; generated code
11902 should never refer to it (except perhaps as a stack pointer, frame
11903 pointer or in some other fixed role).
11904
11905 @var{reg} must be the name of a register. The register names accepted
11906 are machine-specific and are defined in the @code{REGISTER_NAMES}
11907 macro in the machine description macro file.
11908
11909 This flag does not have a negative form, because it specifies a
11910 three-way choice.
11911
11912 @item -fcall-used-@var{reg}
11913 @opindex fcall-used
11914 Treat the register named @var{reg} as an allocable register that is
11915 clobbered by function calls. It may be allocated for temporaries or
11916 variables that do not live across a call. Functions compiled this way
11917 do not save and restore the register @var{reg}.
11918
11919 It is an error to use this flag with the frame pointer or stack pointer.
11920 Use of this flag for other registers that have fixed pervasive roles in
11921 the machine's execution model produces disastrous results.
11922
11923 This flag does not have a negative form, because it specifies a
11924 three-way choice.
11925
11926 @item -fcall-saved-@var{reg}
11927 @opindex fcall-saved
11928 Treat the register named @var{reg} as an allocable register saved by
11929 functions. It may be allocated even for temporaries or variables that
11930 live across a call. Functions compiled this way save and restore
11931 the register @var{reg} if they use it.
11932
11933 It is an error to use this flag with the frame pointer or stack pointer.
11934 Use of this flag for other registers that have fixed pervasive roles in
11935 the machine's execution model produces disastrous results.
11936
11937 A different sort of disaster results from the use of this flag for
11938 a register in which function values may be returned.
11939
11940 This flag does not have a negative form, because it specifies a
11941 three-way choice.
11942
11943 @item -fpack-struct[=@var{n}]
11944 @opindex fpack-struct
11945 Without a value specified, pack all structure members together without
11946 holes. When a value is specified (which must be a small power of two), pack
11947 structure members according to this value, representing the maximum
11948 alignment (that is, objects with default alignment requirements larger than
11949 this are output potentially unaligned at the next fitting location.
11950
11951 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11952 code that is not binary compatible with code generated without that switch.
11953 Additionally, it makes the code suboptimal.
11954 Use it to conform to a non-default application binary interface.
11955
11956 @item -fleading-underscore
11957 @opindex fleading-underscore
11958 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11959 change the way C symbols are represented in the object file. One use
11960 is to help link with legacy assembly code.
11961
11962 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11963 generate code that is not binary compatible with code generated without that
11964 switch. Use it to conform to a non-default application binary interface.
11965 Not all targets provide complete support for this switch.
11966
11967 @item -ftls-model=@var{model}
11968 @opindex ftls-model
11969 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11970 The @var{model} argument should be one of @samp{global-dynamic},
11971 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
11972 Note that the choice is subject to optimization: the compiler may use
11973 a more efficient model for symbols not visible outside of the translation
11974 unit, or if @option{-fpic} is not given on the command line.
11975
11976 The default without @option{-fpic} is @samp{initial-exec}; with
11977 @option{-fpic} the default is @samp{global-dynamic}.
11978
11979 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
11980 @opindex fvisibility
11981 Set the default ELF image symbol visibility to the specified option---all
11982 symbols are marked with this unless overridden within the code.
11983 Using this feature can very substantially improve linking and
11984 load times of shared object libraries, produce more optimized
11985 code, provide near-perfect API export and prevent symbol clashes.
11986 It is @strong{strongly} recommended that you use this in any shared objects
11987 you distribute.
11988
11989 Despite the nomenclature, @samp{default} always means public; i.e.,
11990 available to be linked against from outside the shared object.
11991 @samp{protected} and @samp{internal} are pretty useless in real-world
11992 usage so the only other commonly used option is @samp{hidden}.
11993 The default if @option{-fvisibility} isn't specified is
11994 @samp{default}, i.e., make every symbol public.
11995
11996 A good explanation of the benefits offered by ensuring ELF
11997 symbols have the correct visibility is given by ``How To Write
11998 Shared Libraries'' by Ulrich Drepper (which can be found at
11999 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
12000 solution made possible by this option to marking things hidden when
12001 the default is public is to make the default hidden and mark things
12002 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
12003 and @code{__attribute__ ((visibility("default")))} instead of
12004 @code{__declspec(dllexport)} you get almost identical semantics with
12005 identical syntax. This is a great boon to those working with
12006 cross-platform projects.
12007
12008 For those adding visibility support to existing code, you may find
12009 @code{#pragma GCC visibility} of use. This works by you enclosing
12010 the declarations you wish to set visibility for with (for example)
12011 @code{#pragma GCC visibility push(hidden)} and
12012 @code{#pragma GCC visibility pop}.
12013 Bear in mind that symbol visibility should be viewed @strong{as
12014 part of the API interface contract} and thus all new code should
12015 always specify visibility when it is not the default; i.e., declarations
12016 only for use within the local DSO should @strong{always} be marked explicitly
12017 as hidden as so to avoid PLT indirection overheads---making this
12018 abundantly clear also aids readability and self-documentation of the code.
12019 Note that due to ISO C++ specification requirements, @code{operator new} and
12020 @code{operator delete} must always be of default visibility.
12021
12022 Be aware that headers from outside your project, in particular system
12023 headers and headers from any other library you use, may not be
12024 expecting to be compiled with visibility other than the default. You
12025 may need to explicitly say @code{#pragma GCC visibility push(default)}
12026 before including any such headers.
12027
12028 @code{extern} declarations are not affected by @option{-fvisibility}, so
12029 a lot of code can be recompiled with @option{-fvisibility=hidden} with
12030 no modifications. However, this means that calls to @code{extern}
12031 functions with no explicit visibility use the PLT, so it is more
12032 effective to use @code{__attribute ((visibility))} and/or
12033 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
12034 declarations should be treated as hidden.
12035
12036 Note that @option{-fvisibility} does affect C++ vague linkage
12037 entities. This means that, for instance, an exception class that is
12038 be thrown between DSOs must be explicitly marked with default
12039 visibility so that the @samp{type_info} nodes are unified between
12040 the DSOs.
12041
12042 An overview of these techniques, their benefits and how to use them
12043 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
12044
12045 @item -fstrict-volatile-bitfields
12046 @opindex fstrict-volatile-bitfields
12047 This option should be used if accesses to volatile bit-fields (or other
12048 structure fields, although the compiler usually honors those types
12049 anyway) should use a single access of the width of the
12050 field's type, aligned to a natural alignment if possible. For
12051 example, targets with memory-mapped peripheral registers might require
12052 all such accesses to be 16 bits wide; with this flag you can
12053 declare all peripheral bit-fields as @code{unsigned short} (assuming short
12054 is 16 bits on these targets) to force GCC to use 16-bit accesses
12055 instead of, perhaps, a more efficient 32-bit access.
12056
12057 If this option is disabled, the compiler uses the most efficient
12058 instruction. In the previous example, that might be a 32-bit load
12059 instruction, even though that accesses bytes that do not contain
12060 any portion of the bit-field, or memory-mapped registers unrelated to
12061 the one being updated.
12062
12063 In some cases, such as when the @code{packed} attribute is applied to a
12064 structure field, it may not be possible to access the field with a single
12065 read or write that is correctly aligned for the target machine. In this
12066 case GCC falls back to generating multiple accesses rather than code that
12067 will fault or truncate the result at run time.
12068
12069 Note: Due to restrictions of the C/C++11 memory model, write accesses are
12070 not allowed to touch non bit-field members. It is therefore recommended
12071 to define all bits of the field's type as bit-field members.
12072
12073 The default value of this option is determined by the application binary
12074 interface for the target processor.
12075
12076 @item -fsync-libcalls
12077 @opindex fsync-libcalls
12078 This option controls whether any out-of-line instance of the @code{__sync}
12079 family of functions may be used to implement the C++11 @code{__atomic}
12080 family of functions.
12081
12082 The default value of this option is enabled, thus the only useful form
12083 of the option is @option{-fno-sync-libcalls}. This option is used in
12084 the implementation of the @file{libatomic} runtime library.
12085
12086 @end table
12087
12088 @node Developer Options
12089 @section GCC Developer Options
12090 @cindex developer options
12091 @cindex debugging GCC
12092 @cindex debug dump options
12093 @cindex dump options
12094 @cindex compilation statistics
12095
12096 This section describes command-line options that are primarily of
12097 interest to GCC developers, including options to support compiler
12098 testing and investigation of compiler bugs and compile-time
12099 performance problems. This includes options that produce debug dumps
12100 at various points in the compilation; that print statistics such as
12101 memory use and execution time; and that print information about GCC's
12102 configuration, such as where it searches for libraries. You should
12103 rarely need to use any of these options for ordinary compilation and
12104 linking tasks.
12105
12106 @table @gcctabopt
12107
12108 @item -d@var{letters}
12109 @itemx -fdump-rtl-@var{pass}
12110 @itemx -fdump-rtl-@var{pass}=@var{filename}
12111 @opindex d
12112 @opindex fdump-rtl-@var{pass}
12113 Says to make debugging dumps during compilation at times specified by
12114 @var{letters}. This is used for debugging the RTL-based passes of the
12115 compiler. The file names for most of the dumps are made by appending
12116 a pass number and a word to the @var{dumpname}, and the files are
12117 created in the directory of the output file. In case of
12118 @option{=@var{filename}} option, the dump is output on the given file
12119 instead of the pass numbered dump files. Note that the pass number is
12120 assigned as passes are registered into the pass manager. Most passes
12121 are registered in the order that they will execute and for these passes
12122 the number corresponds to the pass execution order. However, passes
12123 registered by plugins, passes specific to compilation targets, or
12124 passes that are otherwise registered after all the other passes are
12125 numbered higher than a pass named "final", even if they are executed
12126 earlier. @var{dumpname} is generated from the name of the output
12127 file if explicitly specified and not an executable, otherwise it is
12128 the basename of the source file. These switches may have different
12129 effects when @option{-E} is used for preprocessing.
12130
12131 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
12132 @option{-d} option @var{letters}. Here are the possible
12133 letters for use in @var{pass} and @var{letters}, and their meanings:
12134
12135 @table @gcctabopt
12136
12137 @item -fdump-rtl-alignments
12138 @opindex fdump-rtl-alignments
12139 Dump after branch alignments have been computed.
12140
12141 @item -fdump-rtl-asmcons
12142 @opindex fdump-rtl-asmcons
12143 Dump after fixing rtl statements that have unsatisfied in/out constraints.
12144
12145 @item -fdump-rtl-auto_inc_dec
12146 @opindex fdump-rtl-auto_inc_dec
12147 Dump after auto-inc-dec discovery. This pass is only run on
12148 architectures that have auto inc or auto dec instructions.
12149
12150 @item -fdump-rtl-barriers
12151 @opindex fdump-rtl-barriers
12152 Dump after cleaning up the barrier instructions.
12153
12154 @item -fdump-rtl-bbpart
12155 @opindex fdump-rtl-bbpart
12156 Dump after partitioning hot and cold basic blocks.
12157
12158 @item -fdump-rtl-bbro
12159 @opindex fdump-rtl-bbro
12160 Dump after block reordering.
12161
12162 @item -fdump-rtl-btl1
12163 @itemx -fdump-rtl-btl2
12164 @opindex fdump-rtl-btl2
12165 @opindex fdump-rtl-btl2
12166 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
12167 after the two branch
12168 target load optimization passes.
12169
12170 @item -fdump-rtl-bypass
12171 @opindex fdump-rtl-bypass
12172 Dump after jump bypassing and control flow optimizations.
12173
12174 @item -fdump-rtl-combine
12175 @opindex fdump-rtl-combine
12176 Dump after the RTL instruction combination pass.
12177
12178 @item -fdump-rtl-compgotos
12179 @opindex fdump-rtl-compgotos
12180 Dump after duplicating the computed gotos.
12181
12182 @item -fdump-rtl-ce1
12183 @itemx -fdump-rtl-ce2
12184 @itemx -fdump-rtl-ce3
12185 @opindex fdump-rtl-ce1
12186 @opindex fdump-rtl-ce2
12187 @opindex fdump-rtl-ce3
12188 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
12189 @option{-fdump-rtl-ce3} enable dumping after the three
12190 if conversion passes.
12191
12192 @item -fdump-rtl-cprop_hardreg
12193 @opindex fdump-rtl-cprop_hardreg
12194 Dump after hard register copy propagation.
12195
12196 @item -fdump-rtl-csa
12197 @opindex fdump-rtl-csa
12198 Dump after combining stack adjustments.
12199
12200 @item -fdump-rtl-cse1
12201 @itemx -fdump-rtl-cse2
12202 @opindex fdump-rtl-cse1
12203 @opindex fdump-rtl-cse2
12204 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
12205 the two common subexpression elimination passes.
12206
12207 @item -fdump-rtl-dce
12208 @opindex fdump-rtl-dce
12209 Dump after the standalone dead code elimination passes.
12210
12211 @item -fdump-rtl-dbr
12212 @opindex fdump-rtl-dbr
12213 Dump after delayed branch scheduling.
12214
12215 @item -fdump-rtl-dce1
12216 @itemx -fdump-rtl-dce2
12217 @opindex fdump-rtl-dce1
12218 @opindex fdump-rtl-dce2
12219 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
12220 the two dead store elimination passes.
12221
12222 @item -fdump-rtl-eh
12223 @opindex fdump-rtl-eh
12224 Dump after finalization of EH handling code.
12225
12226 @item -fdump-rtl-eh_ranges
12227 @opindex fdump-rtl-eh_ranges
12228 Dump after conversion of EH handling range regions.
12229
12230 @item -fdump-rtl-expand
12231 @opindex fdump-rtl-expand
12232 Dump after RTL generation.
12233
12234 @item -fdump-rtl-fwprop1
12235 @itemx -fdump-rtl-fwprop2
12236 @opindex fdump-rtl-fwprop1
12237 @opindex fdump-rtl-fwprop2
12238 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
12239 dumping after the two forward propagation passes.
12240
12241 @item -fdump-rtl-gcse1
12242 @itemx -fdump-rtl-gcse2
12243 @opindex fdump-rtl-gcse1
12244 @opindex fdump-rtl-gcse2
12245 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
12246 after global common subexpression elimination.
12247
12248 @item -fdump-rtl-init-regs
12249 @opindex fdump-rtl-init-regs
12250 Dump after the initialization of the registers.
12251
12252 @item -fdump-rtl-initvals
12253 @opindex fdump-rtl-initvals
12254 Dump after the computation of the initial value sets.
12255
12256 @item -fdump-rtl-into_cfglayout
12257 @opindex fdump-rtl-into_cfglayout
12258 Dump after converting to cfglayout mode.
12259
12260 @item -fdump-rtl-ira
12261 @opindex fdump-rtl-ira
12262 Dump after iterated register allocation.
12263
12264 @item -fdump-rtl-jump
12265 @opindex fdump-rtl-jump
12266 Dump after the second jump optimization.
12267
12268 @item -fdump-rtl-loop2
12269 @opindex fdump-rtl-loop2
12270 @option{-fdump-rtl-loop2} enables dumping after the rtl
12271 loop optimization passes.
12272
12273 @item -fdump-rtl-mach
12274 @opindex fdump-rtl-mach
12275 Dump after performing the machine dependent reorganization pass, if that
12276 pass exists.
12277
12278 @item -fdump-rtl-mode_sw
12279 @opindex fdump-rtl-mode_sw
12280 Dump after removing redundant mode switches.
12281
12282 @item -fdump-rtl-rnreg
12283 @opindex fdump-rtl-rnreg
12284 Dump after register renumbering.
12285
12286 @item -fdump-rtl-outof_cfglayout
12287 @opindex fdump-rtl-outof_cfglayout
12288 Dump after converting from cfglayout mode.
12289
12290 @item -fdump-rtl-peephole2
12291 @opindex fdump-rtl-peephole2
12292 Dump after the peephole pass.
12293
12294 @item -fdump-rtl-postreload
12295 @opindex fdump-rtl-postreload
12296 Dump after post-reload optimizations.
12297
12298 @item -fdump-rtl-pro_and_epilogue
12299 @opindex fdump-rtl-pro_and_epilogue
12300 Dump after generating the function prologues and epilogues.
12301
12302 @item -fdump-rtl-sched1
12303 @itemx -fdump-rtl-sched2
12304 @opindex fdump-rtl-sched1
12305 @opindex fdump-rtl-sched2
12306 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
12307 after the basic block scheduling passes.
12308
12309 @item -fdump-rtl-ree
12310 @opindex fdump-rtl-ree
12311 Dump after sign/zero extension elimination.
12312
12313 @item -fdump-rtl-seqabstr
12314 @opindex fdump-rtl-seqabstr
12315 Dump after common sequence discovery.
12316
12317 @item -fdump-rtl-shorten
12318 @opindex fdump-rtl-shorten
12319 Dump after shortening branches.
12320
12321 @item -fdump-rtl-sibling
12322 @opindex fdump-rtl-sibling
12323 Dump after sibling call optimizations.
12324
12325 @item -fdump-rtl-split1
12326 @itemx -fdump-rtl-split2
12327 @itemx -fdump-rtl-split3
12328 @itemx -fdump-rtl-split4
12329 @itemx -fdump-rtl-split5
12330 @opindex fdump-rtl-split1
12331 @opindex fdump-rtl-split2
12332 @opindex fdump-rtl-split3
12333 @opindex fdump-rtl-split4
12334 @opindex fdump-rtl-split5
12335 These options enable dumping after five rounds of
12336 instruction splitting.
12337
12338 @item -fdump-rtl-sms
12339 @opindex fdump-rtl-sms
12340 Dump after modulo scheduling. This pass is only run on some
12341 architectures.
12342
12343 @item -fdump-rtl-stack
12344 @opindex fdump-rtl-stack
12345 Dump after conversion from GCC's ``flat register file'' registers to the
12346 x87's stack-like registers. This pass is only run on x86 variants.
12347
12348 @item -fdump-rtl-subreg1
12349 @itemx -fdump-rtl-subreg2
12350 @opindex fdump-rtl-subreg1
12351 @opindex fdump-rtl-subreg2
12352 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
12353 the two subreg expansion passes.
12354
12355 @item -fdump-rtl-unshare
12356 @opindex fdump-rtl-unshare
12357 Dump after all rtl has been unshared.
12358
12359 @item -fdump-rtl-vartrack
12360 @opindex fdump-rtl-vartrack
12361 Dump after variable tracking.
12362
12363 @item -fdump-rtl-vregs
12364 @opindex fdump-rtl-vregs
12365 Dump after converting virtual registers to hard registers.
12366
12367 @item -fdump-rtl-web
12368 @opindex fdump-rtl-web
12369 Dump after live range splitting.
12370
12371 @item -fdump-rtl-regclass
12372 @itemx -fdump-rtl-subregs_of_mode_init
12373 @itemx -fdump-rtl-subregs_of_mode_finish
12374 @itemx -fdump-rtl-dfinit
12375 @itemx -fdump-rtl-dfinish
12376 @opindex fdump-rtl-regclass
12377 @opindex fdump-rtl-subregs_of_mode_init
12378 @opindex fdump-rtl-subregs_of_mode_finish
12379 @opindex fdump-rtl-dfinit
12380 @opindex fdump-rtl-dfinish
12381 These dumps are defined but always produce empty files.
12382
12383 @item -da
12384 @itemx -fdump-rtl-all
12385 @opindex da
12386 @opindex fdump-rtl-all
12387 Produce all the dumps listed above.
12388
12389 @item -dA
12390 @opindex dA
12391 Annotate the assembler output with miscellaneous debugging information.
12392
12393 @item -dD
12394 @opindex dD
12395 Dump all macro definitions, at the end of preprocessing, in addition to
12396 normal output.
12397
12398 @item -dH
12399 @opindex dH
12400 Produce a core dump whenever an error occurs.
12401
12402 @item -dp
12403 @opindex dp
12404 Annotate the assembler output with a comment indicating which
12405 pattern and alternative is used. The length of each instruction is
12406 also printed.
12407
12408 @item -dP
12409 @opindex dP
12410 Dump the RTL in the assembler output as a comment before each instruction.
12411 Also turns on @option{-dp} annotation.
12412
12413 @item -dx
12414 @opindex dx
12415 Just generate RTL for a function instead of compiling it. Usually used
12416 with @option{-fdump-rtl-expand}.
12417 @end table
12418
12419 @item -fdump-noaddr
12420 @opindex fdump-noaddr
12421 When doing debugging dumps, suppress address output. This makes it more
12422 feasible to use diff on debugging dumps for compiler invocations with
12423 different compiler binaries and/or different
12424 text / bss / data / heap / stack / dso start locations.
12425
12426 @item -freport-bug
12427 @opindex freport-bug
12428 Collect and dump debug information into a temporary file if an
12429 internal compiler error (ICE) occurs.
12430
12431 @item -fdump-unnumbered
12432 @opindex fdump-unnumbered
12433 When doing debugging dumps, suppress instruction numbers and address output.
12434 This makes it more feasible to use diff on debugging dumps for compiler
12435 invocations with different options, in particular with and without
12436 @option{-g}.
12437
12438 @item -fdump-unnumbered-links
12439 @opindex fdump-unnumbered-links
12440 When doing debugging dumps (see @option{-d} option above), suppress
12441 instruction numbers for the links to the previous and next instructions
12442 in a sequence.
12443
12444 @item -fdump-translation-unit @r{(C++ only)}
12445 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
12446 @opindex fdump-translation-unit
12447 Dump a representation of the tree structure for the entire translation
12448 unit to a file. The file name is made by appending @file{.tu} to the
12449 source file name, and the file is created in the same directory as the
12450 output file. If the @samp{-@var{options}} form is used, @var{options}
12451 controls the details of the dump as described for the
12452 @option{-fdump-tree} options.
12453
12454 @item -fdump-class-hierarchy @r{(C++ only)}
12455 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
12456 @opindex fdump-class-hierarchy
12457 Dump a representation of each class's hierarchy and virtual function
12458 table layout to a file. The file name is made by appending
12459 @file{.class} to the source file name, and the file is created in the
12460 same directory as the output file. If the @samp{-@var{options}} form
12461 is used, @var{options} controls the details of the dump as described
12462 for the @option{-fdump-tree} options.
12463
12464 @item -fdump-ipa-@var{switch}
12465 @opindex fdump-ipa
12466 Control the dumping at various stages of inter-procedural analysis
12467 language tree to a file. The file name is generated by appending a
12468 switch specific suffix to the source file name, and the file is created
12469 in the same directory as the output file. The following dumps are
12470 possible:
12471
12472 @table @samp
12473 @item all
12474 Enables all inter-procedural analysis dumps.
12475
12476 @item cgraph
12477 Dumps information about call-graph optimization, unused function removal,
12478 and inlining decisions.
12479
12480 @item inline
12481 Dump after function inlining.
12482
12483 @end table
12484
12485 @item -fdump-passes
12486 @opindex fdump-passes
12487 Dump the list of optimization passes that are turned on and off by
12488 the current command-line options.
12489
12490 @item -fdump-statistics-@var{option}
12491 @opindex fdump-statistics
12492 Enable and control dumping of pass statistics in a separate file. The
12493 file name is generated by appending a suffix ending in
12494 @samp{.statistics} to the source file name, and the file is created in
12495 the same directory as the output file. If the @samp{-@var{option}}
12496 form is used, @samp{-stats} causes counters to be summed over the
12497 whole compilation unit while @samp{-details} dumps every event as
12498 the passes generate them. The default with no option is to sum
12499 counters for each function compiled.
12500
12501 @item -fdump-tree-@var{switch}
12502 @itemx -fdump-tree-@var{switch}-@var{options}
12503 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
12504 @opindex fdump-tree
12505 Control the dumping at various stages of processing the intermediate
12506 language tree to a file. The file name is generated by appending a
12507 switch-specific suffix to the source file name, and the file is
12508 created in the same directory as the output file. In case of
12509 @option{=@var{filename}} option, the dump is output on the given file
12510 instead of the auto named dump files. If the @samp{-@var{options}}
12511 form is used, @var{options} is a list of @samp{-} separated options
12512 which control the details of the dump. Not all options are applicable
12513 to all dumps; those that are not meaningful are ignored. The
12514 following options are available
12515
12516 @table @samp
12517 @item address
12518 Print the address of each node. Usually this is not meaningful as it
12519 changes according to the environment and source file. Its primary use
12520 is for tying up a dump file with a debug environment.
12521 @item asmname
12522 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
12523 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
12524 use working backward from mangled names in the assembly file.
12525 @item slim
12526 When dumping front-end intermediate representations, inhibit dumping
12527 of members of a scope or body of a function merely because that scope
12528 has been reached. Only dump such items when they are directly reachable
12529 by some other path.
12530
12531 When dumping pretty-printed trees, this option inhibits dumping the
12532 bodies of control structures.
12533
12534 When dumping RTL, print the RTL in slim (condensed) form instead of
12535 the default LISP-like representation.
12536 @item raw
12537 Print a raw representation of the tree. By default, trees are
12538 pretty-printed into a C-like representation.
12539 @item details
12540 Enable more detailed dumps (not honored by every dump option). Also
12541 include information from the optimization passes.
12542 @item stats
12543 Enable dumping various statistics about the pass (not honored by every dump
12544 option).
12545 @item blocks
12546 Enable showing basic block boundaries (disabled in raw dumps).
12547 @item graph
12548 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
12549 dump a representation of the control flow graph suitable for viewing with
12550 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
12551 the file is pretty-printed as a subgraph, so that GraphViz can render them
12552 all in a single plot.
12553
12554 This option currently only works for RTL dumps, and the RTL is always
12555 dumped in slim form.
12556 @item vops
12557 Enable showing virtual operands for every statement.
12558 @item lineno
12559 Enable showing line numbers for statements.
12560 @item uid
12561 Enable showing the unique ID (@code{DECL_UID}) for each variable.
12562 @item verbose
12563 Enable showing the tree dump for each statement.
12564 @item eh
12565 Enable showing the EH region number holding each statement.
12566 @item scev
12567 Enable showing scalar evolution analysis details.
12568 @item optimized
12569 Enable showing optimization information (only available in certain
12570 passes).
12571 @item missed
12572 Enable showing missed optimization information (only available in certain
12573 passes).
12574 @item note
12575 Enable other detailed optimization information (only available in
12576 certain passes).
12577 @item =@var{filename}
12578 Instead of an auto named dump file, output into the given file
12579 name. The file names @file{stdout} and @file{stderr} are treated
12580 specially and are considered already open standard streams. For
12581 example,
12582
12583 @smallexample
12584 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
12585 -fdump-tree-pre=stderr file.c
12586 @end smallexample
12587
12588 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
12589 output on to @file{stderr}. If two conflicting dump filenames are
12590 given for the same pass, then the latter option overrides the earlier
12591 one.
12592
12593 @item split-paths
12594 @opindex fdump-tree-split-paths
12595 Dump each function after splitting paths to loop backedges. The file
12596 name is made by appending @file{.split-paths} to the source file name.
12597
12598 @item all
12599 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
12600 and @option{lineno}.
12601
12602 @item optall
12603 Turn on all optimization options, i.e., @option{optimized},
12604 @option{missed}, and @option{note}.
12605 @end table
12606
12607 The following tree dumps are possible:
12608 @table @samp
12609
12610 @item original
12611 @opindex fdump-tree-original
12612 Dump before any tree based optimization, to @file{@var{file}.original}.
12613
12614 @item optimized
12615 @opindex fdump-tree-optimized
12616 Dump after all tree based optimization, to @file{@var{file}.optimized}.
12617
12618 @item gimple
12619 @opindex fdump-tree-gimple
12620 Dump each function before and after the gimplification pass to a file. The
12621 file name is made by appending @file{.gimple} to the source file name.
12622
12623 @item cfg
12624 @opindex fdump-tree-cfg
12625 Dump the control flow graph of each function to a file. The file name is
12626 made by appending @file{.cfg} to the source file name.
12627
12628 @item ch
12629 @opindex fdump-tree-ch
12630 Dump each function after copying loop headers. The file name is made by
12631 appending @file{.ch} to the source file name.
12632
12633 @item ssa
12634 @opindex fdump-tree-ssa
12635 Dump SSA related information to a file. The file name is made by appending
12636 @file{.ssa} to the source file name.
12637
12638 @item alias
12639 @opindex fdump-tree-alias
12640 Dump aliasing information for each function. The file name is made by
12641 appending @file{.alias} to the source file name.
12642
12643 @item ccp
12644 @opindex fdump-tree-ccp
12645 Dump each function after CCP@. The file name is made by appending
12646 @file{.ccp} to the source file name.
12647
12648 @item storeccp
12649 @opindex fdump-tree-storeccp
12650 Dump each function after STORE-CCP@. The file name is made by appending
12651 @file{.storeccp} to the source file name.
12652
12653 @item pre
12654 @opindex fdump-tree-pre
12655 Dump trees after partial redundancy elimination and/or code hoisting.
12656 The file name is made by appending @file{.pre} to the source file name.
12657
12658 @item fre
12659 @opindex fdump-tree-fre
12660 Dump trees after full redundancy elimination. The file name is made
12661 by appending @file{.fre} to the source file name.
12662
12663 @item copyprop
12664 @opindex fdump-tree-copyprop
12665 Dump trees after copy propagation. The file name is made
12666 by appending @file{.copyprop} to the source file name.
12667
12668 @item store_copyprop
12669 @opindex fdump-tree-store_copyprop
12670 Dump trees after store copy-propagation. The file name is made
12671 by appending @file{.store_copyprop} to the source file name.
12672
12673 @item dce
12674 @opindex fdump-tree-dce
12675 Dump each function after dead code elimination. The file name is made by
12676 appending @file{.dce} to the source file name.
12677
12678 @item sra
12679 @opindex fdump-tree-sra
12680 Dump each function after performing scalar replacement of aggregates. The
12681 file name is made by appending @file{.sra} to the source file name.
12682
12683 @item sink
12684 @opindex fdump-tree-sink
12685 Dump each function after performing code sinking. The file name is made
12686 by appending @file{.sink} to the source file name.
12687
12688 @item dom
12689 @opindex fdump-tree-dom
12690 Dump each function after applying dominator tree optimizations. The file
12691 name is made by appending @file{.dom} to the source file name.
12692
12693 @item dse
12694 @opindex fdump-tree-dse
12695 Dump each function after applying dead store elimination. The file
12696 name is made by appending @file{.dse} to the source file name.
12697
12698 @item phiopt
12699 @opindex fdump-tree-phiopt
12700 Dump each function after optimizing PHI nodes into straightline code. The file
12701 name is made by appending @file{.phiopt} to the source file name.
12702
12703 @item backprop
12704 @opindex fdump-tree-backprop
12705 Dump each function after back-propagating use information up the definition
12706 chain. The file name is made by appending @file{.backprop} to the
12707 source file name.
12708
12709 @item forwprop
12710 @opindex fdump-tree-forwprop
12711 Dump each function after forward propagating single use variables. The file
12712 name is made by appending @file{.forwprop} to the source file name.
12713
12714 @item nrv
12715 @opindex fdump-tree-nrv
12716 Dump each function after applying the named return value optimization on
12717 generic trees. The file name is made by appending @file{.nrv} to the source
12718 file name.
12719
12720 @item vect
12721 @opindex fdump-tree-vect
12722 Dump each function after applying vectorization of loops. The file name is
12723 made by appending @file{.vect} to the source file name.
12724
12725 @item slp
12726 @opindex fdump-tree-slp
12727 Dump each function after applying vectorization of basic blocks. The file name
12728 is made by appending @file{.slp} to the source file name.
12729
12730 @item vrp
12731 @opindex fdump-tree-vrp
12732 Dump each function after Value Range Propagation (VRP). The file name
12733 is made by appending @file{.vrp} to the source file name.
12734
12735 @item early vrp
12736 @opindex fdump-tree-evrp
12737 Dump each function after Early Value Range Propagation (EVRP). The file name
12738 is made by appending @file{.evrp} to the source file name.
12739
12740 @item oaccdevlow
12741 @opindex fdump-tree-oaccdevlow
12742 Dump each function after applying device-specific OpenACC transformations.
12743 The file name is made by appending @file{.oaccdevlow} to the source file name.
12744
12745 @item all
12746 @opindex fdump-tree-all
12747 Enable all the available tree dumps with the flags provided in this option.
12748 @end table
12749
12750 @item -fopt-info
12751 @itemx -fopt-info-@var{options}
12752 @itemx -fopt-info-@var{options}=@var{filename}
12753 @opindex fopt-info
12754 Controls optimization dumps from various optimization passes. If the
12755 @samp{-@var{options}} form is used, @var{options} is a list of
12756 @samp{-} separated option keywords to select the dump details and
12757 optimizations.
12758
12759 The @var{options} can be divided into two groups: options describing the
12760 verbosity of the dump, and options describing which optimizations
12761 should be included. The options from both the groups can be freely
12762 mixed as they are non-overlapping. However, in case of any conflicts,
12763 the later options override the earlier options on the command
12764 line.
12765
12766 The following options control the dump verbosity:
12767
12768 @table @samp
12769 @item optimized
12770 Print information when an optimization is successfully applied. It is
12771 up to a pass to decide which information is relevant. For example, the
12772 vectorizer passes print the source location of loops which are
12773 successfully vectorized.
12774 @item missed
12775 Print information about missed optimizations. Individual passes
12776 control which information to include in the output.
12777 @item note
12778 Print verbose information about optimizations, such as certain
12779 transformations, more detailed messages about decisions etc.
12780 @item all
12781 Print detailed optimization information. This includes
12782 @samp{optimized}, @samp{missed}, and @samp{note}.
12783 @end table
12784
12785 One or more of the following option keywords can be used to describe a
12786 group of optimizations:
12787
12788 @table @samp
12789 @item ipa
12790 Enable dumps from all interprocedural optimizations.
12791 @item loop
12792 Enable dumps from all loop optimizations.
12793 @item inline
12794 Enable dumps from all inlining optimizations.
12795 @item vec
12796 Enable dumps from all vectorization optimizations.
12797 @item optall
12798 Enable dumps from all optimizations. This is a superset of
12799 the optimization groups listed above.
12800 @end table
12801
12802 If @var{options} is
12803 omitted, it defaults to @samp{optimized-optall}, which means to dump all
12804 info about successful optimizations from all the passes.
12805
12806 If the @var{filename} is provided, then the dumps from all the
12807 applicable optimizations are concatenated into the @var{filename}.
12808 Otherwise the dump is output onto @file{stderr}. Though multiple
12809 @option{-fopt-info} options are accepted, only one of them can include
12810 a @var{filename}. If other filenames are provided then all but the
12811 first such option are ignored.
12812
12813 Note that the output @var{filename} is overwritten
12814 in case of multiple translation units. If a combined output from
12815 multiple translation units is desired, @file{stderr} should be used
12816 instead.
12817
12818 In the following example, the optimization info is output to
12819 @file{stderr}:
12820
12821 @smallexample
12822 gcc -O3 -fopt-info
12823 @end smallexample
12824
12825 This example:
12826 @smallexample
12827 gcc -O3 -fopt-info-missed=missed.all
12828 @end smallexample
12829
12830 @noindent
12831 outputs missed optimization report from all the passes into
12832 @file{missed.all}, and this one:
12833
12834 @smallexample
12835 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
12836 @end smallexample
12837
12838 @noindent
12839 prints information about missed optimization opportunities from
12840 vectorization passes on @file{stderr}.
12841 Note that @option{-fopt-info-vec-missed} is equivalent to
12842 @option{-fopt-info-missed-vec}.
12843
12844 As another example,
12845 @smallexample
12846 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
12847 @end smallexample
12848
12849 @noindent
12850 outputs information about missed optimizations as well as
12851 optimized locations from all the inlining passes into
12852 @file{inline.txt}.
12853
12854 Finally, consider:
12855
12856 @smallexample
12857 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
12858 @end smallexample
12859
12860 @noindent
12861 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
12862 in conflict since only one output file is allowed. In this case, only
12863 the first option takes effect and the subsequent options are
12864 ignored. Thus only @file{vec.miss} is produced which contains
12865 dumps from the vectorizer about missed opportunities.
12866
12867 @item -fsched-verbose=@var{n}
12868 @opindex fsched-verbose
12869 On targets that use instruction scheduling, this option controls the
12870 amount of debugging output the scheduler prints to the dump files.
12871
12872 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
12873 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
12874 For @var{n} greater than one, it also output basic block probabilities,
12875 detailed ready list information and unit/insn info. For @var{n} greater
12876 than two, it includes RTL at abort point, control-flow and regions info.
12877 And for @var{n} over four, @option{-fsched-verbose} also includes
12878 dependence info.
12879
12880
12881
12882 @item -fenable-@var{kind}-@var{pass}
12883 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
12884 @opindex fdisable-
12885 @opindex fenable-
12886
12887 This is a set of options that are used to explicitly disable/enable
12888 optimization passes. These options are intended for use for debugging GCC.
12889 Compiler users should use regular options for enabling/disabling
12890 passes instead.
12891
12892 @table @gcctabopt
12893
12894 @item -fdisable-ipa-@var{pass}
12895 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12896 statically invoked in the compiler multiple times, the pass name should be
12897 appended with a sequential number starting from 1.
12898
12899 @item -fdisable-rtl-@var{pass}
12900 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
12901 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
12902 statically invoked in the compiler multiple times, the pass name should be
12903 appended with a sequential number starting from 1. @var{range-list} is a
12904 comma-separated list of function ranges or assembler names. Each range is a number
12905 pair separated by a colon. The range is inclusive in both ends. If the range
12906 is trivial, the number pair can be simplified as a single number. If the
12907 function's call graph node's @var{uid} falls within one of the specified ranges,
12908 the @var{pass} is disabled for that function. The @var{uid} is shown in the
12909 function header of a dump file, and the pass names can be dumped by using
12910 option @option{-fdump-passes}.
12911
12912 @item -fdisable-tree-@var{pass}
12913 @itemx -fdisable-tree-@var{pass}=@var{range-list}
12914 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
12915 option arguments.
12916
12917 @item -fenable-ipa-@var{pass}
12918 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12919 statically invoked in the compiler multiple times, the pass name should be
12920 appended with a sequential number starting from 1.
12921
12922 @item -fenable-rtl-@var{pass}
12923 @itemx -fenable-rtl-@var{pass}=@var{range-list}
12924 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
12925 description and examples.
12926
12927 @item -fenable-tree-@var{pass}
12928 @itemx -fenable-tree-@var{pass}=@var{range-list}
12929 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
12930 of option arguments.
12931
12932 @end table
12933
12934 Here are some examples showing uses of these options.
12935
12936 @smallexample
12937
12938 # disable ccp1 for all functions
12939 -fdisable-tree-ccp1
12940 # disable complete unroll for function whose cgraph node uid is 1
12941 -fenable-tree-cunroll=1
12942 # disable gcse2 for functions at the following ranges [1,1],
12943 # [300,400], and [400,1000]
12944 # disable gcse2 for functions foo and foo2
12945 -fdisable-rtl-gcse2=foo,foo2
12946 # disable early inlining
12947 -fdisable-tree-einline
12948 # disable ipa inlining
12949 -fdisable-ipa-inline
12950 # enable tree full unroll
12951 -fenable-tree-unroll
12952
12953 @end smallexample
12954
12955 @item -fchecking
12956 @itemx -fchecking=@var{n}
12957 @opindex fchecking
12958 @opindex fno-checking
12959 Enable internal consistency checking. The default depends on
12960 the compiler configuration. @option{-fchecking=2} enables further
12961 internal consistency checking that might affect code generation.
12962
12963 @item -frandom-seed=@var{string}
12964 @opindex frandom-seed
12965 This option provides a seed that GCC uses in place of
12966 random numbers in generating certain symbol names
12967 that have to be different in every compiled file. It is also used to
12968 place unique stamps in coverage data files and the object files that
12969 produce them. You can use the @option{-frandom-seed} option to produce
12970 reproducibly identical object files.
12971
12972 The @var{string} can either be a number (decimal, octal or hex) or an
12973 arbitrary string (in which case it's converted to a number by
12974 computing CRC32).
12975
12976 The @var{string} should be different for every file you compile.
12977
12978 @item -save-temps
12979 @itemx -save-temps=cwd
12980 @opindex save-temps
12981 Store the usual ``temporary'' intermediate files permanently; place them
12982 in the current directory and name them based on the source file. Thus,
12983 compiling @file{foo.c} with @option{-c -save-temps} produces files
12984 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
12985 preprocessed @file{foo.i} output file even though the compiler now
12986 normally uses an integrated preprocessor.
12987
12988 When used in combination with the @option{-x} command-line option,
12989 @option{-save-temps} is sensible enough to avoid over writing an
12990 input source file with the same extension as an intermediate file.
12991 The corresponding intermediate file may be obtained by renaming the
12992 source file before using @option{-save-temps}.
12993
12994 If you invoke GCC in parallel, compiling several different source
12995 files that share a common base name in different subdirectories or the
12996 same source file compiled for multiple output destinations, it is
12997 likely that the different parallel compilers will interfere with each
12998 other, and overwrite the temporary files. For instance:
12999
13000 @smallexample
13001 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
13002 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
13003 @end smallexample
13004
13005 may result in @file{foo.i} and @file{foo.o} being written to
13006 simultaneously by both compilers.
13007
13008 @item -save-temps=obj
13009 @opindex save-temps=obj
13010 Store the usual ``temporary'' intermediate files permanently. If the
13011 @option{-o} option is used, the temporary files are based on the
13012 object file. If the @option{-o} option is not used, the
13013 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
13014
13015 For example:
13016
13017 @smallexample
13018 gcc -save-temps=obj -c foo.c
13019 gcc -save-temps=obj -c bar.c -o dir/xbar.o
13020 gcc -save-temps=obj foobar.c -o dir2/yfoobar
13021 @end smallexample
13022
13023 @noindent
13024 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
13025 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
13026 @file{dir2/yfoobar.o}.
13027
13028 @item -time@r{[}=@var{file}@r{]}
13029 @opindex time
13030 Report the CPU time taken by each subprocess in the compilation
13031 sequence. For C source files, this is the compiler proper and assembler
13032 (plus the linker if linking is done).
13033
13034 Without the specification of an output file, the output looks like this:
13035
13036 @smallexample
13037 # cc1 0.12 0.01
13038 # as 0.00 0.01
13039 @end smallexample
13040
13041 The first number on each line is the ``user time'', that is time spent
13042 executing the program itself. The second number is ``system time'',
13043 time spent executing operating system routines on behalf of the program.
13044 Both numbers are in seconds.
13045
13046 With the specification of an output file, the output is appended to the
13047 named file, and it looks like this:
13048
13049 @smallexample
13050 0.12 0.01 cc1 @var{options}
13051 0.00 0.01 as @var{options}
13052 @end smallexample
13053
13054 The ``user time'' and the ``system time'' are moved before the program
13055 name, and the options passed to the program are displayed, so that one
13056 can later tell what file was being compiled, and with which options.
13057
13058 @item -fdump-final-insns@r{[}=@var{file}@r{]}
13059 @opindex fdump-final-insns
13060 Dump the final internal representation (RTL) to @var{file}. If the
13061 optional argument is omitted (or if @var{file} is @code{.}), the name
13062 of the dump file is determined by appending @code{.gkd} to the
13063 compilation output file name.
13064
13065 @item -fcompare-debug@r{[}=@var{opts}@r{]}
13066 @opindex fcompare-debug
13067 @opindex fno-compare-debug
13068 If no error occurs during compilation, run the compiler a second time,
13069 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
13070 passed to the second compilation. Dump the final internal
13071 representation in both compilations, and print an error if they differ.
13072
13073 If the equal sign is omitted, the default @option{-gtoggle} is used.
13074
13075 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
13076 and nonzero, implicitly enables @option{-fcompare-debug}. If
13077 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
13078 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
13079 is used.
13080
13081 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
13082 is equivalent to @option{-fno-compare-debug}, which disables the dumping
13083 of the final representation and the second compilation, preventing even
13084 @env{GCC_COMPARE_DEBUG} from taking effect.
13085
13086 To verify full coverage during @option{-fcompare-debug} testing, set
13087 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
13088 which GCC rejects as an invalid option in any actual compilation
13089 (rather than preprocessing, assembly or linking). To get just a
13090 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
13091 not overridden} will do.
13092
13093 @item -fcompare-debug-second
13094 @opindex fcompare-debug-second
13095 This option is implicitly passed to the compiler for the second
13096 compilation requested by @option{-fcompare-debug}, along with options to
13097 silence warnings, and omitting other options that would cause
13098 side-effect compiler outputs to files or to the standard output. Dump
13099 files and preserved temporary files are renamed so as to contain the
13100 @code{.gk} additional extension during the second compilation, to avoid
13101 overwriting those generated by the first.
13102
13103 When this option is passed to the compiler driver, it causes the
13104 @emph{first} compilation to be skipped, which makes it useful for little
13105 other than debugging the compiler proper.
13106
13107 @item -gtoggle
13108 @opindex gtoggle
13109 Turn off generation of debug info, if leaving out this option
13110 generates it, or turn it on at level 2 otherwise. The position of this
13111 argument in the command line does not matter; it takes effect after all
13112 other options are processed, and it does so only once, no matter how
13113 many times it is given. This is mainly intended to be used with
13114 @option{-fcompare-debug}.
13115
13116 @item -fvar-tracking-assignments-toggle
13117 @opindex fvar-tracking-assignments-toggle
13118 @opindex fno-var-tracking-assignments-toggle
13119 Toggle @option{-fvar-tracking-assignments}, in the same way that
13120 @option{-gtoggle} toggles @option{-g}.
13121
13122 @item -Q
13123 @opindex Q
13124 Makes the compiler print out each function name as it is compiled, and
13125 print some statistics about each pass when it finishes.
13126
13127 @item -ftime-report
13128 @opindex ftime-report
13129 Makes the compiler print some statistics about the time consumed by each
13130 pass when it finishes.
13131
13132 @item -ftime-report-details
13133 @opindex ftime-report-details
13134 Record the time consumed by infrastructure parts separately for each pass.
13135
13136 @item -fira-verbose=@var{n}
13137 @opindex fira-verbose
13138 Control the verbosity of the dump file for the integrated register allocator.
13139 The default value is 5. If the value @var{n} is greater or equal to 10,
13140 the dump output is sent to stderr using the same format as @var{n} minus 10.
13141
13142 @item -flto-report
13143 @opindex flto-report
13144 Prints a report with internal details on the workings of the link-time
13145 optimizer. The contents of this report vary from version to version.
13146 It is meant to be useful to GCC developers when processing object
13147 files in LTO mode (via @option{-flto}).
13148
13149 Disabled by default.
13150
13151 @item -flto-report-wpa
13152 @opindex flto-report-wpa
13153 Like @option{-flto-report}, but only print for the WPA phase of Link
13154 Time Optimization.
13155
13156 @item -fmem-report
13157 @opindex fmem-report
13158 Makes the compiler print some statistics about permanent memory
13159 allocation when it finishes.
13160
13161 @item -fmem-report-wpa
13162 @opindex fmem-report-wpa
13163 Makes the compiler print some statistics about permanent memory
13164 allocation for the WPA phase only.
13165
13166 @item -fpre-ipa-mem-report
13167 @opindex fpre-ipa-mem-report
13168 @item -fpost-ipa-mem-report
13169 @opindex fpost-ipa-mem-report
13170 Makes the compiler print some statistics about permanent memory
13171 allocation before or after interprocedural optimization.
13172
13173 @item -fprofile-report
13174 @opindex fprofile-report
13175 Makes the compiler print some statistics about consistency of the
13176 (estimated) profile and effect of individual passes.
13177
13178 @item -fstack-usage
13179 @opindex fstack-usage
13180 Makes the compiler output stack usage information for the program, on a
13181 per-function basis. The filename for the dump is made by appending
13182 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
13183 the output file, if explicitly specified and it is not an executable,
13184 otherwise it is the basename of the source file. An entry is made up
13185 of three fields:
13186
13187 @itemize
13188 @item
13189 The name of the function.
13190 @item
13191 A number of bytes.
13192 @item
13193 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
13194 @end itemize
13195
13196 The qualifier @code{static} means that the function manipulates the stack
13197 statically: a fixed number of bytes are allocated for the frame on function
13198 entry and released on function exit; no stack adjustments are otherwise made
13199 in the function. The second field is this fixed number of bytes.
13200
13201 The qualifier @code{dynamic} means that the function manipulates the stack
13202 dynamically: in addition to the static allocation described above, stack
13203 adjustments are made in the body of the function, for example to push/pop
13204 arguments around function calls. If the qualifier @code{bounded} is also
13205 present, the amount of these adjustments is bounded at compile time and
13206 the second field is an upper bound of the total amount of stack used by
13207 the function. If it is not present, the amount of these adjustments is
13208 not bounded at compile time and the second field only represents the
13209 bounded part.
13210
13211 @item -fstats
13212 @opindex fstats
13213 Emit statistics about front-end processing at the end of the compilation.
13214 This option is supported only by the C++ front end, and
13215 the information is generally only useful to the G++ development team.
13216
13217 @item -fdbg-cnt-list
13218 @opindex fdbg-cnt-list
13219 Print the name and the counter upper bound for all debug counters.
13220
13221
13222 @item -fdbg-cnt=@var{counter-value-list}
13223 @opindex fdbg-cnt
13224 Set the internal debug counter upper bound. @var{counter-value-list}
13225 is a comma-separated list of @var{name}:@var{value} pairs
13226 which sets the upper bound of each debug counter @var{name} to @var{value}.
13227 All debug counters have the initial upper bound of @code{UINT_MAX};
13228 thus @code{dbg_cnt} returns true always unless the upper bound
13229 is set by this option.
13230 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
13231 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
13232
13233 @item -print-file-name=@var{library}
13234 @opindex print-file-name
13235 Print the full absolute name of the library file @var{library} that
13236 would be used when linking---and don't do anything else. With this
13237 option, GCC does not compile or link anything; it just prints the
13238 file name.
13239
13240 @item -print-multi-directory
13241 @opindex print-multi-directory
13242 Print the directory name corresponding to the multilib selected by any
13243 other switches present in the command line. This directory is supposed
13244 to exist in @env{GCC_EXEC_PREFIX}.
13245
13246 @item -print-multi-lib
13247 @opindex print-multi-lib
13248 Print the mapping from multilib directory names to compiler switches
13249 that enable them. The directory name is separated from the switches by
13250 @samp{;}, and each switch starts with an @samp{@@} instead of the
13251 @samp{-}, without spaces between multiple switches. This is supposed to
13252 ease shell processing.
13253
13254 @item -print-multi-os-directory
13255 @opindex print-multi-os-directory
13256 Print the path to OS libraries for the selected
13257 multilib, relative to some @file{lib} subdirectory. If OS libraries are
13258 present in the @file{lib} subdirectory and no multilibs are used, this is
13259 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
13260 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
13261 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
13262 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
13263
13264 @item -print-multiarch
13265 @opindex print-multiarch
13266 Print the path to OS libraries for the selected multiarch,
13267 relative to some @file{lib} subdirectory.
13268
13269 @item -print-prog-name=@var{program}
13270 @opindex print-prog-name
13271 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
13272
13273 @item -print-libgcc-file-name
13274 @opindex print-libgcc-file-name
13275 Same as @option{-print-file-name=libgcc.a}.
13276
13277 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
13278 but you do want to link with @file{libgcc.a}. You can do:
13279
13280 @smallexample
13281 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
13282 @end smallexample
13283
13284 @item -print-search-dirs
13285 @opindex print-search-dirs
13286 Print the name of the configured installation directory and a list of
13287 program and library directories @command{gcc} searches---and don't do anything else.
13288
13289 This is useful when @command{gcc} prints the error message
13290 @samp{installation problem, cannot exec cpp0: No such file or directory}.
13291 To resolve this you either need to put @file{cpp0} and the other compiler
13292 components where @command{gcc} expects to find them, or you can set the environment
13293 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
13294 Don't forget the trailing @samp{/}.
13295 @xref{Environment Variables}.
13296
13297 @item -print-sysroot
13298 @opindex print-sysroot
13299 Print the target sysroot directory that is used during
13300 compilation. This is the target sysroot specified either at configure
13301 time or using the @option{--sysroot} option, possibly with an extra
13302 suffix that depends on compilation options. If no target sysroot is
13303 specified, the option prints nothing.
13304
13305 @item -print-sysroot-headers-suffix
13306 @opindex print-sysroot-headers-suffix
13307 Print the suffix added to the target sysroot when searching for
13308 headers, or give an error if the compiler is not configured with such
13309 a suffix---and don't do anything else.
13310
13311 @item -dumpmachine
13312 @opindex dumpmachine
13313 Print the compiler's target machine (for example,
13314 @samp{i686-pc-linux-gnu})---and don't do anything else.
13315
13316 @item -dumpversion
13317 @opindex dumpversion
13318 Print the compiler version (for example, @code{3.0})---and don't do
13319 anything else.
13320
13321 @item -dumpspecs
13322 @opindex dumpspecs
13323 Print the compiler's built-in specs---and don't do anything else. (This
13324 is used when GCC itself is being built.) @xref{Spec Files}.
13325 @end table
13326
13327 @node Submodel Options
13328 @section Machine-Dependent Options
13329 @cindex submodel options
13330 @cindex specifying hardware config
13331 @cindex hardware models and configurations, specifying
13332 @cindex target-dependent options
13333 @cindex machine-dependent options
13334
13335 Each target machine supported by GCC can have its own options---for
13336 example, to allow you to compile for a particular processor variant or
13337 ABI, or to control optimizations specific to that machine. By
13338 convention, the names of machine-specific options start with
13339 @samp{-m}.
13340
13341 Some configurations of the compiler also support additional target-specific
13342 options, usually for compatibility with other compilers on the same
13343 platform.
13344
13345 @c This list is ordered alphanumerically by subsection name.
13346 @c It should be the same order and spelling as these options are listed
13347 @c in Machine Dependent Options
13348
13349 @menu
13350 * AArch64 Options::
13351 * Adapteva Epiphany Options::
13352 * ARC Options::
13353 * ARM Options::
13354 * AVR Options::
13355 * Blackfin Options::
13356 * C6X Options::
13357 * CRIS Options::
13358 * CR16 Options::
13359 * Darwin Options::
13360 * DEC Alpha Options::
13361 * FR30 Options::
13362 * FT32 Options::
13363 * FRV Options::
13364 * GNU/Linux Options::
13365 * H8/300 Options::
13366 * HPPA Options::
13367 * IA-64 Options::
13368 * LM32 Options::
13369 * M32C Options::
13370 * M32R/D Options::
13371 * M680x0 Options::
13372 * MCore Options::
13373 * MeP Options::
13374 * MicroBlaze Options::
13375 * MIPS Options::
13376 * MMIX Options::
13377 * MN10300 Options::
13378 * Moxie Options::
13379 * MSP430 Options::
13380 * NDS32 Options::
13381 * Nios II Options::
13382 * Nvidia PTX Options::
13383 * PDP-11 Options::
13384 * picoChip Options::
13385 * PowerPC Options::
13386 * RL78 Options::
13387 * RS/6000 and PowerPC Options::
13388 * RX Options::
13389 * S/390 and zSeries Options::
13390 * Score Options::
13391 * SH Options::
13392 * Solaris 2 Options::
13393 * SPARC Options::
13394 * SPU Options::
13395 * System V Options::
13396 * TILE-Gx Options::
13397 * TILEPro Options::
13398 * V850 Options::
13399 * VAX Options::
13400 * Visium Options::
13401 * VMS Options::
13402 * VxWorks Options::
13403 * x86 Options::
13404 * x86 Windows Options::
13405 * Xstormy16 Options::
13406 * Xtensa Options::
13407 * zSeries Options::
13408 @end menu
13409
13410 @node AArch64 Options
13411 @subsection AArch64 Options
13412 @cindex AArch64 Options
13413
13414 These options are defined for AArch64 implementations:
13415
13416 @table @gcctabopt
13417
13418 @item -mabi=@var{name}
13419 @opindex mabi
13420 Generate code for the specified data model. Permissible values
13421 are @samp{ilp32} for SysV-like data model where int, long int and pointers
13422 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
13423 but long int and pointers are 64 bits.
13424
13425 The default depends on the specific target configuration. Note that
13426 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
13427 entire program with the same ABI, and link with a compatible set of libraries.
13428
13429 @item -mbig-endian
13430 @opindex mbig-endian
13431 Generate big-endian code. This is the default when GCC is configured for an
13432 @samp{aarch64_be-*-*} target.
13433
13434 @item -mgeneral-regs-only
13435 @opindex mgeneral-regs-only
13436 Generate code which uses only the general-purpose registers. This will prevent
13437 the compiler from using floating-point and Advanced SIMD registers but will not
13438 impose any restrictions on the assembler.
13439
13440 @item -mlittle-endian
13441 @opindex mlittle-endian
13442 Generate little-endian code. This is the default when GCC is configured for an
13443 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
13444
13445 @item -mcmodel=tiny
13446 @opindex mcmodel=tiny
13447 Generate code for the tiny code model. The program and its statically defined
13448 symbols must be within 1MB of each other. Programs can be statically or
13449 dynamically linked.
13450
13451 @item -mcmodel=small
13452 @opindex mcmodel=small
13453 Generate code for the small code model. The program and its statically defined
13454 symbols must be within 4GB of each other. Programs can be statically or
13455 dynamically linked. This is the default code model.
13456
13457 @item -mcmodel=large
13458 @opindex mcmodel=large
13459 Generate code for the large code model. This makes no assumptions about
13460 addresses and sizes of sections. Programs can be statically linked only.
13461
13462 @item -mstrict-align
13463 @opindex mstrict-align
13464 Avoid generating memory accesses that may not be aligned on a natural object
13465 boundary as described in the architecture specification.
13466
13467 @item -momit-leaf-frame-pointer
13468 @itemx -mno-omit-leaf-frame-pointer
13469 @opindex momit-leaf-frame-pointer
13470 @opindex mno-omit-leaf-frame-pointer
13471 Omit or keep the frame pointer in leaf functions. The former behavior is the
13472 default.
13473
13474 @item -mtls-dialect=desc
13475 @opindex mtls-dialect=desc
13476 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
13477 of TLS variables. This is the default.
13478
13479 @item -mtls-dialect=traditional
13480 @opindex mtls-dialect=traditional
13481 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
13482 of TLS variables.
13483
13484 @item -mtls-size=@var{size}
13485 @opindex mtls-size
13486 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
13487 This option requires binutils 2.26 or newer.
13488
13489 @item -mfix-cortex-a53-835769
13490 @itemx -mno-fix-cortex-a53-835769
13491 @opindex mfix-cortex-a53-835769
13492 @opindex mno-fix-cortex-a53-835769
13493 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
13494 This involves inserting a NOP instruction between memory instructions and
13495 64-bit integer multiply-accumulate instructions.
13496
13497 @item -mfix-cortex-a53-843419
13498 @itemx -mno-fix-cortex-a53-843419
13499 @opindex mfix-cortex-a53-843419
13500 @opindex mno-fix-cortex-a53-843419
13501 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
13502 This erratum workaround is made at link time and this will only pass the
13503 corresponding flag to the linker.
13504
13505 @item -mlow-precision-recip-sqrt
13506 @item -mno-low-precision-recip-sqrt
13507 @opindex mlow-precision-recip-sqrt
13508 @opindex mno-low-precision-recip-sqrt
13509 Enable or disable the reciprocal square root approximation.
13510 This option only has an effect if @option{-ffast-math} or
13511 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13512 precision of reciprocal square root results to about 16 bits for
13513 single precision and to 32 bits for double precision.
13514
13515 @item -mlow-precision-sqrt
13516 @item -mno-low-precision-sqrt
13517 @opindex -mlow-precision-sqrt
13518 @opindex -mno-low-precision-sqrt
13519 Enable or disable the square root approximation.
13520 This option only has an effect if @option{-ffast-math} or
13521 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13522 precision of square root results to about 16 bits for
13523 single precision and to 32 bits for double precision.
13524 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
13525
13526 @item -mlow-precision-div
13527 @item -mno-low-precision-div
13528 @opindex -mlow-precision-div
13529 @opindex -mno-low-precision-div
13530 Enable or disable the division approximation.
13531 This option only has an effect if @option{-ffast-math} or
13532 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13533 precision of division results to about 16 bits for
13534 single precision and to 32 bits for double precision.
13535
13536 @item -march=@var{name}
13537 @opindex march
13538 Specify the name of the target architecture and, optionally, one or
13539 more feature modifiers. This option has the form
13540 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
13541
13542 The permissible values for @var{arch} are @samp{armv8-a},
13543 @samp{armv8.1-a}, @samp{armv8.2-a} or @var{native}.
13544
13545 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
13546 support for the ARMv8.2-A architecture extensions.
13547
13548 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
13549 support for the ARMv8.1-A architecture extension. In particular, it
13550 enables the @samp{+crc} and @samp{+lse} features.
13551
13552 The value @samp{native} is available on native AArch64 GNU/Linux and
13553 causes the compiler to pick the architecture of the host system. This
13554 option has no effect if the compiler is unable to recognize the
13555 architecture of the host system,
13556
13557 The permissible values for @var{feature} are listed in the sub-section
13558 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13559 Feature Modifiers}. Where conflicting feature modifiers are
13560 specified, the right-most feature is used.
13561
13562 GCC uses @var{name} to determine what kind of instructions it can emit
13563 when generating assembly code. If @option{-march} is specified
13564 without either of @option{-mtune} or @option{-mcpu} also being
13565 specified, the code is tuned to perform well across a range of target
13566 processors implementing the target architecture.
13567
13568 @item -mtune=@var{name}
13569 @opindex mtune
13570 Specify the name of the target processor for which GCC should tune the
13571 performance of the code. Permissible values for this option are:
13572 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
13573 @samp{cortex-a72}, @samp{cortex-a73}, @samp{exynos-m1}, @samp{qdf24xx},
13574 @samp{thunderx}, @samp{xgene1}, @samp{vulcan}, @samp{cortex-a57.cortex-a53},
13575 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
13576 @samp{cortex-a73.cortex-a53}, @samp{native}.
13577
13578 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
13579 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}
13580 specify that GCC should tune for a big.LITTLE system.
13581
13582 Additionally on native AArch64 GNU/Linux systems the value
13583 @samp{native} tunes performance to the host system. This option has no effect
13584 if the compiler is unable to recognize the processor of the host system.
13585
13586 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
13587 are specified, the code is tuned to perform well across a range
13588 of target processors.
13589
13590 This option cannot be suffixed by feature modifiers.
13591
13592 @item -mcpu=@var{name}
13593 @opindex mcpu
13594 Specify the name of the target processor, optionally suffixed by one
13595 or more feature modifiers. This option has the form
13596 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
13597 the permissible values for @var{cpu} are the same as those available
13598 for @option{-mtune}. The permissible values for @var{feature} are
13599 documented in the sub-section on
13600 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13601 Feature Modifiers}. Where conflicting feature modifiers are
13602 specified, the right-most feature is used.
13603
13604 GCC uses @var{name} to determine what kind of instructions it can emit when
13605 generating assembly code (as if by @option{-march}) and to determine
13606 the target processor for which to tune for performance (as if
13607 by @option{-mtune}). Where this option is used in conjunction
13608 with @option{-march} or @option{-mtune}, those options take precedence
13609 over the appropriate part of this option.
13610
13611 @item -moverride=@var{string}
13612 @opindex moverride
13613 Override tuning decisions made by the back-end in response to a
13614 @option{-mtune=} switch. The syntax, semantics, and accepted values
13615 for @var{string} in this option are not guaranteed to be consistent
13616 across releases.
13617
13618 This option is only intended to be useful when developing GCC.
13619
13620 @item -mpc-relative-literal-loads
13621 @opindex mpc-relative-literal-loads
13622 Enable PC-relative literal loads. With this option literal pools are
13623 accessed using a single instruction and emitted after each function. This
13624 limits the maximum size of functions to 1MB. This is enabled by default for
13625 @option{-mcmodel=tiny}.
13626
13627 @end table
13628
13629 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
13630 @anchor{aarch64-feature-modifiers}
13631 @cindex @option{-march} feature modifiers
13632 @cindex @option{-mcpu} feature modifiers
13633 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
13634 the following and their inverses @option{no@var{feature}}:
13635
13636 @table @samp
13637 @item crc
13638 Enable CRC extension. This is on by default for
13639 @option{-march=armv8.1-a}.
13640 @item crypto
13641 Enable Crypto extension. This also enables Advanced SIMD and floating-point
13642 instructions.
13643 @item fp
13644 Enable floating-point instructions. This is on by default for all possible
13645 values for options @option{-march} and @option{-mcpu}.
13646 @item simd
13647 Enable Advanced SIMD instructions. This also enables floating-point
13648 instructions. This is on by default for all possible values for options
13649 @option{-march} and @option{-mcpu}.
13650 @item lse
13651 Enable Large System Extension instructions. This is on by default for
13652 @option{-march=armv8.1-a}.
13653 @item fp16
13654 Enable FP16 extension. This also enables floating-point instructions.
13655
13656 @end table
13657
13658 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
13659 Conversely, @option{nofp} implies @option{nosimd}, which implies
13660 @option{nocrypto}.
13661
13662 @node Adapteva Epiphany Options
13663 @subsection Adapteva Epiphany Options
13664
13665 These @samp{-m} options are defined for Adapteva Epiphany:
13666
13667 @table @gcctabopt
13668 @item -mhalf-reg-file
13669 @opindex mhalf-reg-file
13670 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
13671 That allows code to run on hardware variants that lack these registers.
13672
13673 @item -mprefer-short-insn-regs
13674 @opindex mprefer-short-insn-regs
13675 Preferentially allocate registers that allow short instruction generation.
13676 This can result in increased instruction count, so this may either reduce or
13677 increase overall code size.
13678
13679 @item -mbranch-cost=@var{num}
13680 @opindex mbranch-cost
13681 Set the cost of branches to roughly @var{num} ``simple'' instructions.
13682 This cost is only a heuristic and is not guaranteed to produce
13683 consistent results across releases.
13684
13685 @item -mcmove
13686 @opindex mcmove
13687 Enable the generation of conditional moves.
13688
13689 @item -mnops=@var{num}
13690 @opindex mnops
13691 Emit @var{num} NOPs before every other generated instruction.
13692
13693 @item -mno-soft-cmpsf
13694 @opindex mno-soft-cmpsf
13695 For single-precision floating-point comparisons, emit an @code{fsub} instruction
13696 and test the flags. This is faster than a software comparison, but can
13697 get incorrect results in the presence of NaNs, or when two different small
13698 numbers are compared such that their difference is calculated as zero.
13699 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
13700 software comparisons.
13701
13702 @item -mstack-offset=@var{num}
13703 @opindex mstack-offset
13704 Set the offset between the top of the stack and the stack pointer.
13705 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
13706 can be used by leaf functions without stack allocation.
13707 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
13708 Note also that this option changes the ABI; compiling a program with a
13709 different stack offset than the libraries have been compiled with
13710 generally does not work.
13711 This option can be useful if you want to evaluate if a different stack
13712 offset would give you better code, but to actually use a different stack
13713 offset to build working programs, it is recommended to configure the
13714 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
13715
13716 @item -mno-round-nearest
13717 @opindex mno-round-nearest
13718 Make the scheduler assume that the rounding mode has been set to
13719 truncating. The default is @option{-mround-nearest}.
13720
13721 @item -mlong-calls
13722 @opindex mlong-calls
13723 If not otherwise specified by an attribute, assume all calls might be beyond
13724 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
13725 function address into a register before performing a (otherwise direct) call.
13726 This is the default.
13727
13728 @item -mshort-calls
13729 @opindex short-calls
13730 If not otherwise specified by an attribute, assume all direct calls are
13731 in the range of the @code{b} / @code{bl} instructions, so use these instructions
13732 for direct calls. The default is @option{-mlong-calls}.
13733
13734 @item -msmall16
13735 @opindex msmall16
13736 Assume addresses can be loaded as 16-bit unsigned values. This does not
13737 apply to function addresses for which @option{-mlong-calls} semantics
13738 are in effect.
13739
13740 @item -mfp-mode=@var{mode}
13741 @opindex mfp-mode
13742 Set the prevailing mode of the floating-point unit.
13743 This determines the floating-point mode that is provided and expected
13744 at function call and return time. Making this mode match the mode you
13745 predominantly need at function start can make your programs smaller and
13746 faster by avoiding unnecessary mode switches.
13747
13748 @var{mode} can be set to one the following values:
13749
13750 @table @samp
13751 @item caller
13752 Any mode at function entry is valid, and retained or restored when
13753 the function returns, and when it calls other functions.
13754 This mode is useful for compiling libraries or other compilation units
13755 you might want to incorporate into different programs with different
13756 prevailing FPU modes, and the convenience of being able to use a single
13757 object file outweighs the size and speed overhead for any extra
13758 mode switching that might be needed, compared with what would be needed
13759 with a more specific choice of prevailing FPU mode.
13760
13761 @item truncate
13762 This is the mode used for floating-point calculations with
13763 truncating (i.e.@: round towards zero) rounding mode. That includes
13764 conversion from floating point to integer.
13765
13766 @item round-nearest
13767 This is the mode used for floating-point calculations with
13768 round-to-nearest-or-even rounding mode.
13769
13770 @item int
13771 This is the mode used to perform integer calculations in the FPU, e.g.@:
13772 integer multiply, or integer multiply-and-accumulate.
13773 @end table
13774
13775 The default is @option{-mfp-mode=caller}
13776
13777 @item -mnosplit-lohi
13778 @itemx -mno-postinc
13779 @itemx -mno-postmodify
13780 @opindex mnosplit-lohi
13781 @opindex mno-postinc
13782 @opindex mno-postmodify
13783 Code generation tweaks that disable, respectively, splitting of 32-bit
13784 loads, generation of post-increment addresses, and generation of
13785 post-modify addresses. The defaults are @option{msplit-lohi},
13786 @option{-mpost-inc}, and @option{-mpost-modify}.
13787
13788 @item -mnovect-double
13789 @opindex mno-vect-double
13790 Change the preferred SIMD mode to SImode. The default is
13791 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
13792
13793 @item -max-vect-align=@var{num}
13794 @opindex max-vect-align
13795 The maximum alignment for SIMD vector mode types.
13796 @var{num} may be 4 or 8. The default is 8.
13797 Note that this is an ABI change, even though many library function
13798 interfaces are unaffected if they don't use SIMD vector modes
13799 in places that affect size and/or alignment of relevant types.
13800
13801 @item -msplit-vecmove-early
13802 @opindex msplit-vecmove-early
13803 Split vector moves into single word moves before reload. In theory this
13804 can give better register allocation, but so far the reverse seems to be
13805 generally the case.
13806
13807 @item -m1reg-@var{reg}
13808 @opindex m1reg-
13809 Specify a register to hold the constant @minus{}1, which makes loading small negative
13810 constants and certain bitmasks faster.
13811 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
13812 which specify use of that register as a fixed register,
13813 and @samp{none}, which means that no register is used for this
13814 purpose. The default is @option{-m1reg-none}.
13815
13816 @end table
13817
13818 @node ARC Options
13819 @subsection ARC Options
13820 @cindex ARC options
13821
13822 The following options control the architecture variant for which code
13823 is being compiled:
13824
13825 @c architecture variants
13826 @table @gcctabopt
13827
13828 @item -mbarrel-shifter
13829 @opindex mbarrel-shifter
13830 Generate instructions supported by barrel shifter. This is the default
13831 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
13832
13833 @item -mcpu=@var{cpu}
13834 @opindex mcpu
13835 Set architecture type, register usage, and instruction scheduling
13836 parameters for @var{cpu}. There are also shortcut alias options
13837 available for backward compatibility and convenience. Supported
13838 values for @var{cpu} are
13839
13840 @table @samp
13841 @opindex mA6
13842 @opindex mARC600
13843 @item ARC600
13844 @item arc600
13845 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
13846
13847 @item ARC601
13848 @item arc601
13849 @opindex mARC601
13850 Compile for ARC601. Alias: @option{-mARC601}.
13851
13852 @item ARC700
13853 @item arc700
13854 @opindex mA7
13855 @opindex mARC700
13856 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
13857 This is the default when configured with @option{--with-cpu=arc700}@.
13858
13859 @item ARCEM
13860 @item arcem
13861 Compile for ARC EM.
13862
13863 @item ARCHS
13864 @item archs
13865 Compile for ARC HS.
13866 @end table
13867
13868 @item -mdpfp
13869 @opindex mdpfp
13870 @itemx -mdpfp-compact
13871 @opindex mdpfp-compact
13872 FPX: Generate Double Precision FPX instructions, tuned for the compact
13873 implementation.
13874
13875 @item -mdpfp-fast
13876 @opindex mdpfp-fast
13877 FPX: Generate Double Precision FPX instructions, tuned for the fast
13878 implementation.
13879
13880 @item -mno-dpfp-lrsr
13881 @opindex mno-dpfp-lrsr
13882 Disable LR and SR instructions from using FPX extension aux registers.
13883
13884 @item -mea
13885 @opindex mea
13886 Generate Extended arithmetic instructions. Currently only
13887 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
13888 supported. This is always enabled for @option{-mcpu=ARC700}.
13889
13890 @item -mno-mpy
13891 @opindex mno-mpy
13892 Do not generate mpy instructions for ARC700.
13893
13894 @item -mmul32x16
13895 @opindex mmul32x16
13896 Generate 32x16 bit multiply and mac instructions.
13897
13898 @item -mmul64
13899 @opindex mmul64
13900 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
13901
13902 @item -mnorm
13903 @opindex mnorm
13904 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
13905 is in effect.
13906
13907 @item -mspfp
13908 @opindex mspfp
13909 @itemx -mspfp-compact
13910 @opindex mspfp-compact
13911 FPX: Generate Single Precision FPX instructions, tuned for the compact
13912 implementation.
13913
13914 @item -mspfp-fast
13915 @opindex mspfp-fast
13916 FPX: Generate Single Precision FPX instructions, tuned for the fast
13917 implementation.
13918
13919 @item -msimd
13920 @opindex msimd
13921 Enable generation of ARC SIMD instructions via target-specific
13922 builtins. Only valid for @option{-mcpu=ARC700}.
13923
13924 @item -msoft-float
13925 @opindex msoft-float
13926 This option ignored; it is provided for compatibility purposes only.
13927 Software floating point code is emitted by default, and this default
13928 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
13929 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
13930 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
13931
13932 @item -mswap
13933 @opindex mswap
13934 Generate swap instructions.
13935
13936 @item -matomic
13937 @opindex matomic
13938 This enables Locked Load/Store Conditional extension to implement
13939 atomic memopry built-in functions. Not available for ARC 6xx or ARC
13940 EM cores.
13941
13942 @item -mdiv-rem
13943 @opindex mdiv-rem
13944 Enable DIV/REM instructions for ARCv2 cores.
13945
13946 @item -mcode-density
13947 @opindex mcode-density
13948 Enable code density instructions for ARC EM, default on for ARC HS.
13949
13950 @item -mll64
13951 @opindex mll64
13952 Enable double load/store operations for ARC HS cores.
13953
13954 @item -mtp-regno=@var{regno}
13955 @opindex mtp-regno
13956 Specify thread pointer register number.
13957
13958 @item -mmpy-option=@var{multo}
13959 @opindex mmpy-option
13960 Compile ARCv2 code with a multiplier design option. @samp{wlh1} is
13961 the default value. The recognized values for @var{multo} are:
13962
13963 @table @samp
13964 @item 0
13965 No multiplier available.
13966
13967 @item 1
13968 @opindex w
13969 The multiply option is set to w: 16x16 multiplier, fully pipelined.
13970 The following instructions are enabled: MPYW, and MPYUW.
13971
13972 @item 2
13973 @opindex wlh1
13974 The multiply option is set to wlh1: 32x32 multiplier, fully
13975 pipelined (1 stage). The following instructions are additionally
13976 enabled: MPY, MPYU, MPYM, MPYMU, and MPY_S.
13977
13978 @item 3
13979 @opindex wlh2
13980 The multiply option is set to wlh2: 32x32 multiplier, fully pipelined
13981 (2 stages). The following instructions are additionally enabled: MPY,
13982 MPYU, MPYM, MPYMU, and MPY_S.
13983
13984 @item 4
13985 @opindex wlh3
13986 The multiply option is set to wlh3: Two 16x16 multiplier, blocking,
13987 sequential. The following instructions are additionally enabled: MPY,
13988 MPYU, MPYM, MPYMU, and MPY_S.
13989
13990 @item 5
13991 @opindex wlh4
13992 The multiply option is set to wlh4: One 16x16 multiplier, blocking,
13993 sequential. The following instructions are additionally enabled: MPY,
13994 MPYU, MPYM, MPYMU, and MPY_S.
13995
13996 @item 6
13997 @opindex wlh5
13998 The multiply option is set to wlh5: One 32x4 multiplier, blocking,
13999 sequential. The following instructions are additionally enabled: MPY,
14000 MPYU, MPYM, MPYMU, and MPY_S.
14001
14002 @end table
14003
14004 This option is only available for ARCv2 cores@.
14005
14006 @item -mfpu=@var{fpu}
14007 @opindex mfpu
14008 Enables specific floating-point hardware extension for ARCv2
14009 core. Supported values for @var{fpu} are:
14010
14011 @table @samp
14012
14013 @item fpus
14014 @opindex fpus
14015 Enables support for single precision floating point hardware
14016 extensions@.
14017
14018 @item fpud
14019 @opindex fpud
14020 Enables support for double precision floating point hardware
14021 extensions. The single precision floating point extension is also
14022 enabled. Not available for ARC EM@.
14023
14024 @item fpuda
14025 @opindex fpuda
14026 Enables support for double precision floating point hardware
14027 extensions using double precision assist instructions. The single
14028 precision floating point extension is also enabled. This option is
14029 only available for ARC EM@.
14030
14031 @item fpuda_div
14032 @opindex fpuda_div
14033 Enables support for double precision floating point hardware
14034 extensions using double precision assist instructions, and simple
14035 precision square-root and divide hardware extensions. The single
14036 precision floating point extension is also enabled. This option is
14037 only available for ARC EM@.
14038
14039 @item fpuda_fma
14040 @opindex fpuda_fma
14041 Enables support for double precision floating point hardware
14042 extensions using double precision assist instructions, and simple
14043 precision fused multiple and add hardware extension. The single
14044 precision floating point extension is also enabled. This option is
14045 only available for ARC EM@.
14046
14047 @item fpuda_all
14048 @opindex fpuda_all
14049 Enables support for double precision floating point hardware
14050 extensions using double precision assist instructions, and all simple
14051 precision hardware extensions. The single precision floating point
14052 extension is also enabled. This option is only available for ARC EM@.
14053
14054 @item fpus_div
14055 @opindex fpus_div
14056 Enables support for single precision floating point, and single
14057 precision square-root and divide hardware extensions@.
14058
14059 @item fpud_div
14060 @opindex fpud_div
14061 Enables support for double precision floating point, and double
14062 precision square-root and divide hardware extensions. This option
14063 includes option @samp{fpus_div}. Not available for ARC EM@.
14064
14065 @item fpus_fma
14066 @opindex fpus_fma
14067 Enables support for single precision floating point, and single
14068 precision fused multiple and add hardware extensions@.
14069
14070 @item fpud_fma
14071 @opindex fpud_fma
14072 Enables support for double precision floating point, and double
14073 precision fused multiple and add hardware extensions. This option
14074 includes option @samp{fpus_fma}. Not available for ARC EM@.
14075
14076 @item fpus_all
14077 @opindex fpus_all
14078 Enables support for all single precision floating point hardware
14079 extensions@.
14080
14081 @item fpud_all
14082 @opindex fpud_all
14083 Enables support for all single and double precision floating point
14084 hardware extensions. Not available for ARC EM@.
14085
14086 @end table
14087
14088 @end table
14089
14090 The following options are passed through to the assembler, and also
14091 define preprocessor macro symbols.
14092
14093 @c Flags used by the assembler, but for which we define preprocessor
14094 @c macro symbols as well.
14095 @table @gcctabopt
14096 @item -mdsp-packa
14097 @opindex mdsp-packa
14098 Passed down to the assembler to enable the DSP Pack A extensions.
14099 Also sets the preprocessor symbol @code{__Xdsp_packa}.
14100
14101 @item -mdvbf
14102 @opindex mdvbf
14103 Passed down to the assembler to enable the dual viterbi butterfly
14104 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
14105
14106 @c ARC700 4.10 extension instruction
14107 @item -mlock
14108 @opindex mlock
14109 Passed down to the assembler to enable the Locked Load/Store
14110 Conditional extension. Also sets the preprocessor symbol
14111 @code{__Xlock}.
14112
14113 @item -mmac-d16
14114 @opindex mmac-d16
14115 Passed down to the assembler. Also sets the preprocessor symbol
14116 @code{__Xxmac_d16}.
14117
14118 @item -mmac-24
14119 @opindex mmac-24
14120 Passed down to the assembler. Also sets the preprocessor symbol
14121 @code{__Xxmac_24}.
14122
14123 @c ARC700 4.10 extension instruction
14124 @item -mrtsc
14125 @opindex mrtsc
14126 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
14127 extension instruction. Also sets the preprocessor symbol
14128 @code{__Xrtsc}.
14129
14130 @c ARC700 4.10 extension instruction
14131 @item -mswape
14132 @opindex mswape
14133 Passed down to the assembler to enable the swap byte ordering
14134 extension instruction. Also sets the preprocessor symbol
14135 @code{__Xswape}.
14136
14137 @item -mtelephony
14138 @opindex mtelephony
14139 Passed down to the assembler to enable dual and single operand
14140 instructions for telephony. Also sets the preprocessor symbol
14141 @code{__Xtelephony}.
14142
14143 @item -mxy
14144 @opindex mxy
14145 Passed down to the assembler to enable the XY Memory extension. Also
14146 sets the preprocessor symbol @code{__Xxy}.
14147
14148 @end table
14149
14150 The following options control how the assembly code is annotated:
14151
14152 @c Assembly annotation options
14153 @table @gcctabopt
14154 @item -misize
14155 @opindex misize
14156 Annotate assembler instructions with estimated addresses.
14157
14158 @item -mannotate-align
14159 @opindex mannotate-align
14160 Explain what alignment considerations lead to the decision to make an
14161 instruction short or long.
14162
14163 @end table
14164
14165 The following options are passed through to the linker:
14166
14167 @c options passed through to the linker
14168 @table @gcctabopt
14169 @item -marclinux
14170 @opindex marclinux
14171 Passed through to the linker, to specify use of the @code{arclinux} emulation.
14172 This option is enabled by default in tool chains built for
14173 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
14174 when profiling is not requested.
14175
14176 @item -marclinux_prof
14177 @opindex marclinux_prof
14178 Passed through to the linker, to specify use of the
14179 @code{arclinux_prof} emulation. This option is enabled by default in
14180 tool chains built for @w{@code{arc-linux-uclibc}} and
14181 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
14182
14183 @end table
14184
14185 The following options control the semantics of generated code:
14186
14187 @c semantically relevant code generation options
14188 @table @gcctabopt
14189 @item -mlong-calls
14190 @opindex mlong-calls
14191 Generate call insns as register indirect calls, thus providing access
14192 to the full 32-bit address range.
14193
14194 @item -mmedium-calls
14195 @opindex mmedium-calls
14196 Don't use less than 25 bit addressing range for calls, which is the
14197 offset available for an unconditional branch-and-link
14198 instruction. Conditional execution of function calls is suppressed, to
14199 allow use of the 25-bit range, rather than the 21-bit range with
14200 conditional branch-and-link. This is the default for tool chains built
14201 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
14202
14203 @item -mno-sdata
14204 @opindex mno-sdata
14205 Do not generate sdata references. This is the default for tool chains
14206 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
14207 targets.
14208
14209 @item -mucb-mcount
14210 @opindex mucb-mcount
14211 Instrument with mcount calls as used in UCB code. I.e. do the
14212 counting in the callee, not the caller. By default ARC instrumentation
14213 counts in the caller.
14214
14215 @item -mvolatile-cache
14216 @opindex mvolatile-cache
14217 Use ordinarily cached memory accesses for volatile references. This is the
14218 default.
14219
14220 @item -mno-volatile-cache
14221 @opindex mno-volatile-cache
14222 Enable cache bypass for volatile references.
14223
14224 @end table
14225
14226 The following options fine tune code generation:
14227 @c code generation tuning options
14228 @table @gcctabopt
14229 @item -malign-call
14230 @opindex malign-call
14231 Do alignment optimizations for call instructions.
14232
14233 @item -mauto-modify-reg
14234 @opindex mauto-modify-reg
14235 Enable the use of pre/post modify with register displacement.
14236
14237 @item -mbbit-peephole
14238 @opindex mbbit-peephole
14239 Enable bbit peephole2.
14240
14241 @item -mno-brcc
14242 @opindex mno-brcc
14243 This option disables a target-specific pass in @file{arc_reorg} to
14244 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
14245 generation driven by the combiner pass.
14246
14247 @item -mcase-vector-pcrel
14248 @opindex mcase-vector-pcrel
14249 Use pc-relative switch case tables - this enables case table shortening.
14250 This is the default for @option{-Os}.
14251
14252 @item -mcompact-casesi
14253 @opindex mcompact-casesi
14254 Enable compact casesi pattern.
14255 This is the default for @option{-Os}.
14256
14257 @item -mno-cond-exec
14258 @opindex mno-cond-exec
14259 Disable ARCompact specific pass to generate conditional execution instructions.
14260 Due to delay slot scheduling and interactions between operand numbers,
14261 literal sizes, instruction lengths, and the support for conditional execution,
14262 the target-independent pass to generate conditional execution is often lacking,
14263 so the ARC port has kept a special pass around that tries to find more
14264 conditional execution generating opportunities after register allocation,
14265 branch shortening, and delay slot scheduling have been done. This pass
14266 generally, but not always, improves performance and code size, at the cost of
14267 extra compilation time, which is why there is an option to switch it off.
14268 If you have a problem with call instructions exceeding their allowable
14269 offset range because they are conditionalized, you should consider using
14270 @option{-mmedium-calls} instead.
14271
14272 @item -mearly-cbranchsi
14273 @opindex mearly-cbranchsi
14274 Enable pre-reload use of the cbranchsi pattern.
14275
14276 @item -mexpand-adddi
14277 @opindex mexpand-adddi
14278 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
14279 @code{add.f}, @code{adc} etc.
14280
14281 @item -mindexed-loads
14282 @opindex mindexed-loads
14283 Enable the use of indexed loads. This can be problematic because some
14284 optimizers then assume that indexed stores exist, which is not
14285 the case.
14286
14287 @opindex mlra
14288 Enable Local Register Allocation. This is still experimental for ARC,
14289 so by default the compiler uses standard reload
14290 (i.e. @option{-mno-lra}).
14291
14292 @item -mlra-priority-none
14293 @opindex mlra-priority-none
14294 Don't indicate any priority for target registers.
14295
14296 @item -mlra-priority-compact
14297 @opindex mlra-priority-compact
14298 Indicate target register priority for r0..r3 / r12..r15.
14299
14300 @item -mlra-priority-noncompact
14301 @opindex mlra-priority-noncompact
14302 Reduce target register priority for r0..r3 / r12..r15.
14303
14304 @item -mno-millicode
14305 @opindex mno-millicode
14306 When optimizing for size (using @option{-Os}), prologues and epilogues
14307 that have to save or restore a large number of registers are often
14308 shortened by using call to a special function in libgcc; this is
14309 referred to as a @emph{millicode} call. As these calls can pose
14310 performance issues, and/or cause linking issues when linking in a
14311 nonstandard way, this option is provided to turn off millicode call
14312 generation.
14313
14314 @item -mmixed-code
14315 @opindex mmixed-code
14316 Tweak register allocation to help 16-bit instruction generation.
14317 This generally has the effect of decreasing the average instruction size
14318 while increasing the instruction count.
14319
14320 @item -mq-class
14321 @opindex mq-class
14322 Enable 'q' instruction alternatives.
14323 This is the default for @option{-Os}.
14324
14325 @item -mRcq
14326 @opindex mRcq
14327 Enable Rcq constraint handling - most short code generation depends on this.
14328 This is the default.
14329
14330 @item -mRcw
14331 @opindex mRcw
14332 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
14333 This is the default.
14334
14335 @item -msize-level=@var{level}
14336 @opindex msize-level
14337 Fine-tune size optimization with regards to instruction lengths and alignment.
14338 The recognized values for @var{level} are:
14339 @table @samp
14340 @item 0
14341 No size optimization. This level is deprecated and treated like @samp{1}.
14342
14343 @item 1
14344 Short instructions are used opportunistically.
14345
14346 @item 2
14347 In addition, alignment of loops and of code after barriers are dropped.
14348
14349 @item 3
14350 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
14351
14352 @end table
14353
14354 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
14355 the behavior when this is not set is equivalent to level @samp{1}.
14356
14357 @item -mtune=@var{cpu}
14358 @opindex mtune
14359 Set instruction scheduling parameters for @var{cpu}, overriding any implied
14360 by @option{-mcpu=}.
14361
14362 Supported values for @var{cpu} are
14363
14364 @table @samp
14365 @item ARC600
14366 Tune for ARC600 cpu.
14367
14368 @item ARC601
14369 Tune for ARC601 cpu.
14370
14371 @item ARC700
14372 Tune for ARC700 cpu with standard multiplier block.
14373
14374 @item ARC700-xmac
14375 Tune for ARC700 cpu with XMAC block.
14376
14377 @item ARC725D
14378 Tune for ARC725D cpu.
14379
14380 @item ARC750D
14381 Tune for ARC750D cpu.
14382
14383 @end table
14384
14385 @item -mmultcost=@var{num}
14386 @opindex mmultcost
14387 Cost to assume for a multiply instruction, with @samp{4} being equal to a
14388 normal instruction.
14389
14390 @item -munalign-prob-threshold=@var{probability}
14391 @opindex munalign-prob-threshold
14392 Set probability threshold for unaligning branches.
14393 When tuning for @samp{ARC700} and optimizing for speed, branches without
14394 filled delay slot are preferably emitted unaligned and long, unless
14395 profiling indicates that the probability for the branch to be taken
14396 is below @var{probability}. @xref{Cross-profiling}.
14397 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
14398
14399 @end table
14400
14401 The following options are maintained for backward compatibility, but
14402 are now deprecated and will be removed in a future release:
14403
14404 @c Deprecated options
14405 @table @gcctabopt
14406
14407 @item -margonaut
14408 @opindex margonaut
14409 Obsolete FPX.
14410
14411 @item -mbig-endian
14412 @opindex mbig-endian
14413 @itemx -EB
14414 @opindex EB
14415 Compile code for big endian targets. Use of these options is now
14416 deprecated. Users wanting big-endian code, should use the
14417 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
14418 building the tool chain, for which big-endian is the default.
14419
14420 @item -mlittle-endian
14421 @opindex mlittle-endian
14422 @itemx -EL
14423 @opindex EL
14424 Compile code for little endian targets. Use of these options is now
14425 deprecated. Users wanting little-endian code should use the
14426 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
14427 building the tool chain, for which little-endian is the default.
14428
14429 @item -mbarrel_shifter
14430 @opindex mbarrel_shifter
14431 Replaced by @option{-mbarrel-shifter}.
14432
14433 @item -mdpfp_compact
14434 @opindex mdpfp_compact
14435 Replaced by @option{-mdpfp-compact}.
14436
14437 @item -mdpfp_fast
14438 @opindex mdpfp_fast
14439 Replaced by @option{-mdpfp-fast}.
14440
14441 @item -mdsp_packa
14442 @opindex mdsp_packa
14443 Replaced by @option{-mdsp-packa}.
14444
14445 @item -mEA
14446 @opindex mEA
14447 Replaced by @option{-mea}.
14448
14449 @item -mmac_24
14450 @opindex mmac_24
14451 Replaced by @option{-mmac-24}.
14452
14453 @item -mmac_d16
14454 @opindex mmac_d16
14455 Replaced by @option{-mmac-d16}.
14456
14457 @item -mspfp_compact
14458 @opindex mspfp_compact
14459 Replaced by @option{-mspfp-compact}.
14460
14461 @item -mspfp_fast
14462 @opindex mspfp_fast
14463 Replaced by @option{-mspfp-fast}.
14464
14465 @item -mtune=@var{cpu}
14466 @opindex mtune
14467 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
14468 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
14469 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
14470
14471 @item -multcost=@var{num}
14472 @opindex multcost
14473 Replaced by @option{-mmultcost}.
14474
14475 @end table
14476
14477 @node ARM Options
14478 @subsection ARM Options
14479 @cindex ARM options
14480
14481 These @samp{-m} options are defined for the ARM port:
14482
14483 @table @gcctabopt
14484 @item -mabi=@var{name}
14485 @opindex mabi
14486 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
14487 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
14488
14489 @item -mapcs-frame
14490 @opindex mapcs-frame
14491 Generate a stack frame that is compliant with the ARM Procedure Call
14492 Standard for all functions, even if this is not strictly necessary for
14493 correct execution of the code. Specifying @option{-fomit-frame-pointer}
14494 with this option causes the stack frames not to be generated for
14495 leaf functions. The default is @option{-mno-apcs-frame}.
14496 This option is deprecated.
14497
14498 @item -mapcs
14499 @opindex mapcs
14500 This is a synonym for @option{-mapcs-frame} and is deprecated.
14501
14502 @ignore
14503 @c not currently implemented
14504 @item -mapcs-stack-check
14505 @opindex mapcs-stack-check
14506 Generate code to check the amount of stack space available upon entry to
14507 every function (that actually uses some stack space). If there is
14508 insufficient space available then either the function
14509 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
14510 called, depending upon the amount of stack space required. The runtime
14511 system is required to provide these functions. The default is
14512 @option{-mno-apcs-stack-check}, since this produces smaller code.
14513
14514 @c not currently implemented
14515 @item -mapcs-float
14516 @opindex mapcs-float
14517 Pass floating-point arguments using the floating-point registers. This is
14518 one of the variants of the APCS@. This option is recommended if the
14519 target hardware has a floating-point unit or if a lot of floating-point
14520 arithmetic is going to be performed by the code. The default is
14521 @option{-mno-apcs-float}, since the size of integer-only code is
14522 slightly increased if @option{-mapcs-float} is used.
14523
14524 @c not currently implemented
14525 @item -mapcs-reentrant
14526 @opindex mapcs-reentrant
14527 Generate reentrant, position-independent code. The default is
14528 @option{-mno-apcs-reentrant}.
14529 @end ignore
14530
14531 @item -mthumb-interwork
14532 @opindex mthumb-interwork
14533 Generate code that supports calling between the ARM and Thumb
14534 instruction sets. Without this option, on pre-v5 architectures, the
14535 two instruction sets cannot be reliably used inside one program. The
14536 default is @option{-mno-thumb-interwork}, since slightly larger code
14537 is generated when @option{-mthumb-interwork} is specified. In AAPCS
14538 configurations this option is meaningless.
14539
14540 @item -mno-sched-prolog
14541 @opindex mno-sched-prolog
14542 Prevent the reordering of instructions in the function prologue, or the
14543 merging of those instruction with the instructions in the function's
14544 body. This means that all functions start with a recognizable set
14545 of instructions (or in fact one of a choice from a small set of
14546 different function prologues), and this information can be used to
14547 locate the start of functions inside an executable piece of code. The
14548 default is @option{-msched-prolog}.
14549
14550 @item -mfloat-abi=@var{name}
14551 @opindex mfloat-abi
14552 Specifies which floating-point ABI to use. Permissible values
14553 are: @samp{soft}, @samp{softfp} and @samp{hard}.
14554
14555 Specifying @samp{soft} causes GCC to generate output containing
14556 library calls for floating-point operations.
14557 @samp{softfp} allows the generation of code using hardware floating-point
14558 instructions, but still uses the soft-float calling conventions.
14559 @samp{hard} allows generation of floating-point instructions
14560 and uses FPU-specific calling conventions.
14561
14562 The default depends on the specific target configuration. Note that
14563 the hard-float and soft-float ABIs are not link-compatible; you must
14564 compile your entire program with the same ABI, and link with a
14565 compatible set of libraries.
14566
14567 @item -mlittle-endian
14568 @opindex mlittle-endian
14569 Generate code for a processor running in little-endian mode. This is
14570 the default for all standard configurations.
14571
14572 @item -mbig-endian
14573 @opindex mbig-endian
14574 Generate code for a processor running in big-endian mode; the default is
14575 to compile code for a little-endian processor.
14576
14577 @item -march=@var{name}
14578 @opindex march
14579 This specifies the name of the target ARM architecture. GCC uses this
14580 name to determine what kind of instructions it can emit when generating
14581 assembly code. This option can be used in conjunction with or instead
14582 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
14583 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
14584 @samp{armv5}, @samp{armv5e}, @samp{armv5t}, @samp{armv5te},
14585 @samp{armv6}, @samp{armv6-m}, @samp{armv6j}, @samp{armv6k},
14586 @samp{armv6kz}, @samp{armv6s-m},
14587 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk},
14588 @samp{armv7}, @samp{armv7-a}, @samp{armv7-m}, @samp{armv7-r}, @samp{armv7e-m},
14589 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
14590 @samp{armv8.1-a+crc}, @samp{armv8-m.base}, @samp{armv8-m.main},
14591 @samp{armv8-m.main+dsp}, @samp{iwmmxt}, @samp{iwmmxt2}.
14592
14593 Architecture revisions older than @samp{armv4t} are deprecated.
14594
14595 @option{-march=armv6s-m} is the @samp{armv6-m} architecture with support for
14596 the (now mandatory) SVC instruction.
14597
14598 @option{-march=armv6zk} is an alias for @samp{armv6kz}, existing for backwards
14599 compatibility.
14600
14601 @option{-march=armv7ve} is the @samp{armv7-a} architecture with virtualization
14602 extensions.
14603
14604 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
14605 architecture together with the optional CRC32 extensions.
14606
14607 @option{-march=armv8.1-a} enables compiler support for the ARMv8.1-A
14608 architecture. This also enables the features provided by
14609 @option{-march=armv8-a+crc}.
14610
14611 @option{-march=armv8.2-a} enables compiler support for the ARMv8.2-A
14612 architecture. This also enables the features provided by
14613 @option{-march=armv8.1-a}.
14614
14615 @option{-march=armv8.2-a+fp16} enables compiler support for the
14616 ARMv8.2-A architecture with the optional FP16 instructions extension.
14617 This also enables the features provided by @option{-march=armv8.1-a}
14618 and implies @option{-mfp16-format=ieee}.
14619
14620 @option{-march=native} causes the compiler to auto-detect the architecture
14621 of the build computer. At present, this feature is only supported on
14622 GNU/Linux, and not all architectures are recognized. If the auto-detect
14623 is unsuccessful the option has no effect.
14624
14625 @item -mtune=@var{name}
14626 @opindex mtune
14627 This option specifies the name of the target ARM processor for
14628 which GCC should tune the performance of the code.
14629 For some ARM implementations better performance can be obtained by using
14630 this option.
14631 Permissible names are: @samp{arm2}, @samp{arm250},
14632 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
14633 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
14634 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
14635 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
14636 @samp{arm720},
14637 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
14638 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
14639 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
14640 @samp{strongarm1110},
14641 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
14642 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
14643 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
14644 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
14645 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
14646 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
14647 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
14648 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
14649 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
14650 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
14651 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-r4},
14652 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
14653 @samp{cortex-m7},
14654 @samp{cortex-m4},
14655 @samp{cortex-m3},
14656 @samp{cortex-m1},
14657 @samp{cortex-m0},
14658 @samp{cortex-m0plus},
14659 @samp{cortex-m1.small-multiply},
14660 @samp{cortex-m0.small-multiply},
14661 @samp{cortex-m0plus.small-multiply},
14662 @samp{exynos-m1},
14663 @samp{qdf24xx},
14664 @samp{marvell-pj4},
14665 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
14666 @samp{fa526}, @samp{fa626},
14667 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
14668 @samp{xgene1}.
14669
14670 Additionally, this option can specify that GCC should tune the performance
14671 of the code for a big.LITTLE system. Permissible names are:
14672 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
14673 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14674 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}.
14675
14676 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
14677 performance for a blend of processors within architecture @var{arch}.
14678 The aim is to generate code that run well on the current most popular
14679 processors, balancing between optimizations that benefit some CPUs in the
14680 range, and avoiding performance pitfalls of other CPUs. The effects of
14681 this option may change in future GCC versions as CPU models come and go.
14682
14683 @option{-mtune=native} causes the compiler to auto-detect the CPU
14684 of the build computer. At present, this feature is only supported on
14685 GNU/Linux, and not all architectures are recognized. If the auto-detect is
14686 unsuccessful the option has no effect.
14687
14688 @item -mcpu=@var{name}
14689 @opindex mcpu
14690 This specifies the name of the target ARM processor. GCC uses this name
14691 to derive the name of the target ARM architecture (as if specified
14692 by @option{-march}) and the ARM processor type for which to tune for
14693 performance (as if specified by @option{-mtune}). Where this option
14694 is used in conjunction with @option{-march} or @option{-mtune},
14695 those options take precedence over the appropriate part of this option.
14696
14697 Permissible names for this option are the same as those for
14698 @option{-mtune}.
14699
14700 @option{-mcpu=generic-@var{arch}} is also permissible, and is
14701 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
14702 See @option{-mtune} for more information.
14703
14704 @option{-mcpu=native} causes the compiler to auto-detect the CPU
14705 of the build computer. At present, this feature is only supported on
14706 GNU/Linux, and not all architectures are recognized. If the auto-detect
14707 is unsuccessful the option has no effect.
14708
14709 @item -mfpu=@var{name}
14710 @opindex mfpu
14711 This specifies what floating-point hardware (or hardware emulation) is
14712 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
14713 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
14714 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
14715 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
14716 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
14717 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
14718
14719 If @option{-msoft-float} is specified this specifies the format of
14720 floating-point values.
14721
14722 If the selected floating-point hardware includes the NEON extension
14723 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
14724 operations are not generated by GCC's auto-vectorization pass unless
14725 @option{-funsafe-math-optimizations} is also specified. This is
14726 because NEON hardware does not fully implement the IEEE 754 standard for
14727 floating-point arithmetic (in particular denormal values are treated as
14728 zero), so the use of NEON instructions may lead to a loss of precision.
14729
14730 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}).
14731
14732 @item -mfp16-format=@var{name}
14733 @opindex mfp16-format
14734 Specify the format of the @code{__fp16} half-precision floating-point type.
14735 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
14736 the default is @samp{none}, in which case the @code{__fp16} type is not
14737 defined. @xref{Half-Precision}, for more information.
14738
14739 @item -mstructure-size-boundary=@var{n}
14740 @opindex mstructure-size-boundary
14741 The sizes of all structures and unions are rounded up to a multiple
14742 of the number of bits set by this option. Permissible values are 8, 32
14743 and 64. The default value varies for different toolchains. For the COFF
14744 targeted toolchain the default value is 8. A value of 64 is only allowed
14745 if the underlying ABI supports it.
14746
14747 Specifying a larger number can produce faster, more efficient code, but
14748 can also increase the size of the program. Different values are potentially
14749 incompatible. Code compiled with one value cannot necessarily expect to
14750 work with code or libraries compiled with another value, if they exchange
14751 information using structures or unions.
14752
14753 @item -mabort-on-noreturn
14754 @opindex mabort-on-noreturn
14755 Generate a call to the function @code{abort} at the end of a
14756 @code{noreturn} function. It is executed if the function tries to
14757 return.
14758
14759 @item -mlong-calls
14760 @itemx -mno-long-calls
14761 @opindex mlong-calls
14762 @opindex mno-long-calls
14763 Tells the compiler to perform function calls by first loading the
14764 address of the function into a register and then performing a subroutine
14765 call on this register. This switch is needed if the target function
14766 lies outside of the 64-megabyte addressing range of the offset-based
14767 version of subroutine call instruction.
14768
14769 Even if this switch is enabled, not all function calls are turned
14770 into long calls. The heuristic is that static functions, functions
14771 that have the @code{short_call} attribute, functions that are inside
14772 the scope of a @code{#pragma no_long_calls} directive, and functions whose
14773 definitions have already been compiled within the current compilation
14774 unit are not turned into long calls. The exceptions to this rule are
14775 that weak function definitions, functions with the @code{long_call}
14776 attribute or the @code{section} attribute, and functions that are within
14777 the scope of a @code{#pragma long_calls} directive are always
14778 turned into long calls.
14779
14780 This feature is not enabled by default. Specifying
14781 @option{-mno-long-calls} restores the default behavior, as does
14782 placing the function calls within the scope of a @code{#pragma
14783 long_calls_off} directive. Note these switches have no effect on how
14784 the compiler generates code to handle function calls via function
14785 pointers.
14786
14787 @item -msingle-pic-base
14788 @opindex msingle-pic-base
14789 Treat the register used for PIC addressing as read-only, rather than
14790 loading it in the prologue for each function. The runtime system is
14791 responsible for initializing this register with an appropriate value
14792 before execution begins.
14793
14794 @item -mpic-register=@var{reg}
14795 @opindex mpic-register
14796 Specify the register to be used for PIC addressing.
14797 For standard PIC base case, the default is any suitable register
14798 determined by compiler. For single PIC base case, the default is
14799 @samp{R9} if target is EABI based or stack-checking is enabled,
14800 otherwise the default is @samp{R10}.
14801
14802 @item -mpic-data-is-text-relative
14803 @opindex mpic-data-is-text-relative
14804 Assume that the displacement between the text and data segments is fixed
14805 at static link time. This permits using PC-relative addressing
14806 operations to access data known to be in the data segment. For
14807 non-VxWorks RTP targets, this option is enabled by default. When
14808 disabled on such targets, it will enable @option{-msingle-pic-base} by
14809 default.
14810
14811 @item -mpoke-function-name
14812 @opindex mpoke-function-name
14813 Write the name of each function into the text section, directly
14814 preceding the function prologue. The generated code is similar to this:
14815
14816 @smallexample
14817 t0
14818 .ascii "arm_poke_function_name", 0
14819 .align
14820 t1
14821 .word 0xff000000 + (t1 - t0)
14822 arm_poke_function_name
14823 mov ip, sp
14824 stmfd sp!, @{fp, ip, lr, pc@}
14825 sub fp, ip, #4
14826 @end smallexample
14827
14828 When performing a stack backtrace, code can inspect the value of
14829 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
14830 location @code{pc - 12} and the top 8 bits are set, then we know that
14831 there is a function name embedded immediately preceding this location
14832 and has length @code{((pc[-3]) & 0xff000000)}.
14833
14834 @item -mthumb
14835 @itemx -marm
14836 @opindex marm
14837 @opindex mthumb
14838
14839 Select between generating code that executes in ARM and Thumb
14840 states. The default for most configurations is to generate code
14841 that executes in ARM state, but the default can be changed by
14842 configuring GCC with the @option{--with-mode=}@var{state}
14843 configure option.
14844
14845 You can also override the ARM and Thumb mode for each function
14846 by using the @code{target("thumb")} and @code{target("arm")} function attributes
14847 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
14848
14849 @item -mtpcs-frame
14850 @opindex mtpcs-frame
14851 Generate a stack frame that is compliant with the Thumb Procedure Call
14852 Standard for all non-leaf functions. (A leaf function is one that does
14853 not call any other functions.) The default is @option{-mno-tpcs-frame}.
14854
14855 @item -mtpcs-leaf-frame
14856 @opindex mtpcs-leaf-frame
14857 Generate a stack frame that is compliant with the Thumb Procedure Call
14858 Standard for all leaf functions. (A leaf function is one that does
14859 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
14860
14861 @item -mcallee-super-interworking
14862 @opindex mcallee-super-interworking
14863 Gives all externally visible functions in the file being compiled an ARM
14864 instruction set header which switches to Thumb mode before executing the
14865 rest of the function. This allows these functions to be called from
14866 non-interworking code. This option is not valid in AAPCS configurations
14867 because interworking is enabled by default.
14868
14869 @item -mcaller-super-interworking
14870 @opindex mcaller-super-interworking
14871 Allows calls via function pointers (including virtual functions) to
14872 execute correctly regardless of whether the target code has been
14873 compiled for interworking or not. There is a small overhead in the cost
14874 of executing a function pointer if this option is enabled. This option
14875 is not valid in AAPCS configurations because interworking is enabled
14876 by default.
14877
14878 @item -mtp=@var{name}
14879 @opindex mtp
14880 Specify the access model for the thread local storage pointer. The valid
14881 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
14882 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
14883 (supported in the arm6k architecture), and @samp{auto}, which uses the
14884 best available method for the selected processor. The default setting is
14885 @samp{auto}.
14886
14887 @item -mtls-dialect=@var{dialect}
14888 @opindex mtls-dialect
14889 Specify the dialect to use for accessing thread local storage. Two
14890 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
14891 @samp{gnu} dialect selects the original GNU scheme for supporting
14892 local and global dynamic TLS models. The @samp{gnu2} dialect
14893 selects the GNU descriptor scheme, which provides better performance
14894 for shared libraries. The GNU descriptor scheme is compatible with
14895 the original scheme, but does require new assembler, linker and
14896 library support. Initial and local exec TLS models are unaffected by
14897 this option and always use the original scheme.
14898
14899 @item -mword-relocations
14900 @opindex mword-relocations
14901 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
14902 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
14903 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
14904 is specified.
14905
14906 @item -mfix-cortex-m3-ldrd
14907 @opindex mfix-cortex-m3-ldrd
14908 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
14909 with overlapping destination and base registers are used. This option avoids
14910 generating these instructions. This option is enabled by default when
14911 @option{-mcpu=cortex-m3} is specified.
14912
14913 @item -munaligned-access
14914 @itemx -mno-unaligned-access
14915 @opindex munaligned-access
14916 @opindex mno-unaligned-access
14917 Enables (or disables) reading and writing of 16- and 32- bit values
14918 from addresses that are not 16- or 32- bit aligned. By default
14919 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
14920 ARMv8-M Baseline architectures, and enabled for all other
14921 architectures. If unaligned access is not enabled then words in packed
14922 data structures are accessed a byte at a time.
14923
14924 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
14925 generated object file to either true or false, depending upon the
14926 setting of this option. If unaligned access is enabled then the
14927 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
14928 defined.
14929
14930 @item -mneon-for-64bits
14931 @opindex mneon-for-64bits
14932 Enables using Neon to handle scalar 64-bits operations. This is
14933 disabled by default since the cost of moving data from core registers
14934 to Neon is high.
14935
14936 @item -mslow-flash-data
14937 @opindex mslow-flash-data
14938 Assume loading data from flash is slower than fetching instruction.
14939 Therefore literal load is minimized for better performance.
14940 This option is only supported when compiling for ARMv7 M-profile and
14941 off by default.
14942
14943 @item -masm-syntax-unified
14944 @opindex masm-syntax-unified
14945 Assume inline assembler is using unified asm syntax. The default is
14946 currently off which implies divided syntax. This option has no impact
14947 on Thumb2. However, this may change in future releases of GCC.
14948 Divided syntax should be considered deprecated.
14949
14950 @item -mrestrict-it
14951 @opindex mrestrict-it
14952 Restricts generation of IT blocks to conform to the rules of ARMv8.
14953 IT blocks can only contain a single 16-bit instruction from a select
14954 set of instructions. This option is on by default for ARMv8 Thumb mode.
14955
14956 @item -mprint-tune-info
14957 @opindex mprint-tune-info
14958 Print CPU tuning information as comment in assembler file. This is
14959 an option used only for regression testing of the compiler and not
14960 intended for ordinary use in compiling code. This option is disabled
14961 by default.
14962
14963 @item -mpure-code
14964 @opindex mpure-code
14965 Do not allow constant data to be placed in code sections.
14966 Additionally, when compiling for ELF object format give all text sections the
14967 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
14968 is only available when generating non-pic code for ARMv7-M targets.
14969
14970 @end table
14971
14972 @node AVR Options
14973 @subsection AVR Options
14974 @cindex AVR Options
14975
14976 These options are defined for AVR implementations:
14977
14978 @table @gcctabopt
14979 @item -mmcu=@var{mcu}
14980 @opindex mmcu
14981 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
14982
14983 The default for this option is@tie{}@samp{avr2}.
14984
14985 GCC supports the following AVR devices and ISAs:
14986
14987 @include avr-mmcu.texi
14988
14989 @item -maccumulate-args
14990 @opindex maccumulate-args
14991 Accumulate outgoing function arguments and acquire/release the needed
14992 stack space for outgoing function arguments once in function
14993 prologue/epilogue. Without this option, outgoing arguments are pushed
14994 before calling a function and popped afterwards.
14995
14996 Popping the arguments after the function call can be expensive on
14997 AVR so that accumulating the stack space might lead to smaller
14998 executables because arguments need not to be removed from the
14999 stack after such a function call.
15000
15001 This option can lead to reduced code size for functions that perform
15002 several calls to functions that get their arguments on the stack like
15003 calls to printf-like functions.
15004
15005 @item -mbranch-cost=@var{cost}
15006 @opindex mbranch-cost
15007 Set the branch costs for conditional branch instructions to
15008 @var{cost}. Reasonable values for @var{cost} are small, non-negative
15009 integers. The default branch cost is 0.
15010
15011 @item -mcall-prologues
15012 @opindex mcall-prologues
15013 Functions prologues/epilogues are expanded as calls to appropriate
15014 subroutines. Code size is smaller.
15015
15016 @item -mint8
15017 @opindex mint8
15018 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
15019 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
15020 and @code{long long} is 4 bytes. Please note that this option does not
15021 conform to the C standards, but it results in smaller code
15022 size.
15023
15024 @item -mn-flash=@var{num}
15025 @opindex mn-flash
15026 Assume that the flash memory has a size of
15027 @var{num} times 64@tie{}KiB.
15028
15029 @item -mno-interrupts
15030 @opindex mno-interrupts
15031 Generated code is not compatible with hardware interrupts.
15032 Code size is smaller.
15033
15034 @item -mrelax
15035 @opindex mrelax
15036 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
15037 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
15038 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
15039 the assembler's command line and the @option{--relax} option to the
15040 linker's command line.
15041
15042 Jump relaxing is performed by the linker because jump offsets are not
15043 known before code is located. Therefore, the assembler code generated by the
15044 compiler is the same, but the instructions in the executable may
15045 differ from instructions in the assembler code.
15046
15047 Relaxing must be turned on if linker stubs are needed, see the
15048 section on @code{EIND} and linker stubs below.
15049
15050 @item -mrmw
15051 @opindex mrmw
15052 Assume that the device supports the Read-Modify-Write
15053 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
15054
15055 @item -msp8
15056 @opindex msp8
15057 Treat the stack pointer register as an 8-bit register,
15058 i.e.@: assume the high byte of the stack pointer is zero.
15059 In general, you don't need to set this option by hand.
15060
15061 This option is used internally by the compiler to select and
15062 build multilibs for architectures @code{avr2} and @code{avr25}.
15063 These architectures mix devices with and without @code{SPH}.
15064 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
15065 the compiler driver adds or removes this option from the compiler
15066 proper's command line, because the compiler then knows if the device
15067 or architecture has an 8-bit stack pointer and thus no @code{SPH}
15068 register or not.
15069
15070 @item -mstrict-X
15071 @opindex mstrict-X
15072 Use address register @code{X} in a way proposed by the hardware. This means
15073 that @code{X} is only used in indirect, post-increment or
15074 pre-decrement addressing.
15075
15076 Without this option, the @code{X} register may be used in the same way
15077 as @code{Y} or @code{Z} which then is emulated by additional
15078 instructions.
15079 For example, loading a value with @code{X+const} addressing with a
15080 small non-negative @code{const < 64} to a register @var{Rn} is
15081 performed as
15082
15083 @example
15084 adiw r26, const ; X += const
15085 ld @var{Rn}, X ; @var{Rn} = *X
15086 sbiw r26, const ; X -= const
15087 @end example
15088
15089 @item -mtiny-stack
15090 @opindex mtiny-stack
15091 Only change the lower 8@tie{}bits of the stack pointer.
15092
15093 @item -mfract-convert-truncate
15094 @opindex mfract-convert-truncate
15095 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
15096
15097 @item -nodevicelib
15098 @opindex nodevicelib
15099 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
15100
15101 @item -Waddr-space-convert
15102 @opindex Waddr-space-convert
15103 Warn about conversions between address spaces in the case where the
15104 resulting address space is not contained in the incoming address space.
15105
15106 @item -Wmisspelled-isr
15107 @opindex Wmisspelled-isr
15108 Warn if the ISR is misspelled, i.e. without __vector prefix.
15109 Enabled by default.
15110 @end table
15111
15112 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
15113 @cindex @code{EIND}
15114 Pointers in the implementation are 16@tie{}bits wide.
15115 The address of a function or label is represented as word address so
15116 that indirect jumps and calls can target any code address in the
15117 range of 64@tie{}Ki words.
15118
15119 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
15120 bytes of program memory space, there is a special function register called
15121 @code{EIND} that serves as most significant part of the target address
15122 when @code{EICALL} or @code{EIJMP} instructions are used.
15123
15124 Indirect jumps and calls on these devices are handled as follows by
15125 the compiler and are subject to some limitations:
15126
15127 @itemize @bullet
15128
15129 @item
15130 The compiler never sets @code{EIND}.
15131
15132 @item
15133 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
15134 instructions or might read @code{EIND} directly in order to emulate an
15135 indirect call/jump by means of a @code{RET} instruction.
15136
15137 @item
15138 The compiler assumes that @code{EIND} never changes during the startup
15139 code or during the application. In particular, @code{EIND} is not
15140 saved/restored in function or interrupt service routine
15141 prologue/epilogue.
15142
15143 @item
15144 For indirect calls to functions and computed goto, the linker
15145 generates @emph{stubs}. Stubs are jump pads sometimes also called
15146 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
15147 The stub contains a direct jump to the desired address.
15148
15149 @item
15150 Linker relaxation must be turned on so that the linker generates
15151 the stubs correctly in all situations. See the compiler option
15152 @option{-mrelax} and the linker option @option{--relax}.
15153 There are corner cases where the linker is supposed to generate stubs
15154 but aborts without relaxation and without a helpful error message.
15155
15156 @item
15157 The default linker script is arranged for code with @code{EIND = 0}.
15158 If code is supposed to work for a setup with @code{EIND != 0}, a custom
15159 linker script has to be used in order to place the sections whose
15160 name start with @code{.trampolines} into the segment where @code{EIND}
15161 points to.
15162
15163 @item
15164 The startup code from libgcc never sets @code{EIND}.
15165 Notice that startup code is a blend of code from libgcc and AVR-LibC.
15166 For the impact of AVR-LibC on @code{EIND}, see the
15167 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
15168
15169 @item
15170 It is legitimate for user-specific startup code to set up @code{EIND}
15171 early, for example by means of initialization code located in
15172 section @code{.init3}. Such code runs prior to general startup code
15173 that initializes RAM and calls constructors, but after the bit
15174 of startup code from AVR-LibC that sets @code{EIND} to the segment
15175 where the vector table is located.
15176 @example
15177 #include <avr/io.h>
15178
15179 static void
15180 __attribute__((section(".init3"),naked,used,no_instrument_function))
15181 init3_set_eind (void)
15182 @{
15183 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
15184 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
15185 @}
15186 @end example
15187
15188 @noindent
15189 The @code{__trampolines_start} symbol is defined in the linker script.
15190
15191 @item
15192 Stubs are generated automatically by the linker if
15193 the following two conditions are met:
15194 @itemize @minus
15195
15196 @item The address of a label is taken by means of the @code{gs} modifier
15197 (short for @emph{generate stubs}) like so:
15198 @example
15199 LDI r24, lo8(gs(@var{func}))
15200 LDI r25, hi8(gs(@var{func}))
15201 @end example
15202 @item The final location of that label is in a code segment
15203 @emph{outside} the segment where the stubs are located.
15204 @end itemize
15205
15206 @item
15207 The compiler emits such @code{gs} modifiers for code labels in the
15208 following situations:
15209 @itemize @minus
15210 @item Taking address of a function or code label.
15211 @item Computed goto.
15212 @item If prologue-save function is used, see @option{-mcall-prologues}
15213 command-line option.
15214 @item Switch/case dispatch tables. If you do not want such dispatch
15215 tables you can specify the @option{-fno-jump-tables} command-line option.
15216 @item C and C++ constructors/destructors called during startup/shutdown.
15217 @item If the tools hit a @code{gs()} modifier explained above.
15218 @end itemize
15219
15220 @item
15221 Jumping to non-symbolic addresses like so is @emph{not} supported:
15222
15223 @example
15224 int main (void)
15225 @{
15226 /* Call function at word address 0x2 */
15227 return ((int(*)(void)) 0x2)();
15228 @}
15229 @end example
15230
15231 Instead, a stub has to be set up, i.e.@: the function has to be called
15232 through a symbol (@code{func_4} in the example):
15233
15234 @example
15235 int main (void)
15236 @{
15237 extern int func_4 (void);
15238
15239 /* Call function at byte address 0x4 */
15240 return func_4();
15241 @}
15242 @end example
15243
15244 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
15245 Alternatively, @code{func_4} can be defined in the linker script.
15246 @end itemize
15247
15248 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
15249 @cindex @code{RAMPD}
15250 @cindex @code{RAMPX}
15251 @cindex @code{RAMPY}
15252 @cindex @code{RAMPZ}
15253 Some AVR devices support memories larger than the 64@tie{}KiB range
15254 that can be accessed with 16-bit pointers. To access memory locations
15255 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
15256 register is used as high part of the address:
15257 The @code{X}, @code{Y}, @code{Z} address register is concatenated
15258 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
15259 register, respectively, to get a wide address. Similarly,
15260 @code{RAMPD} is used together with direct addressing.
15261
15262 @itemize
15263 @item
15264 The startup code initializes the @code{RAMP} special function
15265 registers with zero.
15266
15267 @item
15268 If a @ref{AVR Named Address Spaces,named address space} other than
15269 generic or @code{__flash} is used, then @code{RAMPZ} is set
15270 as needed before the operation.
15271
15272 @item
15273 If the device supports RAM larger than 64@tie{}KiB and the compiler
15274 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
15275 is reset to zero after the operation.
15276
15277 @item
15278 If the device comes with a specific @code{RAMP} register, the ISR
15279 prologue/epilogue saves/restores that SFR and initializes it with
15280 zero in case the ISR code might (implicitly) use it.
15281
15282 @item
15283 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
15284 If you use inline assembler to read from locations outside the
15285 16-bit address range and change one of the @code{RAMP} registers,
15286 you must reset it to zero after the access.
15287
15288 @end itemize
15289
15290 @subsubsection AVR Built-in Macros
15291
15292 GCC defines several built-in macros so that the user code can test
15293 for the presence or absence of features. Almost any of the following
15294 built-in macros are deduced from device capabilities and thus
15295 triggered by the @option{-mmcu=} command-line option.
15296
15297 For even more AVR-specific built-in macros see
15298 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
15299
15300 @table @code
15301
15302 @item __AVR_ARCH__
15303 Build-in macro that resolves to a decimal number that identifies the
15304 architecture and depends on the @option{-mmcu=@var{mcu}} option.
15305 Possible values are:
15306
15307 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
15308 @code{4}, @code{5}, @code{51}, @code{6}
15309
15310 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
15311 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
15312
15313 respectively and
15314
15315 @code{100}, @code{102}, @code{104},
15316 @code{105}, @code{106}, @code{107}
15317
15318 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
15319 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
15320 If @var{mcu} specifies a device, this built-in macro is set
15321 accordingly. For example, with @option{-mmcu=atmega8} the macro is
15322 defined to @code{4}.
15323
15324 @item __AVR_@var{Device}__
15325 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
15326 the device's name. For example, @option{-mmcu=atmega8} defines the
15327 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
15328 @code{__AVR_ATtiny261A__}, etc.
15329
15330 The built-in macros' names follow
15331 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
15332 the device name as from the AVR user manual. The difference between
15333 @var{Device} in the built-in macro and @var{device} in
15334 @option{-mmcu=@var{device}} is that the latter is always lowercase.
15335
15336 If @var{device} is not a device but only a core architecture like
15337 @samp{avr51}, this macro is not defined.
15338
15339 @item __AVR_DEVICE_NAME__
15340 Setting @option{-mmcu=@var{device}} defines this built-in macro to
15341 the device's name. For example, with @option{-mmcu=atmega8} the macro
15342 is defined to @code{atmega8}.
15343
15344 If @var{device} is not a device but only a core architecture like
15345 @samp{avr51}, this macro is not defined.
15346
15347 @item __AVR_XMEGA__
15348 The device / architecture belongs to the XMEGA family of devices.
15349
15350 @item __AVR_HAVE_ELPM__
15351 The device has the @code{ELPM} instruction.
15352
15353 @item __AVR_HAVE_ELPMX__
15354 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
15355 R@var{n},Z+} instructions.
15356
15357 @item __AVR_HAVE_MOVW__
15358 The device has the @code{MOVW} instruction to perform 16-bit
15359 register-register moves.
15360
15361 @item __AVR_HAVE_LPMX__
15362 The device has the @code{LPM R@var{n},Z} and
15363 @code{LPM R@var{n},Z+} instructions.
15364
15365 @item __AVR_HAVE_MUL__
15366 The device has a hardware multiplier.
15367
15368 @item __AVR_HAVE_JMP_CALL__
15369 The device has the @code{JMP} and @code{CALL} instructions.
15370 This is the case for devices with at least 16@tie{}KiB of program
15371 memory.
15372
15373 @item __AVR_HAVE_EIJMP_EICALL__
15374 @itemx __AVR_3_BYTE_PC__
15375 The device has the @code{EIJMP} and @code{EICALL} instructions.
15376 This is the case for devices with more than 128@tie{}KiB of program memory.
15377 This also means that the program counter
15378 (PC) is 3@tie{}bytes wide.
15379
15380 @item __AVR_2_BYTE_PC__
15381 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
15382 with up to 128@tie{}KiB of program memory.
15383
15384 @item __AVR_HAVE_8BIT_SP__
15385 @itemx __AVR_HAVE_16BIT_SP__
15386 The stack pointer (SP) register is treated as 8-bit respectively
15387 16-bit register by the compiler.
15388 The definition of these macros is affected by @option{-mtiny-stack}.
15389
15390 @item __AVR_HAVE_SPH__
15391 @itemx __AVR_SP8__
15392 The device has the SPH (high part of stack pointer) special function
15393 register or has an 8-bit stack pointer, respectively.
15394 The definition of these macros is affected by @option{-mmcu=} and
15395 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
15396 by @option{-msp8}.
15397
15398 @item __AVR_HAVE_RAMPD__
15399 @itemx __AVR_HAVE_RAMPX__
15400 @itemx __AVR_HAVE_RAMPY__
15401 @itemx __AVR_HAVE_RAMPZ__
15402 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
15403 @code{RAMPZ} special function register, respectively.
15404
15405 @item __NO_INTERRUPTS__
15406 This macro reflects the @option{-mno-interrupts} command-line option.
15407
15408 @item __AVR_ERRATA_SKIP__
15409 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
15410 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
15411 instructions because of a hardware erratum. Skip instructions are
15412 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
15413 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
15414 set.
15415
15416 @item __AVR_ISA_RMW__
15417 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
15418
15419 @item __AVR_SFR_OFFSET__=@var{offset}
15420 Instructions that can address I/O special function registers directly
15421 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
15422 address as if addressed by an instruction to access RAM like @code{LD}
15423 or @code{STS}. This offset depends on the device architecture and has
15424 to be subtracted from the RAM address in order to get the
15425 respective I/O@tie{}address.
15426
15427 @item __WITH_AVRLIBC__
15428 The compiler is configured to be used together with AVR-Libc.
15429 See the @option{--with-avrlibc} configure option.
15430
15431 @end table
15432
15433 @node Blackfin Options
15434 @subsection Blackfin Options
15435 @cindex Blackfin Options
15436
15437 @table @gcctabopt
15438 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
15439 @opindex mcpu=
15440 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
15441 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
15442 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
15443 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
15444 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
15445 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
15446 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
15447 @samp{bf561}, @samp{bf592}.
15448
15449 The optional @var{sirevision} specifies the silicon revision of the target
15450 Blackfin processor. Any workarounds available for the targeted silicon revision
15451 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
15452 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
15453 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
15454 hexadecimal digits representing the major and minor numbers in the silicon
15455 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
15456 is not defined. If @var{sirevision} is @samp{any}, the
15457 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
15458 If this optional @var{sirevision} is not used, GCC assumes the latest known
15459 silicon revision of the targeted Blackfin processor.
15460
15461 GCC defines a preprocessor macro for the specified @var{cpu}.
15462 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
15463 provided by libgloss to be linked in if @option{-msim} is not given.
15464
15465 Without this option, @samp{bf532} is used as the processor by default.
15466
15467 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
15468 only the preprocessor macro is defined.
15469
15470 @item -msim
15471 @opindex msim
15472 Specifies that the program will be run on the simulator. This causes
15473 the simulator BSP provided by libgloss to be linked in. This option
15474 has effect only for @samp{bfin-elf} toolchain.
15475 Certain other options, such as @option{-mid-shared-library} and
15476 @option{-mfdpic}, imply @option{-msim}.
15477
15478 @item -momit-leaf-frame-pointer
15479 @opindex momit-leaf-frame-pointer
15480 Don't keep the frame pointer in a register for leaf functions. This
15481 avoids the instructions to save, set up and restore frame pointers and
15482 makes an extra register available in leaf functions. The option
15483 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
15484 which might make debugging harder.
15485
15486 @item -mspecld-anomaly
15487 @opindex mspecld-anomaly
15488 When enabled, the compiler ensures that the generated code does not
15489 contain speculative loads after jump instructions. If this option is used,
15490 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
15491
15492 @item -mno-specld-anomaly
15493 @opindex mno-specld-anomaly
15494 Don't generate extra code to prevent speculative loads from occurring.
15495
15496 @item -mcsync-anomaly
15497 @opindex mcsync-anomaly
15498 When enabled, the compiler ensures that the generated code does not
15499 contain CSYNC or SSYNC instructions too soon after conditional branches.
15500 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
15501
15502 @item -mno-csync-anomaly
15503 @opindex mno-csync-anomaly
15504 Don't generate extra code to prevent CSYNC or SSYNC instructions from
15505 occurring too soon after a conditional branch.
15506
15507 @item -mlow-64k
15508 @opindex mlow-64k
15509 When enabled, the compiler is free to take advantage of the knowledge that
15510 the entire program fits into the low 64k of memory.
15511
15512 @item -mno-low-64k
15513 @opindex mno-low-64k
15514 Assume that the program is arbitrarily large. This is the default.
15515
15516 @item -mstack-check-l1
15517 @opindex mstack-check-l1
15518 Do stack checking using information placed into L1 scratchpad memory by the
15519 uClinux kernel.
15520
15521 @item -mid-shared-library
15522 @opindex mid-shared-library
15523 Generate code that supports shared libraries via the library ID method.
15524 This allows for execute in place and shared libraries in an environment
15525 without virtual memory management. This option implies @option{-fPIC}.
15526 With a @samp{bfin-elf} target, this option implies @option{-msim}.
15527
15528 @item -mno-id-shared-library
15529 @opindex mno-id-shared-library
15530 Generate code that doesn't assume ID-based shared libraries are being used.
15531 This is the default.
15532
15533 @item -mleaf-id-shared-library
15534 @opindex mleaf-id-shared-library
15535 Generate code that supports shared libraries via the library ID method,
15536 but assumes that this library or executable won't link against any other
15537 ID shared libraries. That allows the compiler to use faster code for jumps
15538 and calls.
15539
15540 @item -mno-leaf-id-shared-library
15541 @opindex mno-leaf-id-shared-library
15542 Do not assume that the code being compiled won't link against any ID shared
15543 libraries. Slower code is generated for jump and call insns.
15544
15545 @item -mshared-library-id=n
15546 @opindex mshared-library-id
15547 Specifies the identification number of the ID-based shared library being
15548 compiled. Specifying a value of 0 generates more compact code; specifying
15549 other values forces the allocation of that number to the current
15550 library but is no more space- or time-efficient than omitting this option.
15551
15552 @item -msep-data
15553 @opindex msep-data
15554 Generate code that allows the data segment to be located in a different
15555 area of memory from the text segment. This allows for execute in place in
15556 an environment without virtual memory management by eliminating relocations
15557 against the text section.
15558
15559 @item -mno-sep-data
15560 @opindex mno-sep-data
15561 Generate code that assumes that the data segment follows the text segment.
15562 This is the default.
15563
15564 @item -mlong-calls
15565 @itemx -mno-long-calls
15566 @opindex mlong-calls
15567 @opindex mno-long-calls
15568 Tells the compiler to perform function calls by first loading the
15569 address of the function into a register and then performing a subroutine
15570 call on this register. This switch is needed if the target function
15571 lies outside of the 24-bit addressing range of the offset-based
15572 version of subroutine call instruction.
15573
15574 This feature is not enabled by default. Specifying
15575 @option{-mno-long-calls} restores the default behavior. Note these
15576 switches have no effect on how the compiler generates code to handle
15577 function calls via function pointers.
15578
15579 @item -mfast-fp
15580 @opindex mfast-fp
15581 Link with the fast floating-point library. This library relaxes some of
15582 the IEEE floating-point standard's rules for checking inputs against
15583 Not-a-Number (NAN), in the interest of performance.
15584
15585 @item -minline-plt
15586 @opindex minline-plt
15587 Enable inlining of PLT entries in function calls to functions that are
15588 not known to bind locally. It has no effect without @option{-mfdpic}.
15589
15590 @item -mmulticore
15591 @opindex mmulticore
15592 Build a standalone application for multicore Blackfin processors.
15593 This option causes proper start files and link scripts supporting
15594 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
15595 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
15596
15597 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
15598 selects the one-application-per-core programming model. Without
15599 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
15600 programming model is used. In this model, the main function of Core B
15601 should be named as @code{coreb_main}.
15602
15603 If this option is not used, the single-core application programming
15604 model is used.
15605
15606 @item -mcorea
15607 @opindex mcorea
15608 Build a standalone application for Core A of BF561 when using
15609 the one-application-per-core programming model. Proper start files
15610 and link scripts are used to support Core A, and the macro
15611 @code{__BFIN_COREA} is defined.
15612 This option can only be used in conjunction with @option{-mmulticore}.
15613
15614 @item -mcoreb
15615 @opindex mcoreb
15616 Build a standalone application for Core B of BF561 when using
15617 the one-application-per-core programming model. Proper start files
15618 and link scripts are used to support Core B, and the macro
15619 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
15620 should be used instead of @code{main}.
15621 This option can only be used in conjunction with @option{-mmulticore}.
15622
15623 @item -msdram
15624 @opindex msdram
15625 Build a standalone application for SDRAM. Proper start files and
15626 link scripts are used to put the application into SDRAM, and the macro
15627 @code{__BFIN_SDRAM} is defined.
15628 The loader should initialize SDRAM before loading the application.
15629
15630 @item -micplb
15631 @opindex micplb
15632 Assume that ICPLBs are enabled at run time. This has an effect on certain
15633 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
15634 are enabled; for standalone applications the default is off.
15635 @end table
15636
15637 @node C6X Options
15638 @subsection C6X Options
15639 @cindex C6X Options
15640
15641 @table @gcctabopt
15642 @item -march=@var{name}
15643 @opindex march
15644 This specifies the name of the target architecture. GCC uses this
15645 name to determine what kind of instructions it can emit when generating
15646 assembly code. Permissible names are: @samp{c62x},
15647 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
15648
15649 @item -mbig-endian
15650 @opindex mbig-endian
15651 Generate code for a big-endian target.
15652
15653 @item -mlittle-endian
15654 @opindex mlittle-endian
15655 Generate code for a little-endian target. This is the default.
15656
15657 @item -msim
15658 @opindex msim
15659 Choose startup files and linker script suitable for the simulator.
15660
15661 @item -msdata=default
15662 @opindex msdata=default
15663 Put small global and static data in the @code{.neardata} section,
15664 which is pointed to by register @code{B14}. Put small uninitialized
15665 global and static data in the @code{.bss} section, which is adjacent
15666 to the @code{.neardata} section. Put small read-only data into the
15667 @code{.rodata} section. The corresponding sections used for large
15668 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
15669
15670 @item -msdata=all
15671 @opindex msdata=all
15672 Put all data, not just small objects, into the sections reserved for
15673 small data, and use addressing relative to the @code{B14} register to
15674 access them.
15675
15676 @item -msdata=none
15677 @opindex msdata=none
15678 Make no use of the sections reserved for small data, and use absolute
15679 addresses to access all data. Put all initialized global and static
15680 data in the @code{.fardata} section, and all uninitialized data in the
15681 @code{.far} section. Put all constant data into the @code{.const}
15682 section.
15683 @end table
15684
15685 @node CRIS Options
15686 @subsection CRIS Options
15687 @cindex CRIS Options
15688
15689 These options are defined specifically for the CRIS ports.
15690
15691 @table @gcctabopt
15692 @item -march=@var{architecture-type}
15693 @itemx -mcpu=@var{architecture-type}
15694 @opindex march
15695 @opindex mcpu
15696 Generate code for the specified architecture. The choices for
15697 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
15698 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
15699 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
15700 @samp{v10}.
15701
15702 @item -mtune=@var{architecture-type}
15703 @opindex mtune
15704 Tune to @var{architecture-type} everything applicable about the generated
15705 code, except for the ABI and the set of available instructions. The
15706 choices for @var{architecture-type} are the same as for
15707 @option{-march=@var{architecture-type}}.
15708
15709 @item -mmax-stack-frame=@var{n}
15710 @opindex mmax-stack-frame
15711 Warn when the stack frame of a function exceeds @var{n} bytes.
15712
15713 @item -metrax4
15714 @itemx -metrax100
15715 @opindex metrax4
15716 @opindex metrax100
15717 The options @option{-metrax4} and @option{-metrax100} are synonyms for
15718 @option{-march=v3} and @option{-march=v8} respectively.
15719
15720 @item -mmul-bug-workaround
15721 @itemx -mno-mul-bug-workaround
15722 @opindex mmul-bug-workaround
15723 @opindex mno-mul-bug-workaround
15724 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
15725 models where it applies. This option is active by default.
15726
15727 @item -mpdebug
15728 @opindex mpdebug
15729 Enable CRIS-specific verbose debug-related information in the assembly
15730 code. This option also has the effect of turning off the @samp{#NO_APP}
15731 formatted-code indicator to the assembler at the beginning of the
15732 assembly file.
15733
15734 @item -mcc-init
15735 @opindex mcc-init
15736 Do not use condition-code results from previous instruction; always emit
15737 compare and test instructions before use of condition codes.
15738
15739 @item -mno-side-effects
15740 @opindex mno-side-effects
15741 Do not emit instructions with side effects in addressing modes other than
15742 post-increment.
15743
15744 @item -mstack-align
15745 @itemx -mno-stack-align
15746 @itemx -mdata-align
15747 @itemx -mno-data-align
15748 @itemx -mconst-align
15749 @itemx -mno-const-align
15750 @opindex mstack-align
15751 @opindex mno-stack-align
15752 @opindex mdata-align
15753 @opindex mno-data-align
15754 @opindex mconst-align
15755 @opindex mno-const-align
15756 These options (@samp{no-} options) arrange (eliminate arrangements) for the
15757 stack frame, individual data and constants to be aligned for the maximum
15758 single data access size for the chosen CPU model. The default is to
15759 arrange for 32-bit alignment. ABI details such as structure layout are
15760 not affected by these options.
15761
15762 @item -m32-bit
15763 @itemx -m16-bit
15764 @itemx -m8-bit
15765 @opindex m32-bit
15766 @opindex m16-bit
15767 @opindex m8-bit
15768 Similar to the stack- data- and const-align options above, these options
15769 arrange for stack frame, writable data and constants to all be 32-bit,
15770 16-bit or 8-bit aligned. The default is 32-bit alignment.
15771
15772 @item -mno-prologue-epilogue
15773 @itemx -mprologue-epilogue
15774 @opindex mno-prologue-epilogue
15775 @opindex mprologue-epilogue
15776 With @option{-mno-prologue-epilogue}, the normal function prologue and
15777 epilogue which set up the stack frame are omitted and no return
15778 instructions or return sequences are generated in the code. Use this
15779 option only together with visual inspection of the compiled code: no
15780 warnings or errors are generated when call-saved registers must be saved,
15781 or storage for local variables needs to be allocated.
15782
15783 @item -mno-gotplt
15784 @itemx -mgotplt
15785 @opindex mno-gotplt
15786 @opindex mgotplt
15787 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
15788 instruction sequences that load addresses for functions from the PLT part
15789 of the GOT rather than (traditional on other architectures) calls to the
15790 PLT@. The default is @option{-mgotplt}.
15791
15792 @item -melf
15793 @opindex melf
15794 Legacy no-op option only recognized with the cris-axis-elf and
15795 cris-axis-linux-gnu targets.
15796
15797 @item -mlinux
15798 @opindex mlinux
15799 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
15800
15801 @item -sim
15802 @opindex sim
15803 This option, recognized for the cris-axis-elf, arranges
15804 to link with input-output functions from a simulator library. Code,
15805 initialized data and zero-initialized data are allocated consecutively.
15806
15807 @item -sim2
15808 @opindex sim2
15809 Like @option{-sim}, but pass linker options to locate initialized data at
15810 0x40000000 and zero-initialized data at 0x80000000.
15811 @end table
15812
15813 @node CR16 Options
15814 @subsection CR16 Options
15815 @cindex CR16 Options
15816
15817 These options are defined specifically for the CR16 ports.
15818
15819 @table @gcctabopt
15820
15821 @item -mmac
15822 @opindex mmac
15823 Enable the use of multiply-accumulate instructions. Disabled by default.
15824
15825 @item -mcr16cplus
15826 @itemx -mcr16c
15827 @opindex mcr16cplus
15828 @opindex mcr16c
15829 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
15830 is default.
15831
15832 @item -msim
15833 @opindex msim
15834 Links the library libsim.a which is in compatible with simulator. Applicable
15835 to ELF compiler only.
15836
15837 @item -mint32
15838 @opindex mint32
15839 Choose integer type as 32-bit wide.
15840
15841 @item -mbit-ops
15842 @opindex mbit-ops
15843 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
15844
15845 @item -mdata-model=@var{model}
15846 @opindex mdata-model
15847 Choose a data model. The choices for @var{model} are @samp{near},
15848 @samp{far} or @samp{medium}. @samp{medium} is default.
15849 However, @samp{far} is not valid with @option{-mcr16c}, as the
15850 CR16C architecture does not support the far data model.
15851 @end table
15852
15853 @node Darwin Options
15854 @subsection Darwin Options
15855 @cindex Darwin options
15856
15857 These options are defined for all architectures running the Darwin operating
15858 system.
15859
15860 FSF GCC on Darwin does not create ``fat'' object files; it creates
15861 an object file for the single architecture that GCC was built to
15862 target. Apple's GCC on Darwin does create ``fat'' files if multiple
15863 @option{-arch} options are used; it does so by running the compiler or
15864 linker multiple times and joining the results together with
15865 @file{lipo}.
15866
15867 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
15868 @samp{i686}) is determined by the flags that specify the ISA
15869 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
15870 @option{-force_cpusubtype_ALL} option can be used to override this.
15871
15872 The Darwin tools vary in their behavior when presented with an ISA
15873 mismatch. The assembler, @file{as}, only permits instructions to
15874 be used that are valid for the subtype of the file it is generating,
15875 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
15876 The linker for shared libraries, @file{/usr/bin/libtool}, fails
15877 and prints an error if asked to create a shared library with a less
15878 restrictive subtype than its input files (for instance, trying to put
15879 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
15880 for executables, @command{ld}, quietly gives the executable the most
15881 restrictive subtype of any of its input files.
15882
15883 @table @gcctabopt
15884 @item -F@var{dir}
15885 @opindex F
15886 Add the framework directory @var{dir} to the head of the list of
15887 directories to be searched for header files. These directories are
15888 interleaved with those specified by @option{-I} options and are
15889 scanned in a left-to-right order.
15890
15891 A framework directory is a directory with frameworks in it. A
15892 framework is a directory with a @file{Headers} and/or
15893 @file{PrivateHeaders} directory contained directly in it that ends
15894 in @file{.framework}. The name of a framework is the name of this
15895 directory excluding the @file{.framework}. Headers associated with
15896 the framework are found in one of those two directories, with
15897 @file{Headers} being searched first. A subframework is a framework
15898 directory that is in a framework's @file{Frameworks} directory.
15899 Includes of subframework headers can only appear in a header of a
15900 framework that contains the subframework, or in a sibling subframework
15901 header. Two subframeworks are siblings if they occur in the same
15902 framework. A subframework should not have the same name as a
15903 framework; a warning is issued if this is violated. Currently a
15904 subframework cannot have subframeworks; in the future, the mechanism
15905 may be extended to support this. The standard frameworks can be found
15906 in @file{/System/Library/Frameworks} and
15907 @file{/Library/Frameworks}. An example include looks like
15908 @code{#include <Framework/header.h>}, where @file{Framework} denotes
15909 the name of the framework and @file{header.h} is found in the
15910 @file{PrivateHeaders} or @file{Headers} directory.
15911
15912 @item -iframework@var{dir}
15913 @opindex iframework
15914 Like @option{-F} except the directory is a treated as a system
15915 directory. The main difference between this @option{-iframework} and
15916 @option{-F} is that with @option{-iframework} the compiler does not
15917 warn about constructs contained within header files found via
15918 @var{dir}. This option is valid only for the C family of languages.
15919
15920 @item -gused
15921 @opindex gused
15922 Emit debugging information for symbols that are used. For stabs
15923 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
15924 This is by default ON@.
15925
15926 @item -gfull
15927 @opindex gfull
15928 Emit debugging information for all symbols and types.
15929
15930 @item -mmacosx-version-min=@var{version}
15931 The earliest version of MacOS X that this executable will run on
15932 is @var{version}. Typical values of @var{version} include @code{10.1},
15933 @code{10.2}, and @code{10.3.9}.
15934
15935 If the compiler was built to use the system's headers by default,
15936 then the default for this option is the system version on which the
15937 compiler is running, otherwise the default is to make choices that
15938 are compatible with as many systems and code bases as possible.
15939
15940 @item -mkernel
15941 @opindex mkernel
15942 Enable kernel development mode. The @option{-mkernel} option sets
15943 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
15944 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
15945 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
15946 applicable. This mode also sets @option{-mno-altivec},
15947 @option{-msoft-float}, @option{-fno-builtin} and
15948 @option{-mlong-branch} for PowerPC targets.
15949
15950 @item -mone-byte-bool
15951 @opindex mone-byte-bool
15952 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
15953 By default @code{sizeof(bool)} is @code{4} when compiling for
15954 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
15955 option has no effect on x86.
15956
15957 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
15958 to generate code that is not binary compatible with code generated
15959 without that switch. Using this switch may require recompiling all
15960 other modules in a program, including system libraries. Use this
15961 switch to conform to a non-default data model.
15962
15963 @item -mfix-and-continue
15964 @itemx -ffix-and-continue
15965 @itemx -findirect-data
15966 @opindex mfix-and-continue
15967 @opindex ffix-and-continue
15968 @opindex findirect-data
15969 Generate code suitable for fast turnaround development, such as to
15970 allow GDB to dynamically load @file{.o} files into already-running
15971 programs. @option{-findirect-data} and @option{-ffix-and-continue}
15972 are provided for backwards compatibility.
15973
15974 @item -all_load
15975 @opindex all_load
15976 Loads all members of static archive libraries.
15977 See man ld(1) for more information.
15978
15979 @item -arch_errors_fatal
15980 @opindex arch_errors_fatal
15981 Cause the errors having to do with files that have the wrong architecture
15982 to be fatal.
15983
15984 @item -bind_at_load
15985 @opindex bind_at_load
15986 Causes the output file to be marked such that the dynamic linker will
15987 bind all undefined references when the file is loaded or launched.
15988
15989 @item -bundle
15990 @opindex bundle
15991 Produce a Mach-o bundle format file.
15992 See man ld(1) for more information.
15993
15994 @item -bundle_loader @var{executable}
15995 @opindex bundle_loader
15996 This option specifies the @var{executable} that will load the build
15997 output file being linked. See man ld(1) for more information.
15998
15999 @item -dynamiclib
16000 @opindex dynamiclib
16001 When passed this option, GCC produces a dynamic library instead of
16002 an executable when linking, using the Darwin @file{libtool} command.
16003
16004 @item -force_cpusubtype_ALL
16005 @opindex force_cpusubtype_ALL
16006 This causes GCC's output file to have the @samp{ALL} subtype, instead of
16007 one controlled by the @option{-mcpu} or @option{-march} option.
16008
16009 @item -allowable_client @var{client_name}
16010 @itemx -client_name
16011 @itemx -compatibility_version
16012 @itemx -current_version
16013 @itemx -dead_strip
16014 @itemx -dependency-file
16015 @itemx -dylib_file
16016 @itemx -dylinker_install_name
16017 @itemx -dynamic
16018 @itemx -exported_symbols_list
16019 @itemx -filelist
16020 @need 800
16021 @itemx -flat_namespace
16022 @itemx -force_flat_namespace
16023 @itemx -headerpad_max_install_names
16024 @itemx -image_base
16025 @itemx -init
16026 @itemx -install_name
16027 @itemx -keep_private_externs
16028 @itemx -multi_module
16029 @itemx -multiply_defined
16030 @itemx -multiply_defined_unused
16031 @need 800
16032 @itemx -noall_load
16033 @itemx -no_dead_strip_inits_and_terms
16034 @itemx -nofixprebinding
16035 @itemx -nomultidefs
16036 @itemx -noprebind
16037 @itemx -noseglinkedit
16038 @itemx -pagezero_size
16039 @itemx -prebind
16040 @itemx -prebind_all_twolevel_modules
16041 @itemx -private_bundle
16042 @need 800
16043 @itemx -read_only_relocs
16044 @itemx -sectalign
16045 @itemx -sectobjectsymbols
16046 @itemx -whyload
16047 @itemx -seg1addr
16048 @itemx -sectcreate
16049 @itemx -sectobjectsymbols
16050 @itemx -sectorder
16051 @itemx -segaddr
16052 @itemx -segs_read_only_addr
16053 @need 800
16054 @itemx -segs_read_write_addr
16055 @itemx -seg_addr_table
16056 @itemx -seg_addr_table_filename
16057 @itemx -seglinkedit
16058 @itemx -segprot
16059 @itemx -segs_read_only_addr
16060 @itemx -segs_read_write_addr
16061 @itemx -single_module
16062 @itemx -static
16063 @itemx -sub_library
16064 @need 800
16065 @itemx -sub_umbrella
16066 @itemx -twolevel_namespace
16067 @itemx -umbrella
16068 @itemx -undefined
16069 @itemx -unexported_symbols_list
16070 @itemx -weak_reference_mismatches
16071 @itemx -whatsloaded
16072 @opindex allowable_client
16073 @opindex client_name
16074 @opindex compatibility_version
16075 @opindex current_version
16076 @opindex dead_strip
16077 @opindex dependency-file
16078 @opindex dylib_file
16079 @opindex dylinker_install_name
16080 @opindex dynamic
16081 @opindex exported_symbols_list
16082 @opindex filelist
16083 @opindex flat_namespace
16084 @opindex force_flat_namespace
16085 @opindex headerpad_max_install_names
16086 @opindex image_base
16087 @opindex init
16088 @opindex install_name
16089 @opindex keep_private_externs
16090 @opindex multi_module
16091 @opindex multiply_defined
16092 @opindex multiply_defined_unused
16093 @opindex noall_load
16094 @opindex no_dead_strip_inits_and_terms
16095 @opindex nofixprebinding
16096 @opindex nomultidefs
16097 @opindex noprebind
16098 @opindex noseglinkedit
16099 @opindex pagezero_size
16100 @opindex prebind
16101 @opindex prebind_all_twolevel_modules
16102 @opindex private_bundle
16103 @opindex read_only_relocs
16104 @opindex sectalign
16105 @opindex sectobjectsymbols
16106 @opindex whyload
16107 @opindex seg1addr
16108 @opindex sectcreate
16109 @opindex sectobjectsymbols
16110 @opindex sectorder
16111 @opindex segaddr
16112 @opindex segs_read_only_addr
16113 @opindex segs_read_write_addr
16114 @opindex seg_addr_table
16115 @opindex seg_addr_table_filename
16116 @opindex seglinkedit
16117 @opindex segprot
16118 @opindex segs_read_only_addr
16119 @opindex segs_read_write_addr
16120 @opindex single_module
16121 @opindex static
16122 @opindex sub_library
16123 @opindex sub_umbrella
16124 @opindex twolevel_namespace
16125 @opindex umbrella
16126 @opindex undefined
16127 @opindex unexported_symbols_list
16128 @opindex weak_reference_mismatches
16129 @opindex whatsloaded
16130 These options are passed to the Darwin linker. The Darwin linker man page
16131 describes them in detail.
16132 @end table
16133
16134 @node DEC Alpha Options
16135 @subsection DEC Alpha Options
16136
16137 These @samp{-m} options are defined for the DEC Alpha implementations:
16138
16139 @table @gcctabopt
16140 @item -mno-soft-float
16141 @itemx -msoft-float
16142 @opindex mno-soft-float
16143 @opindex msoft-float
16144 Use (do not use) the hardware floating-point instructions for
16145 floating-point operations. When @option{-msoft-float} is specified,
16146 functions in @file{libgcc.a} are used to perform floating-point
16147 operations. Unless they are replaced by routines that emulate the
16148 floating-point operations, or compiled in such a way as to call such
16149 emulations routines, these routines issue floating-point
16150 operations. If you are compiling for an Alpha without floating-point
16151 operations, you must ensure that the library is built so as not to call
16152 them.
16153
16154 Note that Alpha implementations without floating-point operations are
16155 required to have floating-point registers.
16156
16157 @item -mfp-reg
16158 @itemx -mno-fp-regs
16159 @opindex mfp-reg
16160 @opindex mno-fp-regs
16161 Generate code that uses (does not use) the floating-point register set.
16162 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
16163 register set is not used, floating-point operands are passed in integer
16164 registers as if they were integers and floating-point results are passed
16165 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
16166 so any function with a floating-point argument or return value called by code
16167 compiled with @option{-mno-fp-regs} must also be compiled with that
16168 option.
16169
16170 A typical use of this option is building a kernel that does not use,
16171 and hence need not save and restore, any floating-point registers.
16172
16173 @item -mieee
16174 @opindex mieee
16175 The Alpha architecture implements floating-point hardware optimized for
16176 maximum performance. It is mostly compliant with the IEEE floating-point
16177 standard. However, for full compliance, software assistance is
16178 required. This option generates code fully IEEE-compliant code
16179 @emph{except} that the @var{inexact-flag} is not maintained (see below).
16180 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
16181 defined during compilation. The resulting code is less efficient but is
16182 able to correctly support denormalized numbers and exceptional IEEE
16183 values such as not-a-number and plus/minus infinity. Other Alpha
16184 compilers call this option @option{-ieee_with_no_inexact}.
16185
16186 @item -mieee-with-inexact
16187 @opindex mieee-with-inexact
16188 This is like @option{-mieee} except the generated code also maintains
16189 the IEEE @var{inexact-flag}. Turning on this option causes the
16190 generated code to implement fully-compliant IEEE math. In addition to
16191 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
16192 macro. On some Alpha implementations the resulting code may execute
16193 significantly slower than the code generated by default. Since there is
16194 very little code that depends on the @var{inexact-flag}, you should
16195 normally not specify this option. Other Alpha compilers call this
16196 option @option{-ieee_with_inexact}.
16197
16198 @item -mfp-trap-mode=@var{trap-mode}
16199 @opindex mfp-trap-mode
16200 This option controls what floating-point related traps are enabled.
16201 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
16202 The trap mode can be set to one of four values:
16203
16204 @table @samp
16205 @item n
16206 This is the default (normal) setting. The only traps that are enabled
16207 are the ones that cannot be disabled in software (e.g., division by zero
16208 trap).
16209
16210 @item u
16211 In addition to the traps enabled by @samp{n}, underflow traps are enabled
16212 as well.
16213
16214 @item su
16215 Like @samp{u}, but the instructions are marked to be safe for software
16216 completion (see Alpha architecture manual for details).
16217
16218 @item sui
16219 Like @samp{su}, but inexact traps are enabled as well.
16220 @end table
16221
16222 @item -mfp-rounding-mode=@var{rounding-mode}
16223 @opindex mfp-rounding-mode
16224 Selects the IEEE rounding mode. Other Alpha compilers call this option
16225 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
16226 of:
16227
16228 @table @samp
16229 @item n
16230 Normal IEEE rounding mode. Floating-point numbers are rounded towards
16231 the nearest machine number or towards the even machine number in case
16232 of a tie.
16233
16234 @item m
16235 Round towards minus infinity.
16236
16237 @item c
16238 Chopped rounding mode. Floating-point numbers are rounded towards zero.
16239
16240 @item d
16241 Dynamic rounding mode. A field in the floating-point control register
16242 (@var{fpcr}, see Alpha architecture reference manual) controls the
16243 rounding mode in effect. The C library initializes this register for
16244 rounding towards plus infinity. Thus, unless your program modifies the
16245 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
16246 @end table
16247
16248 @item -mtrap-precision=@var{trap-precision}
16249 @opindex mtrap-precision
16250 In the Alpha architecture, floating-point traps are imprecise. This
16251 means without software assistance it is impossible to recover from a
16252 floating trap and program execution normally needs to be terminated.
16253 GCC can generate code that can assist operating system trap handlers
16254 in determining the exact location that caused a floating-point trap.
16255 Depending on the requirements of an application, different levels of
16256 precisions can be selected:
16257
16258 @table @samp
16259 @item p
16260 Program precision. This option is the default and means a trap handler
16261 can only identify which program caused a floating-point exception.
16262
16263 @item f
16264 Function precision. The trap handler can determine the function that
16265 caused a floating-point exception.
16266
16267 @item i
16268 Instruction precision. The trap handler can determine the exact
16269 instruction that caused a floating-point exception.
16270 @end table
16271
16272 Other Alpha compilers provide the equivalent options called
16273 @option{-scope_safe} and @option{-resumption_safe}.
16274
16275 @item -mieee-conformant
16276 @opindex mieee-conformant
16277 This option marks the generated code as IEEE conformant. You must not
16278 use this option unless you also specify @option{-mtrap-precision=i} and either
16279 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
16280 is to emit the line @samp{.eflag 48} in the function prologue of the
16281 generated assembly file.
16282
16283 @item -mbuild-constants
16284 @opindex mbuild-constants
16285 Normally GCC examines a 32- or 64-bit integer constant to
16286 see if it can construct it from smaller constants in two or three
16287 instructions. If it cannot, it outputs the constant as a literal and
16288 generates code to load it from the data segment at run time.
16289
16290 Use this option to require GCC to construct @emph{all} integer constants
16291 using code, even if it takes more instructions (the maximum is six).
16292
16293 You typically use this option to build a shared library dynamic
16294 loader. Itself a shared library, it must relocate itself in memory
16295 before it can find the variables and constants in its own data segment.
16296
16297 @item -mbwx
16298 @itemx -mno-bwx
16299 @itemx -mcix
16300 @itemx -mno-cix
16301 @itemx -mfix
16302 @itemx -mno-fix
16303 @itemx -mmax
16304 @itemx -mno-max
16305 @opindex mbwx
16306 @opindex mno-bwx
16307 @opindex mcix
16308 @opindex mno-cix
16309 @opindex mfix
16310 @opindex mno-fix
16311 @opindex mmax
16312 @opindex mno-max
16313 Indicate whether GCC should generate code to use the optional BWX,
16314 CIX, FIX and MAX instruction sets. The default is to use the instruction
16315 sets supported by the CPU type specified via @option{-mcpu=} option or that
16316 of the CPU on which GCC was built if none is specified.
16317
16318 @item -mfloat-vax
16319 @itemx -mfloat-ieee
16320 @opindex mfloat-vax
16321 @opindex mfloat-ieee
16322 Generate code that uses (does not use) VAX F and G floating-point
16323 arithmetic instead of IEEE single and double precision.
16324
16325 @item -mexplicit-relocs
16326 @itemx -mno-explicit-relocs
16327 @opindex mexplicit-relocs
16328 @opindex mno-explicit-relocs
16329 Older Alpha assemblers provided no way to generate symbol relocations
16330 except via assembler macros. Use of these macros does not allow
16331 optimal instruction scheduling. GNU binutils as of version 2.12
16332 supports a new syntax that allows the compiler to explicitly mark
16333 which relocations should apply to which instructions. This option
16334 is mostly useful for debugging, as GCC detects the capabilities of
16335 the assembler when it is built and sets the default accordingly.
16336
16337 @item -msmall-data
16338 @itemx -mlarge-data
16339 @opindex msmall-data
16340 @opindex mlarge-data
16341 When @option{-mexplicit-relocs} is in effect, static data is
16342 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
16343 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
16344 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
16345 16-bit relocations off of the @code{$gp} register. This limits the
16346 size of the small data area to 64KB, but allows the variables to be
16347 directly accessed via a single instruction.
16348
16349 The default is @option{-mlarge-data}. With this option the data area
16350 is limited to just below 2GB@. Programs that require more than 2GB of
16351 data must use @code{malloc} or @code{mmap} to allocate the data in the
16352 heap instead of in the program's data segment.
16353
16354 When generating code for shared libraries, @option{-fpic} implies
16355 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
16356
16357 @item -msmall-text
16358 @itemx -mlarge-text
16359 @opindex msmall-text
16360 @opindex mlarge-text
16361 When @option{-msmall-text} is used, the compiler assumes that the
16362 code of the entire program (or shared library) fits in 4MB, and is
16363 thus reachable with a branch instruction. When @option{-msmall-data}
16364 is used, the compiler can assume that all local symbols share the
16365 same @code{$gp} value, and thus reduce the number of instructions
16366 required for a function call from 4 to 1.
16367
16368 The default is @option{-mlarge-text}.
16369
16370 @item -mcpu=@var{cpu_type}
16371 @opindex mcpu
16372 Set the instruction set and instruction scheduling parameters for
16373 machine type @var{cpu_type}. You can specify either the @samp{EV}
16374 style name or the corresponding chip number. GCC supports scheduling
16375 parameters for the EV4, EV5 and EV6 family of processors and
16376 chooses the default values for the instruction set from the processor
16377 you specify. If you do not specify a processor type, GCC defaults
16378 to the processor on which the compiler was built.
16379
16380 Supported values for @var{cpu_type} are
16381
16382 @table @samp
16383 @item ev4
16384 @itemx ev45
16385 @itemx 21064
16386 Schedules as an EV4 and has no instruction set extensions.
16387
16388 @item ev5
16389 @itemx 21164
16390 Schedules as an EV5 and has no instruction set extensions.
16391
16392 @item ev56
16393 @itemx 21164a
16394 Schedules as an EV5 and supports the BWX extension.
16395
16396 @item pca56
16397 @itemx 21164pc
16398 @itemx 21164PC
16399 Schedules as an EV5 and supports the BWX and MAX extensions.
16400
16401 @item ev6
16402 @itemx 21264
16403 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
16404
16405 @item ev67
16406 @itemx 21264a
16407 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
16408 @end table
16409
16410 Native toolchains also support the value @samp{native},
16411 which selects the best architecture option for the host processor.
16412 @option{-mcpu=native} has no effect if GCC does not recognize
16413 the processor.
16414
16415 @item -mtune=@var{cpu_type}
16416 @opindex mtune
16417 Set only the instruction scheduling parameters for machine type
16418 @var{cpu_type}. The instruction set is not changed.
16419
16420 Native toolchains also support the value @samp{native},
16421 which selects the best architecture option for the host processor.
16422 @option{-mtune=native} has no effect if GCC does not recognize
16423 the processor.
16424
16425 @item -mmemory-latency=@var{time}
16426 @opindex mmemory-latency
16427 Sets the latency the scheduler should assume for typical memory
16428 references as seen by the application. This number is highly
16429 dependent on the memory access patterns used by the application
16430 and the size of the external cache on the machine.
16431
16432 Valid options for @var{time} are
16433
16434 @table @samp
16435 @item @var{number}
16436 A decimal number representing clock cycles.
16437
16438 @item L1
16439 @itemx L2
16440 @itemx L3
16441 @itemx main
16442 The compiler contains estimates of the number of clock cycles for
16443 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
16444 (also called Dcache, Scache, and Bcache), as well as to main memory.
16445 Note that L3 is only valid for EV5.
16446
16447 @end table
16448 @end table
16449
16450 @node FR30 Options
16451 @subsection FR30 Options
16452 @cindex FR30 Options
16453
16454 These options are defined specifically for the FR30 port.
16455
16456 @table @gcctabopt
16457
16458 @item -msmall-model
16459 @opindex msmall-model
16460 Use the small address space model. This can produce smaller code, but
16461 it does assume that all symbolic values and addresses fit into a
16462 20-bit range.
16463
16464 @item -mno-lsim
16465 @opindex mno-lsim
16466 Assume that runtime support has been provided and so there is no need
16467 to include the simulator library (@file{libsim.a}) on the linker
16468 command line.
16469
16470 @end table
16471
16472 @node FT32 Options
16473 @subsection FT32 Options
16474 @cindex FT32 Options
16475
16476 These options are defined specifically for the FT32 port.
16477
16478 @table @gcctabopt
16479
16480 @item -msim
16481 @opindex msim
16482 Specifies that the program will be run on the simulator. This causes
16483 an alternate runtime startup and library to be linked.
16484 You must not use this option when generating programs that will run on
16485 real hardware; you must provide your own runtime library for whatever
16486 I/O functions are needed.
16487
16488 @item -mlra
16489 @opindex mlra
16490 Enable Local Register Allocation. This is still experimental for FT32,
16491 so by default the compiler uses standard reload.
16492
16493 @item -mnodiv
16494 @opindex mnodiv
16495 Do not use div and mod instructions.
16496
16497 @end table
16498
16499 @node FRV Options
16500 @subsection FRV Options
16501 @cindex FRV Options
16502
16503 @table @gcctabopt
16504 @item -mgpr-32
16505 @opindex mgpr-32
16506
16507 Only use the first 32 general-purpose registers.
16508
16509 @item -mgpr-64
16510 @opindex mgpr-64
16511
16512 Use all 64 general-purpose registers.
16513
16514 @item -mfpr-32
16515 @opindex mfpr-32
16516
16517 Use only the first 32 floating-point registers.
16518
16519 @item -mfpr-64
16520 @opindex mfpr-64
16521
16522 Use all 64 floating-point registers.
16523
16524 @item -mhard-float
16525 @opindex mhard-float
16526
16527 Use hardware instructions for floating-point operations.
16528
16529 @item -msoft-float
16530 @opindex msoft-float
16531
16532 Use library routines for floating-point operations.
16533
16534 @item -malloc-cc
16535 @opindex malloc-cc
16536
16537 Dynamically allocate condition code registers.
16538
16539 @item -mfixed-cc
16540 @opindex mfixed-cc
16541
16542 Do not try to dynamically allocate condition code registers, only
16543 use @code{icc0} and @code{fcc0}.
16544
16545 @item -mdword
16546 @opindex mdword
16547
16548 Change ABI to use double word insns.
16549
16550 @item -mno-dword
16551 @opindex mno-dword
16552
16553 Do not use double word instructions.
16554
16555 @item -mdouble
16556 @opindex mdouble
16557
16558 Use floating-point double instructions.
16559
16560 @item -mno-double
16561 @opindex mno-double
16562
16563 Do not use floating-point double instructions.
16564
16565 @item -mmedia
16566 @opindex mmedia
16567
16568 Use media instructions.
16569
16570 @item -mno-media
16571 @opindex mno-media
16572
16573 Do not use media instructions.
16574
16575 @item -mmuladd
16576 @opindex mmuladd
16577
16578 Use multiply and add/subtract instructions.
16579
16580 @item -mno-muladd
16581 @opindex mno-muladd
16582
16583 Do not use multiply and add/subtract instructions.
16584
16585 @item -mfdpic
16586 @opindex mfdpic
16587
16588 Select the FDPIC ABI, which uses function descriptors to represent
16589 pointers to functions. Without any PIC/PIE-related options, it
16590 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
16591 assumes GOT entries and small data are within a 12-bit range from the
16592 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
16593 are computed with 32 bits.
16594 With a @samp{bfin-elf} target, this option implies @option{-msim}.
16595
16596 @item -minline-plt
16597 @opindex minline-plt
16598
16599 Enable inlining of PLT entries in function calls to functions that are
16600 not known to bind locally. It has no effect without @option{-mfdpic}.
16601 It's enabled by default if optimizing for speed and compiling for
16602 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
16603 optimization option such as @option{-O3} or above is present in the
16604 command line.
16605
16606 @item -mTLS
16607 @opindex mTLS
16608
16609 Assume a large TLS segment when generating thread-local code.
16610
16611 @item -mtls
16612 @opindex mtls
16613
16614 Do not assume a large TLS segment when generating thread-local code.
16615
16616 @item -mgprel-ro
16617 @opindex mgprel-ro
16618
16619 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
16620 that is known to be in read-only sections. It's enabled by default,
16621 except for @option{-fpic} or @option{-fpie}: even though it may help
16622 make the global offset table smaller, it trades 1 instruction for 4.
16623 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
16624 one of which may be shared by multiple symbols, and it avoids the need
16625 for a GOT entry for the referenced symbol, so it's more likely to be a
16626 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
16627
16628 @item -multilib-library-pic
16629 @opindex multilib-library-pic
16630
16631 Link with the (library, not FD) pic libraries. It's implied by
16632 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
16633 @option{-fpic} without @option{-mfdpic}. You should never have to use
16634 it explicitly.
16635
16636 @item -mlinked-fp
16637 @opindex mlinked-fp
16638
16639 Follow the EABI requirement of always creating a frame pointer whenever
16640 a stack frame is allocated. This option is enabled by default and can
16641 be disabled with @option{-mno-linked-fp}.
16642
16643 @item -mlong-calls
16644 @opindex mlong-calls
16645
16646 Use indirect addressing to call functions outside the current
16647 compilation unit. This allows the functions to be placed anywhere
16648 within the 32-bit address space.
16649
16650 @item -malign-labels
16651 @opindex malign-labels
16652
16653 Try to align labels to an 8-byte boundary by inserting NOPs into the
16654 previous packet. This option only has an effect when VLIW packing
16655 is enabled. It doesn't create new packets; it merely adds NOPs to
16656 existing ones.
16657
16658 @item -mlibrary-pic
16659 @opindex mlibrary-pic
16660
16661 Generate position-independent EABI code.
16662
16663 @item -macc-4
16664 @opindex macc-4
16665
16666 Use only the first four media accumulator registers.
16667
16668 @item -macc-8
16669 @opindex macc-8
16670
16671 Use all eight media accumulator registers.
16672
16673 @item -mpack
16674 @opindex mpack
16675
16676 Pack VLIW instructions.
16677
16678 @item -mno-pack
16679 @opindex mno-pack
16680
16681 Do not pack VLIW instructions.
16682
16683 @item -mno-eflags
16684 @opindex mno-eflags
16685
16686 Do not mark ABI switches in e_flags.
16687
16688 @item -mcond-move
16689 @opindex mcond-move
16690
16691 Enable the use of conditional-move instructions (default).
16692
16693 This switch is mainly for debugging the compiler and will likely be removed
16694 in a future version.
16695
16696 @item -mno-cond-move
16697 @opindex mno-cond-move
16698
16699 Disable the use of conditional-move instructions.
16700
16701 This switch is mainly for debugging the compiler and will likely be removed
16702 in a future version.
16703
16704 @item -mscc
16705 @opindex mscc
16706
16707 Enable the use of conditional set instructions (default).
16708
16709 This switch is mainly for debugging the compiler and will likely be removed
16710 in a future version.
16711
16712 @item -mno-scc
16713 @opindex mno-scc
16714
16715 Disable the use of conditional set instructions.
16716
16717 This switch is mainly for debugging the compiler and will likely be removed
16718 in a future version.
16719
16720 @item -mcond-exec
16721 @opindex mcond-exec
16722
16723 Enable the use of conditional execution (default).
16724
16725 This switch is mainly for debugging the compiler and will likely be removed
16726 in a future version.
16727
16728 @item -mno-cond-exec
16729 @opindex mno-cond-exec
16730
16731 Disable the use of conditional execution.
16732
16733 This switch is mainly for debugging the compiler and will likely be removed
16734 in a future version.
16735
16736 @item -mvliw-branch
16737 @opindex mvliw-branch
16738
16739 Run a pass to pack branches into VLIW instructions (default).
16740
16741 This switch is mainly for debugging the compiler and will likely be removed
16742 in a future version.
16743
16744 @item -mno-vliw-branch
16745 @opindex mno-vliw-branch
16746
16747 Do not run a pass to pack branches into VLIW instructions.
16748
16749 This switch is mainly for debugging the compiler and will likely be removed
16750 in a future version.
16751
16752 @item -mmulti-cond-exec
16753 @opindex mmulti-cond-exec
16754
16755 Enable optimization of @code{&&} and @code{||} in conditional execution
16756 (default).
16757
16758 This switch is mainly for debugging the compiler and will likely be removed
16759 in a future version.
16760
16761 @item -mno-multi-cond-exec
16762 @opindex mno-multi-cond-exec
16763
16764 Disable optimization of @code{&&} and @code{||} in conditional execution.
16765
16766 This switch is mainly for debugging the compiler and will likely be removed
16767 in a future version.
16768
16769 @item -mnested-cond-exec
16770 @opindex mnested-cond-exec
16771
16772 Enable nested conditional execution optimizations (default).
16773
16774 This switch is mainly for debugging the compiler and will likely be removed
16775 in a future version.
16776
16777 @item -mno-nested-cond-exec
16778 @opindex mno-nested-cond-exec
16779
16780 Disable nested conditional execution optimizations.
16781
16782 This switch is mainly for debugging the compiler and will likely be removed
16783 in a future version.
16784
16785 @item -moptimize-membar
16786 @opindex moptimize-membar
16787
16788 This switch removes redundant @code{membar} instructions from the
16789 compiler-generated code. It is enabled by default.
16790
16791 @item -mno-optimize-membar
16792 @opindex mno-optimize-membar
16793
16794 This switch disables the automatic removal of redundant @code{membar}
16795 instructions from the generated code.
16796
16797 @item -mtomcat-stats
16798 @opindex mtomcat-stats
16799
16800 Cause gas to print out tomcat statistics.
16801
16802 @item -mcpu=@var{cpu}
16803 @opindex mcpu
16804
16805 Select the processor type for which to generate code. Possible values are
16806 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
16807 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
16808
16809 @end table
16810
16811 @node GNU/Linux Options
16812 @subsection GNU/Linux Options
16813
16814 These @samp{-m} options are defined for GNU/Linux targets:
16815
16816 @table @gcctabopt
16817 @item -mglibc
16818 @opindex mglibc
16819 Use the GNU C library. This is the default except
16820 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
16821 @samp{*-*-linux-*android*} targets.
16822
16823 @item -muclibc
16824 @opindex muclibc
16825 Use uClibc C library. This is the default on
16826 @samp{*-*-linux-*uclibc*} targets.
16827
16828 @item -mmusl
16829 @opindex mmusl
16830 Use the musl C library. This is the default on
16831 @samp{*-*-linux-*musl*} targets.
16832
16833 @item -mbionic
16834 @opindex mbionic
16835 Use Bionic C library. This is the default on
16836 @samp{*-*-linux-*android*} targets.
16837
16838 @item -mandroid
16839 @opindex mandroid
16840 Compile code compatible with Android platform. This is the default on
16841 @samp{*-*-linux-*android*} targets.
16842
16843 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
16844 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
16845 this option makes the GCC driver pass Android-specific options to the linker.
16846 Finally, this option causes the preprocessor macro @code{__ANDROID__}
16847 to be defined.
16848
16849 @item -tno-android-cc
16850 @opindex tno-android-cc
16851 Disable compilation effects of @option{-mandroid}, i.e., do not enable
16852 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
16853 @option{-fno-rtti} by default.
16854
16855 @item -tno-android-ld
16856 @opindex tno-android-ld
16857 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
16858 linking options to the linker.
16859
16860 @end table
16861
16862 @node H8/300 Options
16863 @subsection H8/300 Options
16864
16865 These @samp{-m} options are defined for the H8/300 implementations:
16866
16867 @table @gcctabopt
16868 @item -mrelax
16869 @opindex mrelax
16870 Shorten some address references at link time, when possible; uses the
16871 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
16872 ld, Using ld}, for a fuller description.
16873
16874 @item -mh
16875 @opindex mh
16876 Generate code for the H8/300H@.
16877
16878 @item -ms
16879 @opindex ms
16880 Generate code for the H8S@.
16881
16882 @item -mn
16883 @opindex mn
16884 Generate code for the H8S and H8/300H in the normal mode. This switch
16885 must be used either with @option{-mh} or @option{-ms}.
16886
16887 @item -ms2600
16888 @opindex ms2600
16889 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
16890
16891 @item -mexr
16892 @opindex mexr
16893 Extended registers are stored on stack before execution of function
16894 with monitor attribute. Default option is @option{-mexr}.
16895 This option is valid only for H8S targets.
16896
16897 @item -mno-exr
16898 @opindex mno-exr
16899 Extended registers are not stored on stack before execution of function
16900 with monitor attribute. Default option is @option{-mno-exr}.
16901 This option is valid only for H8S targets.
16902
16903 @item -mint32
16904 @opindex mint32
16905 Make @code{int} data 32 bits by default.
16906
16907 @item -malign-300
16908 @opindex malign-300
16909 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
16910 The default for the H8/300H and H8S is to align longs and floats on
16911 4-byte boundaries.
16912 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
16913 This option has no effect on the H8/300.
16914 @end table
16915
16916 @node HPPA Options
16917 @subsection HPPA Options
16918 @cindex HPPA Options
16919
16920 These @samp{-m} options are defined for the HPPA family of computers:
16921
16922 @table @gcctabopt
16923 @item -march=@var{architecture-type}
16924 @opindex march
16925 Generate code for the specified architecture. The choices for
16926 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
16927 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
16928 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
16929 architecture option for your machine. Code compiled for lower numbered
16930 architectures runs on higher numbered architectures, but not the
16931 other way around.
16932
16933 @item -mpa-risc-1-0
16934 @itemx -mpa-risc-1-1
16935 @itemx -mpa-risc-2-0
16936 @opindex mpa-risc-1-0
16937 @opindex mpa-risc-1-1
16938 @opindex mpa-risc-2-0
16939 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
16940
16941 @item -mjump-in-delay
16942 @opindex mjump-in-delay
16943 This option is ignored and provided for compatibility purposes only.
16944
16945 @item -mdisable-fpregs
16946 @opindex mdisable-fpregs
16947 Prevent floating-point registers from being used in any manner. This is
16948 necessary for compiling kernels that perform lazy context switching of
16949 floating-point registers. If you use this option and attempt to perform
16950 floating-point operations, the compiler aborts.
16951
16952 @item -mdisable-indexing
16953 @opindex mdisable-indexing
16954 Prevent the compiler from using indexing address modes. This avoids some
16955 rather obscure problems when compiling MIG generated code under MACH@.
16956
16957 @item -mno-space-regs
16958 @opindex mno-space-regs
16959 Generate code that assumes the target has no space registers. This allows
16960 GCC to generate faster indirect calls and use unscaled index address modes.
16961
16962 Such code is suitable for level 0 PA systems and kernels.
16963
16964 @item -mfast-indirect-calls
16965 @opindex mfast-indirect-calls
16966 Generate code that assumes calls never cross space boundaries. This
16967 allows GCC to emit code that performs faster indirect calls.
16968
16969 This option does not work in the presence of shared libraries or nested
16970 functions.
16971
16972 @item -mfixed-range=@var{register-range}
16973 @opindex mfixed-range
16974 Generate code treating the given register range as fixed registers.
16975 A fixed register is one that the register allocator cannot use. This is
16976 useful when compiling kernel code. A register range is specified as
16977 two registers separated by a dash. Multiple register ranges can be
16978 specified separated by a comma.
16979
16980 @item -mlong-load-store
16981 @opindex mlong-load-store
16982 Generate 3-instruction load and store sequences as sometimes required by
16983 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
16984 the HP compilers.
16985
16986 @item -mportable-runtime
16987 @opindex mportable-runtime
16988 Use the portable calling conventions proposed by HP for ELF systems.
16989
16990 @item -mgas
16991 @opindex mgas
16992 Enable the use of assembler directives only GAS understands.
16993
16994 @item -mschedule=@var{cpu-type}
16995 @opindex mschedule
16996 Schedule code according to the constraints for the machine type
16997 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
16998 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
16999 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
17000 proper scheduling option for your machine. The default scheduling is
17001 @samp{8000}.
17002
17003 @item -mlinker-opt
17004 @opindex mlinker-opt
17005 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
17006 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
17007 linkers in which they give bogus error messages when linking some programs.
17008
17009 @item -msoft-float
17010 @opindex msoft-float
17011 Generate output containing library calls for floating point.
17012 @strong{Warning:} the requisite libraries are not available for all HPPA
17013 targets. Normally the facilities of the machine's usual C compiler are
17014 used, but this cannot be done directly in cross-compilation. You must make
17015 your own arrangements to provide suitable library functions for
17016 cross-compilation.
17017
17018 @option{-msoft-float} changes the calling convention in the output file;
17019 therefore, it is only useful if you compile @emph{all} of a program with
17020 this option. In particular, you need to compile @file{libgcc.a}, the
17021 library that comes with GCC, with @option{-msoft-float} in order for
17022 this to work.
17023
17024 @item -msio
17025 @opindex msio
17026 Generate the predefine, @code{_SIO}, for server IO@. The default is
17027 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
17028 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
17029 options are available under HP-UX and HI-UX@.
17030
17031 @item -mgnu-ld
17032 @opindex mgnu-ld
17033 Use options specific to GNU @command{ld}.
17034 This passes @option{-shared} to @command{ld} when
17035 building a shared library. It is the default when GCC is configured,
17036 explicitly or implicitly, with the GNU linker. This option does not
17037 affect which @command{ld} is called; it only changes what parameters
17038 are passed to that @command{ld}.
17039 The @command{ld} that is called is determined by the
17040 @option{--with-ld} configure option, GCC's program search path, and
17041 finally by the user's @env{PATH}. The linker used by GCC can be printed
17042 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
17043 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
17044
17045 @item -mhp-ld
17046 @opindex mhp-ld
17047 Use options specific to HP @command{ld}.
17048 This passes @option{-b} to @command{ld} when building
17049 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
17050 links. It is the default when GCC is configured, explicitly or
17051 implicitly, with the HP linker. This option does not affect
17052 which @command{ld} is called; it only changes what parameters are passed to that
17053 @command{ld}.
17054 The @command{ld} that is called is determined by the @option{--with-ld}
17055 configure option, GCC's program search path, and finally by the user's
17056 @env{PATH}. The linker used by GCC can be printed using @samp{which
17057 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
17058 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
17059
17060 @item -mlong-calls
17061 @opindex mno-long-calls
17062 Generate code that uses long call sequences. This ensures that a call
17063 is always able to reach linker generated stubs. The default is to generate
17064 long calls only when the distance from the call site to the beginning
17065 of the function or translation unit, as the case may be, exceeds a
17066 predefined limit set by the branch type being used. The limits for
17067 normal calls are 7,600,000 and 240,000 bytes, respectively for the
17068 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
17069 240,000 bytes.
17070
17071 Distances are measured from the beginning of functions when using the
17072 @option{-ffunction-sections} option, or when using the @option{-mgas}
17073 and @option{-mno-portable-runtime} options together under HP-UX with
17074 the SOM linker.
17075
17076 It is normally not desirable to use this option as it degrades
17077 performance. However, it may be useful in large applications,
17078 particularly when partial linking is used to build the application.
17079
17080 The types of long calls used depends on the capabilities of the
17081 assembler and linker, and the type of code being generated. The
17082 impact on systems that support long absolute calls, and long pic
17083 symbol-difference or pc-relative calls should be relatively small.
17084 However, an indirect call is used on 32-bit ELF systems in pic code
17085 and it is quite long.
17086
17087 @item -munix=@var{unix-std}
17088 @opindex march
17089 Generate compiler predefines and select a startfile for the specified
17090 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
17091 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
17092 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
17093 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
17094 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
17095 and later.
17096
17097 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
17098 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
17099 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
17100 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
17101 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
17102 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
17103
17104 It is @emph{important} to note that this option changes the interfaces
17105 for various library routines. It also affects the operational behavior
17106 of the C library. Thus, @emph{extreme} care is needed in using this
17107 option.
17108
17109 Library code that is intended to operate with more than one UNIX
17110 standard must test, set and restore the variable @code{__xpg4_extended_mask}
17111 as appropriate. Most GNU software doesn't provide this capability.
17112
17113 @item -nolibdld
17114 @opindex nolibdld
17115 Suppress the generation of link options to search libdld.sl when the
17116 @option{-static} option is specified on HP-UX 10 and later.
17117
17118 @item -static
17119 @opindex static
17120 The HP-UX implementation of setlocale in libc has a dependency on
17121 libdld.sl. There isn't an archive version of libdld.sl. Thus,
17122 when the @option{-static} option is specified, special link options
17123 are needed to resolve this dependency.
17124
17125 On HP-UX 10 and later, the GCC driver adds the necessary options to
17126 link with libdld.sl when the @option{-static} option is specified.
17127 This causes the resulting binary to be dynamic. On the 64-bit port,
17128 the linkers generate dynamic binaries by default in any case. The
17129 @option{-nolibdld} option can be used to prevent the GCC driver from
17130 adding these link options.
17131
17132 @item -threads
17133 @opindex threads
17134 Add support for multithreading with the @dfn{dce thread} library
17135 under HP-UX@. This option sets flags for both the preprocessor and
17136 linker.
17137 @end table
17138
17139 @node IA-64 Options
17140 @subsection IA-64 Options
17141 @cindex IA-64 Options
17142
17143 These are the @samp{-m} options defined for the Intel IA-64 architecture.
17144
17145 @table @gcctabopt
17146 @item -mbig-endian
17147 @opindex mbig-endian
17148 Generate code for a big-endian target. This is the default for HP-UX@.
17149
17150 @item -mlittle-endian
17151 @opindex mlittle-endian
17152 Generate code for a little-endian target. This is the default for AIX5
17153 and GNU/Linux.
17154
17155 @item -mgnu-as
17156 @itemx -mno-gnu-as
17157 @opindex mgnu-as
17158 @opindex mno-gnu-as
17159 Generate (or don't) code for the GNU assembler. This is the default.
17160 @c Also, this is the default if the configure option @option{--with-gnu-as}
17161 @c is used.
17162
17163 @item -mgnu-ld
17164 @itemx -mno-gnu-ld
17165 @opindex mgnu-ld
17166 @opindex mno-gnu-ld
17167 Generate (or don't) code for the GNU linker. This is the default.
17168 @c Also, this is the default if the configure option @option{--with-gnu-ld}
17169 @c is used.
17170
17171 @item -mno-pic
17172 @opindex mno-pic
17173 Generate code that does not use a global pointer register. The result
17174 is not position independent code, and violates the IA-64 ABI@.
17175
17176 @item -mvolatile-asm-stop
17177 @itemx -mno-volatile-asm-stop
17178 @opindex mvolatile-asm-stop
17179 @opindex mno-volatile-asm-stop
17180 Generate (or don't) a stop bit immediately before and after volatile asm
17181 statements.
17182
17183 @item -mregister-names
17184 @itemx -mno-register-names
17185 @opindex mregister-names
17186 @opindex mno-register-names
17187 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
17188 the stacked registers. This may make assembler output more readable.
17189
17190 @item -mno-sdata
17191 @itemx -msdata
17192 @opindex mno-sdata
17193 @opindex msdata
17194 Disable (or enable) optimizations that use the small data section. This may
17195 be useful for working around optimizer bugs.
17196
17197 @item -mconstant-gp
17198 @opindex mconstant-gp
17199 Generate code that uses a single constant global pointer value. This is
17200 useful when compiling kernel code.
17201
17202 @item -mauto-pic
17203 @opindex mauto-pic
17204 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
17205 This is useful when compiling firmware code.
17206
17207 @item -minline-float-divide-min-latency
17208 @opindex minline-float-divide-min-latency
17209 Generate code for inline divides of floating-point values
17210 using the minimum latency algorithm.
17211
17212 @item -minline-float-divide-max-throughput
17213 @opindex minline-float-divide-max-throughput
17214 Generate code for inline divides of floating-point values
17215 using the maximum throughput algorithm.
17216
17217 @item -mno-inline-float-divide
17218 @opindex mno-inline-float-divide
17219 Do not generate inline code for divides of floating-point values.
17220
17221 @item -minline-int-divide-min-latency
17222 @opindex minline-int-divide-min-latency
17223 Generate code for inline divides of integer values
17224 using the minimum latency algorithm.
17225
17226 @item -minline-int-divide-max-throughput
17227 @opindex minline-int-divide-max-throughput
17228 Generate code for inline divides of integer values
17229 using the maximum throughput algorithm.
17230
17231 @item -mno-inline-int-divide
17232 @opindex mno-inline-int-divide
17233 Do not generate inline code for divides of integer values.
17234
17235 @item -minline-sqrt-min-latency
17236 @opindex minline-sqrt-min-latency
17237 Generate code for inline square roots
17238 using the minimum latency algorithm.
17239
17240 @item -minline-sqrt-max-throughput
17241 @opindex minline-sqrt-max-throughput
17242 Generate code for inline square roots
17243 using the maximum throughput algorithm.
17244
17245 @item -mno-inline-sqrt
17246 @opindex mno-inline-sqrt
17247 Do not generate inline code for @code{sqrt}.
17248
17249 @item -mfused-madd
17250 @itemx -mno-fused-madd
17251 @opindex mfused-madd
17252 @opindex mno-fused-madd
17253 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
17254 instructions. The default is to use these instructions.
17255
17256 @item -mno-dwarf2-asm
17257 @itemx -mdwarf2-asm
17258 @opindex mno-dwarf2-asm
17259 @opindex mdwarf2-asm
17260 Don't (or do) generate assembler code for the DWARF line number debugging
17261 info. This may be useful when not using the GNU assembler.
17262
17263 @item -mearly-stop-bits
17264 @itemx -mno-early-stop-bits
17265 @opindex mearly-stop-bits
17266 @opindex mno-early-stop-bits
17267 Allow stop bits to be placed earlier than immediately preceding the
17268 instruction that triggered the stop bit. This can improve instruction
17269 scheduling, but does not always do so.
17270
17271 @item -mfixed-range=@var{register-range}
17272 @opindex mfixed-range
17273 Generate code treating the given register range as fixed registers.
17274 A fixed register is one that the register allocator cannot use. This is
17275 useful when compiling kernel code. A register range is specified as
17276 two registers separated by a dash. Multiple register ranges can be
17277 specified separated by a comma.
17278
17279 @item -mtls-size=@var{tls-size}
17280 @opindex mtls-size
17281 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
17282 64.
17283
17284 @item -mtune=@var{cpu-type}
17285 @opindex mtune
17286 Tune the instruction scheduling for a particular CPU, Valid values are
17287 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
17288 and @samp{mckinley}.
17289
17290 @item -milp32
17291 @itemx -mlp64
17292 @opindex milp32
17293 @opindex mlp64
17294 Generate code for a 32-bit or 64-bit environment.
17295 The 32-bit environment sets int, long and pointer to 32 bits.
17296 The 64-bit environment sets int to 32 bits and long and pointer
17297 to 64 bits. These are HP-UX specific flags.
17298
17299 @item -mno-sched-br-data-spec
17300 @itemx -msched-br-data-spec
17301 @opindex mno-sched-br-data-spec
17302 @opindex msched-br-data-spec
17303 (Dis/En)able data speculative scheduling before reload.
17304 This results in generation of @code{ld.a} instructions and
17305 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17306 The default setting is disabled.
17307
17308 @item -msched-ar-data-spec
17309 @itemx -mno-sched-ar-data-spec
17310 @opindex msched-ar-data-spec
17311 @opindex mno-sched-ar-data-spec
17312 (En/Dis)able data speculative scheduling after reload.
17313 This results in generation of @code{ld.a} instructions and
17314 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17315 The default setting is enabled.
17316
17317 @item -mno-sched-control-spec
17318 @itemx -msched-control-spec
17319 @opindex mno-sched-control-spec
17320 @opindex msched-control-spec
17321 (Dis/En)able control speculative scheduling. This feature is
17322 available only during region scheduling (i.e.@: before reload).
17323 This results in generation of the @code{ld.s} instructions and
17324 the corresponding check instructions @code{chk.s}.
17325 The default setting is disabled.
17326
17327 @item -msched-br-in-data-spec
17328 @itemx -mno-sched-br-in-data-spec
17329 @opindex msched-br-in-data-spec
17330 @opindex mno-sched-br-in-data-spec
17331 (En/Dis)able speculative scheduling of the instructions that
17332 are dependent on the data speculative loads before reload.
17333 This is effective only with @option{-msched-br-data-spec} enabled.
17334 The default setting is enabled.
17335
17336 @item -msched-ar-in-data-spec
17337 @itemx -mno-sched-ar-in-data-spec
17338 @opindex msched-ar-in-data-spec
17339 @opindex mno-sched-ar-in-data-spec
17340 (En/Dis)able speculative scheduling of the instructions that
17341 are dependent on the data speculative loads after reload.
17342 This is effective only with @option{-msched-ar-data-spec} enabled.
17343 The default setting is enabled.
17344
17345 @item -msched-in-control-spec
17346 @itemx -mno-sched-in-control-spec
17347 @opindex msched-in-control-spec
17348 @opindex mno-sched-in-control-spec
17349 (En/Dis)able speculative scheduling of the instructions that
17350 are dependent on the control speculative loads.
17351 This is effective only with @option{-msched-control-spec} enabled.
17352 The default setting is enabled.
17353
17354 @item -mno-sched-prefer-non-data-spec-insns
17355 @itemx -msched-prefer-non-data-spec-insns
17356 @opindex mno-sched-prefer-non-data-spec-insns
17357 @opindex msched-prefer-non-data-spec-insns
17358 If enabled, data-speculative instructions are chosen for schedule
17359 only if there are no other choices at the moment. This makes
17360 the use of the data speculation much more conservative.
17361 The default setting is disabled.
17362
17363 @item -mno-sched-prefer-non-control-spec-insns
17364 @itemx -msched-prefer-non-control-spec-insns
17365 @opindex mno-sched-prefer-non-control-spec-insns
17366 @opindex msched-prefer-non-control-spec-insns
17367 If enabled, control-speculative instructions are chosen for schedule
17368 only if there are no other choices at the moment. This makes
17369 the use of the control speculation much more conservative.
17370 The default setting is disabled.
17371
17372 @item -mno-sched-count-spec-in-critical-path
17373 @itemx -msched-count-spec-in-critical-path
17374 @opindex mno-sched-count-spec-in-critical-path
17375 @opindex msched-count-spec-in-critical-path
17376 If enabled, speculative dependencies are considered during
17377 computation of the instructions priorities. This makes the use of the
17378 speculation a bit more conservative.
17379 The default setting is disabled.
17380
17381 @item -msched-spec-ldc
17382 @opindex msched-spec-ldc
17383 Use a simple data speculation check. This option is on by default.
17384
17385 @item -msched-control-spec-ldc
17386 @opindex msched-spec-ldc
17387 Use a simple check for control speculation. This option is on by default.
17388
17389 @item -msched-stop-bits-after-every-cycle
17390 @opindex msched-stop-bits-after-every-cycle
17391 Place a stop bit after every cycle when scheduling. This option is on
17392 by default.
17393
17394 @item -msched-fp-mem-deps-zero-cost
17395 @opindex msched-fp-mem-deps-zero-cost
17396 Assume that floating-point stores and loads are not likely to cause a conflict
17397 when placed into the same instruction group. This option is disabled by
17398 default.
17399
17400 @item -msel-sched-dont-check-control-spec
17401 @opindex msel-sched-dont-check-control-spec
17402 Generate checks for control speculation in selective scheduling.
17403 This flag is disabled by default.
17404
17405 @item -msched-max-memory-insns=@var{max-insns}
17406 @opindex msched-max-memory-insns
17407 Limit on the number of memory insns per instruction group, giving lower
17408 priority to subsequent memory insns attempting to schedule in the same
17409 instruction group. Frequently useful to prevent cache bank conflicts.
17410 The default value is 1.
17411
17412 @item -msched-max-memory-insns-hard-limit
17413 @opindex msched-max-memory-insns-hard-limit
17414 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
17415 disallowing more than that number in an instruction group.
17416 Otherwise, the limit is ``soft'', meaning that non-memory operations
17417 are preferred when the limit is reached, but memory operations may still
17418 be scheduled.
17419
17420 @end table
17421
17422 @node LM32 Options
17423 @subsection LM32 Options
17424 @cindex LM32 options
17425
17426 These @option{-m} options are defined for the LatticeMico32 architecture:
17427
17428 @table @gcctabopt
17429 @item -mbarrel-shift-enabled
17430 @opindex mbarrel-shift-enabled
17431 Enable barrel-shift instructions.
17432
17433 @item -mdivide-enabled
17434 @opindex mdivide-enabled
17435 Enable divide and modulus instructions.
17436
17437 @item -mmultiply-enabled
17438 @opindex multiply-enabled
17439 Enable multiply instructions.
17440
17441 @item -msign-extend-enabled
17442 @opindex msign-extend-enabled
17443 Enable sign extend instructions.
17444
17445 @item -muser-enabled
17446 @opindex muser-enabled
17447 Enable user-defined instructions.
17448
17449 @end table
17450
17451 @node M32C Options
17452 @subsection M32C Options
17453 @cindex M32C options
17454
17455 @table @gcctabopt
17456 @item -mcpu=@var{name}
17457 @opindex mcpu=
17458 Select the CPU for which code is generated. @var{name} may be one of
17459 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
17460 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
17461 the M32C/80 series.
17462
17463 @item -msim
17464 @opindex msim
17465 Specifies that the program will be run on the simulator. This causes
17466 an alternate runtime library to be linked in which supports, for
17467 example, file I/O@. You must not use this option when generating
17468 programs that will run on real hardware; you must provide your own
17469 runtime library for whatever I/O functions are needed.
17470
17471 @item -memregs=@var{number}
17472 @opindex memregs=
17473 Specifies the number of memory-based pseudo-registers GCC uses
17474 during code generation. These pseudo-registers are used like real
17475 registers, so there is a tradeoff between GCC's ability to fit the
17476 code into available registers, and the performance penalty of using
17477 memory instead of registers. Note that all modules in a program must
17478 be compiled with the same value for this option. Because of that, you
17479 must not use this option with GCC's default runtime libraries.
17480
17481 @end table
17482
17483 @node M32R/D Options
17484 @subsection M32R/D Options
17485 @cindex M32R/D options
17486
17487 These @option{-m} options are defined for Renesas M32R/D architectures:
17488
17489 @table @gcctabopt
17490 @item -m32r2
17491 @opindex m32r2
17492 Generate code for the M32R/2@.
17493
17494 @item -m32rx
17495 @opindex m32rx
17496 Generate code for the M32R/X@.
17497
17498 @item -m32r
17499 @opindex m32r
17500 Generate code for the M32R@. This is the default.
17501
17502 @item -mmodel=small
17503 @opindex mmodel=small
17504 Assume all objects live in the lower 16MB of memory (so that their addresses
17505 can be loaded with the @code{ld24} instruction), and assume all subroutines
17506 are reachable with the @code{bl} instruction.
17507 This is the default.
17508
17509 The addressability of a particular object can be set with the
17510 @code{model} attribute.
17511
17512 @item -mmodel=medium
17513 @opindex mmodel=medium
17514 Assume objects may be anywhere in the 32-bit address space (the compiler
17515 generates @code{seth/add3} instructions to load their addresses), and
17516 assume all subroutines are reachable with the @code{bl} instruction.
17517
17518 @item -mmodel=large
17519 @opindex mmodel=large
17520 Assume objects may be anywhere in the 32-bit address space (the compiler
17521 generates @code{seth/add3} instructions to load their addresses), and
17522 assume subroutines may not be reachable with the @code{bl} instruction
17523 (the compiler generates the much slower @code{seth/add3/jl}
17524 instruction sequence).
17525
17526 @item -msdata=none
17527 @opindex msdata=none
17528 Disable use of the small data area. Variables are put into
17529 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
17530 @code{section} attribute has been specified).
17531 This is the default.
17532
17533 The small data area consists of sections @code{.sdata} and @code{.sbss}.
17534 Objects may be explicitly put in the small data area with the
17535 @code{section} attribute using one of these sections.
17536
17537 @item -msdata=sdata
17538 @opindex msdata=sdata
17539 Put small global and static data in the small data area, but do not
17540 generate special code to reference them.
17541
17542 @item -msdata=use
17543 @opindex msdata=use
17544 Put small global and static data in the small data area, and generate
17545 special instructions to reference them.
17546
17547 @item -G @var{num}
17548 @opindex G
17549 @cindex smaller data references
17550 Put global and static objects less than or equal to @var{num} bytes
17551 into the small data or BSS sections instead of the normal data or BSS
17552 sections. The default value of @var{num} is 8.
17553 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
17554 for this option to have any effect.
17555
17556 All modules should be compiled with the same @option{-G @var{num}} value.
17557 Compiling with different values of @var{num} may or may not work; if it
17558 doesn't the linker gives an error message---incorrect code is not
17559 generated.
17560
17561 @item -mdebug
17562 @opindex mdebug
17563 Makes the M32R-specific code in the compiler display some statistics
17564 that might help in debugging programs.
17565
17566 @item -malign-loops
17567 @opindex malign-loops
17568 Align all loops to a 32-byte boundary.
17569
17570 @item -mno-align-loops
17571 @opindex mno-align-loops
17572 Do not enforce a 32-byte alignment for loops. This is the default.
17573
17574 @item -missue-rate=@var{number}
17575 @opindex missue-rate=@var{number}
17576 Issue @var{number} instructions per cycle. @var{number} can only be 1
17577 or 2.
17578
17579 @item -mbranch-cost=@var{number}
17580 @opindex mbranch-cost=@var{number}
17581 @var{number} can only be 1 or 2. If it is 1 then branches are
17582 preferred over conditional code, if it is 2, then the opposite applies.
17583
17584 @item -mflush-trap=@var{number}
17585 @opindex mflush-trap=@var{number}
17586 Specifies the trap number to use to flush the cache. The default is
17587 12. Valid numbers are between 0 and 15 inclusive.
17588
17589 @item -mno-flush-trap
17590 @opindex mno-flush-trap
17591 Specifies that the cache cannot be flushed by using a trap.
17592
17593 @item -mflush-func=@var{name}
17594 @opindex mflush-func=@var{name}
17595 Specifies the name of the operating system function to call to flush
17596 the cache. The default is @samp{_flush_cache}, but a function call
17597 is only used if a trap is not available.
17598
17599 @item -mno-flush-func
17600 @opindex mno-flush-func
17601 Indicates that there is no OS function for flushing the cache.
17602
17603 @end table
17604
17605 @node M680x0 Options
17606 @subsection M680x0 Options
17607 @cindex M680x0 options
17608
17609 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
17610 The default settings depend on which architecture was selected when
17611 the compiler was configured; the defaults for the most common choices
17612 are given below.
17613
17614 @table @gcctabopt
17615 @item -march=@var{arch}
17616 @opindex march
17617 Generate code for a specific M680x0 or ColdFire instruction set
17618 architecture. Permissible values of @var{arch} for M680x0
17619 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
17620 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
17621 architectures are selected according to Freescale's ISA classification
17622 and the permissible values are: @samp{isaa}, @samp{isaaplus},
17623 @samp{isab} and @samp{isac}.
17624
17625 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
17626 code for a ColdFire target. The @var{arch} in this macro is one of the
17627 @option{-march} arguments given above.
17628
17629 When used together, @option{-march} and @option{-mtune} select code
17630 that runs on a family of similar processors but that is optimized
17631 for a particular microarchitecture.
17632
17633 @item -mcpu=@var{cpu}
17634 @opindex mcpu
17635 Generate code for a specific M680x0 or ColdFire processor.
17636 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
17637 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
17638 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
17639 below, which also classifies the CPUs into families:
17640
17641 @multitable @columnfractions 0.20 0.80
17642 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
17643 @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}
17644 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
17645 @item @samp{5206e} @tab @samp{5206e}
17646 @item @samp{5208} @tab @samp{5207} @samp{5208}
17647 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
17648 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
17649 @item @samp{5216} @tab @samp{5214} @samp{5216}
17650 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
17651 @item @samp{5225} @tab @samp{5224} @samp{5225}
17652 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
17653 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
17654 @item @samp{5249} @tab @samp{5249}
17655 @item @samp{5250} @tab @samp{5250}
17656 @item @samp{5271} @tab @samp{5270} @samp{5271}
17657 @item @samp{5272} @tab @samp{5272}
17658 @item @samp{5275} @tab @samp{5274} @samp{5275}
17659 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
17660 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
17661 @item @samp{5307} @tab @samp{5307}
17662 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
17663 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
17664 @item @samp{5407} @tab @samp{5407}
17665 @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}
17666 @end multitable
17667
17668 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
17669 @var{arch} is compatible with @var{cpu}. Other combinations of
17670 @option{-mcpu} and @option{-march} are rejected.
17671
17672 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
17673 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
17674 where the value of @var{family} is given by the table above.
17675
17676 @item -mtune=@var{tune}
17677 @opindex mtune
17678 Tune the code for a particular microarchitecture within the
17679 constraints set by @option{-march} and @option{-mcpu}.
17680 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
17681 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
17682 and @samp{cpu32}. The ColdFire microarchitectures
17683 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
17684
17685 You can also use @option{-mtune=68020-40} for code that needs
17686 to run relatively well on 68020, 68030 and 68040 targets.
17687 @option{-mtune=68020-60} is similar but includes 68060 targets
17688 as well. These two options select the same tuning decisions as
17689 @option{-m68020-40} and @option{-m68020-60} respectively.
17690
17691 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
17692 when tuning for 680x0 architecture @var{arch}. It also defines
17693 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
17694 option is used. If GCC is tuning for a range of architectures,
17695 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
17696 it defines the macros for every architecture in the range.
17697
17698 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
17699 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
17700 of the arguments given above.
17701
17702 @item -m68000
17703 @itemx -mc68000
17704 @opindex m68000
17705 @opindex mc68000
17706 Generate output for a 68000. This is the default
17707 when the compiler is configured for 68000-based systems.
17708 It is equivalent to @option{-march=68000}.
17709
17710 Use this option for microcontrollers with a 68000 or EC000 core,
17711 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
17712
17713 @item -m68010
17714 @opindex m68010
17715 Generate output for a 68010. This is the default
17716 when the compiler is configured for 68010-based systems.
17717 It is equivalent to @option{-march=68010}.
17718
17719 @item -m68020
17720 @itemx -mc68020
17721 @opindex m68020
17722 @opindex mc68020
17723 Generate output for a 68020. This is the default
17724 when the compiler is configured for 68020-based systems.
17725 It is equivalent to @option{-march=68020}.
17726
17727 @item -m68030
17728 @opindex m68030
17729 Generate output for a 68030. This is the default when the compiler is
17730 configured for 68030-based systems. It is equivalent to
17731 @option{-march=68030}.
17732
17733 @item -m68040
17734 @opindex m68040
17735 Generate output for a 68040. This is the default when the compiler is
17736 configured for 68040-based systems. It is equivalent to
17737 @option{-march=68040}.
17738
17739 This option inhibits the use of 68881/68882 instructions that have to be
17740 emulated by software on the 68040. Use this option if your 68040 does not
17741 have code to emulate those instructions.
17742
17743 @item -m68060
17744 @opindex m68060
17745 Generate output for a 68060. This is the default when the compiler is
17746 configured for 68060-based systems. It is equivalent to
17747 @option{-march=68060}.
17748
17749 This option inhibits the use of 68020 and 68881/68882 instructions that
17750 have to be emulated by software on the 68060. Use this option if your 68060
17751 does not have code to emulate those instructions.
17752
17753 @item -mcpu32
17754 @opindex mcpu32
17755 Generate output for a CPU32. This is the default
17756 when the compiler is configured for CPU32-based systems.
17757 It is equivalent to @option{-march=cpu32}.
17758
17759 Use this option for microcontrollers with a
17760 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
17761 68336, 68340, 68341, 68349 and 68360.
17762
17763 @item -m5200
17764 @opindex m5200
17765 Generate output for a 520X ColdFire CPU@. This is the default
17766 when the compiler is configured for 520X-based systems.
17767 It is equivalent to @option{-mcpu=5206}, and is now deprecated
17768 in favor of that option.
17769
17770 Use this option for microcontroller with a 5200 core, including
17771 the MCF5202, MCF5203, MCF5204 and MCF5206.
17772
17773 @item -m5206e
17774 @opindex m5206e
17775 Generate output for a 5206e ColdFire CPU@. The option is now
17776 deprecated in favor of the equivalent @option{-mcpu=5206e}.
17777
17778 @item -m528x
17779 @opindex m528x
17780 Generate output for a member of the ColdFire 528X family.
17781 The option is now deprecated in favor of the equivalent
17782 @option{-mcpu=528x}.
17783
17784 @item -m5307
17785 @opindex m5307
17786 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
17787 in favor of the equivalent @option{-mcpu=5307}.
17788
17789 @item -m5407
17790 @opindex m5407
17791 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
17792 in favor of the equivalent @option{-mcpu=5407}.
17793
17794 @item -mcfv4e
17795 @opindex mcfv4e
17796 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
17797 This includes use of hardware floating-point instructions.
17798 The option is equivalent to @option{-mcpu=547x}, and is now
17799 deprecated in favor of that option.
17800
17801 @item -m68020-40
17802 @opindex m68020-40
17803 Generate output for a 68040, without using any of the new instructions.
17804 This results in code that can run relatively efficiently on either a
17805 68020/68881 or a 68030 or a 68040. The generated code does use the
17806 68881 instructions that are emulated on the 68040.
17807
17808 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
17809
17810 @item -m68020-60
17811 @opindex m68020-60
17812 Generate output for a 68060, without using any of the new instructions.
17813 This results in code that can run relatively efficiently on either a
17814 68020/68881 or a 68030 or a 68040. The generated code does use the
17815 68881 instructions that are emulated on the 68060.
17816
17817 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
17818
17819 @item -mhard-float
17820 @itemx -m68881
17821 @opindex mhard-float
17822 @opindex m68881
17823 Generate floating-point instructions. This is the default for 68020
17824 and above, and for ColdFire devices that have an FPU@. It defines the
17825 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
17826 on ColdFire targets.
17827
17828 @item -msoft-float
17829 @opindex msoft-float
17830 Do not generate floating-point instructions; use library calls instead.
17831 This is the default for 68000, 68010, and 68832 targets. It is also
17832 the default for ColdFire devices that have no FPU.
17833
17834 @item -mdiv
17835 @itemx -mno-div
17836 @opindex mdiv
17837 @opindex mno-div
17838 Generate (do not generate) ColdFire hardware divide and remainder
17839 instructions. If @option{-march} is used without @option{-mcpu},
17840 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
17841 architectures. Otherwise, the default is taken from the target CPU
17842 (either the default CPU, or the one specified by @option{-mcpu}). For
17843 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
17844 @option{-mcpu=5206e}.
17845
17846 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
17847
17848 @item -mshort
17849 @opindex mshort
17850 Consider type @code{int} to be 16 bits wide, like @code{short int}.
17851 Additionally, parameters passed on the stack are also aligned to a
17852 16-bit boundary even on targets whose API mandates promotion to 32-bit.
17853
17854 @item -mno-short
17855 @opindex mno-short
17856 Do not consider type @code{int} to be 16 bits wide. This is the default.
17857
17858 @item -mnobitfield
17859 @itemx -mno-bitfield
17860 @opindex mnobitfield
17861 @opindex mno-bitfield
17862 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
17863 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
17864
17865 @item -mbitfield
17866 @opindex mbitfield
17867 Do use the bit-field instructions. The @option{-m68020} option implies
17868 @option{-mbitfield}. This is the default if you use a configuration
17869 designed for a 68020.
17870
17871 @item -mrtd
17872 @opindex mrtd
17873 Use a different function-calling convention, in which functions
17874 that take a fixed number of arguments return with the @code{rtd}
17875 instruction, which pops their arguments while returning. This
17876 saves one instruction in the caller since there is no need to pop
17877 the arguments there.
17878
17879 This calling convention is incompatible with the one normally
17880 used on Unix, so you cannot use it if you need to call libraries
17881 compiled with the Unix compiler.
17882
17883 Also, you must provide function prototypes for all functions that
17884 take variable numbers of arguments (including @code{printf});
17885 otherwise incorrect code is generated for calls to those
17886 functions.
17887
17888 In addition, seriously incorrect code results if you call a
17889 function with too many arguments. (Normally, extra arguments are
17890 harmlessly ignored.)
17891
17892 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
17893 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
17894
17895 @item -mno-rtd
17896 @opindex mno-rtd
17897 Do not use the calling conventions selected by @option{-mrtd}.
17898 This is the default.
17899
17900 @item -malign-int
17901 @itemx -mno-align-int
17902 @opindex malign-int
17903 @opindex mno-align-int
17904 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
17905 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
17906 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
17907 Aligning variables on 32-bit boundaries produces code that runs somewhat
17908 faster on processors with 32-bit busses at the expense of more memory.
17909
17910 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
17911 aligns structures containing the above types differently than
17912 most published application binary interface specifications for the m68k.
17913
17914 @item -mpcrel
17915 @opindex mpcrel
17916 Use the pc-relative addressing mode of the 68000 directly, instead of
17917 using a global offset table. At present, this option implies @option{-fpic},
17918 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
17919 not presently supported with @option{-mpcrel}, though this could be supported for
17920 68020 and higher processors.
17921
17922 @item -mno-strict-align
17923 @itemx -mstrict-align
17924 @opindex mno-strict-align
17925 @opindex mstrict-align
17926 Do not (do) assume that unaligned memory references are handled by
17927 the system.
17928
17929 @item -msep-data
17930 Generate code that allows the data segment to be located in a different
17931 area of memory from the text segment. This allows for execute-in-place in
17932 an environment without virtual memory management. This option implies
17933 @option{-fPIC}.
17934
17935 @item -mno-sep-data
17936 Generate code that assumes that the data segment follows the text segment.
17937 This is the default.
17938
17939 @item -mid-shared-library
17940 Generate code that supports shared libraries via the library ID method.
17941 This allows for execute-in-place and shared libraries in an environment
17942 without virtual memory management. This option implies @option{-fPIC}.
17943
17944 @item -mno-id-shared-library
17945 Generate code that doesn't assume ID-based shared libraries are being used.
17946 This is the default.
17947
17948 @item -mshared-library-id=n
17949 Specifies the identification number of the ID-based shared library being
17950 compiled. Specifying a value of 0 generates more compact code; specifying
17951 other values forces the allocation of that number to the current
17952 library, but is no more space- or time-efficient than omitting this option.
17953
17954 @item -mxgot
17955 @itemx -mno-xgot
17956 @opindex mxgot
17957 @opindex mno-xgot
17958 When generating position-independent code for ColdFire, generate code
17959 that works if the GOT has more than 8192 entries. This code is
17960 larger and slower than code generated without this option. On M680x0
17961 processors, this option is not needed; @option{-fPIC} suffices.
17962
17963 GCC normally uses a single instruction to load values from the GOT@.
17964 While this is relatively efficient, it only works if the GOT
17965 is smaller than about 64k. Anything larger causes the linker
17966 to report an error such as:
17967
17968 @cindex relocation truncated to fit (ColdFire)
17969 @smallexample
17970 relocation truncated to fit: R_68K_GOT16O foobar
17971 @end smallexample
17972
17973 If this happens, you should recompile your code with @option{-mxgot}.
17974 It should then work with very large GOTs. However, code generated with
17975 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
17976 the value of a global symbol.
17977
17978 Note that some linkers, including newer versions of the GNU linker,
17979 can create multiple GOTs and sort GOT entries. If you have such a linker,
17980 you should only need to use @option{-mxgot} when compiling a single
17981 object file that accesses more than 8192 GOT entries. Very few do.
17982
17983 These options have no effect unless GCC is generating
17984 position-independent code.
17985
17986 @end table
17987
17988 @node MCore Options
17989 @subsection MCore Options
17990 @cindex MCore options
17991
17992 These are the @samp{-m} options defined for the Motorola M*Core
17993 processors.
17994
17995 @table @gcctabopt
17996
17997 @item -mhardlit
17998 @itemx -mno-hardlit
17999 @opindex mhardlit
18000 @opindex mno-hardlit
18001 Inline constants into the code stream if it can be done in two
18002 instructions or less.
18003
18004 @item -mdiv
18005 @itemx -mno-div
18006 @opindex mdiv
18007 @opindex mno-div
18008 Use the divide instruction. (Enabled by default).
18009
18010 @item -mrelax-immediate
18011 @itemx -mno-relax-immediate
18012 @opindex mrelax-immediate
18013 @opindex mno-relax-immediate
18014 Allow arbitrary-sized immediates in bit operations.
18015
18016 @item -mwide-bitfields
18017 @itemx -mno-wide-bitfields
18018 @opindex mwide-bitfields
18019 @opindex mno-wide-bitfields
18020 Always treat bit-fields as @code{int}-sized.
18021
18022 @item -m4byte-functions
18023 @itemx -mno-4byte-functions
18024 @opindex m4byte-functions
18025 @opindex mno-4byte-functions
18026 Force all functions to be aligned to a 4-byte boundary.
18027
18028 @item -mcallgraph-data
18029 @itemx -mno-callgraph-data
18030 @opindex mcallgraph-data
18031 @opindex mno-callgraph-data
18032 Emit callgraph information.
18033
18034 @item -mslow-bytes
18035 @itemx -mno-slow-bytes
18036 @opindex mslow-bytes
18037 @opindex mno-slow-bytes
18038 Prefer word access when reading byte quantities.
18039
18040 @item -mlittle-endian
18041 @itemx -mbig-endian
18042 @opindex mlittle-endian
18043 @opindex mbig-endian
18044 Generate code for a little-endian target.
18045
18046 @item -m210
18047 @itemx -m340
18048 @opindex m210
18049 @opindex m340
18050 Generate code for the 210 processor.
18051
18052 @item -mno-lsim
18053 @opindex mno-lsim
18054 Assume that runtime support has been provided and so omit the
18055 simulator library (@file{libsim.a)} from the linker command line.
18056
18057 @item -mstack-increment=@var{size}
18058 @opindex mstack-increment
18059 Set the maximum amount for a single stack increment operation. Large
18060 values can increase the speed of programs that contain functions
18061 that need a large amount of stack space, but they can also trigger a
18062 segmentation fault if the stack is extended too much. The default
18063 value is 0x1000.
18064
18065 @end table
18066
18067 @node MeP Options
18068 @subsection MeP Options
18069 @cindex MeP options
18070
18071 @table @gcctabopt
18072
18073 @item -mabsdiff
18074 @opindex mabsdiff
18075 Enables the @code{abs} instruction, which is the absolute difference
18076 between two registers.
18077
18078 @item -mall-opts
18079 @opindex mall-opts
18080 Enables all the optional instructions---average, multiply, divide, bit
18081 operations, leading zero, absolute difference, min/max, clip, and
18082 saturation.
18083
18084
18085 @item -maverage
18086 @opindex maverage
18087 Enables the @code{ave} instruction, which computes the average of two
18088 registers.
18089
18090 @item -mbased=@var{n}
18091 @opindex mbased=
18092 Variables of size @var{n} bytes or smaller are placed in the
18093 @code{.based} section by default. Based variables use the @code{$tp}
18094 register as a base register, and there is a 128-byte limit to the
18095 @code{.based} section.
18096
18097 @item -mbitops
18098 @opindex mbitops
18099 Enables the bit operation instructions---bit test (@code{btstm}), set
18100 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
18101 test-and-set (@code{tas}).
18102
18103 @item -mc=@var{name}
18104 @opindex mc=
18105 Selects which section constant data is placed in. @var{name} may
18106 be @samp{tiny}, @samp{near}, or @samp{far}.
18107
18108 @item -mclip
18109 @opindex mclip
18110 Enables the @code{clip} instruction. Note that @option{-mclip} is not
18111 useful unless you also provide @option{-mminmax}.
18112
18113 @item -mconfig=@var{name}
18114 @opindex mconfig=
18115 Selects one of the built-in core configurations. Each MeP chip has
18116 one or more modules in it; each module has a core CPU and a variety of
18117 coprocessors, optional instructions, and peripherals. The
18118 @code{MeP-Integrator} tool, not part of GCC, provides these
18119 configurations through this option; using this option is the same as
18120 using all the corresponding command-line options. The default
18121 configuration is @samp{default}.
18122
18123 @item -mcop
18124 @opindex mcop
18125 Enables the coprocessor instructions. By default, this is a 32-bit
18126 coprocessor. Note that the coprocessor is normally enabled via the
18127 @option{-mconfig=} option.
18128
18129 @item -mcop32
18130 @opindex mcop32
18131 Enables the 32-bit coprocessor's instructions.
18132
18133 @item -mcop64
18134 @opindex mcop64
18135 Enables the 64-bit coprocessor's instructions.
18136
18137 @item -mivc2
18138 @opindex mivc2
18139 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
18140
18141 @item -mdc
18142 @opindex mdc
18143 Causes constant variables to be placed in the @code{.near} section.
18144
18145 @item -mdiv
18146 @opindex mdiv
18147 Enables the @code{div} and @code{divu} instructions.
18148
18149 @item -meb
18150 @opindex meb
18151 Generate big-endian code.
18152
18153 @item -mel
18154 @opindex mel
18155 Generate little-endian code.
18156
18157 @item -mio-volatile
18158 @opindex mio-volatile
18159 Tells the compiler that any variable marked with the @code{io}
18160 attribute is to be considered volatile.
18161
18162 @item -ml
18163 @opindex ml
18164 Causes variables to be assigned to the @code{.far} section by default.
18165
18166 @item -mleadz
18167 @opindex mleadz
18168 Enables the @code{leadz} (leading zero) instruction.
18169
18170 @item -mm
18171 @opindex mm
18172 Causes variables to be assigned to the @code{.near} section by default.
18173
18174 @item -mminmax
18175 @opindex mminmax
18176 Enables the @code{min} and @code{max} instructions.
18177
18178 @item -mmult
18179 @opindex mmult
18180 Enables the multiplication and multiply-accumulate instructions.
18181
18182 @item -mno-opts
18183 @opindex mno-opts
18184 Disables all the optional instructions enabled by @option{-mall-opts}.
18185
18186 @item -mrepeat
18187 @opindex mrepeat
18188 Enables the @code{repeat} and @code{erepeat} instructions, used for
18189 low-overhead looping.
18190
18191 @item -ms
18192 @opindex ms
18193 Causes all variables to default to the @code{.tiny} section. Note
18194 that there is a 65536-byte limit to this section. Accesses to these
18195 variables use the @code{%gp} base register.
18196
18197 @item -msatur
18198 @opindex msatur
18199 Enables the saturation instructions. Note that the compiler does not
18200 currently generate these itself, but this option is included for
18201 compatibility with other tools, like @code{as}.
18202
18203 @item -msdram
18204 @opindex msdram
18205 Link the SDRAM-based runtime instead of the default ROM-based runtime.
18206
18207 @item -msim
18208 @opindex msim
18209 Link the simulator run-time libraries.
18210
18211 @item -msimnovec
18212 @opindex msimnovec
18213 Link the simulator runtime libraries, excluding built-in support
18214 for reset and exception vectors and tables.
18215
18216 @item -mtf
18217 @opindex mtf
18218 Causes all functions to default to the @code{.far} section. Without
18219 this option, functions default to the @code{.near} section.
18220
18221 @item -mtiny=@var{n}
18222 @opindex mtiny=
18223 Variables that are @var{n} bytes or smaller are allocated to the
18224 @code{.tiny} section. These variables use the @code{$gp} base
18225 register. The default for this option is 4, but note that there's a
18226 65536-byte limit to the @code{.tiny} section.
18227
18228 @end table
18229
18230 @node MicroBlaze Options
18231 @subsection MicroBlaze Options
18232 @cindex MicroBlaze Options
18233
18234 @table @gcctabopt
18235
18236 @item -msoft-float
18237 @opindex msoft-float
18238 Use software emulation for floating point (default).
18239
18240 @item -mhard-float
18241 @opindex mhard-float
18242 Use hardware floating-point instructions.
18243
18244 @item -mmemcpy
18245 @opindex mmemcpy
18246 Do not optimize block moves, use @code{memcpy}.
18247
18248 @item -mno-clearbss
18249 @opindex mno-clearbss
18250 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
18251
18252 @item -mcpu=@var{cpu-type}
18253 @opindex mcpu=
18254 Use features of, and schedule code for, the given CPU.
18255 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
18256 where @var{X} is a major version, @var{YY} is the minor version, and
18257 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
18258 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
18259
18260 @item -mxl-soft-mul
18261 @opindex mxl-soft-mul
18262 Use software multiply emulation (default).
18263
18264 @item -mxl-soft-div
18265 @opindex mxl-soft-div
18266 Use software emulation for divides (default).
18267
18268 @item -mxl-barrel-shift
18269 @opindex mxl-barrel-shift
18270 Use the hardware barrel shifter.
18271
18272 @item -mxl-pattern-compare
18273 @opindex mxl-pattern-compare
18274 Use pattern compare instructions.
18275
18276 @item -msmall-divides
18277 @opindex msmall-divides
18278 Use table lookup optimization for small signed integer divisions.
18279
18280 @item -mxl-stack-check
18281 @opindex mxl-stack-check
18282 This option is deprecated. Use @option{-fstack-check} instead.
18283
18284 @item -mxl-gp-opt
18285 @opindex mxl-gp-opt
18286 Use GP-relative @code{.sdata}/@code{.sbss} sections.
18287
18288 @item -mxl-multiply-high
18289 @opindex mxl-multiply-high
18290 Use multiply high instructions for high part of 32x32 multiply.
18291
18292 @item -mxl-float-convert
18293 @opindex mxl-float-convert
18294 Use hardware floating-point conversion instructions.
18295
18296 @item -mxl-float-sqrt
18297 @opindex mxl-float-sqrt
18298 Use hardware floating-point square root instruction.
18299
18300 @item -mbig-endian
18301 @opindex mbig-endian
18302 Generate code for a big-endian target.
18303
18304 @item -mlittle-endian
18305 @opindex mlittle-endian
18306 Generate code for a little-endian target.
18307
18308 @item -mxl-reorder
18309 @opindex mxl-reorder
18310 Use reorder instructions (swap and byte reversed load/store).
18311
18312 @item -mxl-mode-@var{app-model}
18313 Select application model @var{app-model}. Valid models are
18314 @table @samp
18315 @item executable
18316 normal executable (default), uses startup code @file{crt0.o}.
18317
18318 @item xmdstub
18319 for use with Xilinx Microprocessor Debugger (XMD) based
18320 software intrusive debug agent called xmdstub. This uses startup file
18321 @file{crt1.o} and sets the start address of the program to 0x800.
18322
18323 @item bootstrap
18324 for applications that are loaded using a bootloader.
18325 This model uses startup file @file{crt2.o} which does not contain a processor
18326 reset vector handler. This is suitable for transferring control on a
18327 processor reset to the bootloader rather than the application.
18328
18329 @item novectors
18330 for applications that do not require any of the
18331 MicroBlaze vectors. This option may be useful for applications running
18332 within a monitoring application. This model uses @file{crt3.o} as a startup file.
18333 @end table
18334
18335 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
18336 @option{-mxl-mode-@var{app-model}}.
18337
18338 @end table
18339
18340 @node MIPS Options
18341 @subsection MIPS Options
18342 @cindex MIPS options
18343
18344 @table @gcctabopt
18345
18346 @item -EB
18347 @opindex EB
18348 Generate big-endian code.
18349
18350 @item -EL
18351 @opindex EL
18352 Generate little-endian code. This is the default for @samp{mips*el-*-*}
18353 configurations.
18354
18355 @item -march=@var{arch}
18356 @opindex march
18357 Generate code that runs on @var{arch}, which can be the name of a
18358 generic MIPS ISA, or the name of a particular processor.
18359 The ISA names are:
18360 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
18361 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
18362 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
18363 @samp{mips64r5} and @samp{mips64r6}.
18364 The processor names are:
18365 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
18366 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
18367 @samp{5kc}, @samp{5kf},
18368 @samp{20kc},
18369 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
18370 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
18371 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
18372 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
18373 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
18374 @samp{i6400},
18375 @samp{interaptiv},
18376 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
18377 @samp{m4k},
18378 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
18379 @samp{m5100}, @samp{m5101},
18380 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
18381 @samp{orion},
18382 @samp{p5600},
18383 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
18384 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
18385 @samp{rm7000}, @samp{rm9000},
18386 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
18387 @samp{sb1},
18388 @samp{sr71000},
18389 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
18390 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
18391 @samp{xlr} and @samp{xlp}.
18392 The special value @samp{from-abi} selects the
18393 most compatible architecture for the selected ABI (that is,
18394 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
18395
18396 The native Linux/GNU toolchain also supports the value @samp{native},
18397 which selects the best architecture option for the host processor.
18398 @option{-march=native} has no effect if GCC does not recognize
18399 the processor.
18400
18401 In processor names, a final @samp{000} can be abbreviated as @samp{k}
18402 (for example, @option{-march=r2k}). Prefixes are optional, and
18403 @samp{vr} may be written @samp{r}.
18404
18405 Names of the form @samp{@var{n}f2_1} refer to processors with
18406 FPUs clocked at half the rate of the core, names of the form
18407 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
18408 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
18409 processors with FPUs clocked a ratio of 3:2 with respect to the core.
18410 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
18411 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
18412 accepted as synonyms for @samp{@var{n}f1_1}.
18413
18414 GCC defines two macros based on the value of this option. The first
18415 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
18416 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
18417 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
18418 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
18419 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
18420
18421 Note that the @code{_MIPS_ARCH} macro uses the processor names given
18422 above. In other words, it has the full prefix and does not
18423 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
18424 the macro names the resolved architecture (either @code{"mips1"} or
18425 @code{"mips3"}). It names the default architecture when no
18426 @option{-march} option is given.
18427
18428 @item -mtune=@var{arch}
18429 @opindex mtune
18430 Optimize for @var{arch}. Among other things, this option controls
18431 the way instructions are scheduled, and the perceived cost of arithmetic
18432 operations. The list of @var{arch} values is the same as for
18433 @option{-march}.
18434
18435 When this option is not used, GCC optimizes for the processor
18436 specified by @option{-march}. By using @option{-march} and
18437 @option{-mtune} together, it is possible to generate code that
18438 runs on a family of processors, but optimize the code for one
18439 particular member of that family.
18440
18441 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
18442 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
18443 @option{-march} ones described above.
18444
18445 @item -mips1
18446 @opindex mips1
18447 Equivalent to @option{-march=mips1}.
18448
18449 @item -mips2
18450 @opindex mips2
18451 Equivalent to @option{-march=mips2}.
18452
18453 @item -mips3
18454 @opindex mips3
18455 Equivalent to @option{-march=mips3}.
18456
18457 @item -mips4
18458 @opindex mips4
18459 Equivalent to @option{-march=mips4}.
18460
18461 @item -mips32
18462 @opindex mips32
18463 Equivalent to @option{-march=mips32}.
18464
18465 @item -mips32r3
18466 @opindex mips32r3
18467 Equivalent to @option{-march=mips32r3}.
18468
18469 @item -mips32r5
18470 @opindex mips32r5
18471 Equivalent to @option{-march=mips32r5}.
18472
18473 @item -mips32r6
18474 @opindex mips32r6
18475 Equivalent to @option{-march=mips32r6}.
18476
18477 @item -mips64
18478 @opindex mips64
18479 Equivalent to @option{-march=mips64}.
18480
18481 @item -mips64r2
18482 @opindex mips64r2
18483 Equivalent to @option{-march=mips64r2}.
18484
18485 @item -mips64r3
18486 @opindex mips64r3
18487 Equivalent to @option{-march=mips64r3}.
18488
18489 @item -mips64r5
18490 @opindex mips64r5
18491 Equivalent to @option{-march=mips64r5}.
18492
18493 @item -mips64r6
18494 @opindex mips64r6
18495 Equivalent to @option{-march=mips64r6}.
18496
18497 @item -mips16
18498 @itemx -mno-mips16
18499 @opindex mips16
18500 @opindex mno-mips16
18501 Generate (do not generate) MIPS16 code. If GCC is targeting a
18502 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
18503
18504 MIPS16 code generation can also be controlled on a per-function basis
18505 by means of @code{mips16} and @code{nomips16} attributes.
18506 @xref{Function Attributes}, for more information.
18507
18508 @item -mflip-mips16
18509 @opindex mflip-mips16
18510 Generate MIPS16 code on alternating functions. This option is provided
18511 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
18512 not intended for ordinary use in compiling user code.
18513
18514 @item -minterlink-compressed
18515 @item -mno-interlink-compressed
18516 @opindex minterlink-compressed
18517 @opindex mno-interlink-compressed
18518 Require (do not require) that code using the standard (uncompressed) MIPS ISA
18519 be link-compatible with MIPS16 and microMIPS code, and vice versa.
18520
18521 For example, code using the standard ISA encoding cannot jump directly
18522 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
18523 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
18524 knows that the target of the jump is not compressed.
18525
18526 @item -minterlink-mips16
18527 @itemx -mno-interlink-mips16
18528 @opindex minterlink-mips16
18529 @opindex mno-interlink-mips16
18530 Aliases of @option{-minterlink-compressed} and
18531 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
18532 and are retained for backwards compatibility.
18533
18534 @item -mabi=32
18535 @itemx -mabi=o64
18536 @itemx -mabi=n32
18537 @itemx -mabi=64
18538 @itemx -mabi=eabi
18539 @opindex mabi=32
18540 @opindex mabi=o64
18541 @opindex mabi=n32
18542 @opindex mabi=64
18543 @opindex mabi=eabi
18544 Generate code for the given ABI@.
18545
18546 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
18547 generates 64-bit code when you select a 64-bit architecture, but you
18548 can use @option{-mgp32} to get 32-bit code instead.
18549
18550 For information about the O64 ABI, see
18551 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
18552
18553 GCC supports a variant of the o32 ABI in which floating-point registers
18554 are 64 rather than 32 bits wide. You can select this combination with
18555 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
18556 and @code{mfhc1} instructions and is therefore only supported for
18557 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
18558
18559 The register assignments for arguments and return values remain the
18560 same, but each scalar value is passed in a single 64-bit register
18561 rather than a pair of 32-bit registers. For example, scalar
18562 floating-point values are returned in @samp{$f0} only, not a
18563 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
18564 remains the same in that the even-numbered double-precision registers
18565 are saved.
18566
18567 Two additional variants of the o32 ABI are supported to enable
18568 a transition from 32-bit to 64-bit registers. These are FPXX
18569 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
18570 The FPXX extension mandates that all code must execute correctly
18571 when run using 32-bit or 64-bit registers. The code can be interlinked
18572 with either FP32 or FP64, but not both.
18573 The FP64A extension is similar to the FP64 extension but forbids the
18574 use of odd-numbered single-precision registers. This can be used
18575 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
18576 processors and allows both FP32 and FP64A code to interlink and
18577 run in the same process without changing FPU modes.
18578
18579 @item -mabicalls
18580 @itemx -mno-abicalls
18581 @opindex mabicalls
18582 @opindex mno-abicalls
18583 Generate (do not generate) code that is suitable for SVR4-style
18584 dynamic objects. @option{-mabicalls} is the default for SVR4-based
18585 systems.
18586
18587 @item -mshared
18588 @itemx -mno-shared
18589 Generate (do not generate) code that is fully position-independent,
18590 and that can therefore be linked into shared libraries. This option
18591 only affects @option{-mabicalls}.
18592
18593 All @option{-mabicalls} code has traditionally been position-independent,
18594 regardless of options like @option{-fPIC} and @option{-fpic}. However,
18595 as an extension, the GNU toolchain allows executables to use absolute
18596 accesses for locally-binding symbols. It can also use shorter GP
18597 initialization sequences and generate direct calls to locally-defined
18598 functions. This mode is selected by @option{-mno-shared}.
18599
18600 @option{-mno-shared} depends on binutils 2.16 or higher and generates
18601 objects that can only be linked by the GNU linker. However, the option
18602 does not affect the ABI of the final executable; it only affects the ABI
18603 of relocatable objects. Using @option{-mno-shared} generally makes
18604 executables both smaller and quicker.
18605
18606 @option{-mshared} is the default.
18607
18608 @item -mplt
18609 @itemx -mno-plt
18610 @opindex mplt
18611 @opindex mno-plt
18612 Assume (do not assume) that the static and dynamic linkers
18613 support PLTs and copy relocations. This option only affects
18614 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
18615 has no effect without @option{-msym32}.
18616
18617 You can make @option{-mplt} the default by configuring
18618 GCC with @option{--with-mips-plt}. The default is
18619 @option{-mno-plt} otherwise.
18620
18621 @item -mxgot
18622 @itemx -mno-xgot
18623 @opindex mxgot
18624 @opindex mno-xgot
18625 Lift (do not lift) the usual restrictions on the size of the global
18626 offset table.
18627
18628 GCC normally uses a single instruction to load values from the GOT@.
18629 While this is relatively efficient, it only works if the GOT
18630 is smaller than about 64k. Anything larger causes the linker
18631 to report an error such as:
18632
18633 @cindex relocation truncated to fit (MIPS)
18634 @smallexample
18635 relocation truncated to fit: R_MIPS_GOT16 foobar
18636 @end smallexample
18637
18638 If this happens, you should recompile your code with @option{-mxgot}.
18639 This works with very large GOTs, although the code is also
18640 less efficient, since it takes three instructions to fetch the
18641 value of a global symbol.
18642
18643 Note that some linkers can create multiple GOTs. If you have such a
18644 linker, you should only need to use @option{-mxgot} when a single object
18645 file accesses more than 64k's worth of GOT entries. Very few do.
18646
18647 These options have no effect unless GCC is generating position
18648 independent code.
18649
18650 @item -mgp32
18651 @opindex mgp32
18652 Assume that general-purpose registers are 32 bits wide.
18653
18654 @item -mgp64
18655 @opindex mgp64
18656 Assume that general-purpose registers are 64 bits wide.
18657
18658 @item -mfp32
18659 @opindex mfp32
18660 Assume that floating-point registers are 32 bits wide.
18661
18662 @item -mfp64
18663 @opindex mfp64
18664 Assume that floating-point registers are 64 bits wide.
18665
18666 @item -mfpxx
18667 @opindex mfpxx
18668 Do not assume the width of floating-point registers.
18669
18670 @item -mhard-float
18671 @opindex mhard-float
18672 Use floating-point coprocessor instructions.
18673
18674 @item -msoft-float
18675 @opindex msoft-float
18676 Do not use floating-point coprocessor instructions. Implement
18677 floating-point calculations using library calls instead.
18678
18679 @item -mno-float
18680 @opindex mno-float
18681 Equivalent to @option{-msoft-float}, but additionally asserts that the
18682 program being compiled does not perform any floating-point operations.
18683 This option is presently supported only by some bare-metal MIPS
18684 configurations, where it may select a special set of libraries
18685 that lack all floating-point support (including, for example, the
18686 floating-point @code{printf} formats).
18687 If code compiled with @option{-mno-float} accidentally contains
18688 floating-point operations, it is likely to suffer a link-time
18689 or run-time failure.
18690
18691 @item -msingle-float
18692 @opindex msingle-float
18693 Assume that the floating-point coprocessor only supports single-precision
18694 operations.
18695
18696 @item -mdouble-float
18697 @opindex mdouble-float
18698 Assume that the floating-point coprocessor supports double-precision
18699 operations. This is the default.
18700
18701 @item -modd-spreg
18702 @itemx -mno-odd-spreg
18703 @opindex modd-spreg
18704 @opindex mno-odd-spreg
18705 Enable the use of odd-numbered single-precision floating-point registers
18706 for the o32 ABI. This is the default for processors that are known to
18707 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
18708 is set by default.
18709
18710 @item -mabs=2008
18711 @itemx -mabs=legacy
18712 @opindex mabs=2008
18713 @opindex mabs=legacy
18714 These options control the treatment of the special not-a-number (NaN)
18715 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
18716 @code{neg.@i{fmt}} machine instructions.
18717
18718 By default or when @option{-mabs=legacy} is used the legacy
18719 treatment is selected. In this case these instructions are considered
18720 arithmetic and avoided where correct operation is required and the
18721 input operand might be a NaN. A longer sequence of instructions that
18722 manipulate the sign bit of floating-point datum manually is used
18723 instead unless the @option{-ffinite-math-only} option has also been
18724 specified.
18725
18726 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
18727 this case these instructions are considered non-arithmetic and therefore
18728 operating correctly in all cases, including in particular where the
18729 input operand is a NaN. These instructions are therefore always used
18730 for the respective operations.
18731
18732 @item -mnan=2008
18733 @itemx -mnan=legacy
18734 @opindex mnan=2008
18735 @opindex mnan=legacy
18736 These options control the encoding of the special not-a-number (NaN)
18737 IEEE 754 floating-point data.
18738
18739 The @option{-mnan=legacy} option selects the legacy encoding. In this
18740 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
18741 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
18742 by the first bit of their trailing significand field being 1.
18743
18744 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
18745 this case qNaNs are denoted by the first bit of their trailing
18746 significand field being 1, whereas sNaNs are denoted by the first bit of
18747 their trailing significand field being 0.
18748
18749 The default is @option{-mnan=legacy} unless GCC has been configured with
18750 @option{--with-nan=2008}.
18751
18752 @item -mllsc
18753 @itemx -mno-llsc
18754 @opindex mllsc
18755 @opindex mno-llsc
18756 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
18757 implement atomic memory built-in functions. When neither option is
18758 specified, GCC uses the instructions if the target architecture
18759 supports them.
18760
18761 @option{-mllsc} is useful if the runtime environment can emulate the
18762 instructions and @option{-mno-llsc} can be useful when compiling for
18763 nonstandard ISAs. You can make either option the default by
18764 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
18765 respectively. @option{--with-llsc} is the default for some
18766 configurations; see the installation documentation for details.
18767
18768 @item -mdsp
18769 @itemx -mno-dsp
18770 @opindex mdsp
18771 @opindex mno-dsp
18772 Use (do not use) revision 1 of the MIPS DSP ASE@.
18773 @xref{MIPS DSP Built-in Functions}. This option defines the
18774 preprocessor macro @code{__mips_dsp}. It also defines
18775 @code{__mips_dsp_rev} to 1.
18776
18777 @item -mdspr2
18778 @itemx -mno-dspr2
18779 @opindex mdspr2
18780 @opindex mno-dspr2
18781 Use (do not use) revision 2 of the MIPS DSP ASE@.
18782 @xref{MIPS DSP Built-in Functions}. This option defines the
18783 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
18784 It also defines @code{__mips_dsp_rev} to 2.
18785
18786 @item -msmartmips
18787 @itemx -mno-smartmips
18788 @opindex msmartmips
18789 @opindex mno-smartmips
18790 Use (do not use) the MIPS SmartMIPS ASE.
18791
18792 @item -mpaired-single
18793 @itemx -mno-paired-single
18794 @opindex mpaired-single
18795 @opindex mno-paired-single
18796 Use (do not use) paired-single floating-point instructions.
18797 @xref{MIPS Paired-Single Support}. This option requires
18798 hardware floating-point support to be enabled.
18799
18800 @item -mdmx
18801 @itemx -mno-mdmx
18802 @opindex mdmx
18803 @opindex mno-mdmx
18804 Use (do not use) MIPS Digital Media Extension instructions.
18805 This option can only be used when generating 64-bit code and requires
18806 hardware floating-point support to be enabled.
18807
18808 @item -mips3d
18809 @itemx -mno-mips3d
18810 @opindex mips3d
18811 @opindex mno-mips3d
18812 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
18813 The option @option{-mips3d} implies @option{-mpaired-single}.
18814
18815 @item -mmicromips
18816 @itemx -mno-micromips
18817 @opindex mmicromips
18818 @opindex mno-mmicromips
18819 Generate (do not generate) microMIPS code.
18820
18821 MicroMIPS code generation can also be controlled on a per-function basis
18822 by means of @code{micromips} and @code{nomicromips} attributes.
18823 @xref{Function Attributes}, for more information.
18824
18825 @item -mmt
18826 @itemx -mno-mt
18827 @opindex mmt
18828 @opindex mno-mt
18829 Use (do not use) MT Multithreading instructions.
18830
18831 @item -mmcu
18832 @itemx -mno-mcu
18833 @opindex mmcu
18834 @opindex mno-mcu
18835 Use (do not use) the MIPS MCU ASE instructions.
18836
18837 @item -meva
18838 @itemx -mno-eva
18839 @opindex meva
18840 @opindex mno-eva
18841 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
18842
18843 @item -mvirt
18844 @itemx -mno-virt
18845 @opindex mvirt
18846 @opindex mno-virt
18847 Use (do not use) the MIPS Virtualization Application Specific instructions.
18848
18849 @item -mxpa
18850 @itemx -mno-xpa
18851 @opindex mxpa
18852 @opindex mno-xpa
18853 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
18854
18855 @item -mlong64
18856 @opindex mlong64
18857 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
18858 an explanation of the default and the way that the pointer size is
18859 determined.
18860
18861 @item -mlong32
18862 @opindex mlong32
18863 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
18864
18865 The default size of @code{int}s, @code{long}s and pointers depends on
18866 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
18867 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
18868 32-bit @code{long}s. Pointers are the same size as @code{long}s,
18869 or the same size as integer registers, whichever is smaller.
18870
18871 @item -msym32
18872 @itemx -mno-sym32
18873 @opindex msym32
18874 @opindex mno-sym32
18875 Assume (do not assume) that all symbols have 32-bit values, regardless
18876 of the selected ABI@. This option is useful in combination with
18877 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
18878 to generate shorter and faster references to symbolic addresses.
18879
18880 @item -G @var{num}
18881 @opindex G
18882 Put definitions of externally-visible data in a small data section
18883 if that data is no bigger than @var{num} bytes. GCC can then generate
18884 more efficient accesses to the data; see @option{-mgpopt} for details.
18885
18886 The default @option{-G} option depends on the configuration.
18887
18888 @item -mlocal-sdata
18889 @itemx -mno-local-sdata
18890 @opindex mlocal-sdata
18891 @opindex mno-local-sdata
18892 Extend (do not extend) the @option{-G} behavior to local data too,
18893 such as to static variables in C@. @option{-mlocal-sdata} is the
18894 default for all configurations.
18895
18896 If the linker complains that an application is using too much small data,
18897 you might want to try rebuilding the less performance-critical parts with
18898 @option{-mno-local-sdata}. You might also want to build large
18899 libraries with @option{-mno-local-sdata}, so that the libraries leave
18900 more room for the main program.
18901
18902 @item -mextern-sdata
18903 @itemx -mno-extern-sdata
18904 @opindex mextern-sdata
18905 @opindex mno-extern-sdata
18906 Assume (do not assume) that externally-defined data is in
18907 a small data section if the size of that data is within the @option{-G} limit.
18908 @option{-mextern-sdata} is the default for all configurations.
18909
18910 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
18911 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
18912 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
18913 is placed in a small data section. If @var{Var} is defined by another
18914 module, you must either compile that module with a high-enough
18915 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
18916 definition. If @var{Var} is common, you must link the application
18917 with a high-enough @option{-G} setting.
18918
18919 The easiest way of satisfying these restrictions is to compile
18920 and link every module with the same @option{-G} option. However,
18921 you may wish to build a library that supports several different
18922 small data limits. You can do this by compiling the library with
18923 the highest supported @option{-G} setting and additionally using
18924 @option{-mno-extern-sdata} to stop the library from making assumptions
18925 about externally-defined data.
18926
18927 @item -mgpopt
18928 @itemx -mno-gpopt
18929 @opindex mgpopt
18930 @opindex mno-gpopt
18931 Use (do not use) GP-relative accesses for symbols that are known to be
18932 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
18933 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
18934 configurations.
18935
18936 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
18937 might not hold the value of @code{_gp}. For example, if the code is
18938 part of a library that might be used in a boot monitor, programs that
18939 call boot monitor routines pass an unknown value in @code{$gp}.
18940 (In such situations, the boot monitor itself is usually compiled
18941 with @option{-G0}.)
18942
18943 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
18944 @option{-mno-extern-sdata}.
18945
18946 @item -membedded-data
18947 @itemx -mno-embedded-data
18948 @opindex membedded-data
18949 @opindex mno-embedded-data
18950 Allocate variables to the read-only data section first if possible, then
18951 next in the small data section if possible, otherwise in data. This gives
18952 slightly slower code than the default, but reduces the amount of RAM required
18953 when executing, and thus may be preferred for some embedded systems.
18954
18955 @item -muninit-const-in-rodata
18956 @itemx -mno-uninit-const-in-rodata
18957 @opindex muninit-const-in-rodata
18958 @opindex mno-uninit-const-in-rodata
18959 Put uninitialized @code{const} variables in the read-only data section.
18960 This option is only meaningful in conjunction with @option{-membedded-data}.
18961
18962 @item -mcode-readable=@var{setting}
18963 @opindex mcode-readable
18964 Specify whether GCC may generate code that reads from executable sections.
18965 There are three possible settings:
18966
18967 @table @gcctabopt
18968 @item -mcode-readable=yes
18969 Instructions may freely access executable sections. This is the
18970 default setting.
18971
18972 @item -mcode-readable=pcrel
18973 MIPS16 PC-relative load instructions can access executable sections,
18974 but other instructions must not do so. This option is useful on 4KSc
18975 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
18976 It is also useful on processors that can be configured to have a dual
18977 instruction/data SRAM interface and that, like the M4K, automatically
18978 redirect PC-relative loads to the instruction RAM.
18979
18980 @item -mcode-readable=no
18981 Instructions must not access executable sections. This option can be
18982 useful on targets that are configured to have a dual instruction/data
18983 SRAM interface but that (unlike the M4K) do not automatically redirect
18984 PC-relative loads to the instruction RAM.
18985 @end table
18986
18987 @item -msplit-addresses
18988 @itemx -mno-split-addresses
18989 @opindex msplit-addresses
18990 @opindex mno-split-addresses
18991 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
18992 relocation operators. This option has been superseded by
18993 @option{-mexplicit-relocs} but is retained for backwards compatibility.
18994
18995 @item -mexplicit-relocs
18996 @itemx -mno-explicit-relocs
18997 @opindex mexplicit-relocs
18998 @opindex mno-explicit-relocs
18999 Use (do not use) assembler relocation operators when dealing with symbolic
19000 addresses. The alternative, selected by @option{-mno-explicit-relocs},
19001 is to use assembler macros instead.
19002
19003 @option{-mexplicit-relocs} is the default if GCC was configured
19004 to use an assembler that supports relocation operators.
19005
19006 @item -mcheck-zero-division
19007 @itemx -mno-check-zero-division
19008 @opindex mcheck-zero-division
19009 @opindex mno-check-zero-division
19010 Trap (do not trap) on integer division by zero.
19011
19012 The default is @option{-mcheck-zero-division}.
19013
19014 @item -mdivide-traps
19015 @itemx -mdivide-breaks
19016 @opindex mdivide-traps
19017 @opindex mdivide-breaks
19018 MIPS systems check for division by zero by generating either a
19019 conditional trap or a break instruction. Using traps results in
19020 smaller code, but is only supported on MIPS II and later. Also, some
19021 versions of the Linux kernel have a bug that prevents trap from
19022 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
19023 allow conditional traps on architectures that support them and
19024 @option{-mdivide-breaks} to force the use of breaks.
19025
19026 The default is usually @option{-mdivide-traps}, but this can be
19027 overridden at configure time using @option{--with-divide=breaks}.
19028 Divide-by-zero checks can be completely disabled using
19029 @option{-mno-check-zero-division}.
19030
19031 @item -mmemcpy
19032 @itemx -mno-memcpy
19033 @opindex mmemcpy
19034 @opindex mno-memcpy
19035 Force (do not force) the use of @code{memcpy} for non-trivial block
19036 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
19037 most constant-sized copies.
19038
19039 @item -mlong-calls
19040 @itemx -mno-long-calls
19041 @opindex mlong-calls
19042 @opindex mno-long-calls
19043 Disable (do not disable) use of the @code{jal} instruction. Calling
19044 functions using @code{jal} is more efficient but requires the caller
19045 and callee to be in the same 256 megabyte segment.
19046
19047 This option has no effect on abicalls code. The default is
19048 @option{-mno-long-calls}.
19049
19050 @item -mmad
19051 @itemx -mno-mad
19052 @opindex mmad
19053 @opindex mno-mad
19054 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
19055 instructions, as provided by the R4650 ISA@.
19056
19057 @item -mimadd
19058 @itemx -mno-imadd
19059 @opindex mimadd
19060 @opindex mno-imadd
19061 Enable (disable) use of the @code{madd} and @code{msub} integer
19062 instructions. The default is @option{-mimadd} on architectures
19063 that support @code{madd} and @code{msub} except for the 74k
19064 architecture where it was found to generate slower code.
19065
19066 @item -mfused-madd
19067 @itemx -mno-fused-madd
19068 @opindex mfused-madd
19069 @opindex mno-fused-madd
19070 Enable (disable) use of the floating-point multiply-accumulate
19071 instructions, when they are available. The default is
19072 @option{-mfused-madd}.
19073
19074 On the R8000 CPU when multiply-accumulate instructions are used,
19075 the intermediate product is calculated to infinite precision
19076 and is not subject to the FCSR Flush to Zero bit. This may be
19077 undesirable in some circumstances. On other processors the result
19078 is numerically identical to the equivalent computation using
19079 separate multiply, add, subtract and negate instructions.
19080
19081 @item -nocpp
19082 @opindex nocpp
19083 Tell the MIPS assembler to not run its preprocessor over user
19084 assembler files (with a @samp{.s} suffix) when assembling them.
19085
19086 @item -mfix-24k
19087 @item -mno-fix-24k
19088 @opindex mfix-24k
19089 @opindex mno-fix-24k
19090 Work around the 24K E48 (lost data on stores during refill) errata.
19091 The workarounds are implemented by the assembler rather than by GCC@.
19092
19093 @item -mfix-r4000
19094 @itemx -mno-fix-r4000
19095 @opindex mfix-r4000
19096 @opindex mno-fix-r4000
19097 Work around certain R4000 CPU errata:
19098 @itemize @minus
19099 @item
19100 A double-word or a variable shift may give an incorrect result if executed
19101 immediately after starting an integer division.
19102 @item
19103 A double-word or a variable shift may give an incorrect result if executed
19104 while an integer multiplication is in progress.
19105 @item
19106 An integer division may give an incorrect result if started in a delay slot
19107 of a taken branch or a jump.
19108 @end itemize
19109
19110 @item -mfix-r4400
19111 @itemx -mno-fix-r4400
19112 @opindex mfix-r4400
19113 @opindex mno-fix-r4400
19114 Work around certain R4400 CPU errata:
19115 @itemize @minus
19116 @item
19117 A double-word or a variable shift may give an incorrect result if executed
19118 immediately after starting an integer division.
19119 @end itemize
19120
19121 @item -mfix-r10000
19122 @itemx -mno-fix-r10000
19123 @opindex mfix-r10000
19124 @opindex mno-fix-r10000
19125 Work around certain R10000 errata:
19126 @itemize @minus
19127 @item
19128 @code{ll}/@code{sc} sequences may not behave atomically on revisions
19129 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
19130 @end itemize
19131
19132 This option can only be used if the target architecture supports
19133 branch-likely instructions. @option{-mfix-r10000} is the default when
19134 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
19135 otherwise.
19136
19137 @item -mfix-rm7000
19138 @itemx -mno-fix-rm7000
19139 @opindex mfix-rm7000
19140 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
19141 workarounds are implemented by the assembler rather than by GCC@.
19142
19143 @item -mfix-vr4120
19144 @itemx -mno-fix-vr4120
19145 @opindex mfix-vr4120
19146 Work around certain VR4120 errata:
19147 @itemize @minus
19148 @item
19149 @code{dmultu} does not always produce the correct result.
19150 @item
19151 @code{div} and @code{ddiv} do not always produce the correct result if one
19152 of the operands is negative.
19153 @end itemize
19154 The workarounds for the division errata rely on special functions in
19155 @file{libgcc.a}. At present, these functions are only provided by
19156 the @code{mips64vr*-elf} configurations.
19157
19158 Other VR4120 errata require a NOP to be inserted between certain pairs of
19159 instructions. These errata are handled by the assembler, not by GCC itself.
19160
19161 @item -mfix-vr4130
19162 @opindex mfix-vr4130
19163 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
19164 workarounds are implemented by the assembler rather than by GCC,
19165 although GCC avoids using @code{mflo} and @code{mfhi} if the
19166 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
19167 instructions are available instead.
19168
19169 @item -mfix-sb1
19170 @itemx -mno-fix-sb1
19171 @opindex mfix-sb1
19172 Work around certain SB-1 CPU core errata.
19173 (This flag currently works around the SB-1 revision 2
19174 ``F1'' and ``F2'' floating-point errata.)
19175
19176 @item -mr10k-cache-barrier=@var{setting}
19177 @opindex mr10k-cache-barrier
19178 Specify whether GCC should insert cache barriers to avoid the
19179 side-effects of speculation on R10K processors.
19180
19181 In common with many processors, the R10K tries to predict the outcome
19182 of a conditional branch and speculatively executes instructions from
19183 the ``taken'' branch. It later aborts these instructions if the
19184 predicted outcome is wrong. However, on the R10K, even aborted
19185 instructions can have side effects.
19186
19187 This problem only affects kernel stores and, depending on the system,
19188 kernel loads. As an example, a speculatively-executed store may load
19189 the target memory into cache and mark the cache line as dirty, even if
19190 the store itself is later aborted. If a DMA operation writes to the
19191 same area of memory before the ``dirty'' line is flushed, the cached
19192 data overwrites the DMA-ed data. See the R10K processor manual
19193 for a full description, including other potential problems.
19194
19195 One workaround is to insert cache barrier instructions before every memory
19196 access that might be speculatively executed and that might have side
19197 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
19198 controls GCC's implementation of this workaround. It assumes that
19199 aborted accesses to any byte in the following regions does not have
19200 side effects:
19201
19202 @enumerate
19203 @item
19204 the memory occupied by the current function's stack frame;
19205
19206 @item
19207 the memory occupied by an incoming stack argument;
19208
19209 @item
19210 the memory occupied by an object with a link-time-constant address.
19211 @end enumerate
19212
19213 It is the kernel's responsibility to ensure that speculative
19214 accesses to these regions are indeed safe.
19215
19216 If the input program contains a function declaration such as:
19217
19218 @smallexample
19219 void foo (void);
19220 @end smallexample
19221
19222 then the implementation of @code{foo} must allow @code{j foo} and
19223 @code{jal foo} to be executed speculatively. GCC honors this
19224 restriction for functions it compiles itself. It expects non-GCC
19225 functions (such as hand-written assembly code) to do the same.
19226
19227 The option has three forms:
19228
19229 @table @gcctabopt
19230 @item -mr10k-cache-barrier=load-store
19231 Insert a cache barrier before a load or store that might be
19232 speculatively executed and that might have side effects even
19233 if aborted.
19234
19235 @item -mr10k-cache-barrier=store
19236 Insert a cache barrier before a store that might be speculatively
19237 executed and that might have side effects even if aborted.
19238
19239 @item -mr10k-cache-barrier=none
19240 Disable the insertion of cache barriers. This is the default setting.
19241 @end table
19242
19243 @item -mflush-func=@var{func}
19244 @itemx -mno-flush-func
19245 @opindex mflush-func
19246 Specifies the function to call to flush the I and D caches, or to not
19247 call any such function. If called, the function must take the same
19248 arguments as the common @code{_flush_func}, that is, the address of the
19249 memory range for which the cache is being flushed, the size of the
19250 memory range, and the number 3 (to flush both caches). The default
19251 depends on the target GCC was configured for, but commonly is either
19252 @code{_flush_func} or @code{__cpu_flush}.
19253
19254 @item mbranch-cost=@var{num}
19255 @opindex mbranch-cost
19256 Set the cost of branches to roughly @var{num} ``simple'' instructions.
19257 This cost is only a heuristic and is not guaranteed to produce
19258 consistent results across releases. A zero cost redundantly selects
19259 the default, which is based on the @option{-mtune} setting.
19260
19261 @item -mbranch-likely
19262 @itemx -mno-branch-likely
19263 @opindex mbranch-likely
19264 @opindex mno-branch-likely
19265 Enable or disable use of Branch Likely instructions, regardless of the
19266 default for the selected architecture. By default, Branch Likely
19267 instructions may be generated if they are supported by the selected
19268 architecture. An exception is for the MIPS32 and MIPS64 architectures
19269 and processors that implement those architectures; for those, Branch
19270 Likely instructions are not be generated by default because the MIPS32
19271 and MIPS64 architectures specifically deprecate their use.
19272
19273 @item -mcompact-branches=never
19274 @itemx -mcompact-branches=optimal
19275 @itemx -mcompact-branches=always
19276 @opindex mcompact-branches=never
19277 @opindex mcompact-branches=optimal
19278 @opindex mcompact-branches=always
19279 These options control which form of branches will be generated. The
19280 default is @option{-mcompact-branches=optimal}.
19281
19282 The @option{-mcompact-branches=never} option ensures that compact branch
19283 instructions will never be generated.
19284
19285 The @option{-mcompact-branches=always} option ensures that a compact
19286 branch instruction will be generated if available. If a compact branch
19287 instruction is not available, a delay slot form of the branch will be
19288 used instead.
19289
19290 This option is supported from MIPS Release 6 onwards.
19291
19292 The @option{-mcompact-branches=optimal} option will cause a delay slot
19293 branch to be used if one is available in the current ISA and the delay
19294 slot is successfully filled. If the delay slot is not filled, a compact
19295 branch will be chosen if one is available.
19296
19297 @item -mfp-exceptions
19298 @itemx -mno-fp-exceptions
19299 @opindex mfp-exceptions
19300 Specifies whether FP exceptions are enabled. This affects how
19301 FP instructions are scheduled for some processors.
19302 The default is that FP exceptions are
19303 enabled.
19304
19305 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
19306 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
19307 FP pipe.
19308
19309 @item -mvr4130-align
19310 @itemx -mno-vr4130-align
19311 @opindex mvr4130-align
19312 The VR4130 pipeline is two-way superscalar, but can only issue two
19313 instructions together if the first one is 8-byte aligned. When this
19314 option is enabled, GCC aligns pairs of instructions that it
19315 thinks should execute in parallel.
19316
19317 This option only has an effect when optimizing for the VR4130.
19318 It normally makes code faster, but at the expense of making it bigger.
19319 It is enabled by default at optimization level @option{-O3}.
19320
19321 @item -msynci
19322 @itemx -mno-synci
19323 @opindex msynci
19324 Enable (disable) generation of @code{synci} instructions on
19325 architectures that support it. The @code{synci} instructions (if
19326 enabled) are generated when @code{__builtin___clear_cache} is
19327 compiled.
19328
19329 This option defaults to @option{-mno-synci}, but the default can be
19330 overridden by configuring GCC with @option{--with-synci}.
19331
19332 When compiling code for single processor systems, it is generally safe
19333 to use @code{synci}. However, on many multi-core (SMP) systems, it
19334 does not invalidate the instruction caches on all cores and may lead
19335 to undefined behavior.
19336
19337 @item -mrelax-pic-calls
19338 @itemx -mno-relax-pic-calls
19339 @opindex mrelax-pic-calls
19340 Try to turn PIC calls that are normally dispatched via register
19341 @code{$25} into direct calls. This is only possible if the linker can
19342 resolve the destination at link time and if the destination is within
19343 range for a direct call.
19344
19345 @option{-mrelax-pic-calls} is the default if GCC was configured to use
19346 an assembler and a linker that support the @code{.reloc} assembly
19347 directive and @option{-mexplicit-relocs} is in effect. With
19348 @option{-mno-explicit-relocs}, this optimization can be performed by the
19349 assembler and the linker alone without help from the compiler.
19350
19351 @item -mmcount-ra-address
19352 @itemx -mno-mcount-ra-address
19353 @opindex mmcount-ra-address
19354 @opindex mno-mcount-ra-address
19355 Emit (do not emit) code that allows @code{_mcount} to modify the
19356 calling function's return address. When enabled, this option extends
19357 the usual @code{_mcount} interface with a new @var{ra-address}
19358 parameter, which has type @code{intptr_t *} and is passed in register
19359 @code{$12}. @code{_mcount} can then modify the return address by
19360 doing both of the following:
19361 @itemize
19362 @item
19363 Returning the new address in register @code{$31}.
19364 @item
19365 Storing the new address in @code{*@var{ra-address}},
19366 if @var{ra-address} is nonnull.
19367 @end itemize
19368
19369 The default is @option{-mno-mcount-ra-address}.
19370
19371 @item -mframe-header-opt
19372 @itemx -mno-frame-header-opt
19373 @opindex mframe-header-opt
19374 Enable (disable) frame header optimization in the o32 ABI. When using the
19375 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
19376 function to write out register arguments. When enabled, this optimization
19377 will suppress the allocation of the frame header if it can be determined that
19378 it is unused.
19379
19380 This optimization is off by default at all optimization levels.
19381
19382 @end table
19383
19384 @node MMIX Options
19385 @subsection MMIX Options
19386 @cindex MMIX Options
19387
19388 These options are defined for the MMIX:
19389
19390 @table @gcctabopt
19391 @item -mlibfuncs
19392 @itemx -mno-libfuncs
19393 @opindex mlibfuncs
19394 @opindex mno-libfuncs
19395 Specify that intrinsic library functions are being compiled, passing all
19396 values in registers, no matter the size.
19397
19398 @item -mepsilon
19399 @itemx -mno-epsilon
19400 @opindex mepsilon
19401 @opindex mno-epsilon
19402 Generate floating-point comparison instructions that compare with respect
19403 to the @code{rE} epsilon register.
19404
19405 @item -mabi=mmixware
19406 @itemx -mabi=gnu
19407 @opindex mabi=mmixware
19408 @opindex mabi=gnu
19409 Generate code that passes function parameters and return values that (in
19410 the called function) are seen as registers @code{$0} and up, as opposed to
19411 the GNU ABI which uses global registers @code{$231} and up.
19412
19413 @item -mzero-extend
19414 @itemx -mno-zero-extend
19415 @opindex mzero-extend
19416 @opindex mno-zero-extend
19417 When reading data from memory in sizes shorter than 64 bits, use (do not
19418 use) zero-extending load instructions by default, rather than
19419 sign-extending ones.
19420
19421 @item -mknuthdiv
19422 @itemx -mno-knuthdiv
19423 @opindex mknuthdiv
19424 @opindex mno-knuthdiv
19425 Make the result of a division yielding a remainder have the same sign as
19426 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
19427 remainder follows the sign of the dividend. Both methods are
19428 arithmetically valid, the latter being almost exclusively used.
19429
19430 @item -mtoplevel-symbols
19431 @itemx -mno-toplevel-symbols
19432 @opindex mtoplevel-symbols
19433 @opindex mno-toplevel-symbols
19434 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
19435 code can be used with the @code{PREFIX} assembly directive.
19436
19437 @item -melf
19438 @opindex melf
19439 Generate an executable in the ELF format, rather than the default
19440 @samp{mmo} format used by the @command{mmix} simulator.
19441
19442 @item -mbranch-predict
19443 @itemx -mno-branch-predict
19444 @opindex mbranch-predict
19445 @opindex mno-branch-predict
19446 Use (do not use) the probable-branch instructions, when static branch
19447 prediction indicates a probable branch.
19448
19449 @item -mbase-addresses
19450 @itemx -mno-base-addresses
19451 @opindex mbase-addresses
19452 @opindex mno-base-addresses
19453 Generate (do not generate) code that uses @emph{base addresses}. Using a
19454 base address automatically generates a request (handled by the assembler
19455 and the linker) for a constant to be set up in a global register. The
19456 register is used for one or more base address requests within the range 0
19457 to 255 from the value held in the register. The generally leads to short
19458 and fast code, but the number of different data items that can be
19459 addressed is limited. This means that a program that uses lots of static
19460 data may require @option{-mno-base-addresses}.
19461
19462 @item -msingle-exit
19463 @itemx -mno-single-exit
19464 @opindex msingle-exit
19465 @opindex mno-single-exit
19466 Force (do not force) generated code to have a single exit point in each
19467 function.
19468 @end table
19469
19470 @node MN10300 Options
19471 @subsection MN10300 Options
19472 @cindex MN10300 options
19473
19474 These @option{-m} options are defined for Matsushita MN10300 architectures:
19475
19476 @table @gcctabopt
19477 @item -mmult-bug
19478 @opindex mmult-bug
19479 Generate code to avoid bugs in the multiply instructions for the MN10300
19480 processors. This is the default.
19481
19482 @item -mno-mult-bug
19483 @opindex mno-mult-bug
19484 Do not generate code to avoid bugs in the multiply instructions for the
19485 MN10300 processors.
19486
19487 @item -mam33
19488 @opindex mam33
19489 Generate code using features specific to the AM33 processor.
19490
19491 @item -mno-am33
19492 @opindex mno-am33
19493 Do not generate code using features specific to the AM33 processor. This
19494 is the default.
19495
19496 @item -mam33-2
19497 @opindex mam33-2
19498 Generate code using features specific to the AM33/2.0 processor.
19499
19500 @item -mam34
19501 @opindex mam34
19502 Generate code using features specific to the AM34 processor.
19503
19504 @item -mtune=@var{cpu-type}
19505 @opindex mtune
19506 Use the timing characteristics of the indicated CPU type when
19507 scheduling instructions. This does not change the targeted processor
19508 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
19509 @samp{am33-2} or @samp{am34}.
19510
19511 @item -mreturn-pointer-on-d0
19512 @opindex mreturn-pointer-on-d0
19513 When generating a function that returns a pointer, return the pointer
19514 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
19515 only in @code{a0}, and attempts to call such functions without a prototype
19516 result in errors. Note that this option is on by default; use
19517 @option{-mno-return-pointer-on-d0} to disable it.
19518
19519 @item -mno-crt0
19520 @opindex mno-crt0
19521 Do not link in the C run-time initialization object file.
19522
19523 @item -mrelax
19524 @opindex mrelax
19525 Indicate to the linker that it should perform a relaxation optimization pass
19526 to shorten branches, calls and absolute memory addresses. This option only
19527 has an effect when used on the command line for the final link step.
19528
19529 This option makes symbolic debugging impossible.
19530
19531 @item -mliw
19532 @opindex mliw
19533 Allow the compiler to generate @emph{Long Instruction Word}
19534 instructions if the target is the @samp{AM33} or later. This is the
19535 default. This option defines the preprocessor macro @code{__LIW__}.
19536
19537 @item -mnoliw
19538 @opindex mnoliw
19539 Do not allow the compiler to generate @emph{Long Instruction Word}
19540 instructions. This option defines the preprocessor macro
19541 @code{__NO_LIW__}.
19542
19543 @item -msetlb
19544 @opindex msetlb
19545 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
19546 instructions if the target is the @samp{AM33} or later. This is the
19547 default. This option defines the preprocessor macro @code{__SETLB__}.
19548
19549 @item -mnosetlb
19550 @opindex mnosetlb
19551 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
19552 instructions. This option defines the preprocessor macro
19553 @code{__NO_SETLB__}.
19554
19555 @end table
19556
19557 @node Moxie Options
19558 @subsection Moxie Options
19559 @cindex Moxie Options
19560
19561 @table @gcctabopt
19562
19563 @item -meb
19564 @opindex meb
19565 Generate big-endian code. This is the default for @samp{moxie-*-*}
19566 configurations.
19567
19568 @item -mel
19569 @opindex mel
19570 Generate little-endian code.
19571
19572 @item -mmul.x
19573 @opindex mmul.x
19574 Generate mul.x and umul.x instructions. This is the default for
19575 @samp{moxiebox-*-*} configurations.
19576
19577 @item -mno-crt0
19578 @opindex mno-crt0
19579 Do not link in the C run-time initialization object file.
19580
19581 @end table
19582
19583 @node MSP430 Options
19584 @subsection MSP430 Options
19585 @cindex MSP430 Options
19586
19587 These options are defined for the MSP430:
19588
19589 @table @gcctabopt
19590
19591 @item -masm-hex
19592 @opindex masm-hex
19593 Force assembly output to always use hex constants. Normally such
19594 constants are signed decimals, but this option is available for
19595 testsuite and/or aesthetic purposes.
19596
19597 @item -mmcu=
19598 @opindex mmcu=
19599 Select the MCU to target. This is used to create a C preprocessor
19600 symbol based upon the MCU name, converted to upper case and pre- and
19601 post-fixed with @samp{__}. This in turn is used by the
19602 @file{msp430.h} header file to select an MCU-specific supplementary
19603 header file.
19604
19605 The option also sets the ISA to use. If the MCU name is one that is
19606 known to only support the 430 ISA then that is selected, otherwise the
19607 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
19608 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
19609 name selects the 430X ISA.
19610
19611 In addition an MCU-specific linker script is added to the linker
19612 command line. The script's name is the name of the MCU with
19613 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
19614 command line defines the C preprocessor symbol @code{__XXX__} and
19615 cause the linker to search for a script called @file{xxx.ld}.
19616
19617 This option is also passed on to the assembler.
19618
19619 @item -mwarn-mcu
19620 @itemx -mno-warn-mcu
19621 @opindex mwarn-mcu
19622 @opindex mno-warn-mcu
19623 This option enables or disables warnings about conflicts between the
19624 MCU name specified by the @option{-mmcu} option and the ISA set by the
19625 @option{-mcpu} option and/or the hardware multiply support set by the
19626 @option{-mhwmult} option. It also toggles warnings about unrecognized
19627 MCU names. This option is on by default.
19628
19629 @item -mcpu=
19630 @opindex mcpu=
19631 Specifies the ISA to use. Accepted values are @samp{msp430},
19632 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
19633 @option{-mmcu=} option should be used to select the ISA.
19634
19635 @item -msim
19636 @opindex msim
19637 Link to the simulator runtime libraries and linker script. Overrides
19638 any scripts that would be selected by the @option{-mmcu=} option.
19639
19640 @item -mlarge
19641 @opindex mlarge
19642 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
19643
19644 @item -msmall
19645 @opindex msmall
19646 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
19647
19648 @item -mrelax
19649 @opindex mrelax
19650 This option is passed to the assembler and linker, and allows the
19651 linker to perform certain optimizations that cannot be done until
19652 the final link.
19653
19654 @item mhwmult=
19655 @opindex mhwmult=
19656 Describes the type of hardware multiply supported by the target.
19657 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
19658 for the original 16-bit-only multiply supported by early MCUs.
19659 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
19660 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
19661 A value of @samp{auto} can also be given. This tells GCC to deduce
19662 the hardware multiply support based upon the MCU name provided by the
19663 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
19664 the MCU name is not recognized then no hardware multiply support is
19665 assumed. @code{auto} is the default setting.
19666
19667 Hardware multiplies are normally performed by calling a library
19668 routine. This saves space in the generated code. When compiling at
19669 @option{-O3} or higher however the hardware multiplier is invoked
19670 inline. This makes for bigger, but faster code.
19671
19672 The hardware multiply routines disable interrupts whilst running and
19673 restore the previous interrupt state when they finish. This makes
19674 them safe to use inside interrupt handlers as well as in normal code.
19675
19676 @item -minrt
19677 @opindex minrt
19678 Enable the use of a minimum runtime environment - no static
19679 initializers or constructors. This is intended for memory-constrained
19680 devices. The compiler includes special symbols in some objects
19681 that tell the linker and runtime which code fragments are required.
19682
19683 @item -mcode-region=
19684 @itemx -mdata-region=
19685 @opindex mcode-region
19686 @opindex mdata-region
19687 These options tell the compiler where to place functions and data that
19688 do not have one of the @code{lower}, @code{upper}, @code{either} or
19689 @code{section} attributes. Possible values are @code{lower},
19690 @code{upper}, @code{either} or @code{any}. The first three behave
19691 like the corresponding attribute. The fourth possible value -
19692 @code{any} - is the default. It leaves placement entirely up to the
19693 linker script and how it assigns the standard sections
19694 (@code{.text}, @code{.data}, etc) to the memory regions.
19695
19696 @item -msilicon-errata=
19697 @opindex msilicon-errata
19698 This option passes on a request to assembler to enable the fixes for
19699 the named silicon errata.
19700
19701 @item -msilicon-errata-warn=
19702 @opindex msilicon-errata-warn
19703 This option passes on a request to the assembler to enable warning
19704 messages when a silicon errata might need to be applied.
19705
19706 @end table
19707
19708 @node NDS32 Options
19709 @subsection NDS32 Options
19710 @cindex NDS32 Options
19711
19712 These options are defined for NDS32 implementations:
19713
19714 @table @gcctabopt
19715
19716 @item -mbig-endian
19717 @opindex mbig-endian
19718 Generate code in big-endian mode.
19719
19720 @item -mlittle-endian
19721 @opindex mlittle-endian
19722 Generate code in little-endian mode.
19723
19724 @item -mreduced-regs
19725 @opindex mreduced-regs
19726 Use reduced-set registers for register allocation.
19727
19728 @item -mfull-regs
19729 @opindex mfull-regs
19730 Use full-set registers for register allocation.
19731
19732 @item -mcmov
19733 @opindex mcmov
19734 Generate conditional move instructions.
19735
19736 @item -mno-cmov
19737 @opindex mno-cmov
19738 Do not generate conditional move instructions.
19739
19740 @item -mperf-ext
19741 @opindex mperf-ext
19742 Generate performance extension instructions.
19743
19744 @item -mno-perf-ext
19745 @opindex mno-perf-ext
19746 Do not generate performance extension instructions.
19747
19748 @item -mv3push
19749 @opindex mv3push
19750 Generate v3 push25/pop25 instructions.
19751
19752 @item -mno-v3push
19753 @opindex mno-v3push
19754 Do not generate v3 push25/pop25 instructions.
19755
19756 @item -m16-bit
19757 @opindex m16-bit
19758 Generate 16-bit instructions.
19759
19760 @item -mno-16-bit
19761 @opindex mno-16-bit
19762 Do not generate 16-bit instructions.
19763
19764 @item -misr-vector-size=@var{num}
19765 @opindex misr-vector-size
19766 Specify the size of each interrupt vector, which must be 4 or 16.
19767
19768 @item -mcache-block-size=@var{num}
19769 @opindex mcache-block-size
19770 Specify the size of each cache block,
19771 which must be a power of 2 between 4 and 512.
19772
19773 @item -march=@var{arch}
19774 @opindex march
19775 Specify the name of the target architecture.
19776
19777 @item -mcmodel=@var{code-model}
19778 @opindex mcmodel
19779 Set the code model to one of
19780 @table @asis
19781 @item @samp{small}
19782 All the data and read-only data segments must be within 512KB addressing space.
19783 The text segment must be within 16MB addressing space.
19784 @item @samp{medium}
19785 The data segment must be within 512KB while the read-only data segment can be
19786 within 4GB addressing space. The text segment should be still within 16MB
19787 addressing space.
19788 @item @samp{large}
19789 All the text and data segments can be within 4GB addressing space.
19790 @end table
19791
19792 @item -mctor-dtor
19793 @opindex mctor-dtor
19794 Enable constructor/destructor feature.
19795
19796 @item -mrelax
19797 @opindex mrelax
19798 Guide linker to relax instructions.
19799
19800 @end table
19801
19802 @node Nios II Options
19803 @subsection Nios II Options
19804 @cindex Nios II options
19805 @cindex Altera Nios II options
19806
19807 These are the options defined for the Altera Nios II processor.
19808
19809 @table @gcctabopt
19810
19811 @item -G @var{num}
19812 @opindex G
19813 @cindex smaller data references
19814 Put global and static objects less than or equal to @var{num} bytes
19815 into the small data or BSS sections instead of the normal data or BSS
19816 sections. The default value of @var{num} is 8.
19817
19818 @item -mgpopt=@var{option}
19819 @item -mgpopt
19820 @itemx -mno-gpopt
19821 @opindex mgpopt
19822 @opindex mno-gpopt
19823 Generate (do not generate) GP-relative accesses. The following
19824 @var{option} names are recognized:
19825
19826 @table @samp
19827
19828 @item none
19829 Do not generate GP-relative accesses.
19830
19831 @item local
19832 Generate GP-relative accesses for small data objects that are not
19833 external, weak, or uninitialized common symbols.
19834 Also use GP-relative addressing for objects that
19835 have been explicitly placed in a small data section via a @code{section}
19836 attribute.
19837
19838 @item global
19839 As for @samp{local}, but also generate GP-relative accesses for
19840 small data objects that are external, weak, or common. If you use this option,
19841 you must ensure that all parts of your program (including libraries) are
19842 compiled with the same @option{-G} setting.
19843
19844 @item data
19845 Generate GP-relative accesses for all data objects in the program. If you
19846 use this option, the entire data and BSS segments
19847 of your program must fit in 64K of memory and you must use an appropriate
19848 linker script to allocate them within the addressable range of the
19849 global pointer.
19850
19851 @item all
19852 Generate GP-relative addresses for function pointers as well as data
19853 pointers. If you use this option, the entire text, data, and BSS segments
19854 of your program must fit in 64K of memory and you must use an appropriate
19855 linker script to allocate them within the addressable range of the
19856 global pointer.
19857
19858 @end table
19859
19860 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
19861 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
19862
19863 The default is @option{-mgpopt} except when @option{-fpic} or
19864 @option{-fPIC} is specified to generate position-independent code.
19865 Note that the Nios II ABI does not permit GP-relative accesses from
19866 shared libraries.
19867
19868 You may need to specify @option{-mno-gpopt} explicitly when building
19869 programs that include large amounts of small data, including large
19870 GOT data sections. In this case, the 16-bit offset for GP-relative
19871 addressing may not be large enough to allow access to the entire
19872 small data section.
19873
19874 @item -mel
19875 @itemx -meb
19876 @opindex mel
19877 @opindex meb
19878 Generate little-endian (default) or big-endian (experimental) code,
19879 respectively.
19880
19881 @item -march=@var{arch}
19882 @opindex march
19883 This specifies the name of the target Nios II architecture. GCC uses this
19884 name to determine what kind of instructions it can emit when generating
19885 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
19886
19887 The preprocessor macro @code{__nios2_arch__} is available to programs,
19888 with value 1 or 2, indicating the targeted ISA level.
19889
19890 @item -mbypass-cache
19891 @itemx -mno-bypass-cache
19892 @opindex mno-bypass-cache
19893 @opindex mbypass-cache
19894 Force all load and store instructions to always bypass cache by
19895 using I/O variants of the instructions. The default is not to
19896 bypass the cache.
19897
19898 @item -mno-cache-volatile
19899 @itemx -mcache-volatile
19900 @opindex mcache-volatile
19901 @opindex mno-cache-volatile
19902 Volatile memory access bypass the cache using the I/O variants of
19903 the load and store instructions. The default is not to bypass the cache.
19904
19905 @item -mno-fast-sw-div
19906 @itemx -mfast-sw-div
19907 @opindex mno-fast-sw-div
19908 @opindex mfast-sw-div
19909 Do not use table-based fast divide for small numbers. The default
19910 is to use the fast divide at @option{-O3} and above.
19911
19912 @item -mno-hw-mul
19913 @itemx -mhw-mul
19914 @itemx -mno-hw-mulx
19915 @itemx -mhw-mulx
19916 @itemx -mno-hw-div
19917 @itemx -mhw-div
19918 @opindex mno-hw-mul
19919 @opindex mhw-mul
19920 @opindex mno-hw-mulx
19921 @opindex mhw-mulx
19922 @opindex mno-hw-div
19923 @opindex mhw-div
19924 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
19925 instructions by the compiler. The default is to emit @code{mul}
19926 and not emit @code{div} and @code{mulx}.
19927
19928 @item -mbmx
19929 @itemx -mno-bmx
19930 @itemx -mcdx
19931 @itemx -mno-cdx
19932 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
19933 CDX (code density) instructions. Enabling these instructions also
19934 requires @option{-march=r2}. Since these instructions are optional
19935 extensions to the R2 architecture, the default is not to emit them.
19936
19937 @item -mcustom-@var{insn}=@var{N}
19938 @itemx -mno-custom-@var{insn}
19939 @opindex mcustom-@var{insn}
19940 @opindex mno-custom-@var{insn}
19941 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
19942 custom instruction with encoding @var{N} when generating code that uses
19943 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
19944 instruction 253 for single-precision floating-point add operations instead
19945 of the default behavior of using a library call.
19946
19947 The following values of @var{insn} are supported. Except as otherwise
19948 noted, floating-point operations are expected to be implemented with
19949 normal IEEE 754 semantics and correspond directly to the C operators or the
19950 equivalent GCC built-in functions (@pxref{Other Builtins}).
19951
19952 Single-precision floating point:
19953 @table @asis
19954
19955 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
19956 Binary arithmetic operations.
19957
19958 @item @samp{fnegs}
19959 Unary negation.
19960
19961 @item @samp{fabss}
19962 Unary absolute value.
19963
19964 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
19965 Comparison operations.
19966
19967 @item @samp{fmins}, @samp{fmaxs}
19968 Floating-point minimum and maximum. These instructions are only
19969 generated if @option{-ffinite-math-only} is specified.
19970
19971 @item @samp{fsqrts}
19972 Unary square root operation.
19973
19974 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
19975 Floating-point trigonometric and exponential functions. These instructions
19976 are only generated if @option{-funsafe-math-optimizations} is also specified.
19977
19978 @end table
19979
19980 Double-precision floating point:
19981 @table @asis
19982
19983 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
19984 Binary arithmetic operations.
19985
19986 @item @samp{fnegd}
19987 Unary negation.
19988
19989 @item @samp{fabsd}
19990 Unary absolute value.
19991
19992 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
19993 Comparison operations.
19994
19995 @item @samp{fmind}, @samp{fmaxd}
19996 Double-precision minimum and maximum. These instructions are only
19997 generated if @option{-ffinite-math-only} is specified.
19998
19999 @item @samp{fsqrtd}
20000 Unary square root operation.
20001
20002 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
20003 Double-precision trigonometric and exponential functions. These instructions
20004 are only generated if @option{-funsafe-math-optimizations} is also specified.
20005
20006 @end table
20007
20008 Conversions:
20009 @table @asis
20010 @item @samp{fextsd}
20011 Conversion from single precision to double precision.
20012
20013 @item @samp{ftruncds}
20014 Conversion from double precision to single precision.
20015
20016 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
20017 Conversion from floating point to signed or unsigned integer types, with
20018 truncation towards zero.
20019
20020 @item @samp{round}
20021 Conversion from single-precision floating point to signed integer,
20022 rounding to the nearest integer and ties away from zero.
20023 This corresponds to the @code{__builtin_lroundf} function when
20024 @option{-fno-math-errno} is used.
20025
20026 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
20027 Conversion from signed or unsigned integer types to floating-point types.
20028
20029 @end table
20030
20031 In addition, all of the following transfer instructions for internal
20032 registers X and Y must be provided to use any of the double-precision
20033 floating-point instructions. Custom instructions taking two
20034 double-precision source operands expect the first operand in the
20035 64-bit register X. The other operand (or only operand of a unary
20036 operation) is given to the custom arithmetic instruction with the
20037 least significant half in source register @var{src1} and the most
20038 significant half in @var{src2}. A custom instruction that returns a
20039 double-precision result returns the most significant 32 bits in the
20040 destination register and the other half in 32-bit register Y.
20041 GCC automatically generates the necessary code sequences to write
20042 register X and/or read register Y when double-precision floating-point
20043 instructions are used.
20044
20045 @table @asis
20046
20047 @item @samp{fwrx}
20048 Write @var{src1} into the least significant half of X and @var{src2} into
20049 the most significant half of X.
20050
20051 @item @samp{fwry}
20052 Write @var{src1} into Y.
20053
20054 @item @samp{frdxhi}, @samp{frdxlo}
20055 Read the most or least (respectively) significant half of X and store it in
20056 @var{dest}.
20057
20058 @item @samp{frdy}
20059 Read the value of Y and store it into @var{dest}.
20060 @end table
20061
20062 Note that you can gain more local control over generation of Nios II custom
20063 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
20064 and @code{target("no-custom-@var{insn}")} function attributes
20065 (@pxref{Function Attributes})
20066 or pragmas (@pxref{Function Specific Option Pragmas}).
20067
20068 @item -mcustom-fpu-cfg=@var{name}
20069 @opindex mcustom-fpu-cfg
20070
20071 This option enables a predefined, named set of custom instruction encodings
20072 (see @option{-mcustom-@var{insn}} above).
20073 Currently, the following sets are defined:
20074
20075 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
20076 @gccoptlist{-mcustom-fmuls=252 @gol
20077 -mcustom-fadds=253 @gol
20078 -mcustom-fsubs=254 @gol
20079 -fsingle-precision-constant}
20080
20081 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
20082 @gccoptlist{-mcustom-fmuls=252 @gol
20083 -mcustom-fadds=253 @gol
20084 -mcustom-fsubs=254 @gol
20085 -mcustom-fdivs=255 @gol
20086 -fsingle-precision-constant}
20087
20088 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
20089 @gccoptlist{-mcustom-floatus=243 @gol
20090 -mcustom-fixsi=244 @gol
20091 -mcustom-floatis=245 @gol
20092 -mcustom-fcmpgts=246 @gol
20093 -mcustom-fcmples=249 @gol
20094 -mcustom-fcmpeqs=250 @gol
20095 -mcustom-fcmpnes=251 @gol
20096 -mcustom-fmuls=252 @gol
20097 -mcustom-fadds=253 @gol
20098 -mcustom-fsubs=254 @gol
20099 -mcustom-fdivs=255 @gol
20100 -fsingle-precision-constant}
20101
20102 Custom instruction assignments given by individual
20103 @option{-mcustom-@var{insn}=} options override those given by
20104 @option{-mcustom-fpu-cfg=}, regardless of the
20105 order of the options on the command line.
20106
20107 Note that you can gain more local control over selection of a FPU
20108 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
20109 function attribute (@pxref{Function Attributes})
20110 or pragma (@pxref{Function Specific Option Pragmas}).
20111
20112 @end table
20113
20114 These additional @samp{-m} options are available for the Altera Nios II
20115 ELF (bare-metal) target:
20116
20117 @table @gcctabopt
20118
20119 @item -mhal
20120 @opindex mhal
20121 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
20122 startup and termination code, and is typically used in conjunction with
20123 @option{-msys-crt0=} to specify the location of the alternate startup code
20124 provided by the HAL BSP.
20125
20126 @item -msmallc
20127 @opindex msmallc
20128 Link with a limited version of the C library, @option{-lsmallc}, rather than
20129 Newlib.
20130
20131 @item -msys-crt0=@var{startfile}
20132 @opindex msys-crt0
20133 @var{startfile} is the file name of the startfile (crt0) to use
20134 when linking. This option is only useful in conjunction with @option{-mhal}.
20135
20136 @item -msys-lib=@var{systemlib}
20137 @opindex msys-lib
20138 @var{systemlib} is the library name of the library that provides
20139 low-level system calls required by the C library,
20140 e.g. @code{read} and @code{write}.
20141 This option is typically used to link with a library provided by a HAL BSP.
20142
20143 @end table
20144
20145 @node Nvidia PTX Options
20146 @subsection Nvidia PTX Options
20147 @cindex Nvidia PTX options
20148 @cindex nvptx options
20149
20150 These options are defined for Nvidia PTX:
20151
20152 @table @gcctabopt
20153
20154 @item -m32
20155 @itemx -m64
20156 @opindex m32
20157 @opindex m64
20158 Generate code for 32-bit or 64-bit ABI.
20159
20160 @item -mmainkernel
20161 @opindex mmainkernel
20162 Link in code for a __main kernel. This is for stand-alone instead of
20163 offloading execution.
20164
20165 @item -moptimize
20166 @opindex moptimize
20167 Apply partitioned execution optimizations. This is the default when any
20168 level of optimization is selected.
20169
20170 @end table
20171
20172 @node PDP-11 Options
20173 @subsection PDP-11 Options
20174 @cindex PDP-11 Options
20175
20176 These options are defined for the PDP-11:
20177
20178 @table @gcctabopt
20179 @item -mfpu
20180 @opindex mfpu
20181 Use hardware FPP floating point. This is the default. (FIS floating
20182 point on the PDP-11/40 is not supported.)
20183
20184 @item -msoft-float
20185 @opindex msoft-float
20186 Do not use hardware floating point.
20187
20188 @item -mac0
20189 @opindex mac0
20190 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
20191
20192 @item -mno-ac0
20193 @opindex mno-ac0
20194 Return floating-point results in memory. This is the default.
20195
20196 @item -m40
20197 @opindex m40
20198 Generate code for a PDP-11/40.
20199
20200 @item -m45
20201 @opindex m45
20202 Generate code for a PDP-11/45. This is the default.
20203
20204 @item -m10
20205 @opindex m10
20206 Generate code for a PDP-11/10.
20207
20208 @item -mbcopy-builtin
20209 @opindex mbcopy-builtin
20210 Use inline @code{movmemhi} patterns for copying memory. This is the
20211 default.
20212
20213 @item -mbcopy
20214 @opindex mbcopy
20215 Do not use inline @code{movmemhi} patterns for copying memory.
20216
20217 @item -mint16
20218 @itemx -mno-int32
20219 @opindex mint16
20220 @opindex mno-int32
20221 Use 16-bit @code{int}. This is the default.
20222
20223 @item -mint32
20224 @itemx -mno-int16
20225 @opindex mint32
20226 @opindex mno-int16
20227 Use 32-bit @code{int}.
20228
20229 @item -mfloat64
20230 @itemx -mno-float32
20231 @opindex mfloat64
20232 @opindex mno-float32
20233 Use 64-bit @code{float}. This is the default.
20234
20235 @item -mfloat32
20236 @itemx -mno-float64
20237 @opindex mfloat32
20238 @opindex mno-float64
20239 Use 32-bit @code{float}.
20240
20241 @item -mabshi
20242 @opindex mabshi
20243 Use @code{abshi2} pattern. This is the default.
20244
20245 @item -mno-abshi
20246 @opindex mno-abshi
20247 Do not use @code{abshi2} pattern.
20248
20249 @item -mbranch-expensive
20250 @opindex mbranch-expensive
20251 Pretend that branches are expensive. This is for experimenting with
20252 code generation only.
20253
20254 @item -mbranch-cheap
20255 @opindex mbranch-cheap
20256 Do not pretend that branches are expensive. This is the default.
20257
20258 @item -munix-asm
20259 @opindex munix-asm
20260 Use Unix assembler syntax. This is the default when configured for
20261 @samp{pdp11-*-bsd}.
20262
20263 @item -mdec-asm
20264 @opindex mdec-asm
20265 Use DEC assembler syntax. This is the default when configured for any
20266 PDP-11 target other than @samp{pdp11-*-bsd}.
20267 @end table
20268
20269 @node picoChip Options
20270 @subsection picoChip Options
20271 @cindex picoChip options
20272
20273 These @samp{-m} options are defined for picoChip implementations:
20274
20275 @table @gcctabopt
20276
20277 @item -mae=@var{ae_type}
20278 @opindex mcpu
20279 Set the instruction set, register set, and instruction scheduling
20280 parameters for array element type @var{ae_type}. Supported values
20281 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
20282
20283 @option{-mae=ANY} selects a completely generic AE type. Code
20284 generated with this option runs on any of the other AE types. The
20285 code is not as efficient as it would be if compiled for a specific
20286 AE type, and some types of operation (e.g., multiplication) do not
20287 work properly on all types of AE.
20288
20289 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
20290 for compiled code, and is the default.
20291
20292 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
20293 option may suffer from poor performance of byte (char) manipulation,
20294 since the DSP AE does not provide hardware support for byte load/stores.
20295
20296 @item -msymbol-as-address
20297 Enable the compiler to directly use a symbol name as an address in a
20298 load/store instruction, without first loading it into a
20299 register. Typically, the use of this option generates larger
20300 programs, which run faster than when the option isn't used. However, the
20301 results vary from program to program, so it is left as a user option,
20302 rather than being permanently enabled.
20303
20304 @item -mno-inefficient-warnings
20305 Disables warnings about the generation of inefficient code. These
20306 warnings can be generated, for example, when compiling code that
20307 performs byte-level memory operations on the MAC AE type. The MAC AE has
20308 no hardware support for byte-level memory operations, so all byte
20309 load/stores must be synthesized from word load/store operations. This is
20310 inefficient and a warning is generated to indicate
20311 that you should rewrite the code to avoid byte operations, or to target
20312 an AE type that has the necessary hardware support. This option disables
20313 these warnings.
20314
20315 @end table
20316
20317 @node PowerPC Options
20318 @subsection PowerPC Options
20319 @cindex PowerPC options
20320
20321 These are listed under @xref{RS/6000 and PowerPC Options}.
20322
20323 @node RL78 Options
20324 @subsection RL78 Options
20325 @cindex RL78 Options
20326
20327 @table @gcctabopt
20328
20329 @item -msim
20330 @opindex msim
20331 Links in additional target libraries to support operation within a
20332 simulator.
20333
20334 @item -mmul=none
20335 @itemx -mmul=g10
20336 @itemx -mmul=g13
20337 @itemx -mmul=g14
20338 @itemx -mmul=rl78
20339 @opindex mmul
20340 Specifies the type of hardware multiplication and division support to
20341 be used. The simplest is @code{none}, which uses software for both
20342 multiplication and division. This is the default. The @code{g13}
20343 value is for the hardware multiply/divide peripheral found on the
20344 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
20345 the multiplication and division instructions supported by the RL78/G14
20346 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
20347 the value @code{mg10} is an alias for @code{none}.
20348
20349 In addition a C preprocessor macro is defined, based upon the setting
20350 of this option. Possible values are: @code{__RL78_MUL_NONE__},
20351 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
20352
20353 @item -mcpu=g10
20354 @itemx -mcpu=g13
20355 @itemx -mcpu=g14
20356 @itemx -mcpu=rl78
20357 @opindex mcpu
20358 Specifies the RL78 core to target. The default is the G14 core, also
20359 known as an S3 core or just RL78. The G13 or S2 core does not have
20360 multiply or divide instructions, instead it uses a hardware peripheral
20361 for these operations. The G10 or S1 core does not have register
20362 banks, so it uses a different calling convention.
20363
20364 If this option is set it also selects the type of hardware multiply
20365 support to use, unless this is overridden by an explicit
20366 @option{-mmul=none} option on the command line. Thus specifying
20367 @option{-mcpu=g13} enables the use of the G13 hardware multiply
20368 peripheral and specifying @option{-mcpu=g10} disables the use of
20369 hardware multiplications altogether.
20370
20371 Note, although the RL78/G14 core is the default target, specifying
20372 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
20373 change the behavior of the toolchain since it also enables G14
20374 hardware multiply support. If these options are not specified on the
20375 command line then software multiplication routines will be used even
20376 though the code targets the RL78 core. This is for backwards
20377 compatibility with older toolchains which did not have hardware
20378 multiply and divide support.
20379
20380 In addition a C preprocessor macro is defined, based upon the setting
20381 of this option. Possible values are: @code{__RL78_G10__},
20382 @code{__RL78_G13__} or @code{__RL78_G14__}.
20383
20384 @item -mg10
20385 @itemx -mg13
20386 @itemx -mg14
20387 @itemx -mrl78
20388 @opindex mg10
20389 @opindex mg13
20390 @opindex mg14
20391 @opindex mrl78
20392 These are aliases for the corresponding @option{-mcpu=} option. They
20393 are provided for backwards compatibility.
20394
20395 @item -mallregs
20396 @opindex mallregs
20397 Allow the compiler to use all of the available registers. By default
20398 registers @code{r24..r31} are reserved for use in interrupt handlers.
20399 With this option enabled these registers can be used in ordinary
20400 functions as well.
20401
20402 @item -m64bit-doubles
20403 @itemx -m32bit-doubles
20404 @opindex m64bit-doubles
20405 @opindex m32bit-doubles
20406 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
20407 or 32 bits (@option{-m32bit-doubles}) in size. The default is
20408 @option{-m32bit-doubles}.
20409
20410 @item -msave-mduc-in-interrupts
20411 @item -mno-save-mduc-in-interrupts
20412 @opindex msave-mduc-in-interrupts
20413 @opindex mno-save-mduc-in-interrupts
20414 Specifies that interrupt handler functions should preserve the
20415 MDUC registers. This is only necessary if normal code might use
20416 the MDUC registers, for example because it performs multiplication
20417 and division operations. The default is to ignore the MDUC registers
20418 as this makes the interrupt handlers faster. The target option -mg13
20419 needs to be passed for this to work as this feature is only available
20420 on the G13 target (S2 core). The MDUC registers will only be saved
20421 if the interrupt handler performs a multiplication or division
20422 operation or it calls another function.
20423
20424 @end table
20425
20426 @node RS/6000 and PowerPC Options
20427 @subsection IBM RS/6000 and PowerPC Options
20428 @cindex RS/6000 and PowerPC Options
20429 @cindex IBM RS/6000 and PowerPC Options
20430
20431 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
20432 @table @gcctabopt
20433 @item -mpowerpc-gpopt
20434 @itemx -mno-powerpc-gpopt
20435 @itemx -mpowerpc-gfxopt
20436 @itemx -mno-powerpc-gfxopt
20437 @need 800
20438 @itemx -mpowerpc64
20439 @itemx -mno-powerpc64
20440 @itemx -mmfcrf
20441 @itemx -mno-mfcrf
20442 @itemx -mpopcntb
20443 @itemx -mno-popcntb
20444 @itemx -mpopcntd
20445 @itemx -mno-popcntd
20446 @itemx -mfprnd
20447 @itemx -mno-fprnd
20448 @need 800
20449 @itemx -mcmpb
20450 @itemx -mno-cmpb
20451 @itemx -mmfpgpr
20452 @itemx -mno-mfpgpr
20453 @itemx -mhard-dfp
20454 @itemx -mno-hard-dfp
20455 @opindex mpowerpc-gpopt
20456 @opindex mno-powerpc-gpopt
20457 @opindex mpowerpc-gfxopt
20458 @opindex mno-powerpc-gfxopt
20459 @opindex mpowerpc64
20460 @opindex mno-powerpc64
20461 @opindex mmfcrf
20462 @opindex mno-mfcrf
20463 @opindex mpopcntb
20464 @opindex mno-popcntb
20465 @opindex mpopcntd
20466 @opindex mno-popcntd
20467 @opindex mfprnd
20468 @opindex mno-fprnd
20469 @opindex mcmpb
20470 @opindex mno-cmpb
20471 @opindex mmfpgpr
20472 @opindex mno-mfpgpr
20473 @opindex mhard-dfp
20474 @opindex mno-hard-dfp
20475 You use these options to specify which instructions are available on the
20476 processor you are using. The default value of these options is
20477 determined when configuring GCC@. Specifying the
20478 @option{-mcpu=@var{cpu_type}} overrides the specification of these
20479 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
20480 rather than the options listed above.
20481
20482 Specifying @option{-mpowerpc-gpopt} allows
20483 GCC to use the optional PowerPC architecture instructions in the
20484 General Purpose group, including floating-point square root. Specifying
20485 @option{-mpowerpc-gfxopt} allows GCC to
20486 use the optional PowerPC architecture instructions in the Graphics
20487 group, including floating-point select.
20488
20489 The @option{-mmfcrf} option allows GCC to generate the move from
20490 condition register field instruction implemented on the POWER4
20491 processor and other processors that support the PowerPC V2.01
20492 architecture.
20493 The @option{-mpopcntb} option allows GCC to generate the popcount and
20494 double-precision FP reciprocal estimate instruction implemented on the
20495 POWER5 processor and other processors that support the PowerPC V2.02
20496 architecture.
20497 The @option{-mpopcntd} option allows GCC to generate the popcount
20498 instruction implemented on the POWER7 processor and other processors
20499 that support the PowerPC V2.06 architecture.
20500 The @option{-mfprnd} option allows GCC to generate the FP round to
20501 integer instructions implemented on the POWER5+ processor and other
20502 processors that support the PowerPC V2.03 architecture.
20503 The @option{-mcmpb} option allows GCC to generate the compare bytes
20504 instruction implemented on the POWER6 processor and other processors
20505 that support the PowerPC V2.05 architecture.
20506 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
20507 general-purpose register instructions implemented on the POWER6X
20508 processor and other processors that support the extended PowerPC V2.05
20509 architecture.
20510 The @option{-mhard-dfp} option allows GCC to generate the decimal
20511 floating-point instructions implemented on some POWER processors.
20512
20513 The @option{-mpowerpc64} option allows GCC to generate the additional
20514 64-bit instructions that are found in the full PowerPC64 architecture
20515 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
20516 @option{-mno-powerpc64}.
20517
20518 @item -mcpu=@var{cpu_type}
20519 @opindex mcpu
20520 Set architecture type, register usage, and
20521 instruction scheduling parameters for machine type @var{cpu_type}.
20522 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
20523 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
20524 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
20525 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
20526 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
20527 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
20528 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
20529 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
20530 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
20531 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
20532 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
20533 and @samp{rs64}.
20534
20535 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
20536 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
20537 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
20538 architecture machine types, with an appropriate, generic processor
20539 model assumed for scheduling purposes.
20540
20541 The other options specify a specific processor. Code generated under
20542 those options runs best on that processor, and may not run at all on
20543 others.
20544
20545 The @option{-mcpu} options automatically enable or disable the
20546 following options:
20547
20548 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
20549 -mpopcntb -mpopcntd -mpowerpc64 @gol
20550 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
20551 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
20552 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
20553 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
20554
20555 The particular options set for any particular CPU varies between
20556 compiler versions, depending on what setting seems to produce optimal
20557 code for that CPU; it doesn't necessarily reflect the actual hardware's
20558 capabilities. If you wish to set an individual option to a particular
20559 value, you may specify it after the @option{-mcpu} option, like
20560 @option{-mcpu=970 -mno-altivec}.
20561
20562 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
20563 not enabled or disabled by the @option{-mcpu} option at present because
20564 AIX does not have full support for these options. You may still
20565 enable or disable them individually if you're sure it'll work in your
20566 environment.
20567
20568 @item -mtune=@var{cpu_type}
20569 @opindex mtune
20570 Set the instruction scheduling parameters for machine type
20571 @var{cpu_type}, but do not set the architecture type or register usage,
20572 as @option{-mcpu=@var{cpu_type}} does. The same
20573 values for @var{cpu_type} are used for @option{-mtune} as for
20574 @option{-mcpu}. If both are specified, the code generated uses the
20575 architecture and registers set by @option{-mcpu}, but the
20576 scheduling parameters set by @option{-mtune}.
20577
20578 @item -mcmodel=small
20579 @opindex mcmodel=small
20580 Generate PowerPC64 code for the small model: The TOC is limited to
20581 64k.
20582
20583 @item -mcmodel=medium
20584 @opindex mcmodel=medium
20585 Generate PowerPC64 code for the medium model: The TOC and other static
20586 data may be up to a total of 4G in size.
20587
20588 @item -mcmodel=large
20589 @opindex mcmodel=large
20590 Generate PowerPC64 code for the large model: The TOC may be up to 4G
20591 in size. Other data and code is only limited by the 64-bit address
20592 space.
20593
20594 @item -maltivec
20595 @itemx -mno-altivec
20596 @opindex maltivec
20597 @opindex mno-altivec
20598 Generate code that uses (does not use) AltiVec instructions, and also
20599 enable the use of built-in functions that allow more direct access to
20600 the AltiVec instruction set. You may also need to set
20601 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
20602 enhancements.
20603
20604 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
20605 @option{-maltivec=be}, the element order for AltiVec intrinsics such
20606 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
20607 match array element order corresponding to the endianness of the
20608 target. That is, element zero identifies the leftmost element in a
20609 vector register when targeting a big-endian platform, and identifies
20610 the rightmost element in a vector register when targeting a
20611 little-endian platform.
20612
20613 @item -maltivec=be
20614 @opindex maltivec=be
20615 Generate AltiVec instructions using big-endian element order,
20616 regardless of whether the target is big- or little-endian. This is
20617 the default when targeting a big-endian platform.
20618
20619 The element order is used to interpret element numbers in AltiVec
20620 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20621 @code{vec_insert}. By default, these match array element order
20622 corresponding to the endianness for the target.
20623
20624 @item -maltivec=le
20625 @opindex maltivec=le
20626 Generate AltiVec instructions using little-endian element order,
20627 regardless of whether the target is big- or little-endian. This is
20628 the default when targeting a little-endian platform. This option is
20629 currently ignored when targeting a big-endian platform.
20630
20631 The element order is used to interpret element numbers in AltiVec
20632 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20633 @code{vec_insert}. By default, these match array element order
20634 corresponding to the endianness for the target.
20635
20636 @item -mvrsave
20637 @itemx -mno-vrsave
20638 @opindex mvrsave
20639 @opindex mno-vrsave
20640 Generate VRSAVE instructions when generating AltiVec code.
20641
20642 @item -mgen-cell-microcode
20643 @opindex mgen-cell-microcode
20644 Generate Cell microcode instructions.
20645
20646 @item -mwarn-cell-microcode
20647 @opindex mwarn-cell-microcode
20648 Warn when a Cell microcode instruction is emitted. An example
20649 of a Cell microcode instruction is a variable shift.
20650
20651 @item -msecure-plt
20652 @opindex msecure-plt
20653 Generate code that allows @command{ld} and @command{ld.so}
20654 to build executables and shared
20655 libraries with non-executable @code{.plt} and @code{.got} sections.
20656 This is a PowerPC
20657 32-bit SYSV ABI option.
20658
20659 @item -mbss-plt
20660 @opindex mbss-plt
20661 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
20662 fills in, and
20663 requires @code{.plt} and @code{.got}
20664 sections that are both writable and executable.
20665 This is a PowerPC 32-bit SYSV ABI option.
20666
20667 @item -misel
20668 @itemx -mno-isel
20669 @opindex misel
20670 @opindex mno-isel
20671 This switch enables or disables the generation of ISEL instructions.
20672
20673 @item -misel=@var{yes/no}
20674 This switch has been deprecated. Use @option{-misel} and
20675 @option{-mno-isel} instead.
20676
20677 @item -mlra
20678 @opindex mlra
20679 Enable Local Register Allocation. This is still experimental for PowerPC,
20680 so by default the compiler uses standard reload
20681 (i.e. @option{-mno-lra}).
20682
20683 @item -mspe
20684 @itemx -mno-spe
20685 @opindex mspe
20686 @opindex mno-spe
20687 This switch enables or disables the generation of SPE simd
20688 instructions.
20689
20690 @item -mpaired
20691 @itemx -mno-paired
20692 @opindex mpaired
20693 @opindex mno-paired
20694 This switch enables or disables the generation of PAIRED simd
20695 instructions.
20696
20697 @item -mspe=@var{yes/no}
20698 This option has been deprecated. Use @option{-mspe} and
20699 @option{-mno-spe} instead.
20700
20701 @item -mvsx
20702 @itemx -mno-vsx
20703 @opindex mvsx
20704 @opindex mno-vsx
20705 Generate code that uses (does not use) vector/scalar (VSX)
20706 instructions, and also enable the use of built-in functions that allow
20707 more direct access to the VSX instruction set.
20708
20709 @item -mcrypto
20710 @itemx -mno-crypto
20711 @opindex mcrypto
20712 @opindex mno-crypto
20713 Enable the use (disable) of the built-in functions that allow direct
20714 access to the cryptographic instructions that were added in version
20715 2.07 of the PowerPC ISA.
20716
20717 @item -mdirect-move
20718 @itemx -mno-direct-move
20719 @opindex mdirect-move
20720 @opindex mno-direct-move
20721 Generate code that uses (does not use) the instructions to move data
20722 between the general purpose registers and the vector/scalar (VSX)
20723 registers that were added in version 2.07 of the PowerPC ISA.
20724
20725 @item -mhtm
20726 @itemx -mno-htm
20727 @opindex mhtm
20728 @opindex mno-htm
20729 Enable (disable) the use of the built-in functions that allow direct
20730 access to the Hardware Transactional Memory (HTM) instructions that
20731 were added in version 2.07 of the PowerPC ISA.
20732
20733 @item -mpower8-fusion
20734 @itemx -mno-power8-fusion
20735 @opindex mpower8-fusion
20736 @opindex mno-power8-fusion
20737 Generate code that keeps (does not keeps) some integer operations
20738 adjacent so that the instructions can be fused together on power8 and
20739 later processors.
20740
20741 @item -mpower8-vector
20742 @itemx -mno-power8-vector
20743 @opindex mpower8-vector
20744 @opindex mno-power8-vector
20745 Generate code that uses (does not use) the vector and scalar
20746 instructions that were added in version 2.07 of the PowerPC ISA. Also
20747 enable the use of built-in functions that allow more direct access to
20748 the vector instructions.
20749
20750 @item -mquad-memory
20751 @itemx -mno-quad-memory
20752 @opindex mquad-memory
20753 @opindex mno-quad-memory
20754 Generate code that uses (does not use) the non-atomic quad word memory
20755 instructions. The @option{-mquad-memory} option requires use of
20756 64-bit mode.
20757
20758 @item -mquad-memory-atomic
20759 @itemx -mno-quad-memory-atomic
20760 @opindex mquad-memory-atomic
20761 @opindex mno-quad-memory-atomic
20762 Generate code that uses (does not use) the atomic quad word memory
20763 instructions. The @option{-mquad-memory-atomic} option requires use of
20764 64-bit mode.
20765
20766 @item -mupper-regs-di
20767 @itemx -mno-upper-regs-di
20768 @opindex mupper-regs-di
20769 @opindex mno-upper-regs-di
20770 Generate code that uses (does not use) the scalar instructions that
20771 target all 64 registers in the vector/scalar floating point register
20772 set that were added in version 2.06 of the PowerPC ISA when processing
20773 integers. @option{-mupper-regs-di} is turned on by default if you use
20774 any of the @option{-mcpu=power7}, @option{-mcpu=power8},
20775 @option{-mcpu=power9}, or @option{-mvsx} options.
20776
20777 @item -mupper-regs-df
20778 @itemx -mno-upper-regs-df
20779 @opindex mupper-regs-df
20780 @opindex mno-upper-regs-df
20781 Generate code that uses (does not use) the scalar double precision
20782 instructions that target all 64 registers in the vector/scalar
20783 floating point register set that were added in version 2.06 of the
20784 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
20785 use any of the @option{-mcpu=power7}, @option{-mcpu=power8},
20786 @option{-mcpu=power9}, or @option{-mvsx} options.
20787
20788 @item -mupper-regs-sf
20789 @itemx -mno-upper-regs-sf
20790 @opindex mupper-regs-sf
20791 @opindex mno-upper-regs-sf
20792 Generate code that uses (does not use) the scalar single precision
20793 instructions that target all 64 registers in the vector/scalar
20794 floating point register set that were added in version 2.07 of the
20795 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
20796 use either of the @option{-mcpu=power8}, @option{-mpower8-vector}, or
20797 @option{-mcpu=power9} options.
20798
20799 @item -mupper-regs
20800 @itemx -mno-upper-regs
20801 @opindex mupper-regs
20802 @opindex mno-upper-regs
20803 Generate code that uses (does not use) the scalar
20804 instructions that target all 64 registers in the vector/scalar
20805 floating point register set, depending on the model of the machine.
20806
20807 If the @option{-mno-upper-regs} option is used, it turns off both
20808 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
20809
20810 @item -mfloat128
20811 @itemx -mno-float128
20812 @opindex mfloat128
20813 @opindex mno-float128
20814 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
20815 and use either software emulation for IEEE 128-bit floating point or
20816 hardware instructions.
20817
20818 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
20819 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
20820 option. The @option{-mfloat128} option only works on PowerPC 64-bit
20821 Linux systems.
20822
20823 If you use the ISA 3.0 instruction set (@option{-mcpu=power9}), the
20824 @option{-mfloat128} option will also enable the generation of ISA 3.0
20825 IEEE 128-bit floating point instructions. Otherwise, IEEE 128-bit
20826 floating point will be done with software emulation.
20827
20828 @item -mfloat128-hardware
20829 @itemx -mno-float128-hardware
20830 @opindex mfloat128-hardware
20831 @opindex mno-float128-hardware
20832 Enable/disable using ISA 3.0 hardware instructions to support the
20833 @var{__float128} data type.
20834
20835 If you use @option{-mfloat128-hardware}, it will enable the option
20836 @option{-mfloat128} as well.
20837
20838 If you select ISA 3.0 instructions with @option{-mcpu=power9}, but do
20839 not use either @option{-mfloat128} or @option{-mfloat128-hardware},
20840 the IEEE 128-bit floating point support will not be enabled.
20841
20842 @item -mfloat-gprs=@var{yes/single/double/no}
20843 @itemx -mfloat-gprs
20844 @opindex mfloat-gprs
20845 This switch enables or disables the generation of floating-point
20846 operations on the general-purpose registers for architectures that
20847 support it.
20848
20849 The argument @samp{yes} or @samp{single} enables the use of
20850 single-precision floating-point operations.
20851
20852 The argument @samp{double} enables the use of single and
20853 double-precision floating-point operations.
20854
20855 The argument @samp{no} disables floating-point operations on the
20856 general-purpose registers.
20857
20858 This option is currently only available on the MPC854x.
20859
20860 @item -m32
20861 @itemx -m64
20862 @opindex m32
20863 @opindex m64
20864 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
20865 targets (including GNU/Linux). The 32-bit environment sets int, long
20866 and pointer to 32 bits and generates code that runs on any PowerPC
20867 variant. The 64-bit environment sets int to 32 bits and long and
20868 pointer to 64 bits, and generates code for PowerPC64, as for
20869 @option{-mpowerpc64}.
20870
20871 @item -mfull-toc
20872 @itemx -mno-fp-in-toc
20873 @itemx -mno-sum-in-toc
20874 @itemx -mminimal-toc
20875 @opindex mfull-toc
20876 @opindex mno-fp-in-toc
20877 @opindex mno-sum-in-toc
20878 @opindex mminimal-toc
20879 Modify generation of the TOC (Table Of Contents), which is created for
20880 every executable file. The @option{-mfull-toc} option is selected by
20881 default. In that case, GCC allocates at least one TOC entry for
20882 each unique non-automatic variable reference in your program. GCC
20883 also places floating-point constants in the TOC@. However, only
20884 16,384 entries are available in the TOC@.
20885
20886 If you receive a linker error message that saying you have overflowed
20887 the available TOC space, you can reduce the amount of TOC space used
20888 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
20889 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
20890 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
20891 generate code to calculate the sum of an address and a constant at
20892 run time instead of putting that sum into the TOC@. You may specify one
20893 or both of these options. Each causes GCC to produce very slightly
20894 slower and larger code at the expense of conserving TOC space.
20895
20896 If you still run out of space in the TOC even when you specify both of
20897 these options, specify @option{-mminimal-toc} instead. This option causes
20898 GCC to make only one TOC entry for every file. When you specify this
20899 option, GCC produces code that is slower and larger but which
20900 uses extremely little TOC space. You may wish to use this option
20901 only on files that contain less frequently-executed code.
20902
20903 @item -maix64
20904 @itemx -maix32
20905 @opindex maix64
20906 @opindex maix32
20907 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
20908 @code{long} type, and the infrastructure needed to support them.
20909 Specifying @option{-maix64} implies @option{-mpowerpc64},
20910 while @option{-maix32} disables the 64-bit ABI and
20911 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
20912
20913 @item -mxl-compat
20914 @itemx -mno-xl-compat
20915 @opindex mxl-compat
20916 @opindex mno-xl-compat
20917 Produce code that conforms more closely to IBM XL compiler semantics
20918 when using AIX-compatible ABI@. Pass floating-point arguments to
20919 prototyped functions beyond the register save area (RSA) on the stack
20920 in addition to argument FPRs. Do not assume that most significant
20921 double in 128-bit long double value is properly rounded when comparing
20922 values and converting to double. Use XL symbol names for long double
20923 support routines.
20924
20925 The AIX calling convention was extended but not initially documented to
20926 handle an obscure K&R C case of calling a function that takes the
20927 address of its arguments with fewer arguments than declared. IBM XL
20928 compilers access floating-point arguments that do not fit in the
20929 RSA from the stack when a subroutine is compiled without
20930 optimization. Because always storing floating-point arguments on the
20931 stack is inefficient and rarely needed, this option is not enabled by
20932 default and only is necessary when calling subroutines compiled by IBM
20933 XL compilers without optimization.
20934
20935 @item -mpe
20936 @opindex mpe
20937 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
20938 application written to use message passing with special startup code to
20939 enable the application to run. The system must have PE installed in the
20940 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
20941 must be overridden with the @option{-specs=} option to specify the
20942 appropriate directory location. The Parallel Environment does not
20943 support threads, so the @option{-mpe} option and the @option{-pthread}
20944 option are incompatible.
20945
20946 @item -malign-natural
20947 @itemx -malign-power
20948 @opindex malign-natural
20949 @opindex malign-power
20950 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
20951 @option{-malign-natural} overrides the ABI-defined alignment of larger
20952 types, such as floating-point doubles, on their natural size-based boundary.
20953 The option @option{-malign-power} instructs GCC to follow the ABI-specified
20954 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
20955
20956 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
20957 is not supported.
20958
20959 @item -msoft-float
20960 @itemx -mhard-float
20961 @opindex msoft-float
20962 @opindex mhard-float
20963 Generate code that does not use (uses) the floating-point register set.
20964 Software floating-point emulation is provided if you use the
20965 @option{-msoft-float} option, and pass the option to GCC when linking.
20966
20967 @item -msingle-float
20968 @itemx -mdouble-float
20969 @opindex msingle-float
20970 @opindex mdouble-float
20971 Generate code for single- or double-precision floating-point operations.
20972 @option{-mdouble-float} implies @option{-msingle-float}.
20973
20974 @item -msimple-fpu
20975 @opindex msimple-fpu
20976 Do not generate @code{sqrt} and @code{div} instructions for hardware
20977 floating-point unit.
20978
20979 @item -mfpu=@var{name}
20980 @opindex mfpu
20981 Specify type of floating-point unit. Valid values for @var{name} are
20982 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
20983 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
20984 @samp{sp_full} (equivalent to @option{-msingle-float}),
20985 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
20986
20987 @item -mxilinx-fpu
20988 @opindex mxilinx-fpu
20989 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
20990
20991 @item -mmultiple
20992 @itemx -mno-multiple
20993 @opindex mmultiple
20994 @opindex mno-multiple
20995 Generate code that uses (does not use) the load multiple word
20996 instructions and the store multiple word instructions. These
20997 instructions are generated by default on POWER systems, and not
20998 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
20999 PowerPC systems, since those instructions do not work when the
21000 processor is in little-endian mode. The exceptions are PPC740 and
21001 PPC750 which permit these instructions in little-endian mode.
21002
21003 @item -mstring
21004 @itemx -mno-string
21005 @opindex mstring
21006 @opindex mno-string
21007 Generate code that uses (does not use) the load string instructions
21008 and the store string word instructions to save multiple registers and
21009 do small block moves. These instructions are generated by default on
21010 POWER systems, and not generated on PowerPC systems. Do not use
21011 @option{-mstring} on little-endian PowerPC systems, since those
21012 instructions do not work when the processor is in little-endian mode.
21013 The exceptions are PPC740 and PPC750 which permit these instructions
21014 in little-endian mode.
21015
21016 @item -mupdate
21017 @itemx -mno-update
21018 @opindex mupdate
21019 @opindex mno-update
21020 Generate code that uses (does not use) the load or store instructions
21021 that update the base register to the address of the calculated memory
21022 location. These instructions are generated by default. If you use
21023 @option{-mno-update}, there is a small window between the time that the
21024 stack pointer is updated and the address of the previous frame is
21025 stored, which means code that walks the stack frame across interrupts or
21026 signals may get corrupted data.
21027
21028 @item -mavoid-indexed-addresses
21029 @itemx -mno-avoid-indexed-addresses
21030 @opindex mavoid-indexed-addresses
21031 @opindex mno-avoid-indexed-addresses
21032 Generate code that tries to avoid (not avoid) the use of indexed load
21033 or store instructions. These instructions can incur a performance
21034 penalty on Power6 processors in certain situations, such as when
21035 stepping through large arrays that cross a 16M boundary. This option
21036 is enabled by default when targeting Power6 and disabled otherwise.
21037
21038 @item -mfused-madd
21039 @itemx -mno-fused-madd
21040 @opindex mfused-madd
21041 @opindex mno-fused-madd
21042 Generate code that uses (does not use) the floating-point multiply and
21043 accumulate instructions. These instructions are generated by default
21044 if hardware floating point is used. The machine-dependent
21045 @option{-mfused-madd} option is now mapped to the machine-independent
21046 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
21047 mapped to @option{-ffp-contract=off}.
21048
21049 @item -mmulhw
21050 @itemx -mno-mulhw
21051 @opindex mmulhw
21052 @opindex mno-mulhw
21053 Generate code that uses (does not use) the half-word multiply and
21054 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
21055 These instructions are generated by default when targeting those
21056 processors.
21057
21058 @item -mdlmzb
21059 @itemx -mno-dlmzb
21060 @opindex mdlmzb
21061 @opindex mno-dlmzb
21062 Generate code that uses (does not use) the string-search @samp{dlmzb}
21063 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
21064 generated by default when targeting those processors.
21065
21066 @item -mno-bit-align
21067 @itemx -mbit-align
21068 @opindex mno-bit-align
21069 @opindex mbit-align
21070 On System V.4 and embedded PowerPC systems do not (do) force structures
21071 and unions that contain bit-fields to be aligned to the base type of the
21072 bit-field.
21073
21074 For example, by default a structure containing nothing but 8
21075 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
21076 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
21077 the structure is aligned to a 1-byte boundary and is 1 byte in
21078 size.
21079
21080 @item -mno-strict-align
21081 @itemx -mstrict-align
21082 @opindex mno-strict-align
21083 @opindex mstrict-align
21084 On System V.4 and embedded PowerPC systems do not (do) assume that
21085 unaligned memory references are handled by the system.
21086
21087 @item -mrelocatable
21088 @itemx -mno-relocatable
21089 @opindex mrelocatable
21090 @opindex mno-relocatable
21091 Generate code that allows (does not allow) a static executable to be
21092 relocated to a different address at run time. A simple embedded
21093 PowerPC system loader should relocate the entire contents of
21094 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
21095 a table of 32-bit addresses generated by this option. For this to
21096 work, all objects linked together must be compiled with
21097 @option{-mrelocatable} or @option{-mrelocatable-lib}.
21098 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
21099
21100 @item -mrelocatable-lib
21101 @itemx -mno-relocatable-lib
21102 @opindex mrelocatable-lib
21103 @opindex mno-relocatable-lib
21104 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
21105 @code{.fixup} section to allow static executables to be relocated at
21106 run time, but @option{-mrelocatable-lib} does not use the smaller stack
21107 alignment of @option{-mrelocatable}. Objects compiled with
21108 @option{-mrelocatable-lib} may be linked with objects compiled with
21109 any combination of the @option{-mrelocatable} options.
21110
21111 @item -mno-toc
21112 @itemx -mtoc
21113 @opindex mno-toc
21114 @opindex mtoc
21115 On System V.4 and embedded PowerPC systems do not (do) assume that
21116 register 2 contains a pointer to a global area pointing to the addresses
21117 used in the program.
21118
21119 @item -mlittle
21120 @itemx -mlittle-endian
21121 @opindex mlittle
21122 @opindex mlittle-endian
21123 On System V.4 and embedded PowerPC systems compile code for the
21124 processor in little-endian mode. The @option{-mlittle-endian} option is
21125 the same as @option{-mlittle}.
21126
21127 @item -mbig
21128 @itemx -mbig-endian
21129 @opindex mbig
21130 @opindex mbig-endian
21131 On System V.4 and embedded PowerPC systems compile code for the
21132 processor in big-endian mode. The @option{-mbig-endian} option is
21133 the same as @option{-mbig}.
21134
21135 @item -mdynamic-no-pic
21136 @opindex mdynamic-no-pic
21137 On Darwin and Mac OS X systems, compile code so that it is not
21138 relocatable, but that its external references are relocatable. The
21139 resulting code is suitable for applications, but not shared
21140 libraries.
21141
21142 @item -msingle-pic-base
21143 @opindex msingle-pic-base
21144 Treat the register used for PIC addressing as read-only, rather than
21145 loading it in the prologue for each function. The runtime system is
21146 responsible for initializing this register with an appropriate value
21147 before execution begins.
21148
21149 @item -mprioritize-restricted-insns=@var{priority}
21150 @opindex mprioritize-restricted-insns
21151 This option controls the priority that is assigned to
21152 dispatch-slot restricted instructions during the second scheduling
21153 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
21154 or @samp{2} to assign no, highest, or second-highest (respectively)
21155 priority to dispatch-slot restricted
21156 instructions.
21157
21158 @item -msched-costly-dep=@var{dependence_type}
21159 @opindex msched-costly-dep
21160 This option controls which dependences are considered costly
21161 by the target during instruction scheduling. The argument
21162 @var{dependence_type} takes one of the following values:
21163
21164 @table @asis
21165 @item @samp{no}
21166 No dependence is costly.
21167
21168 @item @samp{all}
21169 All dependences are costly.
21170
21171 @item @samp{true_store_to_load}
21172 A true dependence from store to load is costly.
21173
21174 @item @samp{store_to_load}
21175 Any dependence from store to load is costly.
21176
21177 @item @var{number}
21178 Any dependence for which the latency is greater than or equal to
21179 @var{number} is costly.
21180 @end table
21181
21182 @item -minsert-sched-nops=@var{scheme}
21183 @opindex minsert-sched-nops
21184 This option controls which NOP insertion scheme is used during
21185 the second scheduling pass. The argument @var{scheme} takes one of the
21186 following values:
21187
21188 @table @asis
21189 @item @samp{no}
21190 Don't insert NOPs.
21191
21192 @item @samp{pad}
21193 Pad with NOPs any dispatch group that has vacant issue slots,
21194 according to the scheduler's grouping.
21195
21196 @item @samp{regroup_exact}
21197 Insert NOPs to force costly dependent insns into
21198 separate groups. Insert exactly as many NOPs as needed to force an insn
21199 to a new group, according to the estimated processor grouping.
21200
21201 @item @var{number}
21202 Insert NOPs to force costly dependent insns into
21203 separate groups. Insert @var{number} NOPs to force an insn to a new group.
21204 @end table
21205
21206 @item -mcall-sysv
21207 @opindex mcall-sysv
21208 On System V.4 and embedded PowerPC systems compile code using calling
21209 conventions that adhere to the March 1995 draft of the System V
21210 Application Binary Interface, PowerPC processor supplement. This is the
21211 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
21212
21213 @item -mcall-sysv-eabi
21214 @itemx -mcall-eabi
21215 @opindex mcall-sysv-eabi
21216 @opindex mcall-eabi
21217 Specify both @option{-mcall-sysv} and @option{-meabi} options.
21218
21219 @item -mcall-sysv-noeabi
21220 @opindex mcall-sysv-noeabi
21221 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
21222
21223 @item -mcall-aixdesc
21224 @opindex m
21225 On System V.4 and embedded PowerPC systems compile code for the AIX
21226 operating system.
21227
21228 @item -mcall-linux
21229 @opindex mcall-linux
21230 On System V.4 and embedded PowerPC systems compile code for the
21231 Linux-based GNU system.
21232
21233 @item -mcall-freebsd
21234 @opindex mcall-freebsd
21235 On System V.4 and embedded PowerPC systems compile code for the
21236 FreeBSD operating system.
21237
21238 @item -mcall-netbsd
21239 @opindex mcall-netbsd
21240 On System V.4 and embedded PowerPC systems compile code for the
21241 NetBSD operating system.
21242
21243 @item -mcall-openbsd
21244 @opindex mcall-netbsd
21245 On System V.4 and embedded PowerPC systems compile code for the
21246 OpenBSD operating system.
21247
21248 @item -maix-struct-return
21249 @opindex maix-struct-return
21250 Return all structures in memory (as specified by the AIX ABI)@.
21251
21252 @item -msvr4-struct-return
21253 @opindex msvr4-struct-return
21254 Return structures smaller than 8 bytes in registers (as specified by the
21255 SVR4 ABI)@.
21256
21257 @item -mabi=@var{abi-type}
21258 @opindex mabi
21259 Extend the current ABI with a particular extension, or remove such extension.
21260 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
21261 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
21262 @samp{elfv1}, @samp{elfv2}@.
21263
21264 @item -mabi=spe
21265 @opindex mabi=spe
21266 Extend the current ABI with SPE ABI extensions. This does not change
21267 the default ABI, instead it adds the SPE ABI extensions to the current
21268 ABI@.
21269
21270 @item -mabi=no-spe
21271 @opindex mabi=no-spe
21272 Disable Book-E SPE ABI extensions for the current ABI@.
21273
21274 @item -mabi=ibmlongdouble
21275 @opindex mabi=ibmlongdouble
21276 Change the current ABI to use IBM extended-precision long double.
21277 This is a PowerPC 32-bit SYSV ABI option.
21278
21279 @item -mabi=ieeelongdouble
21280 @opindex mabi=ieeelongdouble
21281 Change the current ABI to use IEEE extended-precision long double.
21282 This is a PowerPC 32-bit Linux ABI option.
21283
21284 @item -mabi=elfv1
21285 @opindex mabi=elfv1
21286 Change the current ABI to use the ELFv1 ABI.
21287 This is the default ABI for big-endian PowerPC 64-bit Linux.
21288 Overriding the default ABI requires special system support and is
21289 likely to fail in spectacular ways.
21290
21291 @item -mabi=elfv2
21292 @opindex mabi=elfv2
21293 Change the current ABI to use the ELFv2 ABI.
21294 This is the default ABI for little-endian PowerPC 64-bit Linux.
21295 Overriding the default ABI requires special system support and is
21296 likely to fail in spectacular ways.
21297
21298 @item -mprototype
21299 @itemx -mno-prototype
21300 @opindex mprototype
21301 @opindex mno-prototype
21302 On System V.4 and embedded PowerPC systems assume that all calls to
21303 variable argument functions are properly prototyped. Otherwise, the
21304 compiler must insert an instruction before every non-prototyped call to
21305 set or clear bit 6 of the condition code register (@code{CR}) to
21306 indicate whether floating-point values are passed in the floating-point
21307 registers in case the function takes variable arguments. With
21308 @option{-mprototype}, only calls to prototyped variable argument functions
21309 set or clear the bit.
21310
21311 @item -msim
21312 @opindex msim
21313 On embedded PowerPC systems, assume that the startup module is called
21314 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
21315 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
21316 configurations.
21317
21318 @item -mmvme
21319 @opindex mmvme
21320 On embedded PowerPC systems, assume that the startup module is called
21321 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
21322 @file{libc.a}.
21323
21324 @item -mads
21325 @opindex mads
21326 On embedded PowerPC systems, assume that the startup module is called
21327 @file{crt0.o} and the standard C libraries are @file{libads.a} and
21328 @file{libc.a}.
21329
21330 @item -myellowknife
21331 @opindex myellowknife
21332 On embedded PowerPC systems, assume that the startup module is called
21333 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
21334 @file{libc.a}.
21335
21336 @item -mvxworks
21337 @opindex mvxworks
21338 On System V.4 and embedded PowerPC systems, specify that you are
21339 compiling for a VxWorks system.
21340
21341 @item -memb
21342 @opindex memb
21343 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
21344 header to indicate that @samp{eabi} extended relocations are used.
21345
21346 @item -meabi
21347 @itemx -mno-eabi
21348 @opindex meabi
21349 @opindex mno-eabi
21350 On System V.4 and embedded PowerPC systems do (do not) adhere to the
21351 Embedded Applications Binary Interface (EABI), which is a set of
21352 modifications to the System V.4 specifications. Selecting @option{-meabi}
21353 means that the stack is aligned to an 8-byte boundary, a function
21354 @code{__eabi} is called from @code{main} to set up the EABI
21355 environment, and the @option{-msdata} option can use both @code{r2} and
21356 @code{r13} to point to two separate small data areas. Selecting
21357 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
21358 no EABI initialization function is called from @code{main}, and the
21359 @option{-msdata} option only uses @code{r13} to point to a single
21360 small data area. The @option{-meabi} option is on by default if you
21361 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
21362
21363 @item -msdata=eabi
21364 @opindex msdata=eabi
21365 On System V.4 and embedded PowerPC systems, put small initialized
21366 @code{const} global and static data in the @code{.sdata2} section, which
21367 is pointed to by register @code{r2}. Put small initialized
21368 non-@code{const} global and static data in the @code{.sdata} section,
21369 which is pointed to by register @code{r13}. Put small uninitialized
21370 global and static data in the @code{.sbss} section, which is adjacent to
21371 the @code{.sdata} section. The @option{-msdata=eabi} option is
21372 incompatible with the @option{-mrelocatable} option. The
21373 @option{-msdata=eabi} option also sets the @option{-memb} option.
21374
21375 @item -msdata=sysv
21376 @opindex msdata=sysv
21377 On System V.4 and embedded PowerPC systems, put small global and static
21378 data in the @code{.sdata} section, which is pointed to by register
21379 @code{r13}. Put small uninitialized global and static data in the
21380 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
21381 The @option{-msdata=sysv} option is incompatible with the
21382 @option{-mrelocatable} option.
21383
21384 @item -msdata=default
21385 @itemx -msdata
21386 @opindex msdata=default
21387 @opindex msdata
21388 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
21389 compile code the same as @option{-msdata=eabi}, otherwise compile code the
21390 same as @option{-msdata=sysv}.
21391
21392 @item -msdata=data
21393 @opindex msdata=data
21394 On System V.4 and embedded PowerPC systems, put small global
21395 data in the @code{.sdata} section. Put small uninitialized global
21396 data in the @code{.sbss} section. Do not use register @code{r13}
21397 to address small data however. This is the default behavior unless
21398 other @option{-msdata} options are used.
21399
21400 @item -msdata=none
21401 @itemx -mno-sdata
21402 @opindex msdata=none
21403 @opindex mno-sdata
21404 On embedded PowerPC systems, put all initialized global and static data
21405 in the @code{.data} section, and all uninitialized data in the
21406 @code{.bss} section.
21407
21408 @item -mblock-move-inline-limit=@var{num}
21409 @opindex mblock-move-inline-limit
21410 Inline all block moves (such as calls to @code{memcpy} or structure
21411 copies) less than or equal to @var{num} bytes. The minimum value for
21412 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
21413 targets. The default value is target-specific.
21414
21415 @item -G @var{num}
21416 @opindex G
21417 @cindex smaller data references (PowerPC)
21418 @cindex .sdata/.sdata2 references (PowerPC)
21419 On embedded PowerPC systems, put global and static items less than or
21420 equal to @var{num} bytes into the small data or BSS sections instead of
21421 the normal data or BSS section. By default, @var{num} is 8. The
21422 @option{-G @var{num}} switch is also passed to the linker.
21423 All modules should be compiled with the same @option{-G @var{num}} value.
21424
21425 @item -mregnames
21426 @itemx -mno-regnames
21427 @opindex mregnames
21428 @opindex mno-regnames
21429 On System V.4 and embedded PowerPC systems do (do not) emit register
21430 names in the assembly language output using symbolic forms.
21431
21432 @item -mlongcall
21433 @itemx -mno-longcall
21434 @opindex mlongcall
21435 @opindex mno-longcall
21436 By default assume that all calls are far away so that a longer and more
21437 expensive calling sequence is required. This is required for calls
21438 farther than 32 megabytes (33,554,432 bytes) from the current location.
21439 A short call is generated if the compiler knows
21440 the call cannot be that far away. This setting can be overridden by
21441 the @code{shortcall} function attribute, or by @code{#pragma
21442 longcall(0)}.
21443
21444 Some linkers are capable of detecting out-of-range calls and generating
21445 glue code on the fly. On these systems, long calls are unnecessary and
21446 generate slower code. As of this writing, the AIX linker can do this,
21447 as can the GNU linker for PowerPC/64. It is planned to add this feature
21448 to the GNU linker for 32-bit PowerPC systems as well.
21449
21450 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
21451 callee, L42}, plus a @dfn{branch island} (glue code). The two target
21452 addresses represent the callee and the branch island. The
21453 Darwin/PPC linker prefers the first address and generates a @code{bl
21454 callee} if the PPC @code{bl} instruction reaches the callee directly;
21455 otherwise, the linker generates @code{bl L42} to call the branch
21456 island. The branch island is appended to the body of the
21457 calling function; it computes the full 32-bit address of the callee
21458 and jumps to it.
21459
21460 On Mach-O (Darwin) systems, this option directs the compiler emit to
21461 the glue for every direct call, and the Darwin linker decides whether
21462 to use or discard it.
21463
21464 In the future, GCC may ignore all longcall specifications
21465 when the linker is known to generate glue.
21466
21467 @item -mtls-markers
21468 @itemx -mno-tls-markers
21469 @opindex mtls-markers
21470 @opindex mno-tls-markers
21471 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
21472 specifying the function argument. The relocation allows the linker to
21473 reliably associate function call with argument setup instructions for
21474 TLS optimization, which in turn allows GCC to better schedule the
21475 sequence.
21476
21477 @item -pthread
21478 @opindex pthread
21479 Adds support for multithreading with the @dfn{pthreads} library.
21480 This option sets flags for both the preprocessor and linker.
21481
21482 @item -mrecip
21483 @itemx -mno-recip
21484 @opindex mrecip
21485 This option enables use of the reciprocal estimate and
21486 reciprocal square root estimate instructions with additional
21487 Newton-Raphson steps to increase precision instead of doing a divide or
21488 square root and divide for floating-point arguments. You should use
21489 the @option{-ffast-math} option when using @option{-mrecip} (or at
21490 least @option{-funsafe-math-optimizations},
21491 @option{-ffinite-math-only}, @option{-freciprocal-math} and
21492 @option{-fno-trapping-math}). Note that while the throughput of the
21493 sequence is generally higher than the throughput of the non-reciprocal
21494 instruction, the precision of the sequence can be decreased by up to 2
21495 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
21496 roots.
21497
21498 @item -mrecip=@var{opt}
21499 @opindex mrecip=opt
21500 This option controls which reciprocal estimate instructions
21501 may be used. @var{opt} is a comma-separated list of options, which may
21502 be preceded by a @code{!} to invert the option:
21503
21504 @table @samp
21505
21506 @item all
21507 Enable all estimate instructions.
21508
21509 @item default
21510 Enable the default instructions, equivalent to @option{-mrecip}.
21511
21512 @item none
21513 Disable all estimate instructions, equivalent to @option{-mno-recip}.
21514
21515 @item div
21516 Enable the reciprocal approximation instructions for both
21517 single and double precision.
21518
21519 @item divf
21520 Enable the single-precision reciprocal approximation instructions.
21521
21522 @item divd
21523 Enable the double-precision reciprocal approximation instructions.
21524
21525 @item rsqrt
21526 Enable the reciprocal square root approximation instructions for both
21527 single and double precision.
21528
21529 @item rsqrtf
21530 Enable the single-precision reciprocal square root approximation instructions.
21531
21532 @item rsqrtd
21533 Enable the double-precision reciprocal square root approximation instructions.
21534
21535 @end table
21536
21537 So, for example, @option{-mrecip=all,!rsqrtd} enables
21538 all of the reciprocal estimate instructions, except for the
21539 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
21540 which handle the double-precision reciprocal square root calculations.
21541
21542 @item -mrecip-precision
21543 @itemx -mno-recip-precision
21544 @opindex mrecip-precision
21545 Assume (do not assume) that the reciprocal estimate instructions
21546 provide higher-precision estimates than is mandated by the PowerPC
21547 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
21548 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
21549 The double-precision square root estimate instructions are not generated by
21550 default on low-precision machines, since they do not provide an
21551 estimate that converges after three steps.
21552
21553 @item -mveclibabi=@var{type}
21554 @opindex mveclibabi
21555 Specifies the ABI type to use for vectorizing intrinsics using an
21556 external library. The only type supported at present is @samp{mass},
21557 which specifies to use IBM's Mathematical Acceleration Subsystem
21558 (MASS) libraries for vectorizing intrinsics using external libraries.
21559 GCC currently emits calls to @code{acosd2}, @code{acosf4},
21560 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
21561 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
21562 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
21563 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
21564 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
21565 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
21566 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
21567 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
21568 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
21569 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
21570 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
21571 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
21572 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
21573 for power7. Both @option{-ftree-vectorize} and
21574 @option{-funsafe-math-optimizations} must also be enabled. The MASS
21575 libraries must be specified at link time.
21576
21577 @item -mfriz
21578 @itemx -mno-friz
21579 @opindex mfriz
21580 Generate (do not generate) the @code{friz} instruction when the
21581 @option{-funsafe-math-optimizations} option is used to optimize
21582 rounding of floating-point values to 64-bit integer and back to floating
21583 point. The @code{friz} instruction does not return the same value if
21584 the floating-point number is too large to fit in an integer.
21585
21586 @item -mpointers-to-nested-functions
21587 @itemx -mno-pointers-to-nested-functions
21588 @opindex mpointers-to-nested-functions
21589 Generate (do not generate) code to load up the static chain register
21590 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
21591 systems where a function pointer points to a 3-word descriptor giving
21592 the function address, TOC value to be loaded in register @code{r2}, and
21593 static chain value to be loaded in register @code{r11}. The
21594 @option{-mpointers-to-nested-functions} is on by default. You cannot
21595 call through pointers to nested functions or pointers
21596 to functions compiled in other languages that use the static chain if
21597 you use @option{-mno-pointers-to-nested-functions}.
21598
21599 @item -msave-toc-indirect
21600 @itemx -mno-save-toc-indirect
21601 @opindex msave-toc-indirect
21602 Generate (do not generate) code to save the TOC value in the reserved
21603 stack location in the function prologue if the function calls through
21604 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
21605 saved in the prologue, it is saved just before the call through the
21606 pointer. The @option{-mno-save-toc-indirect} option is the default.
21607
21608 @item -mcompat-align-parm
21609 @itemx -mno-compat-align-parm
21610 @opindex mcompat-align-parm
21611 Generate (do not generate) code to pass structure parameters with a
21612 maximum alignment of 64 bits, for compatibility with older versions
21613 of GCC.
21614
21615 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
21616 structure parameter on a 128-bit boundary when that structure contained
21617 a member requiring 128-bit alignment. This is corrected in more
21618 recent versions of GCC. This option may be used to generate code
21619 that is compatible with functions compiled with older versions of
21620 GCC.
21621
21622 The @option{-mno-compat-align-parm} option is the default.
21623 @end table
21624
21625 @node RX Options
21626 @subsection RX Options
21627 @cindex RX Options
21628
21629 These command-line options are defined for RX targets:
21630
21631 @table @gcctabopt
21632 @item -m64bit-doubles
21633 @itemx -m32bit-doubles
21634 @opindex m64bit-doubles
21635 @opindex m32bit-doubles
21636 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
21637 or 32 bits (@option{-m32bit-doubles}) in size. The default is
21638 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
21639 works on 32-bit values, which is why the default is
21640 @option{-m32bit-doubles}.
21641
21642 @item -fpu
21643 @itemx -nofpu
21644 @opindex fpu
21645 @opindex nofpu
21646 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
21647 floating-point hardware. The default is enabled for the RX600
21648 series and disabled for the RX200 series.
21649
21650 Floating-point instructions are only generated for 32-bit floating-point
21651 values, however, so the FPU hardware is not used for doubles if the
21652 @option{-m64bit-doubles} option is used.
21653
21654 @emph{Note} If the @option{-fpu} option is enabled then
21655 @option{-funsafe-math-optimizations} is also enabled automatically.
21656 This is because the RX FPU instructions are themselves unsafe.
21657
21658 @item -mcpu=@var{name}
21659 @opindex mcpu
21660 Selects the type of RX CPU to be targeted. Currently three types are
21661 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
21662 the specific @samp{RX610} CPU. The default is @samp{RX600}.
21663
21664 The only difference between @samp{RX600} and @samp{RX610} is that the
21665 @samp{RX610} does not support the @code{MVTIPL} instruction.
21666
21667 The @samp{RX200} series does not have a hardware floating-point unit
21668 and so @option{-nofpu} is enabled by default when this type is
21669 selected.
21670
21671 @item -mbig-endian-data
21672 @itemx -mlittle-endian-data
21673 @opindex mbig-endian-data
21674 @opindex mlittle-endian-data
21675 Store data (but not code) in the big-endian format. The default is
21676 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
21677 format.
21678
21679 @item -msmall-data-limit=@var{N}
21680 @opindex msmall-data-limit
21681 Specifies the maximum size in bytes of global and static variables
21682 which can be placed into the small data area. Using the small data
21683 area can lead to smaller and faster code, but the size of area is
21684 limited and it is up to the programmer to ensure that the area does
21685 not overflow. Also when the small data area is used one of the RX's
21686 registers (usually @code{r13}) is reserved for use pointing to this
21687 area, so it is no longer available for use by the compiler. This
21688 could result in slower and/or larger code if variables are pushed onto
21689 the stack instead of being held in this register.
21690
21691 Note, common variables (variables that have not been initialized) and
21692 constants are not placed into the small data area as they are assigned
21693 to other sections in the output executable.
21694
21695 The default value is zero, which disables this feature. Note, this
21696 feature is not enabled by default with higher optimization levels
21697 (@option{-O2} etc) because of the potentially detrimental effects of
21698 reserving a register. It is up to the programmer to experiment and
21699 discover whether this feature is of benefit to their program. See the
21700 description of the @option{-mpid} option for a description of how the
21701 actual register to hold the small data area pointer is chosen.
21702
21703 @item -msim
21704 @itemx -mno-sim
21705 @opindex msim
21706 @opindex mno-sim
21707 Use the simulator runtime. The default is to use the libgloss
21708 board-specific runtime.
21709
21710 @item -mas100-syntax
21711 @itemx -mno-as100-syntax
21712 @opindex mas100-syntax
21713 @opindex mno-as100-syntax
21714 When generating assembler output use a syntax that is compatible with
21715 Renesas's AS100 assembler. This syntax can also be handled by the GAS
21716 assembler, but it has some restrictions so it is not generated by default.
21717
21718 @item -mmax-constant-size=@var{N}
21719 @opindex mmax-constant-size
21720 Specifies the maximum size, in bytes, of a constant that can be used as
21721 an operand in a RX instruction. Although the RX instruction set does
21722 allow constants of up to 4 bytes in length to be used in instructions,
21723 a longer value equates to a longer instruction. Thus in some
21724 circumstances it can be beneficial to restrict the size of constants
21725 that are used in instructions. Constants that are too big are instead
21726 placed into a constant pool and referenced via register indirection.
21727
21728 The value @var{N} can be between 0 and 4. A value of 0 (the default)
21729 or 4 means that constants of any size are allowed.
21730
21731 @item -mrelax
21732 @opindex mrelax
21733 Enable linker relaxation. Linker relaxation is a process whereby the
21734 linker attempts to reduce the size of a program by finding shorter
21735 versions of various instructions. Disabled by default.
21736
21737 @item -mint-register=@var{N}
21738 @opindex mint-register
21739 Specify the number of registers to reserve for fast interrupt handler
21740 functions. The value @var{N} can be between 0 and 4. A value of 1
21741 means that register @code{r13} is reserved for the exclusive use
21742 of fast interrupt handlers. A value of 2 reserves @code{r13} and
21743 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
21744 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
21745 A value of 0, the default, does not reserve any registers.
21746
21747 @item -msave-acc-in-interrupts
21748 @opindex msave-acc-in-interrupts
21749 Specifies that interrupt handler functions should preserve the
21750 accumulator register. This is only necessary if normal code might use
21751 the accumulator register, for example because it performs 64-bit
21752 multiplications. The default is to ignore the accumulator as this
21753 makes the interrupt handlers faster.
21754
21755 @item -mpid
21756 @itemx -mno-pid
21757 @opindex mpid
21758 @opindex mno-pid
21759 Enables the generation of position independent data. When enabled any
21760 access to constant data is done via an offset from a base address
21761 held in a register. This allows the location of constant data to be
21762 determined at run time without requiring the executable to be
21763 relocated, which is a benefit to embedded applications with tight
21764 memory constraints. Data that can be modified is not affected by this
21765 option.
21766
21767 Note, using this feature reserves a register, usually @code{r13}, for
21768 the constant data base address. This can result in slower and/or
21769 larger code, especially in complicated functions.
21770
21771 The actual register chosen to hold the constant data base address
21772 depends upon whether the @option{-msmall-data-limit} and/or the
21773 @option{-mint-register} command-line options are enabled. Starting
21774 with register @code{r13} and proceeding downwards, registers are
21775 allocated first to satisfy the requirements of @option{-mint-register},
21776 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
21777 is possible for the small data area register to be @code{r8} if both
21778 @option{-mint-register=4} and @option{-mpid} are specified on the
21779 command line.
21780
21781 By default this feature is not enabled. The default can be restored
21782 via the @option{-mno-pid} command-line option.
21783
21784 @item -mno-warn-multiple-fast-interrupts
21785 @itemx -mwarn-multiple-fast-interrupts
21786 @opindex mno-warn-multiple-fast-interrupts
21787 @opindex mwarn-multiple-fast-interrupts
21788 Prevents GCC from issuing a warning message if it finds more than one
21789 fast interrupt handler when it is compiling a file. The default is to
21790 issue a warning for each extra fast interrupt handler found, as the RX
21791 only supports one such interrupt.
21792
21793 @item -mallow-string-insns
21794 @itemx -mno-allow-string-insns
21795 @opindex mallow-string-insns
21796 @opindex mno-allow-string-insns
21797 Enables or disables the use of the string manipulation instructions
21798 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
21799 @code{SWHILE} and also the @code{RMPA} instruction. These
21800 instructions may prefetch data, which is not safe to do if accessing
21801 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
21802 for more information).
21803
21804 The default is to allow these instructions, but it is not possible for
21805 GCC to reliably detect all circumstances where a string instruction
21806 might be used to access an I/O register, so their use cannot be
21807 disabled automatically. Instead it is reliant upon the programmer to
21808 use the @option{-mno-allow-string-insns} option if their program
21809 accesses I/O space.
21810
21811 When the instructions are enabled GCC defines the C preprocessor
21812 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
21813 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
21814
21815 @item -mjsr
21816 @itemx -mno-jsr
21817 @opindex mjsr
21818 @opindex mno-jsr
21819 Use only (or not only) @code{JSR} instructions to access functions.
21820 This option can be used when code size exceeds the range of @code{BSR}
21821 instructions. Note that @option{-mno-jsr} does not mean to not use
21822 @code{JSR} but instead means that any type of branch may be used.
21823 @end table
21824
21825 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
21826 has special significance to the RX port when used with the
21827 @code{interrupt} function attribute. This attribute indicates a
21828 function intended to process fast interrupts. GCC ensures
21829 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
21830 and/or @code{r13} and only provided that the normal use of the
21831 corresponding registers have been restricted via the
21832 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
21833 options.
21834
21835 @node S/390 and zSeries Options
21836 @subsection S/390 and zSeries Options
21837 @cindex S/390 and zSeries Options
21838
21839 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
21840
21841 @table @gcctabopt
21842 @item -mhard-float
21843 @itemx -msoft-float
21844 @opindex mhard-float
21845 @opindex msoft-float
21846 Use (do not use) the hardware floating-point instructions and registers
21847 for floating-point operations. When @option{-msoft-float} is specified,
21848 functions in @file{libgcc.a} are used to perform floating-point
21849 operations. When @option{-mhard-float} is specified, the compiler
21850 generates IEEE floating-point instructions. This is the default.
21851
21852 @item -mhard-dfp
21853 @itemx -mno-hard-dfp
21854 @opindex mhard-dfp
21855 @opindex mno-hard-dfp
21856 Use (do not use) the hardware decimal-floating-point instructions for
21857 decimal-floating-point operations. When @option{-mno-hard-dfp} is
21858 specified, functions in @file{libgcc.a} are used to perform
21859 decimal-floating-point operations. When @option{-mhard-dfp} is
21860 specified, the compiler generates decimal-floating-point hardware
21861 instructions. This is the default for @option{-march=z9-ec} or higher.
21862
21863 @item -mlong-double-64
21864 @itemx -mlong-double-128
21865 @opindex mlong-double-64
21866 @opindex mlong-double-128
21867 These switches control the size of @code{long double} type. A size
21868 of 64 bits makes the @code{long double} type equivalent to the @code{double}
21869 type. This is the default.
21870
21871 @item -mbackchain
21872 @itemx -mno-backchain
21873 @opindex mbackchain
21874 @opindex mno-backchain
21875 Store (do not store) the address of the caller's frame as backchain pointer
21876 into the callee's stack frame.
21877 A backchain may be needed to allow debugging using tools that do not understand
21878 DWARF call frame information.
21879 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
21880 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
21881 the backchain is placed into the topmost word of the 96/160 byte register
21882 save area.
21883
21884 In general, code compiled with @option{-mbackchain} is call-compatible with
21885 code compiled with @option{-mmo-backchain}; however, use of the backchain
21886 for debugging purposes usually requires that the whole binary is built with
21887 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
21888 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21889 to build a linux kernel use @option{-msoft-float}.
21890
21891 The default is to not maintain the backchain.
21892
21893 @item -mpacked-stack
21894 @itemx -mno-packed-stack
21895 @opindex mpacked-stack
21896 @opindex mno-packed-stack
21897 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
21898 specified, the compiler uses the all fields of the 96/160 byte register save
21899 area only for their default purpose; unused fields still take up stack space.
21900 When @option{-mpacked-stack} is specified, register save slots are densely
21901 packed at the top of the register save area; unused space is reused for other
21902 purposes, allowing for more efficient use of the available stack space.
21903 However, when @option{-mbackchain} is also in effect, the topmost word of
21904 the save area is always used to store the backchain, and the return address
21905 register is always saved two words below the backchain.
21906
21907 As long as the stack frame backchain is not used, code generated with
21908 @option{-mpacked-stack} is call-compatible with code generated with
21909 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
21910 S/390 or zSeries generated code that uses the stack frame backchain at run
21911 time, not just for debugging purposes. Such code is not call-compatible
21912 with code compiled with @option{-mpacked-stack}. Also, note that the
21913 combination of @option{-mbackchain},
21914 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21915 to build a linux kernel use @option{-msoft-float}.
21916
21917 The default is to not use the packed stack layout.
21918
21919 @item -msmall-exec
21920 @itemx -mno-small-exec
21921 @opindex msmall-exec
21922 @opindex mno-small-exec
21923 Generate (or do not generate) code using the @code{bras} instruction
21924 to do subroutine calls.
21925 This only works reliably if the total executable size does not
21926 exceed 64k. The default is to use the @code{basr} instruction instead,
21927 which does not have this limitation.
21928
21929 @item -m64
21930 @itemx -m31
21931 @opindex m64
21932 @opindex m31
21933 When @option{-m31} is specified, generate code compliant to the
21934 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
21935 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
21936 particular to generate 64-bit instructions. For the @samp{s390}
21937 targets, the default is @option{-m31}, while the @samp{s390x}
21938 targets default to @option{-m64}.
21939
21940 @item -mzarch
21941 @itemx -mesa
21942 @opindex mzarch
21943 @opindex mesa
21944 When @option{-mzarch} is specified, generate code using the
21945 instructions available on z/Architecture.
21946 When @option{-mesa} is specified, generate code using the
21947 instructions available on ESA/390. Note that @option{-mesa} is
21948 not possible with @option{-m64}.
21949 When generating code compliant to the GNU/Linux for S/390 ABI,
21950 the default is @option{-mesa}. When generating code compliant
21951 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
21952
21953 @item -mhtm
21954 @itemx -mno-htm
21955 @opindex mhtm
21956 @opindex mno-htm
21957 The @option{-mhtm} option enables a set of builtins making use of
21958 instructions available with the transactional execution facility
21959 introduced with the IBM zEnterprise EC12 machine generation
21960 @ref{S/390 System z Built-in Functions}.
21961 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
21962
21963 @item -mvx
21964 @itemx -mno-vx
21965 @opindex mvx
21966 @opindex mno-vx
21967 When @option{-mvx} is specified, generate code using the instructions
21968 available with the vector extension facility introduced with the IBM
21969 z13 machine generation.
21970 This option changes the ABI for some vector type values with regard to
21971 alignment and calling conventions. In case vector type values are
21972 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
21973 command will be added to mark the resulting binary with the ABI used.
21974 @option{-mvx} is enabled by default when using @option{-march=z13}.
21975
21976 @item -mzvector
21977 @itemx -mno-zvector
21978 @opindex mzvector
21979 @opindex mno-zvector
21980 The @option{-mzvector} option enables vector language extensions and
21981 builtins using instructions available with the vector extension
21982 facility introduced with the IBM z13 machine generation.
21983 This option adds support for @samp{vector} to be used as a keyword to
21984 define vector type variables and arguments. @samp{vector} is only
21985 available when GNU extensions are enabled. It will not be expanded
21986 when requesting strict standard compliance e.g. with @option{-std=c99}.
21987 In addition to the GCC low-level builtins @option{-mzvector} enables
21988 a set of builtins added for compatibility with AltiVec-style
21989 implementations like Power and Cell. In order to make use of these
21990 builtins the header file @file{vecintrin.h} needs to be included.
21991 @option{-mzvector} is disabled by default.
21992
21993 @item -mmvcle
21994 @itemx -mno-mvcle
21995 @opindex mmvcle
21996 @opindex mno-mvcle
21997 Generate (or do not generate) code using the @code{mvcle} instruction
21998 to perform block moves. When @option{-mno-mvcle} is specified,
21999 use a @code{mvc} loop instead. This is the default unless optimizing for
22000 size.
22001
22002 @item -mdebug
22003 @itemx -mno-debug
22004 @opindex mdebug
22005 @opindex mno-debug
22006 Print (or do not print) additional debug information when compiling.
22007 The default is to not print debug information.
22008
22009 @item -march=@var{cpu-type}
22010 @opindex march
22011 Generate code that runs on @var{cpu-type}, which is the name of a
22012 system representing a certain processor type. Possible values for
22013 @var{cpu-type} are @samp{z900}, @samp{z990}, @samp{z9-109},
22014 @samp{z9-ec}, @samp{z10}, @samp{z196}, @samp{zEC12}, and @samp{z13}.
22015 The default is @option{-march=z900}. @samp{g5} and @samp{g6} are
22016 deprecated and will be removed with future releases.
22017
22018 @item -mtune=@var{cpu-type}
22019 @opindex mtune
22020 Tune to @var{cpu-type} everything applicable about the generated code,
22021 except for the ABI and the set of available instructions.
22022 The list of @var{cpu-type} values is the same as for @option{-march}.
22023 The default is the value used for @option{-march}.
22024
22025 @item -mtpf-trace
22026 @itemx -mno-tpf-trace
22027 @opindex mtpf-trace
22028 @opindex mno-tpf-trace
22029 Generate code that adds (does not add) in TPF OS specific branches to trace
22030 routines in the operating system. This option is off by default, even
22031 when compiling for the TPF OS@.
22032
22033 @item -mfused-madd
22034 @itemx -mno-fused-madd
22035 @opindex mfused-madd
22036 @opindex mno-fused-madd
22037 Generate code that uses (does not use) the floating-point multiply and
22038 accumulate instructions. These instructions are generated by default if
22039 hardware floating point is used.
22040
22041 @item -mwarn-framesize=@var{framesize}
22042 @opindex mwarn-framesize
22043 Emit a warning if the current function exceeds the given frame size. Because
22044 this is a compile-time check it doesn't need to be a real problem when the program
22045 runs. It is intended to identify functions that most probably cause
22046 a stack overflow. It is useful to be used in an environment with limited stack
22047 size e.g.@: the linux kernel.
22048
22049 @item -mwarn-dynamicstack
22050 @opindex mwarn-dynamicstack
22051 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
22052 arrays. This is generally a bad idea with a limited stack size.
22053
22054 @item -mstack-guard=@var{stack-guard}
22055 @itemx -mstack-size=@var{stack-size}
22056 @opindex mstack-guard
22057 @opindex mstack-size
22058 If these options are provided the S/390 back end emits additional instructions in
22059 the function prologue that trigger a trap if the stack size is @var{stack-guard}
22060 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
22061 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
22062 the frame size of the compiled function is chosen.
22063 These options are intended to be used to help debugging stack overflow problems.
22064 The additionally emitted code causes only little overhead and hence can also be
22065 used in production-like systems without greater performance degradation. The given
22066 values have to be exact powers of 2 and @var{stack-size} has to be greater than
22067 @var{stack-guard} without exceeding 64k.
22068 In order to be efficient the extra code makes the assumption that the stack starts
22069 at an address aligned to the value given by @var{stack-size}.
22070 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
22071
22072 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
22073 @opindex mhotpatch
22074 If the hotpatch option is enabled, a ``hot-patching'' function
22075 prologue is generated for all functions in the compilation unit.
22076 The funtion label is prepended with the given number of two-byte
22077 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
22078 the label, 2 * @var{post-halfwords} bytes are appended, using the
22079 largest NOP like instructions the architecture allows (maximum
22080 1000000).
22081
22082 If both arguments are zero, hotpatching is disabled.
22083
22084 This option can be overridden for individual functions with the
22085 @code{hotpatch} attribute.
22086 @end table
22087
22088 @node Score Options
22089 @subsection Score Options
22090 @cindex Score Options
22091
22092 These options are defined for Score implementations:
22093
22094 @table @gcctabopt
22095 @item -meb
22096 @opindex meb
22097 Compile code for big-endian mode. This is the default.
22098
22099 @item -mel
22100 @opindex mel
22101 Compile code for little-endian mode.
22102
22103 @item -mnhwloop
22104 @opindex mnhwloop
22105 Disable generation of @code{bcnz} instructions.
22106
22107 @item -muls
22108 @opindex muls
22109 Enable generation of unaligned load and store instructions.
22110
22111 @item -mmac
22112 @opindex mmac
22113 Enable the use of multiply-accumulate instructions. Disabled by default.
22114
22115 @item -mscore5
22116 @opindex mscore5
22117 Specify the SCORE5 as the target architecture.
22118
22119 @item -mscore5u
22120 @opindex mscore5u
22121 Specify the SCORE5U of the target architecture.
22122
22123 @item -mscore7
22124 @opindex mscore7
22125 Specify the SCORE7 as the target architecture. This is the default.
22126
22127 @item -mscore7d
22128 @opindex mscore7d
22129 Specify the SCORE7D as the target architecture.
22130 @end table
22131
22132 @node SH Options
22133 @subsection SH Options
22134
22135 These @samp{-m} options are defined for the SH implementations:
22136
22137 @table @gcctabopt
22138 @item -m1
22139 @opindex m1
22140 Generate code for the SH1.
22141
22142 @item -m2
22143 @opindex m2
22144 Generate code for the SH2.
22145
22146 @item -m2e
22147 Generate code for the SH2e.
22148
22149 @item -m2a-nofpu
22150 @opindex m2a-nofpu
22151 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
22152 that the floating-point unit is not used.
22153
22154 @item -m2a-single-only
22155 @opindex m2a-single-only
22156 Generate code for the SH2a-FPU, in such a way that no double-precision
22157 floating-point operations are used.
22158
22159 @item -m2a-single
22160 @opindex m2a-single
22161 Generate code for the SH2a-FPU assuming the floating-point unit is in
22162 single-precision mode by default.
22163
22164 @item -m2a
22165 @opindex m2a
22166 Generate code for the SH2a-FPU assuming the floating-point unit is in
22167 double-precision mode by default.
22168
22169 @item -m3
22170 @opindex m3
22171 Generate code for the SH3.
22172
22173 @item -m3e
22174 @opindex m3e
22175 Generate code for the SH3e.
22176
22177 @item -m4-nofpu
22178 @opindex m4-nofpu
22179 Generate code for the SH4 without a floating-point unit.
22180
22181 @item -m4-single-only
22182 @opindex m4-single-only
22183 Generate code for the SH4 with a floating-point unit that only
22184 supports single-precision arithmetic.
22185
22186 @item -m4-single
22187 @opindex m4-single
22188 Generate code for the SH4 assuming the floating-point unit is in
22189 single-precision mode by default.
22190
22191 @item -m4
22192 @opindex m4
22193 Generate code for the SH4.
22194
22195 @item -m4-100
22196 @opindex m4-100
22197 Generate code for SH4-100.
22198
22199 @item -m4-100-nofpu
22200 @opindex m4-100-nofpu
22201 Generate code for SH4-100 in such a way that the
22202 floating-point unit is not used.
22203
22204 @item -m4-100-single
22205 @opindex m4-100-single
22206 Generate code for SH4-100 assuming the floating-point unit is in
22207 single-precision mode by default.
22208
22209 @item -m4-100-single-only
22210 @opindex m4-100-single-only
22211 Generate code for SH4-100 in such a way that no double-precision
22212 floating-point operations are used.
22213
22214 @item -m4-200
22215 @opindex m4-200
22216 Generate code for SH4-200.
22217
22218 @item -m4-200-nofpu
22219 @opindex m4-200-nofpu
22220 Generate code for SH4-200 without in such a way that the
22221 floating-point unit is not used.
22222
22223 @item -m4-200-single
22224 @opindex m4-200-single
22225 Generate code for SH4-200 assuming the floating-point unit is in
22226 single-precision mode by default.
22227
22228 @item -m4-200-single-only
22229 @opindex m4-200-single-only
22230 Generate code for SH4-200 in such a way that no double-precision
22231 floating-point operations are used.
22232
22233 @item -m4-300
22234 @opindex m4-300
22235 Generate code for SH4-300.
22236
22237 @item -m4-300-nofpu
22238 @opindex m4-300-nofpu
22239 Generate code for SH4-300 without in such a way that the
22240 floating-point unit is not used.
22241
22242 @item -m4-300-single
22243 @opindex m4-300-single
22244 Generate code for SH4-300 in such a way that no double-precision
22245 floating-point operations are used.
22246
22247 @item -m4-300-single-only
22248 @opindex m4-300-single-only
22249 Generate code for SH4-300 in such a way that no double-precision
22250 floating-point operations are used.
22251
22252 @item -m4-340
22253 @opindex m4-340
22254 Generate code for SH4-340 (no MMU, no FPU).
22255
22256 @item -m4-500
22257 @opindex m4-500
22258 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
22259 assembler.
22260
22261 @item -m4a-nofpu
22262 @opindex m4a-nofpu
22263 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
22264 floating-point unit is not used.
22265
22266 @item -m4a-single-only
22267 @opindex m4a-single-only
22268 Generate code for the SH4a, in such a way that no double-precision
22269 floating-point operations are used.
22270
22271 @item -m4a-single
22272 @opindex m4a-single
22273 Generate code for the SH4a assuming the floating-point unit is in
22274 single-precision mode by default.
22275
22276 @item -m4a
22277 @opindex m4a
22278 Generate code for the SH4a.
22279
22280 @item -m4al
22281 @opindex m4al
22282 Same as @option{-m4a-nofpu}, except that it implicitly passes
22283 @option{-dsp} to the assembler. GCC doesn't generate any DSP
22284 instructions at the moment.
22285
22286 @item -mb
22287 @opindex mb
22288 Compile code for the processor in big-endian mode.
22289
22290 @item -ml
22291 @opindex ml
22292 Compile code for the processor in little-endian mode.
22293
22294 @item -mdalign
22295 @opindex mdalign
22296 Align doubles at 64-bit boundaries. Note that this changes the calling
22297 conventions, and thus some functions from the standard C library do
22298 not work unless you recompile it first with @option{-mdalign}.
22299
22300 @item -mrelax
22301 @opindex mrelax
22302 Shorten some address references at link time, when possible; uses the
22303 linker option @option{-relax}.
22304
22305 @item -mbigtable
22306 @opindex mbigtable
22307 Use 32-bit offsets in @code{switch} tables. The default is to use
22308 16-bit offsets.
22309
22310 @item -mbitops
22311 @opindex mbitops
22312 Enable the use of bit manipulation instructions on SH2A.
22313
22314 @item -mfmovd
22315 @opindex mfmovd
22316 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
22317 alignment constraints.
22318
22319 @item -mrenesas
22320 @opindex mrenesas
22321 Comply with the calling conventions defined by Renesas.
22322
22323 @item -mno-renesas
22324 @opindex mno-renesas
22325 Comply with the calling conventions defined for GCC before the Renesas
22326 conventions were available. This option is the default for all
22327 targets of the SH toolchain.
22328
22329 @item -mnomacsave
22330 @opindex mnomacsave
22331 Mark the @code{MAC} register as call-clobbered, even if
22332 @option{-mrenesas} is given.
22333
22334 @item -mieee
22335 @itemx -mno-ieee
22336 @opindex mieee
22337 @opindex mno-ieee
22338 Control the IEEE compliance of floating-point comparisons, which affects the
22339 handling of cases where the result of a comparison is unordered. By default
22340 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
22341 enabled @option{-mno-ieee} is implicitly set, which results in faster
22342 floating-point greater-equal and less-equal comparisons. The implicit settings
22343 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
22344
22345 @item -minline-ic_invalidate
22346 @opindex minline-ic_invalidate
22347 Inline code to invalidate instruction cache entries after setting up
22348 nested function trampolines.
22349 This option has no effect if @option{-musermode} is in effect and the selected
22350 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
22351 instruction.
22352 If the selected code generation option does not allow the use of the @code{icbi}
22353 instruction, and @option{-musermode} is not in effect, the inlined code
22354 manipulates the instruction cache address array directly with an associative
22355 write. This not only requires privileged mode at run time, but it also
22356 fails if the cache line had been mapped via the TLB and has become unmapped.
22357
22358 @item -misize
22359 @opindex misize
22360 Dump instruction size and location in the assembly code.
22361
22362 @item -mpadstruct
22363 @opindex mpadstruct
22364 This option is deprecated. It pads structures to multiple of 4 bytes,
22365 which is incompatible with the SH ABI@.
22366
22367 @item -matomic-model=@var{model}
22368 @opindex matomic-model=@var{model}
22369 Sets the model of atomic operations and additional parameters as a comma
22370 separated list. For details on the atomic built-in functions see
22371 @ref{__atomic Builtins}. The following models and parameters are supported:
22372
22373 @table @samp
22374
22375 @item none
22376 Disable compiler generated atomic sequences and emit library calls for atomic
22377 operations. This is the default if the target is not @code{sh*-*-linux*}.
22378
22379 @item soft-gusa
22380 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
22381 built-in functions. The generated atomic sequences require additional support
22382 from the interrupt/exception handling code of the system and are only suitable
22383 for SH3* and SH4* single-core systems. This option is enabled by default when
22384 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
22385 this option also partially utilizes the hardware atomic instructions
22386 @code{movli.l} and @code{movco.l} to create more efficient code, unless
22387 @samp{strict} is specified.
22388
22389 @item soft-tcb
22390 Generate software atomic sequences that use a variable in the thread control
22391 block. This is a variation of the gUSA sequences which can also be used on
22392 SH1* and SH2* targets. The generated atomic sequences require additional
22393 support from the interrupt/exception handling code of the system and are only
22394 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
22395 parameter has to be specified as well.
22396
22397 @item soft-imask
22398 Generate software atomic sequences that temporarily disable interrupts by
22399 setting @code{SR.IMASK = 1111}. This model works only when the program runs
22400 in privileged mode and is only suitable for single-core systems. Additional
22401 support from the interrupt/exception handling code of the system is not
22402 required. This model is enabled by default when the target is
22403 @code{sh*-*-linux*} and SH1* or SH2*.
22404
22405 @item hard-llcs
22406 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
22407 instructions only. This is only available on SH4A and is suitable for
22408 multi-core systems. Since the hardware instructions support only 32 bit atomic
22409 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
22410 Code compiled with this option is also compatible with other software
22411 atomic model interrupt/exception handling systems if executed on an SH4A
22412 system. Additional support from the interrupt/exception handling code of the
22413 system is not required for this model.
22414
22415 @item gbr-offset=
22416 This parameter specifies the offset in bytes of the variable in the thread
22417 control block structure that should be used by the generated atomic sequences
22418 when the @samp{soft-tcb} model has been selected. For other models this
22419 parameter is ignored. The specified value must be an integer multiple of four
22420 and in the range 0-1020.
22421
22422 @item strict
22423 This parameter prevents mixed usage of multiple atomic models, even if they
22424 are compatible, and makes the compiler generate atomic sequences of the
22425 specified model only.
22426
22427 @end table
22428
22429 @item -mtas
22430 @opindex mtas
22431 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
22432 Notice that depending on the particular hardware and software configuration
22433 this can degrade overall performance due to the operand cache line flushes
22434 that are implied by the @code{tas.b} instruction. On multi-core SH4A
22435 processors the @code{tas.b} instruction must be used with caution since it
22436 can result in data corruption for certain cache configurations.
22437
22438 @item -mprefergot
22439 @opindex mprefergot
22440 When generating position-independent code, emit function calls using
22441 the Global Offset Table instead of the Procedure Linkage Table.
22442
22443 @item -musermode
22444 @itemx -mno-usermode
22445 @opindex musermode
22446 @opindex mno-usermode
22447 Don't allow (allow) the compiler generating privileged mode code. Specifying
22448 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
22449 inlined code would not work in user mode. @option{-musermode} is the default
22450 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
22451 @option{-musermode} has no effect, since there is no user mode.
22452
22453 @item -multcost=@var{number}
22454 @opindex multcost=@var{number}
22455 Set the cost to assume for a multiply insn.
22456
22457 @item -mdiv=@var{strategy}
22458 @opindex mdiv=@var{strategy}
22459 Set the division strategy to be used for integer division operations.
22460 @var{strategy} can be one of:
22461
22462 @table @samp
22463
22464 @item call-div1
22465 Calls a library function that uses the single-step division instruction
22466 @code{div1} to perform the operation. Division by zero calculates an
22467 unspecified result and does not trap. This is the default except for SH4,
22468 SH2A and SHcompact.
22469
22470 @item call-fp
22471 Calls a library function that performs the operation in double precision
22472 floating point. Division by zero causes a floating-point exception. This is
22473 the default for SHcompact with FPU. Specifying this for targets that do not
22474 have a double precision FPU defaults to @code{call-div1}.
22475
22476 @item call-table
22477 Calls a library function that uses a lookup table for small divisors and
22478 the @code{div1} instruction with case distinction for larger divisors. Division
22479 by zero calculates an unspecified result and does not trap. This is the default
22480 for SH4. Specifying this for targets that do not have dynamic shift
22481 instructions defaults to @code{call-div1}.
22482
22483 @end table
22484
22485 When a division strategy has not been specified the default strategy is
22486 selected based on the current target. For SH2A the default strategy is to
22487 use the @code{divs} and @code{divu} instructions instead of library function
22488 calls.
22489
22490 @item -maccumulate-outgoing-args
22491 @opindex maccumulate-outgoing-args
22492 Reserve space once for outgoing arguments in the function prologue rather
22493 than around each call. Generally beneficial for performance and size. Also
22494 needed for unwinding to avoid changing the stack frame around conditional code.
22495
22496 @item -mdivsi3_libfunc=@var{name}
22497 @opindex mdivsi3_libfunc=@var{name}
22498 Set the name of the library function used for 32-bit signed division to
22499 @var{name}.
22500 This only affects the name used in the @samp{call} division strategies, and
22501 the compiler still expects the same sets of input/output/clobbered registers as
22502 if this option were not present.
22503
22504 @item -mfixed-range=@var{register-range}
22505 @opindex mfixed-range
22506 Generate code treating the given register range as fixed registers.
22507 A fixed register is one that the register allocator can not use. This is
22508 useful when compiling kernel code. A register range is specified as
22509 two registers separated by a dash. Multiple register ranges can be
22510 specified separated by a comma.
22511
22512 @item -mbranch-cost=@var{num}
22513 @opindex mbranch-cost=@var{num}
22514 Assume @var{num} to be the cost for a branch instruction. Higher numbers
22515 make the compiler try to generate more branch-free code if possible.
22516 If not specified the value is selected depending on the processor type that
22517 is being compiled for.
22518
22519 @item -mzdcbranch
22520 @itemx -mno-zdcbranch
22521 @opindex mzdcbranch
22522 @opindex mno-zdcbranch
22523 Assume (do not assume) that zero displacement conditional branch instructions
22524 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
22525 compiler prefers zero displacement branch code sequences. This is
22526 enabled by default when generating code for SH4 and SH4A. It can be explicitly
22527 disabled by specifying @option{-mno-zdcbranch}.
22528
22529 @item -mcbranch-force-delay-slot
22530 @opindex mcbranch-force-delay-slot
22531 Force the usage of delay slots for conditional branches, which stuffs the delay
22532 slot with a @code{nop} if a suitable instruction can't be found. By default
22533 this option is disabled. It can be enabled to work around hardware bugs as
22534 found in the original SH7055.
22535
22536 @item -mfused-madd
22537 @itemx -mno-fused-madd
22538 @opindex mfused-madd
22539 @opindex mno-fused-madd
22540 Generate code that uses (does not use) the floating-point multiply and
22541 accumulate instructions. These instructions are generated by default
22542 if hardware floating point is used. The machine-dependent
22543 @option{-mfused-madd} option is now mapped to the machine-independent
22544 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22545 mapped to @option{-ffp-contract=off}.
22546
22547 @item -mfsca
22548 @itemx -mno-fsca
22549 @opindex mfsca
22550 @opindex mno-fsca
22551 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
22552 and cosine approximations. The option @option{-mfsca} must be used in
22553 combination with @option{-funsafe-math-optimizations}. It is enabled by default
22554 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
22555 approximations even if @option{-funsafe-math-optimizations} is in effect.
22556
22557 @item -mfsrra
22558 @itemx -mno-fsrra
22559 @opindex mfsrra
22560 @opindex mno-fsrra
22561 Allow or disallow the compiler to emit the @code{fsrra} instruction for
22562 reciprocal square root approximations. The option @option{-mfsrra} must be used
22563 in combination with @option{-funsafe-math-optimizations} and
22564 @option{-ffinite-math-only}. It is enabled by default when generating code for
22565 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
22566 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
22567 in effect.
22568
22569 @item -mpretend-cmove
22570 @opindex mpretend-cmove
22571 Prefer zero-displacement conditional branches for conditional move instruction
22572 patterns. This can result in faster code on the SH4 processor.
22573
22574 @item -mfdpic
22575 @opindex fdpic
22576 Generate code using the FDPIC ABI.
22577
22578 @end table
22579
22580 @node Solaris 2 Options
22581 @subsection Solaris 2 Options
22582 @cindex Solaris 2 options
22583
22584 These @samp{-m} options are supported on Solaris 2:
22585
22586 @table @gcctabopt
22587 @item -mclear-hwcap
22588 @opindex mclear-hwcap
22589 @option{-mclear-hwcap} tells the compiler to remove the hardware
22590 capabilities generated by the Solaris assembler. This is only necessary
22591 when object files use ISA extensions not supported by the current
22592 machine, but check at runtime whether or not to use them.
22593
22594 @item -mimpure-text
22595 @opindex mimpure-text
22596 @option{-mimpure-text}, used in addition to @option{-shared}, tells
22597 the compiler to not pass @option{-z text} to the linker when linking a
22598 shared object. Using this option, you can link position-dependent
22599 code into a shared object.
22600
22601 @option{-mimpure-text} suppresses the ``relocations remain against
22602 allocatable but non-writable sections'' linker error message.
22603 However, the necessary relocations trigger copy-on-write, and the
22604 shared object is not actually shared across processes. Instead of
22605 using @option{-mimpure-text}, you should compile all source code with
22606 @option{-fpic} or @option{-fPIC}.
22607
22608 @end table
22609
22610 These switches are supported in addition to the above on Solaris 2:
22611
22612 @table @gcctabopt
22613 @item -pthreads
22614 @opindex pthreads
22615 Add support for multithreading using the POSIX threads library. This
22616 option sets flags for both the preprocessor and linker. This option does
22617 not affect the thread safety of object code produced by the compiler or
22618 that of libraries supplied with it.
22619
22620 @item -pthread
22621 @opindex pthread
22622 This is a synonym for @option{-pthreads}.
22623 @end table
22624
22625 @node SPARC Options
22626 @subsection SPARC Options
22627 @cindex SPARC options
22628
22629 These @samp{-m} options are supported on the SPARC:
22630
22631 @table @gcctabopt
22632 @item -mno-app-regs
22633 @itemx -mapp-regs
22634 @opindex mno-app-regs
22635 @opindex mapp-regs
22636 Specify @option{-mapp-regs} to generate output using the global registers
22637 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
22638 global register 1, each global register 2 through 4 is then treated as an
22639 allocable register that is clobbered by function calls. This is the default.
22640
22641 To be fully SVR4 ABI-compliant at the cost of some performance loss,
22642 specify @option{-mno-app-regs}. You should compile libraries and system
22643 software with this option.
22644
22645 @item -mflat
22646 @itemx -mno-flat
22647 @opindex mflat
22648 @opindex mno-flat
22649 With @option{-mflat}, the compiler does not generate save/restore instructions
22650 and uses a ``flat'' or single register window model. This model is compatible
22651 with the regular register window model. The local registers and the input
22652 registers (0--5) are still treated as ``call-saved'' registers and are
22653 saved on the stack as needed.
22654
22655 With @option{-mno-flat} (the default), the compiler generates save/restore
22656 instructions (except for leaf functions). This is the normal operating mode.
22657
22658 @item -mfpu
22659 @itemx -mhard-float
22660 @opindex mfpu
22661 @opindex mhard-float
22662 Generate output containing floating-point instructions. This is the
22663 default.
22664
22665 @item -mno-fpu
22666 @itemx -msoft-float
22667 @opindex mno-fpu
22668 @opindex msoft-float
22669 Generate output containing library calls for floating point.
22670 @strong{Warning:} the requisite libraries are not available for all SPARC
22671 targets. Normally the facilities of the machine's usual C compiler are
22672 used, but this cannot be done directly in cross-compilation. You must make
22673 your own arrangements to provide suitable library functions for
22674 cross-compilation. The embedded targets @samp{sparc-*-aout} and
22675 @samp{sparclite-*-*} do provide software floating-point support.
22676
22677 @option{-msoft-float} changes the calling convention in the output file;
22678 therefore, it is only useful if you compile @emph{all} of a program with
22679 this option. In particular, you need to compile @file{libgcc.a}, the
22680 library that comes with GCC, with @option{-msoft-float} in order for
22681 this to work.
22682
22683 @item -mhard-quad-float
22684 @opindex mhard-quad-float
22685 Generate output containing quad-word (long double) floating-point
22686 instructions.
22687
22688 @item -msoft-quad-float
22689 @opindex msoft-quad-float
22690 Generate output containing library calls for quad-word (long double)
22691 floating-point instructions. The functions called are those specified
22692 in the SPARC ABI@. This is the default.
22693
22694 As of this writing, there are no SPARC implementations that have hardware
22695 support for the quad-word floating-point instructions. They all invoke
22696 a trap handler for one of these instructions, and then the trap handler
22697 emulates the effect of the instruction. Because of the trap handler overhead,
22698 this is much slower than calling the ABI library routines. Thus the
22699 @option{-msoft-quad-float} option is the default.
22700
22701 @item -mno-unaligned-doubles
22702 @itemx -munaligned-doubles
22703 @opindex mno-unaligned-doubles
22704 @opindex munaligned-doubles
22705 Assume that doubles have 8-byte alignment. This is the default.
22706
22707 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
22708 alignment only if they are contained in another type, or if they have an
22709 absolute address. Otherwise, it assumes they have 4-byte alignment.
22710 Specifying this option avoids some rare compatibility problems with code
22711 generated by other compilers. It is not the default because it results
22712 in a performance loss, especially for floating-point code.
22713
22714 @item -muser-mode
22715 @itemx -mno-user-mode
22716 @opindex muser-mode
22717 @opindex mno-user-mode
22718 Do not generate code that can only run in supervisor mode. This is relevant
22719 only for the @code{casa} instruction emitted for the LEON3 processor. This
22720 is the default.
22721
22722 @item -mfaster-structs
22723 @itemx -mno-faster-structs
22724 @opindex mfaster-structs
22725 @opindex mno-faster-structs
22726 With @option{-mfaster-structs}, the compiler assumes that structures
22727 should have 8-byte alignment. This enables the use of pairs of
22728 @code{ldd} and @code{std} instructions for copies in structure
22729 assignment, in place of twice as many @code{ld} and @code{st} pairs.
22730 However, the use of this changed alignment directly violates the SPARC
22731 ABI@. Thus, it's intended only for use on targets where the developer
22732 acknowledges that their resulting code is not directly in line with
22733 the rules of the ABI@.
22734
22735 @item -mstd-struct-return
22736 @itemx -mno-std-struct-return
22737 @opindex mstd-struct-return
22738 @opindex mno-std-struct-return
22739 With @option{-mstd-struct-return}, the compiler generates checking code
22740 in functions returning structures or unions to detect size mismatches
22741 between the two sides of function calls, as per the 32-bit ABI@.
22742
22743 The default is @option{-mno-std-struct-return}. This option has no effect
22744 in 64-bit mode.
22745
22746 @item -mcpu=@var{cpu_type}
22747 @opindex mcpu
22748 Set the instruction set, register set, and instruction scheduling parameters
22749 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22750 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
22751 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
22752 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
22753 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
22754 @samp{niagara3}, @samp{niagara4} and @samp{niagara7}.
22755
22756 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
22757 which selects the best architecture option for the host processor.
22758 @option{-mcpu=native} has no effect if GCC does not recognize
22759 the processor.
22760
22761 Default instruction scheduling parameters are used for values that select
22762 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
22763 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
22764
22765 Here is a list of each supported architecture and their supported
22766 implementations.
22767
22768 @table @asis
22769 @item v7
22770 cypress, leon3v7
22771
22772 @item v8
22773 supersparc, hypersparc, leon, leon3
22774
22775 @item sparclite
22776 f930, f934, sparclite86x
22777
22778 @item sparclet
22779 tsc701
22780
22781 @item v9
22782 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7
22783 @end table
22784
22785 By default (unless configured otherwise), GCC generates code for the V7
22786 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
22787 additionally optimizes it for the Cypress CY7C602 chip, as used in the
22788 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
22789 SPARCStation 1, 2, IPX etc.
22790
22791 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
22792 architecture. The only difference from V7 code is that the compiler emits
22793 the integer multiply and integer divide instructions which exist in SPARC-V8
22794 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
22795 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
22796 2000 series.
22797
22798 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
22799 the SPARC architecture. This adds the integer multiply, integer divide step
22800 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
22801 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
22802 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
22803 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
22804 MB86934 chip, which is the more recent SPARClite with FPU@.
22805
22806 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
22807 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
22808 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
22809 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
22810 optimizes it for the TEMIC SPARClet chip.
22811
22812 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
22813 architecture. This adds 64-bit integer and floating-point move instructions,
22814 3 additional floating-point condition code registers and conditional move
22815 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
22816 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
22817 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
22818 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
22819 @option{-mcpu=niagara}, the compiler additionally optimizes it for
22820 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
22821 additionally optimizes it for Sun UltraSPARC T2 chips. With
22822 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
22823 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
22824 additionally optimizes it for Sun UltraSPARC T4 chips. With
22825 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
22826 Oracle SPARC M7 chips.
22827
22828 @item -mtune=@var{cpu_type}
22829 @opindex mtune
22830 Set the instruction scheduling parameters for machine type
22831 @var{cpu_type}, but do not set the instruction set or register set that the
22832 option @option{-mcpu=@var{cpu_type}} does.
22833
22834 The same values for @option{-mcpu=@var{cpu_type}} can be used for
22835 @option{-mtune=@var{cpu_type}}, but the only useful values are those
22836 that select a particular CPU implementation. Those are
22837 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
22838 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
22839 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
22840 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
22841 @samp{niagara4} and @samp{niagara7}. With native Solaris and
22842 GNU/Linux toolchains, @samp{native} can also be used.
22843
22844 @item -mv8plus
22845 @itemx -mno-v8plus
22846 @opindex mv8plus
22847 @opindex mno-v8plus
22848 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
22849 difference from the V8 ABI is that the global and out registers are
22850 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
22851 mode for all SPARC-V9 processors.
22852
22853 @item -mvis
22854 @itemx -mno-vis
22855 @opindex mvis
22856 @opindex mno-vis
22857 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
22858 Visual Instruction Set extensions. The default is @option{-mno-vis}.
22859
22860 @item -mvis2
22861 @itemx -mno-vis2
22862 @opindex mvis2
22863 @opindex mno-vis2
22864 With @option{-mvis2}, GCC generates code that takes advantage of
22865 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
22866 default is @option{-mvis2} when targeting a cpu that supports such
22867 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
22868 also sets @option{-mvis}.
22869
22870 @item -mvis3
22871 @itemx -mno-vis3
22872 @opindex mvis3
22873 @opindex mno-vis3
22874 With @option{-mvis3}, GCC generates code that takes advantage of
22875 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
22876 default is @option{-mvis3} when targeting a cpu that supports such
22877 instructions, such as niagara-3 and later. Setting @option{-mvis3}
22878 also sets @option{-mvis2} and @option{-mvis}.
22879
22880 @item -mvis4
22881 @itemx -mno-vis4
22882 @opindex mvis4
22883 @opindex mno-vis4
22884 With @option{-mvis4}, GCC generates code that takes advantage of
22885 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
22886 default is @option{-mvis4} when targeting a cpu that supports such
22887 instructions, such as niagara-7 and later. Setting @option{-mvis4}
22888 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
22889
22890 @item -mcbcond
22891 @itemx -mno-cbcond
22892 @opindex mcbcond
22893 @opindex mno-cbcond
22894 With @option{-mcbcond}, GCC generates code that takes advantage of
22895 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
22896 The default is @option{-mcbcond} when targeting a cpu that supports such
22897 instructions, such as niagara-4 and later.
22898
22899 @item -mpopc
22900 @itemx -mno-popc
22901 @opindex mpopc
22902 @opindex mno-popc
22903 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
22904 population count instruction. The default is @option{-mpopc}
22905 when targeting a cpu that supports such instructions, such as Niagara-2 and
22906 later.
22907
22908 @item -mfmaf
22909 @itemx -mno-fmaf
22910 @opindex mfmaf
22911 @opindex mno-fmaf
22912 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
22913 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
22914 when targeting a cpu that supports such instructions, such as Niagara-3 and
22915 later.
22916
22917 @item -mfix-at697f
22918 @opindex mfix-at697f
22919 Enable the documented workaround for the single erratum of the Atmel AT697F
22920 processor (which corresponds to erratum #13 of the AT697E processor).
22921
22922 @item -mfix-ut699
22923 @opindex mfix-ut699
22924 Enable the documented workarounds for the floating-point errata and the data
22925 cache nullify errata of the UT699 processor.
22926 @end table
22927
22928 These @samp{-m} options are supported in addition to the above
22929 on SPARC-V9 processors in 64-bit environments:
22930
22931 @table @gcctabopt
22932 @item -m32
22933 @itemx -m64
22934 @opindex m32
22935 @opindex m64
22936 Generate code for a 32-bit or 64-bit environment.
22937 The 32-bit environment sets int, long and pointer to 32 bits.
22938 The 64-bit environment sets int to 32 bits and long and pointer
22939 to 64 bits.
22940
22941 @item -mcmodel=@var{which}
22942 @opindex mcmodel
22943 Set the code model to one of
22944
22945 @table @samp
22946 @item medlow
22947 The Medium/Low code model: 64-bit addresses, programs
22948 must be linked in the low 32 bits of memory. Programs can be statically
22949 or dynamically linked.
22950
22951 @item medmid
22952 The Medium/Middle code model: 64-bit addresses, programs
22953 must be linked in the low 44 bits of memory, the text and data segments must
22954 be less than 2GB in size and the data segment must be located within 2GB of
22955 the text segment.
22956
22957 @item medany
22958 The Medium/Anywhere code model: 64-bit addresses, programs
22959 may be linked anywhere in memory, the text and data segments must be less
22960 than 2GB in size and the data segment must be located within 2GB of the
22961 text segment.
22962
22963 @item embmedany
22964 The Medium/Anywhere code model for embedded systems:
22965 64-bit addresses, the text and data segments must be less than 2GB in
22966 size, both starting anywhere in memory (determined at link time). The
22967 global register %g4 points to the base of the data segment. Programs
22968 are statically linked and PIC is not supported.
22969 @end table
22970
22971 @item -mmemory-model=@var{mem-model}
22972 @opindex mmemory-model
22973 Set the memory model in force on the processor to one of
22974
22975 @table @samp
22976 @item default
22977 The default memory model for the processor and operating system.
22978
22979 @item rmo
22980 Relaxed Memory Order
22981
22982 @item pso
22983 Partial Store Order
22984
22985 @item tso
22986 Total Store Order
22987
22988 @item sc
22989 Sequential Consistency
22990 @end table
22991
22992 These memory models are formally defined in Appendix D of the Sparc V9
22993 architecture manual, as set in the processor's @code{PSTATE.MM} field.
22994
22995 @item -mstack-bias
22996 @itemx -mno-stack-bias
22997 @opindex mstack-bias
22998 @opindex mno-stack-bias
22999 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
23000 frame pointer if present, are offset by @minus{}2047 which must be added back
23001 when making stack frame references. This is the default in 64-bit mode.
23002 Otherwise, assume no such offset is present.
23003 @end table
23004
23005 @node SPU Options
23006 @subsection SPU Options
23007 @cindex SPU options
23008
23009 These @samp{-m} options are supported on the SPU:
23010
23011 @table @gcctabopt
23012 @item -mwarn-reloc
23013 @itemx -merror-reloc
23014 @opindex mwarn-reloc
23015 @opindex merror-reloc
23016
23017 The loader for SPU does not handle dynamic relocations. By default, GCC
23018 gives an error when it generates code that requires a dynamic
23019 relocation. @option{-mno-error-reloc} disables the error,
23020 @option{-mwarn-reloc} generates a warning instead.
23021
23022 @item -msafe-dma
23023 @itemx -munsafe-dma
23024 @opindex msafe-dma
23025 @opindex munsafe-dma
23026
23027 Instructions that initiate or test completion of DMA must not be
23028 reordered with respect to loads and stores of the memory that is being
23029 accessed.
23030 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
23031 memory accesses, but that can lead to inefficient code in places where the
23032 memory is known to not change. Rather than mark the memory as volatile,
23033 you can use @option{-msafe-dma} to tell the compiler to treat
23034 the DMA instructions as potentially affecting all memory.
23035
23036 @item -mbranch-hints
23037 @opindex mbranch-hints
23038
23039 By default, GCC generates a branch hint instruction to avoid
23040 pipeline stalls for always-taken or probably-taken branches. A hint
23041 is not generated closer than 8 instructions away from its branch.
23042 There is little reason to disable them, except for debugging purposes,
23043 or to make an object a little bit smaller.
23044
23045 @item -msmall-mem
23046 @itemx -mlarge-mem
23047 @opindex msmall-mem
23048 @opindex mlarge-mem
23049
23050 By default, GCC generates code assuming that addresses are never larger
23051 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
23052 a full 32-bit address.
23053
23054 @item -mstdmain
23055 @opindex mstdmain
23056
23057 By default, GCC links against startup code that assumes the SPU-style
23058 main function interface (which has an unconventional parameter list).
23059 With @option{-mstdmain}, GCC links your program against startup
23060 code that assumes a C99-style interface to @code{main}, including a
23061 local copy of @code{argv} strings.
23062
23063 @item -mfixed-range=@var{register-range}
23064 @opindex mfixed-range
23065 Generate code treating the given register range as fixed registers.
23066 A fixed register is one that the register allocator cannot use. This is
23067 useful when compiling kernel code. A register range is specified as
23068 two registers separated by a dash. Multiple register ranges can be
23069 specified separated by a comma.
23070
23071 @item -mea32
23072 @itemx -mea64
23073 @opindex mea32
23074 @opindex mea64
23075 Compile code assuming that pointers to the PPU address space accessed
23076 via the @code{__ea} named address space qualifier are either 32 or 64
23077 bits wide. The default is 32 bits. As this is an ABI-changing option,
23078 all object code in an executable must be compiled with the same setting.
23079
23080 @item -maddress-space-conversion
23081 @itemx -mno-address-space-conversion
23082 @opindex maddress-space-conversion
23083 @opindex mno-address-space-conversion
23084 Allow/disallow treating the @code{__ea} address space as superset
23085 of the generic address space. This enables explicit type casts
23086 between @code{__ea} and generic pointer as well as implicit
23087 conversions of generic pointers to @code{__ea} pointers. The
23088 default is to allow address space pointer conversions.
23089
23090 @item -mcache-size=@var{cache-size}
23091 @opindex mcache-size
23092 This option controls the version of libgcc that the compiler links to an
23093 executable and selects a software-managed cache for accessing variables
23094 in the @code{__ea} address space with a particular cache size. Possible
23095 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
23096 and @samp{128}. The default cache size is 64KB.
23097
23098 @item -matomic-updates
23099 @itemx -mno-atomic-updates
23100 @opindex matomic-updates
23101 @opindex mno-atomic-updates
23102 This option controls the version of libgcc that the compiler links to an
23103 executable and selects whether atomic updates to the software-managed
23104 cache of PPU-side variables are used. If you use atomic updates, changes
23105 to a PPU variable from SPU code using the @code{__ea} named address space
23106 qualifier do not interfere with changes to other PPU variables residing
23107 in the same cache line from PPU code. If you do not use atomic updates,
23108 such interference may occur; however, writing back cache lines is
23109 more efficient. The default behavior is to use atomic updates.
23110
23111 @item -mdual-nops
23112 @itemx -mdual-nops=@var{n}
23113 @opindex mdual-nops
23114 By default, GCC inserts NOPs to increase dual issue when it expects
23115 it to increase performance. @var{n} can be a value from 0 to 10. A
23116 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
23117 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
23118
23119 @item -mhint-max-nops=@var{n}
23120 @opindex mhint-max-nops
23121 Maximum number of NOPs to insert for a branch hint. A branch hint must
23122 be at least 8 instructions away from the branch it is affecting. GCC
23123 inserts up to @var{n} NOPs to enforce this, otherwise it does not
23124 generate the branch hint.
23125
23126 @item -mhint-max-distance=@var{n}
23127 @opindex mhint-max-distance
23128 The encoding of the branch hint instruction limits the hint to be within
23129 256 instructions of the branch it is affecting. By default, GCC makes
23130 sure it is within 125.
23131
23132 @item -msafe-hints
23133 @opindex msafe-hints
23134 Work around a hardware bug that causes the SPU to stall indefinitely.
23135 By default, GCC inserts the @code{hbrp} instruction to make sure
23136 this stall won't happen.
23137
23138 @end table
23139
23140 @node System V Options
23141 @subsection Options for System V
23142
23143 These additional options are available on System V Release 4 for
23144 compatibility with other compilers on those systems:
23145
23146 @table @gcctabopt
23147 @item -G
23148 @opindex G
23149 Create a shared object.
23150 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
23151
23152 @item -Qy
23153 @opindex Qy
23154 Identify the versions of each tool used by the compiler, in a
23155 @code{.ident} assembler directive in the output.
23156
23157 @item -Qn
23158 @opindex Qn
23159 Refrain from adding @code{.ident} directives to the output file (this is
23160 the default).
23161
23162 @item -YP,@var{dirs}
23163 @opindex YP
23164 Search the directories @var{dirs}, and no others, for libraries
23165 specified with @option{-l}.
23166
23167 @item -Ym,@var{dir}
23168 @opindex Ym
23169 Look in the directory @var{dir} to find the M4 preprocessor.
23170 The assembler uses this option.
23171 @c This is supposed to go with a -Yd for predefined M4 macro files, but
23172 @c the generic assembler that comes with Solaris takes just -Ym.
23173 @end table
23174
23175 @node TILE-Gx Options
23176 @subsection TILE-Gx Options
23177 @cindex TILE-Gx options
23178
23179 These @samp{-m} options are supported on the TILE-Gx:
23180
23181 @table @gcctabopt
23182 @item -mcmodel=small
23183 @opindex mcmodel=small
23184 Generate code for the small model. The distance for direct calls is
23185 limited to 500M in either direction. PC-relative addresses are 32
23186 bits. Absolute addresses support the full address range.
23187
23188 @item -mcmodel=large
23189 @opindex mcmodel=large
23190 Generate code for the large model. There is no limitation on call
23191 distance, pc-relative addresses, or absolute addresses.
23192
23193 @item -mcpu=@var{name}
23194 @opindex mcpu
23195 Selects the type of CPU to be targeted. Currently the only supported
23196 type is @samp{tilegx}.
23197
23198 @item -m32
23199 @itemx -m64
23200 @opindex m32
23201 @opindex m64
23202 Generate code for a 32-bit or 64-bit environment. The 32-bit
23203 environment sets int, long, and pointer to 32 bits. The 64-bit
23204 environment sets int to 32 bits and long and pointer to 64 bits.
23205
23206 @item -mbig-endian
23207 @itemx -mlittle-endian
23208 @opindex mbig-endian
23209 @opindex mlittle-endian
23210 Generate code in big/little endian mode, respectively.
23211 @end table
23212
23213 @node TILEPro Options
23214 @subsection TILEPro Options
23215 @cindex TILEPro options
23216
23217 These @samp{-m} options are supported on the TILEPro:
23218
23219 @table @gcctabopt
23220 @item -mcpu=@var{name}
23221 @opindex mcpu
23222 Selects the type of CPU to be targeted. Currently the only supported
23223 type is @samp{tilepro}.
23224
23225 @item -m32
23226 @opindex m32
23227 Generate code for a 32-bit environment, which sets int, long, and
23228 pointer to 32 bits. This is the only supported behavior so the flag
23229 is essentially ignored.
23230 @end table
23231
23232 @node V850 Options
23233 @subsection V850 Options
23234 @cindex V850 Options
23235
23236 These @samp{-m} options are defined for V850 implementations:
23237
23238 @table @gcctabopt
23239 @item -mlong-calls
23240 @itemx -mno-long-calls
23241 @opindex mlong-calls
23242 @opindex mno-long-calls
23243 Treat all calls as being far away (near). If calls are assumed to be
23244 far away, the compiler always loads the function's address into a
23245 register, and calls indirect through the pointer.
23246
23247 @item -mno-ep
23248 @itemx -mep
23249 @opindex mno-ep
23250 @opindex mep
23251 Do not optimize (do optimize) basic blocks that use the same index
23252 pointer 4 or more times to copy pointer into the @code{ep} register, and
23253 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
23254 option is on by default if you optimize.
23255
23256 @item -mno-prolog-function
23257 @itemx -mprolog-function
23258 @opindex mno-prolog-function
23259 @opindex mprolog-function
23260 Do not use (do use) external functions to save and restore registers
23261 at the prologue and epilogue of a function. The external functions
23262 are slower, but use less code space if more than one function saves
23263 the same number of registers. The @option{-mprolog-function} option
23264 is on by default if you optimize.
23265
23266 @item -mspace
23267 @opindex mspace
23268 Try to make the code as small as possible. At present, this just turns
23269 on the @option{-mep} and @option{-mprolog-function} options.
23270
23271 @item -mtda=@var{n}
23272 @opindex mtda
23273 Put static or global variables whose size is @var{n} bytes or less into
23274 the tiny data area that register @code{ep} points to. The tiny data
23275 area can hold up to 256 bytes in total (128 bytes for byte references).
23276
23277 @item -msda=@var{n}
23278 @opindex msda
23279 Put static or global variables whose size is @var{n} bytes or less into
23280 the small data area that register @code{gp} points to. The small data
23281 area can hold up to 64 kilobytes.
23282
23283 @item -mzda=@var{n}
23284 @opindex mzda
23285 Put static or global variables whose size is @var{n} bytes or less into
23286 the first 32 kilobytes of memory.
23287
23288 @item -mv850
23289 @opindex mv850
23290 Specify that the target processor is the V850.
23291
23292 @item -mv850e3v5
23293 @opindex mv850e3v5
23294 Specify that the target processor is the V850E3V5. The preprocessor
23295 constant @code{__v850e3v5__} is defined if this option is used.
23296
23297 @item -mv850e2v4
23298 @opindex mv850e2v4
23299 Specify that the target processor is the V850E3V5. This is an alias for
23300 the @option{-mv850e3v5} option.
23301
23302 @item -mv850e2v3
23303 @opindex mv850e2v3
23304 Specify that the target processor is the V850E2V3. The preprocessor
23305 constant @code{__v850e2v3__} is defined if this option is used.
23306
23307 @item -mv850e2
23308 @opindex mv850e2
23309 Specify that the target processor is the V850E2. The preprocessor
23310 constant @code{__v850e2__} is defined if this option is used.
23311
23312 @item -mv850e1
23313 @opindex mv850e1
23314 Specify that the target processor is the V850E1. The preprocessor
23315 constants @code{__v850e1__} and @code{__v850e__} are defined if
23316 this option is used.
23317
23318 @item -mv850es
23319 @opindex mv850es
23320 Specify that the target processor is the V850ES. This is an alias for
23321 the @option{-mv850e1} option.
23322
23323 @item -mv850e
23324 @opindex mv850e
23325 Specify that the target processor is the V850E@. The preprocessor
23326 constant @code{__v850e__} is defined if this option is used.
23327
23328 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
23329 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
23330 are defined then a default target processor is chosen and the
23331 relevant @samp{__v850*__} preprocessor constant is defined.
23332
23333 The preprocessor constants @code{__v850} and @code{__v851__} are always
23334 defined, regardless of which processor variant is the target.
23335
23336 @item -mdisable-callt
23337 @itemx -mno-disable-callt
23338 @opindex mdisable-callt
23339 @opindex mno-disable-callt
23340 This option suppresses generation of the @code{CALLT} instruction for the
23341 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
23342 architecture.
23343
23344 This option is enabled by default when the RH850 ABI is
23345 in use (see @option{-mrh850-abi}), and disabled by default when the
23346 GCC ABI is in use. If @code{CALLT} instructions are being generated
23347 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
23348
23349 @item -mrelax
23350 @itemx -mno-relax
23351 @opindex mrelax
23352 @opindex mno-relax
23353 Pass on (or do not pass on) the @option{-mrelax} command-line option
23354 to the assembler.
23355
23356 @item -mlong-jumps
23357 @itemx -mno-long-jumps
23358 @opindex mlong-jumps
23359 @opindex mno-long-jumps
23360 Disable (or re-enable) the generation of PC-relative jump instructions.
23361
23362 @item -msoft-float
23363 @itemx -mhard-float
23364 @opindex msoft-float
23365 @opindex mhard-float
23366 Disable (or re-enable) the generation of hardware floating point
23367 instructions. This option is only significant when the target
23368 architecture is @samp{V850E2V3} or higher. If hardware floating point
23369 instructions are being generated then the C preprocessor symbol
23370 @code{__FPU_OK__} is defined, otherwise the symbol
23371 @code{__NO_FPU__} is defined.
23372
23373 @item -mloop
23374 @opindex mloop
23375 Enables the use of the e3v5 LOOP instruction. The use of this
23376 instruction is not enabled by default when the e3v5 architecture is
23377 selected because its use is still experimental.
23378
23379 @item -mrh850-abi
23380 @itemx -mghs
23381 @opindex mrh850-abi
23382 @opindex mghs
23383 Enables support for the RH850 version of the V850 ABI. This is the
23384 default. With this version of the ABI the following rules apply:
23385
23386 @itemize
23387 @item
23388 Integer sized structures and unions are returned via a memory pointer
23389 rather than a register.
23390
23391 @item
23392 Large structures and unions (more than 8 bytes in size) are passed by
23393 value.
23394
23395 @item
23396 Functions are aligned to 16-bit boundaries.
23397
23398 @item
23399 The @option{-m8byte-align} command-line option is supported.
23400
23401 @item
23402 The @option{-mdisable-callt} command-line option is enabled by
23403 default. The @option{-mno-disable-callt} command-line option is not
23404 supported.
23405 @end itemize
23406
23407 When this version of the ABI is enabled the C preprocessor symbol
23408 @code{__V850_RH850_ABI__} is defined.
23409
23410 @item -mgcc-abi
23411 @opindex mgcc-abi
23412 Enables support for the old GCC version of the V850 ABI. With this
23413 version of the ABI the following rules apply:
23414
23415 @itemize
23416 @item
23417 Integer sized structures and unions are returned in register @code{r10}.
23418
23419 @item
23420 Large structures and unions (more than 8 bytes in size) are passed by
23421 reference.
23422
23423 @item
23424 Functions are aligned to 32-bit boundaries, unless optimizing for
23425 size.
23426
23427 @item
23428 The @option{-m8byte-align} command-line option is not supported.
23429
23430 @item
23431 The @option{-mdisable-callt} command-line option is supported but not
23432 enabled by default.
23433 @end itemize
23434
23435 When this version of the ABI is enabled the C preprocessor symbol
23436 @code{__V850_GCC_ABI__} is defined.
23437
23438 @item -m8byte-align
23439 @itemx -mno-8byte-align
23440 @opindex m8byte-align
23441 @opindex mno-8byte-align
23442 Enables support for @code{double} and @code{long long} types to be
23443 aligned on 8-byte boundaries. The default is to restrict the
23444 alignment of all objects to at most 4-bytes. When
23445 @option{-m8byte-align} is in effect the C preprocessor symbol
23446 @code{__V850_8BYTE_ALIGN__} is defined.
23447
23448 @item -mbig-switch
23449 @opindex mbig-switch
23450 Generate code suitable for big switch tables. Use this option only if
23451 the assembler/linker complain about out of range branches within a switch
23452 table.
23453
23454 @item -mapp-regs
23455 @opindex mapp-regs
23456 This option causes r2 and r5 to be used in the code generated by
23457 the compiler. This setting is the default.
23458
23459 @item -mno-app-regs
23460 @opindex mno-app-regs
23461 This option causes r2 and r5 to be treated as fixed registers.
23462
23463 @end table
23464
23465 @node VAX Options
23466 @subsection VAX Options
23467 @cindex VAX options
23468
23469 These @samp{-m} options are defined for the VAX:
23470
23471 @table @gcctabopt
23472 @item -munix
23473 @opindex munix
23474 Do not output certain jump instructions (@code{aobleq} and so on)
23475 that the Unix assembler for the VAX cannot handle across long
23476 ranges.
23477
23478 @item -mgnu
23479 @opindex mgnu
23480 Do output those jump instructions, on the assumption that the
23481 GNU assembler is being used.
23482
23483 @item -mg
23484 @opindex mg
23485 Output code for G-format floating-point numbers instead of D-format.
23486 @end table
23487
23488 @node Visium Options
23489 @subsection Visium Options
23490 @cindex Visium options
23491
23492 @table @gcctabopt
23493
23494 @item -mdebug
23495 @opindex mdebug
23496 A program which performs file I/O and is destined to run on an MCM target
23497 should be linked with this option. It causes the libraries libc.a and
23498 libdebug.a to be linked. The program should be run on the target under
23499 the control of the GDB remote debugging stub.
23500
23501 @item -msim
23502 @opindex msim
23503 A program which performs file I/O and is destined to run on the simulator
23504 should be linked with option. This causes libraries libc.a and libsim.a to
23505 be linked.
23506
23507 @item -mfpu
23508 @itemx -mhard-float
23509 @opindex mfpu
23510 @opindex mhard-float
23511 Generate code containing floating-point instructions. This is the
23512 default.
23513
23514 @item -mno-fpu
23515 @itemx -msoft-float
23516 @opindex mno-fpu
23517 @opindex msoft-float
23518 Generate code containing library calls for floating-point.
23519
23520 @option{-msoft-float} changes the calling convention in the output file;
23521 therefore, it is only useful if you compile @emph{all} of a program with
23522 this option. In particular, you need to compile @file{libgcc.a}, the
23523 library that comes with GCC, with @option{-msoft-float} in order for
23524 this to work.
23525
23526 @item -mcpu=@var{cpu_type}
23527 @opindex mcpu
23528 Set the instruction set, register set, and instruction scheduling parameters
23529 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23530 @samp{mcm}, @samp{gr5} and @samp{gr6}.
23531
23532 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
23533
23534 By default (unless configured otherwise), GCC generates code for the GR5
23535 variant of the Visium architecture.
23536
23537 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
23538 architecture. The only difference from GR5 code is that the compiler will
23539 generate block move instructions.
23540
23541 @item -mtune=@var{cpu_type}
23542 @opindex mtune
23543 Set the instruction scheduling parameters for machine type @var{cpu_type},
23544 but do not set the instruction set or register set that the option
23545 @option{-mcpu=@var{cpu_type}} would.
23546
23547 @item -msv-mode
23548 @opindex msv-mode
23549 Generate code for the supervisor mode, where there are no restrictions on
23550 the access to general registers. This is the default.
23551
23552 @item -muser-mode
23553 @opindex muser-mode
23554 Generate code for the user mode, where the access to some general registers
23555 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
23556 mode; on the GR6, only registers r29 to r31 are affected.
23557 @end table
23558
23559 @node VMS Options
23560 @subsection VMS Options
23561
23562 These @samp{-m} options are defined for the VMS implementations:
23563
23564 @table @gcctabopt
23565 @item -mvms-return-codes
23566 @opindex mvms-return-codes
23567 Return VMS condition codes from @code{main}. The default is to return POSIX-style
23568 condition (e.g.@ error) codes.
23569
23570 @item -mdebug-main=@var{prefix}
23571 @opindex mdebug-main=@var{prefix}
23572 Flag the first routine whose name starts with @var{prefix} as the main
23573 routine for the debugger.
23574
23575 @item -mmalloc64
23576 @opindex mmalloc64
23577 Default to 64-bit memory allocation routines.
23578
23579 @item -mpointer-size=@var{size}
23580 @opindex mpointer-size=@var{size}
23581 Set the default size of pointers. Possible options for @var{size} are
23582 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
23583 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
23584 The later option disables @code{pragma pointer_size}.
23585 @end table
23586
23587 @node VxWorks Options
23588 @subsection VxWorks Options
23589 @cindex VxWorks Options
23590
23591 The options in this section are defined for all VxWorks targets.
23592 Options specific to the target hardware are listed with the other
23593 options for that target.
23594
23595 @table @gcctabopt
23596 @item -mrtp
23597 @opindex mrtp
23598 GCC can generate code for both VxWorks kernels and real time processes
23599 (RTPs). This option switches from the former to the latter. It also
23600 defines the preprocessor macro @code{__RTP__}.
23601
23602 @item -non-static
23603 @opindex non-static
23604 Link an RTP executable against shared libraries rather than static
23605 libraries. The options @option{-static} and @option{-shared} can
23606 also be used for RTPs (@pxref{Link Options}); @option{-static}
23607 is the default.
23608
23609 @item -Bstatic
23610 @itemx -Bdynamic
23611 @opindex Bstatic
23612 @opindex Bdynamic
23613 These options are passed down to the linker. They are defined for
23614 compatibility with Diab.
23615
23616 @item -Xbind-lazy
23617 @opindex Xbind-lazy
23618 Enable lazy binding of function calls. This option is equivalent to
23619 @option{-Wl,-z,now} and is defined for compatibility with Diab.
23620
23621 @item -Xbind-now
23622 @opindex Xbind-now
23623 Disable lazy binding of function calls. This option is the default and
23624 is defined for compatibility with Diab.
23625 @end table
23626
23627 @node x86 Options
23628 @subsection x86 Options
23629 @cindex x86 Options
23630
23631 These @samp{-m} options are defined for the x86 family of computers.
23632
23633 @table @gcctabopt
23634
23635 @item -march=@var{cpu-type}
23636 @opindex march
23637 Generate instructions for the machine type @var{cpu-type}. In contrast to
23638 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
23639 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
23640 to generate code that may not run at all on processors other than the one
23641 indicated. Specifying @option{-march=@var{cpu-type}} implies
23642 @option{-mtune=@var{cpu-type}}.
23643
23644 The choices for @var{cpu-type} are:
23645
23646 @table @samp
23647 @item native
23648 This selects the CPU to generate code for at compilation time by determining
23649 the processor type of the compiling machine. Using @option{-march=native}
23650 enables all instruction subsets supported by the local machine (hence
23651 the result might not run on different machines). Using @option{-mtune=native}
23652 produces code optimized for the local machine under the constraints
23653 of the selected instruction set.
23654
23655 @item i386
23656 Original Intel i386 CPU@.
23657
23658 @item i486
23659 Intel i486 CPU@. (No scheduling is implemented for this chip.)
23660
23661 @item i586
23662 @itemx pentium
23663 Intel Pentium CPU with no MMX support.
23664
23665 @item lakemont
23666 Intel Lakemont MCU, based on Intel Pentium CPU.
23667
23668 @item pentium-mmx
23669 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
23670
23671 @item pentiumpro
23672 Intel Pentium Pro CPU@.
23673
23674 @item i686
23675 When used with @option{-march}, the Pentium Pro
23676 instruction set is used, so the code runs on all i686 family chips.
23677 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
23678
23679 @item pentium2
23680 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
23681 support.
23682
23683 @item pentium3
23684 @itemx pentium3m
23685 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
23686 set support.
23687
23688 @item pentium-m
23689 Intel Pentium M; low-power version of Intel Pentium III CPU
23690 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
23691
23692 @item pentium4
23693 @itemx pentium4m
23694 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
23695
23696 @item prescott
23697 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
23698 set support.
23699
23700 @item nocona
23701 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
23702 SSE2 and SSE3 instruction set support.
23703
23704 @item core2
23705 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
23706 instruction set support.
23707
23708 @item nehalem
23709 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23710 SSE4.1, SSE4.2 and POPCNT instruction set support.
23711
23712 @item westmere
23713 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23714 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
23715
23716 @item sandybridge
23717 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23718 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
23719
23720 @item ivybridge
23721 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23722 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
23723 instruction set support.
23724
23725 @item haswell
23726 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23727 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23728 BMI, BMI2 and F16C instruction set support.
23729
23730 @item broadwell
23731 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23732 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23733 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
23734
23735 @item skylake
23736 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23737 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23738 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
23739 XSAVES instruction set support.
23740
23741 @item bonnell
23742 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
23743 instruction set support.
23744
23745 @item silvermont
23746 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23747 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
23748
23749 @item knl
23750 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23751 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23752 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
23753 AVX512CD instruction set support.
23754
23755 @item skylake-avx512
23756 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23757 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23758 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
23759 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
23760
23761 @item k6
23762 AMD K6 CPU with MMX instruction set support.
23763
23764 @item k6-2
23765 @itemx k6-3
23766 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
23767
23768 @item athlon
23769 @itemx athlon-tbird
23770 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
23771 support.
23772
23773 @item athlon-4
23774 @itemx athlon-xp
23775 @itemx athlon-mp
23776 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
23777 instruction set support.
23778
23779 @item k8
23780 @itemx opteron
23781 @itemx athlon64
23782 @itemx athlon-fx
23783 Processors based on the AMD K8 core with x86-64 instruction set support,
23784 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
23785 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
23786 instruction set extensions.)
23787
23788 @item k8-sse3
23789 @itemx opteron-sse3
23790 @itemx athlon64-sse3
23791 Improved versions of AMD K8 cores with SSE3 instruction set support.
23792
23793 @item amdfam10
23794 @itemx barcelona
23795 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
23796 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
23797 instruction set extensions.)
23798
23799 @item bdver1
23800 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
23801 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
23802 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
23803 @item bdver2
23804 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23805 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
23806 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
23807 extensions.)
23808 @item bdver3
23809 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23810 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
23811 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
23812 64-bit instruction set extensions.
23813 @item bdver4
23814 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23815 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
23816 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
23817 SSE4.2, ABM and 64-bit instruction set extensions.
23818
23819 @item znver1
23820 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
23821 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
23822 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
23823 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
23824 instruction set extensions.
23825
23826 @item btver1
23827 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
23828 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
23829 instruction set extensions.)
23830
23831 @item btver2
23832 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
23833 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
23834 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
23835
23836 @item winchip-c6
23837 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
23838 set support.
23839
23840 @item winchip2
23841 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
23842 instruction set support.
23843
23844 @item c3
23845 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
23846 (No scheduling is implemented for this chip.)
23847
23848 @item c3-2
23849 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
23850 (No scheduling is implemented for this chip.)
23851
23852 @item c7
23853 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
23854 (No scheduling is implemented for this chip.)
23855
23856 @item samuel-2
23857 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
23858 (No scheduling is implemented for this chip.)
23859
23860 @item nehemiah
23861 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
23862 (No scheduling is implemented for this chip.)
23863
23864 @item esther
23865 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
23866 (No scheduling is implemented for this chip.)
23867
23868 @item eden-x2
23869 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
23870 (No scheduling is implemented for this chip.)
23871
23872 @item eden-x4
23873 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
23874 AVX and AVX2 instruction set support.
23875 (No scheduling is implemented for this chip.)
23876
23877 @item nano
23878 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23879 instruction set support.
23880 (No scheduling is implemented for this chip.)
23881
23882 @item nano-1000
23883 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23884 instruction set support.
23885 (No scheduling is implemented for this chip.)
23886
23887 @item nano-2000
23888 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23889 instruction set support.
23890 (No scheduling is implemented for this chip.)
23891
23892 @item nano-3000
23893 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23894 instruction set support.
23895 (No scheduling is implemented for this chip.)
23896
23897 @item nano-x2
23898 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23899 instruction set support.
23900 (No scheduling is implemented for this chip.)
23901
23902 @item nano-x4
23903 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23904 instruction set support.
23905 (No scheduling is implemented for this chip.)
23906
23907 @item geode
23908 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
23909 @end table
23910
23911 @item -mtune=@var{cpu-type}
23912 @opindex mtune
23913 Tune to @var{cpu-type} everything applicable about the generated code, except
23914 for the ABI and the set of available instructions.
23915 While picking a specific @var{cpu-type} schedules things appropriately
23916 for that particular chip, the compiler does not generate any code that
23917 cannot run on the default machine type unless you use a
23918 @option{-march=@var{cpu-type}} option.
23919 For example, if GCC is configured for i686-pc-linux-gnu
23920 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
23921 but still runs on i686 machines.
23922
23923 The choices for @var{cpu-type} are the same as for @option{-march}.
23924 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
23925
23926 @table @samp
23927 @item generic
23928 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
23929 If you know the CPU on which your code will run, then you should use
23930 the corresponding @option{-mtune} or @option{-march} option instead of
23931 @option{-mtune=generic}. But, if you do not know exactly what CPU users
23932 of your application will have, then you should use this option.
23933
23934 As new processors are deployed in the marketplace, the behavior of this
23935 option will change. Therefore, if you upgrade to a newer version of
23936 GCC, code generation controlled by this option will change to reflect
23937 the processors
23938 that are most common at the time that version of GCC is released.
23939
23940 There is no @option{-march=generic} option because @option{-march}
23941 indicates the instruction set the compiler can use, and there is no
23942 generic instruction set applicable to all processors. In contrast,
23943 @option{-mtune} indicates the processor (or, in this case, collection of
23944 processors) for which the code is optimized.
23945
23946 @item intel
23947 Produce code optimized for the most current Intel processors, which are
23948 Haswell and Silvermont for this version of GCC. If you know the CPU
23949 on which your code will run, then you should use the corresponding
23950 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
23951 But, if you want your application performs better on both Haswell and
23952 Silvermont, then you should use this option.
23953
23954 As new Intel processors are deployed in the marketplace, the behavior of
23955 this option will change. Therefore, if you upgrade to a newer version of
23956 GCC, code generation controlled by this option will change to reflect
23957 the most current Intel processors at the time that version of GCC is
23958 released.
23959
23960 There is no @option{-march=intel} option because @option{-march} indicates
23961 the instruction set the compiler can use, and there is no common
23962 instruction set applicable to all processors. In contrast,
23963 @option{-mtune} indicates the processor (or, in this case, collection of
23964 processors) for which the code is optimized.
23965 @end table
23966
23967 @item -mcpu=@var{cpu-type}
23968 @opindex mcpu
23969 A deprecated synonym for @option{-mtune}.
23970
23971 @item -mfpmath=@var{unit}
23972 @opindex mfpmath
23973 Generate floating-point arithmetic for selected unit @var{unit}. The choices
23974 for @var{unit} are:
23975
23976 @table @samp
23977 @item 387
23978 Use the standard 387 floating-point coprocessor present on the majority of chips and
23979 emulated otherwise. Code compiled with this option runs almost everywhere.
23980 The temporary results are computed in 80-bit precision instead of the precision
23981 specified by the type, resulting in slightly different results compared to most
23982 of other chips. See @option{-ffloat-store} for more detailed description.
23983
23984 This is the default choice for x86-32 targets.
23985
23986 @item sse
23987 Use scalar floating-point instructions present in the SSE instruction set.
23988 This instruction set is supported by Pentium III and newer chips,
23989 and in the AMD line
23990 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
23991 instruction set supports only single-precision arithmetic, thus the double and
23992 extended-precision arithmetic are still done using 387. A later version, present
23993 only in Pentium 4 and AMD x86-64 chips, supports double-precision
23994 arithmetic too.
23995
23996 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
23997 or @option{-msse2} switches to enable SSE extensions and make this option
23998 effective. For the x86-64 compiler, these extensions are enabled by default.
23999
24000 The resulting code should be considerably faster in the majority of cases and avoid
24001 the numerical instability problems of 387 code, but may break some existing
24002 code that expects temporaries to be 80 bits.
24003
24004 This is the default choice for the x86-64 compiler.
24005
24006 @item sse,387
24007 @itemx sse+387
24008 @itemx both
24009 Attempt to utilize both instruction sets at once. This effectively doubles the
24010 amount of available registers, and on chips with separate execution units for
24011 387 and SSE the execution resources too. Use this option with care, as it is
24012 still experimental, because the GCC register allocator does not model separate
24013 functional units well, resulting in unstable performance.
24014 @end table
24015
24016 @item -masm=@var{dialect}
24017 @opindex masm=@var{dialect}
24018 Output assembly instructions using selected @var{dialect}. Also affects
24019 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
24020 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
24021 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
24022 not support @samp{intel}.
24023
24024 @item -mieee-fp
24025 @itemx -mno-ieee-fp
24026 @opindex mieee-fp
24027 @opindex mno-ieee-fp
24028 Control whether or not the compiler uses IEEE floating-point
24029 comparisons. These correctly handle the case where the result of a
24030 comparison is unordered.
24031
24032 @item -m80387
24033 @item -mhard-float
24034 @opindex 80387
24035 @opindex mhard-float
24036 Generate output containing 80387 instructions for floating point.
24037
24038 @item -mno-80387
24039 @item -msoft-float
24040 @opindex no-80387
24041 @opindex msoft-float
24042 Generate output containing library calls for floating point.
24043
24044 @strong{Warning:} the requisite libraries are not part of GCC@.
24045 Normally the facilities of the machine's usual C compiler are used, but
24046 this can't be done directly in cross-compilation. You must make your
24047 own arrangements to provide suitable library functions for
24048 cross-compilation.
24049
24050 On machines where a function returns floating-point results in the 80387
24051 register stack, some floating-point opcodes may be emitted even if
24052 @option{-msoft-float} is used.
24053
24054 @item -mno-fp-ret-in-387
24055 @opindex mno-fp-ret-in-387
24056 Do not use the FPU registers for return values of functions.
24057
24058 The usual calling convention has functions return values of types
24059 @code{float} and @code{double} in an FPU register, even if there
24060 is no FPU@. The idea is that the operating system should emulate
24061 an FPU@.
24062
24063 The option @option{-mno-fp-ret-in-387} causes such values to be returned
24064 in ordinary CPU registers instead.
24065
24066 @item -mno-fancy-math-387
24067 @opindex mno-fancy-math-387
24068 Some 387 emulators do not support the @code{sin}, @code{cos} and
24069 @code{sqrt} instructions for the 387. Specify this option to avoid
24070 generating those instructions. This option is the default on
24071 OpenBSD and NetBSD@. This option is overridden when @option{-march}
24072 indicates that the target CPU always has an FPU and so the
24073 instruction does not need emulation. These
24074 instructions are not generated unless you also use the
24075 @option{-funsafe-math-optimizations} switch.
24076
24077 @item -malign-double
24078 @itemx -mno-align-double
24079 @opindex malign-double
24080 @opindex mno-align-double
24081 Control whether GCC aligns @code{double}, @code{long double}, and
24082 @code{long long} variables on a two-word boundary or a one-word
24083 boundary. Aligning @code{double} variables on a two-word boundary
24084 produces code that runs somewhat faster on a Pentium at the
24085 expense of more memory.
24086
24087 On x86-64, @option{-malign-double} is enabled by default.
24088
24089 @strong{Warning:} if you use the @option{-malign-double} switch,
24090 structures containing the above types are aligned differently than
24091 the published application binary interface specifications for the x86-32
24092 and are not binary compatible with structures in code compiled
24093 without that switch.
24094
24095 @item -m96bit-long-double
24096 @itemx -m128bit-long-double
24097 @opindex m96bit-long-double
24098 @opindex m128bit-long-double
24099 These switches control the size of @code{long double} type. The x86-32
24100 application binary interface specifies the size to be 96 bits,
24101 so @option{-m96bit-long-double} is the default in 32-bit mode.
24102
24103 Modern architectures (Pentium and newer) prefer @code{long double}
24104 to be aligned to an 8- or 16-byte boundary. In arrays or structures
24105 conforming to the ABI, this is not possible. So specifying
24106 @option{-m128bit-long-double} aligns @code{long double}
24107 to a 16-byte boundary by padding the @code{long double} with an additional
24108 32-bit zero.
24109
24110 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
24111 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
24112
24113 Notice that neither of these options enable any extra precision over the x87
24114 standard of 80 bits for a @code{long double}.
24115
24116 @strong{Warning:} if you override the default value for your target ABI, this
24117 changes the size of
24118 structures and arrays containing @code{long double} variables,
24119 as well as modifying the function calling convention for functions taking
24120 @code{long double}. Hence they are not binary-compatible
24121 with code compiled without that switch.
24122
24123 @item -mlong-double-64
24124 @itemx -mlong-double-80
24125 @itemx -mlong-double-128
24126 @opindex mlong-double-64
24127 @opindex mlong-double-80
24128 @opindex mlong-double-128
24129 These switches control the size of @code{long double} type. A size
24130 of 64 bits makes the @code{long double} type equivalent to the @code{double}
24131 type. This is the default for 32-bit Bionic C library. A size
24132 of 128 bits makes the @code{long double} type equivalent to the
24133 @code{__float128} type. This is the default for 64-bit Bionic C library.
24134
24135 @strong{Warning:} if you override the default value for your target ABI, this
24136 changes the size of
24137 structures and arrays containing @code{long double} variables,
24138 as well as modifying the function calling convention for functions taking
24139 @code{long double}. Hence they are not binary-compatible
24140 with code compiled without that switch.
24141
24142 @item -malign-data=@var{type}
24143 @opindex malign-data
24144 Control how GCC aligns variables. Supported values for @var{type} are
24145 @samp{compat} uses increased alignment value compatible uses GCC 4.8
24146 and earlier, @samp{abi} uses alignment value as specified by the
24147 psABI, and @samp{cacheline} uses increased alignment value to match
24148 the cache line size. @samp{compat} is the default.
24149
24150 @item -mlarge-data-threshold=@var{threshold}
24151 @opindex mlarge-data-threshold
24152 When @option{-mcmodel=medium} is specified, data objects larger than
24153 @var{threshold} are placed in the large data section. This value must be the
24154 same across all objects linked into the binary, and defaults to 65535.
24155
24156 @item -mrtd
24157 @opindex mrtd
24158 Use a different function-calling convention, in which functions that
24159 take a fixed number of arguments return with the @code{ret @var{num}}
24160 instruction, which pops their arguments while returning. This saves one
24161 instruction in the caller since there is no need to pop the arguments
24162 there.
24163
24164 You can specify that an individual function is called with this calling
24165 sequence with the function attribute @code{stdcall}. You can also
24166 override the @option{-mrtd} option by using the function attribute
24167 @code{cdecl}. @xref{Function Attributes}.
24168
24169 @strong{Warning:} this calling convention is incompatible with the one
24170 normally used on Unix, so you cannot use it if you need to call
24171 libraries compiled with the Unix compiler.
24172
24173 Also, you must provide function prototypes for all functions that
24174 take variable numbers of arguments (including @code{printf});
24175 otherwise incorrect code is generated for calls to those
24176 functions.
24177
24178 In addition, seriously incorrect code results if you call a
24179 function with too many arguments. (Normally, extra arguments are
24180 harmlessly ignored.)
24181
24182 @item -mregparm=@var{num}
24183 @opindex mregparm
24184 Control how many registers are used to pass integer arguments. By
24185 default, no registers are used to pass arguments, and at most 3
24186 registers can be used. You can control this behavior for a specific
24187 function by using the function attribute @code{regparm}.
24188 @xref{Function Attributes}.
24189
24190 @strong{Warning:} if you use this switch, and
24191 @var{num} is nonzero, then you must build all modules with the same
24192 value, including any libraries. This includes the system libraries and
24193 startup modules.
24194
24195 @item -msseregparm
24196 @opindex msseregparm
24197 Use SSE register passing conventions for float and double arguments
24198 and return values. You can control this behavior for a specific
24199 function by using the function attribute @code{sseregparm}.
24200 @xref{Function Attributes}.
24201
24202 @strong{Warning:} if you use this switch then you must build all
24203 modules with the same value, including any libraries. This includes
24204 the system libraries and startup modules.
24205
24206 @item -mvect8-ret-in-mem
24207 @opindex mvect8-ret-in-mem
24208 Return 8-byte vectors in memory instead of MMX registers. This is the
24209 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
24210 Studio compilers until version 12. Later compiler versions (starting
24211 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
24212 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
24213 you need to remain compatible with existing code produced by those
24214 previous compiler versions or older versions of GCC@.
24215
24216 @item -mpc32
24217 @itemx -mpc64
24218 @itemx -mpc80
24219 @opindex mpc32
24220 @opindex mpc64
24221 @opindex mpc80
24222
24223 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
24224 is specified, the significands of results of floating-point operations are
24225 rounded to 24 bits (single precision); @option{-mpc64} rounds the
24226 significands of results of floating-point operations to 53 bits (double
24227 precision) and @option{-mpc80} rounds the significands of results of
24228 floating-point operations to 64 bits (extended double precision), which is
24229 the default. When this option is used, floating-point operations in higher
24230 precisions are not available to the programmer without setting the FPU
24231 control word explicitly.
24232
24233 Setting the rounding of floating-point operations to less than the default
24234 80 bits can speed some programs by 2% or more. Note that some mathematical
24235 libraries assume that extended-precision (80-bit) floating-point operations
24236 are enabled by default; routines in such libraries could suffer significant
24237 loss of accuracy, typically through so-called ``catastrophic cancellation'',
24238 when this option is used to set the precision to less than extended precision.
24239
24240 @item -mstackrealign
24241 @opindex mstackrealign
24242 Realign the stack at entry. On the x86, the @option{-mstackrealign}
24243 option generates an alternate prologue and epilogue that realigns the
24244 run-time stack if necessary. This supports mixing legacy codes that keep
24245 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
24246 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
24247 applicable to individual functions.
24248
24249 @item -mpreferred-stack-boundary=@var{num}
24250 @opindex mpreferred-stack-boundary
24251 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24252 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24253 the default is 4 (16 bytes or 128 bits).
24254
24255 @strong{Warning:} When generating code for the x86-64 architecture with
24256 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
24257 used to keep the stack boundary aligned to 8 byte boundary. Since
24258 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
24259 intended to be used in controlled environment where stack space is
24260 important limitation. This option leads to wrong code when functions
24261 compiled with 16 byte stack alignment (such as functions from a standard
24262 library) are called with misaligned stack. In this case, SSE
24263 instructions may lead to misaligned memory access traps. In addition,
24264 variable arguments are handled incorrectly for 16 byte aligned
24265 objects (including x87 long double and __int128), leading to wrong
24266 results. You must build all modules with
24267 @option{-mpreferred-stack-boundary=3}, including any libraries. This
24268 includes the system libraries and startup modules.
24269
24270 @item -mincoming-stack-boundary=@var{num}
24271 @opindex mincoming-stack-boundary
24272 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
24273 boundary. If @option{-mincoming-stack-boundary} is not specified,
24274 the one specified by @option{-mpreferred-stack-boundary} is used.
24275
24276 On Pentium and Pentium Pro, @code{double} and @code{long double} values
24277 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
24278 suffer significant run time performance penalties. On Pentium III, the
24279 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
24280 properly if it is not 16-byte aligned.
24281
24282 To ensure proper alignment of this values on the stack, the stack boundary
24283 must be as aligned as that required by any value stored on the stack.
24284 Further, every function must be generated such that it keeps the stack
24285 aligned. Thus calling a function compiled with a higher preferred
24286 stack boundary from a function compiled with a lower preferred stack
24287 boundary most likely misaligns the stack. It is recommended that
24288 libraries that use callbacks always use the default setting.
24289
24290 This extra alignment does consume extra stack space, and generally
24291 increases code size. Code that is sensitive to stack space usage, such
24292 as embedded systems and operating system kernels, may want to reduce the
24293 preferred alignment to @option{-mpreferred-stack-boundary=2}.
24294
24295 @need 200
24296 @item -mmmx
24297 @opindex mmmx
24298 @need 200
24299 @itemx -msse
24300 @opindex msse
24301 @need 200
24302 @itemx -msse2
24303 @opindex msse2
24304 @need 200
24305 @itemx -msse3
24306 @opindex msse3
24307 @need 200
24308 @itemx -mssse3
24309 @opindex mssse3
24310 @need 200
24311 @itemx -msse4
24312 @opindex msse4
24313 @need 200
24314 @itemx -msse4a
24315 @opindex msse4a
24316 @need 200
24317 @itemx -msse4.1
24318 @opindex msse4.1
24319 @need 200
24320 @itemx -msse4.2
24321 @opindex msse4.2
24322 @need 200
24323 @itemx -mavx
24324 @opindex mavx
24325 @need 200
24326 @itemx -mavx2
24327 @opindex mavx2
24328 @need 200
24329 @itemx -mavx512f
24330 @opindex mavx512f
24331 @need 200
24332 @itemx -mavx512pf
24333 @opindex mavx512pf
24334 @need 200
24335 @itemx -mavx512er
24336 @opindex mavx512er
24337 @need 200
24338 @itemx -mavx512cd
24339 @opindex mavx512cd
24340 @need 200
24341 @itemx -mavx512vl
24342 @opindex mavx512vl
24343 @need 200
24344 @itemx -mavx512bw
24345 @opindex mavx512bw
24346 @need 200
24347 @itemx -mavx512dq
24348 @opindex mavx512dq
24349 @need 200
24350 @itemx -mavx512ifma
24351 @opindex mavx512ifma
24352 @need 200
24353 @itemx -mavx512vbmi
24354 @opindex mavx512vbmi
24355 @need 200
24356 @itemx -msha
24357 @opindex msha
24358 @need 200
24359 @itemx -maes
24360 @opindex maes
24361 @need 200
24362 @itemx -mpclmul
24363 @opindex mpclmul
24364 @need 200
24365 @itemx -mclfushopt
24366 @opindex mclfushopt
24367 @need 200
24368 @itemx -mfsgsbase
24369 @opindex mfsgsbase
24370 @need 200
24371 @itemx -mrdrnd
24372 @opindex mrdrnd
24373 @need 200
24374 @itemx -mf16c
24375 @opindex mf16c
24376 @need 200
24377 @itemx -mfma
24378 @opindex mfma
24379 @need 200
24380 @itemx -mfma4
24381 @opindex mfma4
24382 @need 200
24383 @itemx -mprefetchwt1
24384 @opindex mprefetchwt1
24385 @need 200
24386 @itemx -mxop
24387 @opindex mxop
24388 @need 200
24389 @itemx -mlwp
24390 @opindex mlwp
24391 @need 200
24392 @itemx -m3dnow
24393 @opindex m3dnow
24394 @need 200
24395 @itemx -mpopcnt
24396 @opindex mpopcnt
24397 @need 200
24398 @itemx -mabm
24399 @opindex mabm
24400 @need 200
24401 @itemx -mbmi
24402 @opindex mbmi
24403 @need 200
24404 @itemx -mbmi2
24405 @need 200
24406 @itemx -mlzcnt
24407 @opindex mlzcnt
24408 @need 200
24409 @itemx -mfxsr
24410 @opindex mfxsr
24411 @need 200
24412 @itemx -mxsave
24413 @opindex mxsave
24414 @need 200
24415 @itemx -mxsaveopt
24416 @opindex mxsaveopt
24417 @need 200
24418 @itemx -mxsavec
24419 @opindex mxsavec
24420 @need 200
24421 @itemx -mxsaves
24422 @opindex mxsaves
24423 @need 200
24424 @itemx -mrtm
24425 @opindex mrtm
24426 @need 200
24427 @itemx -mtbm
24428 @opindex mtbm
24429 @need 200
24430 @itemx -mmpx
24431 @opindex mmpx
24432 @need 200
24433 @itemx -mmwaitx
24434 @opindex mmwaitx
24435 @need 200
24436 @itemx -mclzero
24437 @opindex mclzero
24438 @itemx -mpku
24439 @opindex mpku
24440 These switches enable the use of instructions in the MMX, SSE,
24441 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
24442 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
24443 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
24444 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU or 3DNow!@:
24445 extended instruction sets. Each has a corresponding @option{-mno-} option
24446 to disable use of these instructions.
24447
24448 These extensions are also available as built-in functions: see
24449 @ref{x86 Built-in Functions}, for details of the functions enabled and
24450 disabled by these switches.
24451
24452 To generate SSE/SSE2 instructions automatically from floating-point
24453 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
24454
24455 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
24456 generates new AVX instructions or AVX equivalence for all SSEx instructions
24457 when needed.
24458
24459 These options enable GCC to use these extended instructions in
24460 generated code, even without @option{-mfpmath=sse}. Applications that
24461 perform run-time CPU detection must compile separate files for each
24462 supported architecture, using the appropriate flags. In particular,
24463 the file containing the CPU detection code should be compiled without
24464 these options.
24465
24466 @item -mdump-tune-features
24467 @opindex mdump-tune-features
24468 This option instructs GCC to dump the names of the x86 performance
24469 tuning features and default settings. The names can be used in
24470 @option{-mtune-ctrl=@var{feature-list}}.
24471
24472 @item -mtune-ctrl=@var{feature-list}
24473 @opindex mtune-ctrl=@var{feature-list}
24474 This option is used to do fine grain control of x86 code generation features.
24475 @var{feature-list} is a comma separated list of @var{feature} names. See also
24476 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
24477 on if it is not preceded with @samp{^}, otherwise, it is turned off.
24478 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
24479 developers. Using it may lead to code paths not covered by testing and can
24480 potentially result in compiler ICEs or runtime errors.
24481
24482 @item -mno-default
24483 @opindex mno-default
24484 This option instructs GCC to turn off all tunable features. See also
24485 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
24486
24487 @item -mcld
24488 @opindex mcld
24489 This option instructs GCC to emit a @code{cld} instruction in the prologue
24490 of functions that use string instructions. String instructions depend on
24491 the DF flag to select between autoincrement or autodecrement mode. While the
24492 ABI specifies the DF flag to be cleared on function entry, some operating
24493 systems violate this specification by not clearing the DF flag in their
24494 exception dispatchers. The exception handler can be invoked with the DF flag
24495 set, which leads to wrong direction mode when string instructions are used.
24496 This option can be enabled by default on 32-bit x86 targets by configuring
24497 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
24498 instructions can be suppressed with the @option{-mno-cld} compiler option
24499 in this case.
24500
24501 @item -mvzeroupper
24502 @opindex mvzeroupper
24503 This option instructs GCC to emit a @code{vzeroupper} instruction
24504 before a transfer of control flow out of the function to minimize
24505 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
24506 intrinsics.
24507
24508 @item -mprefer-avx128
24509 @opindex mprefer-avx128
24510 This option instructs GCC to use 128-bit AVX instructions instead of
24511 256-bit AVX instructions in the auto-vectorizer.
24512
24513 @item -mcx16
24514 @opindex mcx16
24515 This option enables GCC to generate @code{CMPXCHG16B} instructions.
24516 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
24517 (or oword) data types.
24518 This is useful for high-resolution counters that can be updated
24519 by multiple processors (or cores). This instruction is generated as part of
24520 atomic built-in functions: see @ref{__sync Builtins} or
24521 @ref{__atomic Builtins} for details.
24522
24523 @item -msahf
24524 @opindex msahf
24525 This option enables generation of @code{SAHF} instructions in 64-bit code.
24526 Early Intel Pentium 4 CPUs with Intel 64 support,
24527 prior to the introduction of Pentium 4 G1 step in December 2005,
24528 lacked the @code{LAHF} and @code{SAHF} instructions
24529 which are supported by AMD64.
24530 These are load and store instructions, respectively, for certain status flags.
24531 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
24532 @code{drem}, and @code{remainder} built-in functions;
24533 see @ref{Other Builtins} for details.
24534
24535 @item -mmovbe
24536 @opindex mmovbe
24537 This option enables use of the @code{movbe} instruction to implement
24538 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
24539
24540 @item -mcrc32
24541 @opindex mcrc32
24542 This option enables built-in functions @code{__builtin_ia32_crc32qi},
24543 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
24544 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
24545
24546 @item -mrecip
24547 @opindex mrecip
24548 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
24549 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
24550 with an additional Newton-Raphson step
24551 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
24552 (and their vectorized
24553 variants) for single-precision floating-point arguments. These instructions
24554 are generated only when @option{-funsafe-math-optimizations} is enabled
24555 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
24556 Note that while the throughput of the sequence is higher than the throughput
24557 of the non-reciprocal instruction, the precision of the sequence can be
24558 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
24559
24560 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
24561 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
24562 combination), and doesn't need @option{-mrecip}.
24563
24564 Also note that GCC emits the above sequence with additional Newton-Raphson step
24565 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
24566 already with @option{-ffast-math} (or the above option combination), and
24567 doesn't need @option{-mrecip}.
24568
24569 @item -mrecip=@var{opt}
24570 @opindex mrecip=opt
24571 This option controls which reciprocal estimate instructions
24572 may be used. @var{opt} is a comma-separated list of options, which may
24573 be preceded by a @samp{!} to invert the option:
24574
24575 @table @samp
24576 @item all
24577 Enable all estimate instructions.
24578
24579 @item default
24580 Enable the default instructions, equivalent to @option{-mrecip}.
24581
24582 @item none
24583 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24584
24585 @item div
24586 Enable the approximation for scalar division.
24587
24588 @item vec-div
24589 Enable the approximation for vectorized division.
24590
24591 @item sqrt
24592 Enable the approximation for scalar square root.
24593
24594 @item vec-sqrt
24595 Enable the approximation for vectorized square root.
24596 @end table
24597
24598 So, for example, @option{-mrecip=all,!sqrt} enables
24599 all of the reciprocal approximations, except for square root.
24600
24601 @item -mveclibabi=@var{type}
24602 @opindex mveclibabi
24603 Specifies the ABI type to use for vectorizing intrinsics using an
24604 external library. Supported values for @var{type} are @samp{svml}
24605 for the Intel short
24606 vector math library and @samp{acml} for the AMD math core library.
24607 To use this option, both @option{-ftree-vectorize} and
24608 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
24609 ABI-compatible library must be specified at link time.
24610
24611 GCC currently emits calls to @code{vmldExp2},
24612 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
24613 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
24614 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
24615 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
24616 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
24617 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
24618 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
24619 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
24620 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
24621 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
24622 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
24623 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
24624 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
24625 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
24626 when @option{-mveclibabi=acml} is used.
24627
24628 @item -mabi=@var{name}
24629 @opindex mabi
24630 Generate code for the specified calling convention. Permissible values
24631 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
24632 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
24633 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
24634 You can control this behavior for specific functions by
24635 using the function attributes @code{ms_abi} and @code{sysv_abi}.
24636 @xref{Function Attributes}.
24637
24638 @item -mtls-dialect=@var{type}
24639 @opindex mtls-dialect
24640 Generate code to access thread-local storage using the @samp{gnu} or
24641 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
24642 @samp{gnu2} is more efficient, but it may add compile- and run-time
24643 requirements that cannot be satisfied on all systems.
24644
24645 @item -mpush-args
24646 @itemx -mno-push-args
24647 @opindex mpush-args
24648 @opindex mno-push-args
24649 Use PUSH operations to store outgoing parameters. This method is shorter
24650 and usually equally fast as method using SUB/MOV operations and is enabled
24651 by default. In some cases disabling it may improve performance because of
24652 improved scheduling and reduced dependencies.
24653
24654 @item -maccumulate-outgoing-args
24655 @opindex maccumulate-outgoing-args
24656 If enabled, the maximum amount of space required for outgoing arguments is
24657 computed in the function prologue. This is faster on most modern CPUs
24658 because of reduced dependencies, improved scheduling and reduced stack usage
24659 when the preferred stack boundary is not equal to 2. The drawback is a notable
24660 increase in code size. This switch implies @option{-mno-push-args}.
24661
24662 @item -mthreads
24663 @opindex mthreads
24664 Support thread-safe exception handling on MinGW. Programs that rely
24665 on thread-safe exception handling must compile and link all code with the
24666 @option{-mthreads} option. When compiling, @option{-mthreads} defines
24667 @option{-D_MT}; when linking, it links in a special thread helper library
24668 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
24669
24670 @item -mms-bitfields
24671 @itemx -mno-ms-bitfields
24672 @opindex mms-bitfields
24673 @opindex mno-ms-bitfields
24674
24675 Enable/disable bit-field layout compatible with the native Microsoft
24676 Windows compiler.
24677
24678 If @code{packed} is used on a structure, or if bit-fields are used,
24679 it may be that the Microsoft ABI lays out the structure differently
24680 than the way GCC normally does. Particularly when moving packed
24681 data between functions compiled with GCC and the native Microsoft compiler
24682 (either via function call or as data in a file), it may be necessary to access
24683 either format.
24684
24685 This option is enabled by default for Microsoft Windows
24686 targets. This behavior can also be controlled locally by use of variable
24687 or type attributes. For more information, see @ref{x86 Variable Attributes}
24688 and @ref{x86 Type Attributes}.
24689
24690 The Microsoft structure layout algorithm is fairly simple with the exception
24691 of the bit-field packing.
24692 The padding and alignment of members of structures and whether a bit-field
24693 can straddle a storage-unit boundary are determine by these rules:
24694
24695 @enumerate
24696 @item Structure members are stored sequentially in the order in which they are
24697 declared: the first member has the lowest memory address and the last member
24698 the highest.
24699
24700 @item Every data object has an alignment requirement. The alignment requirement
24701 for all data except structures, unions, and arrays is either the size of the
24702 object or the current packing size (specified with either the
24703 @code{aligned} attribute or the @code{pack} pragma),
24704 whichever is less. For structures, unions, and arrays,
24705 the alignment requirement is the largest alignment requirement of its members.
24706 Every object is allocated an offset so that:
24707
24708 @smallexample
24709 offset % alignment_requirement == 0
24710 @end smallexample
24711
24712 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
24713 unit if the integral types are the same size and if the next bit-field fits
24714 into the current allocation unit without crossing the boundary imposed by the
24715 common alignment requirements of the bit-fields.
24716 @end enumerate
24717
24718 MSVC interprets zero-length bit-fields in the following ways:
24719
24720 @enumerate
24721 @item If a zero-length bit-field is inserted between two bit-fields that
24722 are normally coalesced, the bit-fields are not coalesced.
24723
24724 For example:
24725
24726 @smallexample
24727 struct
24728 @{
24729 unsigned long bf_1 : 12;
24730 unsigned long : 0;
24731 unsigned long bf_2 : 12;
24732 @} t1;
24733 @end smallexample
24734
24735 @noindent
24736 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
24737 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
24738
24739 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
24740 alignment of the zero-length bit-field is greater than the member that follows it,
24741 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
24742
24743 For example:
24744
24745 @smallexample
24746 struct
24747 @{
24748 char foo : 4;
24749 short : 0;
24750 char bar;
24751 @} t2;
24752
24753 struct
24754 @{
24755 char foo : 4;
24756 short : 0;
24757 double bar;
24758 @} t3;
24759 @end smallexample
24760
24761 @noindent
24762 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
24763 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
24764 bit-field does not affect the alignment of @code{bar} or, as a result, the size
24765 of the structure.
24766
24767 Taking this into account, it is important to note the following:
24768
24769 @enumerate
24770 @item If a zero-length bit-field follows a normal bit-field, the type of the
24771 zero-length bit-field may affect the alignment of the structure as whole. For
24772 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
24773 normal bit-field, and is of type short.
24774
24775 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
24776 still affect the alignment of the structure:
24777
24778 @smallexample
24779 struct
24780 @{
24781 char foo : 6;
24782 long : 0;
24783 @} t4;
24784 @end smallexample
24785
24786 @noindent
24787 Here, @code{t4} takes up 4 bytes.
24788 @end enumerate
24789
24790 @item Zero-length bit-fields following non-bit-field members are ignored:
24791
24792 @smallexample
24793 struct
24794 @{
24795 char foo;
24796 long : 0;
24797 char bar;
24798 @} t5;
24799 @end smallexample
24800
24801 @noindent
24802 Here, @code{t5} takes up 2 bytes.
24803 @end enumerate
24804
24805
24806 @item -mno-align-stringops
24807 @opindex mno-align-stringops
24808 Do not align the destination of inlined string operations. This switch reduces
24809 code size and improves performance in case the destination is already aligned,
24810 but GCC doesn't know about it.
24811
24812 @item -minline-all-stringops
24813 @opindex minline-all-stringops
24814 By default GCC inlines string operations only when the destination is
24815 known to be aligned to least a 4-byte boundary.
24816 This enables more inlining and increases code
24817 size, but may improve performance of code that depends on fast
24818 @code{memcpy}, @code{strlen},
24819 and @code{memset} for short lengths.
24820
24821 @item -minline-stringops-dynamically
24822 @opindex minline-stringops-dynamically
24823 For string operations of unknown size, use run-time checks with
24824 inline code for small blocks and a library call for large blocks.
24825
24826 @item -mstringop-strategy=@var{alg}
24827 @opindex mstringop-strategy=@var{alg}
24828 Override the internal decision heuristic for the particular algorithm to use
24829 for inlining string operations. The allowed values for @var{alg} are:
24830
24831 @table @samp
24832 @item rep_byte
24833 @itemx rep_4byte
24834 @itemx rep_8byte
24835 Expand using i386 @code{rep} prefix of the specified size.
24836
24837 @item byte_loop
24838 @itemx loop
24839 @itemx unrolled_loop
24840 Expand into an inline loop.
24841
24842 @item libcall
24843 Always use a library call.
24844 @end table
24845
24846 @item -mmemcpy-strategy=@var{strategy}
24847 @opindex mmemcpy-strategy=@var{strategy}
24848 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
24849 should be inlined and what inline algorithm to use when the expected size
24850 of the copy operation is known. @var{strategy}
24851 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
24852 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
24853 the max byte size with which inline algorithm @var{alg} is allowed. For the last
24854 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
24855 in the list must be specified in increasing order. The minimal byte size for
24856 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
24857 preceding range.
24858
24859 @item -mmemset-strategy=@var{strategy}
24860 @opindex mmemset-strategy=@var{strategy}
24861 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
24862 @code{__builtin_memset} expansion.
24863
24864 @item -momit-leaf-frame-pointer
24865 @opindex momit-leaf-frame-pointer
24866 Don't keep the frame pointer in a register for leaf functions. This
24867 avoids the instructions to save, set up, and restore frame pointers and
24868 makes an extra register available in leaf functions. The option
24869 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
24870 which might make debugging harder.
24871
24872 @item -mtls-direct-seg-refs
24873 @itemx -mno-tls-direct-seg-refs
24874 @opindex mtls-direct-seg-refs
24875 Controls whether TLS variables may be accessed with offsets from the
24876 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
24877 or whether the thread base pointer must be added. Whether or not this
24878 is valid depends on the operating system, and whether it maps the
24879 segment to cover the entire TLS area.
24880
24881 For systems that use the GNU C Library, the default is on.
24882
24883 @item -msse2avx
24884 @itemx -mno-sse2avx
24885 @opindex msse2avx
24886 Specify that the assembler should encode SSE instructions with VEX
24887 prefix. The option @option{-mavx} turns this on by default.
24888
24889 @item -mfentry
24890 @itemx -mno-fentry
24891 @opindex mfentry
24892 If profiling is active (@option{-pg}), put the profiling
24893 counter call before the prologue.
24894 Note: On x86 architectures the attribute @code{ms_hook_prologue}
24895 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
24896
24897 @item -mrecord-mcount
24898 @itemx -mno-record-mcount
24899 @opindex mrecord-mcount
24900 If profiling is active (@option{-pg}), generate a __mcount_loc section
24901 that contains pointers to each profiling call. This is useful for
24902 automatically patching and out calls.
24903
24904 @item -mnop-mcount
24905 @itemx -mno-nop-mcount
24906 @opindex mnop-mcount
24907 If profiling is active (@option{-pg}), generate the calls to
24908 the profiling functions as NOPs. This is useful when they
24909 should be patched in later dynamically. This is likely only
24910 useful together with @option{-mrecord-mcount}.
24911
24912 @item -mskip-rax-setup
24913 @itemx -mno-skip-rax-setup
24914 @opindex mskip-rax-setup
24915 When generating code for the x86-64 architecture with SSE extensions
24916 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
24917 register when there are no variable arguments passed in vector registers.
24918
24919 @strong{Warning:} Since RAX register is used to avoid unnecessarily
24920 saving vector registers on stack when passing variable arguments, the
24921 impacts of this option are callees may waste some stack space,
24922 misbehave or jump to a random location. GCC 4.4 or newer don't have
24923 those issues, regardless the RAX register value.
24924
24925 @item -m8bit-idiv
24926 @itemx -mno-8bit-idiv
24927 @opindex m8bit-idiv
24928 On some processors, like Intel Atom, 8-bit unsigned integer divide is
24929 much faster than 32-bit/64-bit integer divide. This option generates a
24930 run-time check. If both dividend and divisor are within range of 0
24931 to 255, 8-bit unsigned integer divide is used instead of
24932 32-bit/64-bit integer divide.
24933
24934 @item -mavx256-split-unaligned-load
24935 @itemx -mavx256-split-unaligned-store
24936 @opindex mavx256-split-unaligned-load
24937 @opindex mavx256-split-unaligned-store
24938 Split 32-byte AVX unaligned load and store.
24939
24940 @item -mstack-protector-guard=@var{guard}
24941 @opindex mstack-protector-guard=@var{guard}
24942 Generate stack protection code using canary at @var{guard}. Supported
24943 locations are @samp{global} for global canary or @samp{tls} for per-thread
24944 canary in the TLS block (the default). This option has effect only when
24945 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
24946
24947 @item -mmitigate-rop
24948 @opindex mmitigate-rop
24949 Try to avoid generating code sequences that contain unintended return
24950 opcodes, to mitigate against certain forms of attack. At the moment,
24951 this option is limited in what it can do and should not be relied
24952 on to provide serious protection.
24953
24954 @item -mgeneral-regs-only
24955 @opindex mgeneral-regs-only
24956 Generate code that uses only the general-purpose registers. This
24957 prevents the compiler from using floating-point, vector, mask and bound
24958 registers.
24959
24960 @end table
24961
24962 These @samp{-m} switches are supported in addition to the above
24963 on x86-64 processors in 64-bit environments.
24964
24965 @table @gcctabopt
24966 @item -m32
24967 @itemx -m64
24968 @itemx -mx32
24969 @itemx -m16
24970 @itemx -miamcu
24971 @opindex m32
24972 @opindex m64
24973 @opindex mx32
24974 @opindex m16
24975 @opindex miamcu
24976 Generate code for a 16-bit, 32-bit or 64-bit environment.
24977 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
24978 to 32 bits, and
24979 generates code that runs on any i386 system.
24980
24981 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
24982 types to 64 bits, and generates code for the x86-64 architecture.
24983 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
24984 and @option{-mdynamic-no-pic} options.
24985
24986 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
24987 to 32 bits, and
24988 generates code for the x86-64 architecture.
24989
24990 The @option{-m16} option is the same as @option{-m32}, except for that
24991 it outputs the @code{.code16gcc} assembly directive at the beginning of
24992 the assembly output so that the binary can run in 16-bit mode.
24993
24994 The @option{-miamcu} option generates code which conforms to Intel MCU
24995 psABI. It requires the @option{-m32} option to be turned on.
24996
24997 @item -mno-red-zone
24998 @opindex mno-red-zone
24999 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
25000 by the x86-64 ABI; it is a 128-byte area beyond the location of the
25001 stack pointer that is not modified by signal or interrupt handlers
25002 and therefore can be used for temporary data without adjusting the stack
25003 pointer. The flag @option{-mno-red-zone} disables this red zone.
25004
25005 @item -mcmodel=small
25006 @opindex mcmodel=small
25007 Generate code for the small code model: the program and its symbols must
25008 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
25009 Programs can be statically or dynamically linked. This is the default
25010 code model.
25011
25012 @item -mcmodel=kernel
25013 @opindex mcmodel=kernel
25014 Generate code for the kernel code model. The kernel runs in the
25015 negative 2 GB of the address space.
25016 This model has to be used for Linux kernel code.
25017
25018 @item -mcmodel=medium
25019 @opindex mcmodel=medium
25020 Generate code for the medium model: the program is linked in the lower 2
25021 GB of the address space. Small symbols are also placed there. Symbols
25022 with sizes larger than @option{-mlarge-data-threshold} are put into
25023 large data or BSS sections and can be located above 2GB. Programs can
25024 be statically or dynamically linked.
25025
25026 @item -mcmodel=large
25027 @opindex mcmodel=large
25028 Generate code for the large model. This model makes no assumptions
25029 about addresses and sizes of sections.
25030
25031 @item -maddress-mode=long
25032 @opindex maddress-mode=long
25033 Generate code for long address mode. This is only supported for 64-bit
25034 and x32 environments. It is the default address mode for 64-bit
25035 environments.
25036
25037 @item -maddress-mode=short
25038 @opindex maddress-mode=short
25039 Generate code for short address mode. This is only supported for 32-bit
25040 and x32 environments. It is the default address mode for 32-bit and
25041 x32 environments.
25042 @end table
25043
25044 @node x86 Windows Options
25045 @subsection x86 Windows Options
25046 @cindex x86 Windows Options
25047 @cindex Windows Options for x86
25048
25049 These additional options are available for Microsoft Windows targets:
25050
25051 @table @gcctabopt
25052 @item -mconsole
25053 @opindex mconsole
25054 This option
25055 specifies that a console application is to be generated, by
25056 instructing the linker to set the PE header subsystem type
25057 required for console applications.
25058 This option is available for Cygwin and MinGW targets and is
25059 enabled by default on those targets.
25060
25061 @item -mdll
25062 @opindex mdll
25063 This option is available for Cygwin and MinGW targets. It
25064 specifies that a DLL---a dynamic link library---is to be
25065 generated, enabling the selection of the required runtime
25066 startup object and entry point.
25067
25068 @item -mnop-fun-dllimport
25069 @opindex mnop-fun-dllimport
25070 This option is available for Cygwin and MinGW targets. It
25071 specifies that the @code{dllimport} attribute should be ignored.
25072
25073 @item -mthread
25074 @opindex mthread
25075 This option is available for MinGW targets. It specifies
25076 that MinGW-specific thread support is to be used.
25077
25078 @item -municode
25079 @opindex municode
25080 This option is available for MinGW-w64 targets. It causes
25081 the @code{UNICODE} preprocessor macro to be predefined, and
25082 chooses Unicode-capable runtime startup code.
25083
25084 @item -mwin32
25085 @opindex mwin32
25086 This option is available for Cygwin and MinGW targets. It
25087 specifies that the typical Microsoft Windows predefined macros are to
25088 be set in the pre-processor, but does not influence the choice
25089 of runtime library/startup code.
25090
25091 @item -mwindows
25092 @opindex mwindows
25093 This option is available for Cygwin and MinGW targets. It
25094 specifies that a GUI application is to be generated by
25095 instructing the linker to set the PE header subsystem type
25096 appropriately.
25097
25098 @item -fno-set-stack-executable
25099 @opindex fno-set-stack-executable
25100 This option is available for MinGW targets. It specifies that
25101 the executable flag for the stack used by nested functions isn't
25102 set. This is necessary for binaries running in kernel mode of
25103 Microsoft Windows, as there the User32 API, which is used to set executable
25104 privileges, isn't available.
25105
25106 @item -fwritable-relocated-rdata
25107 @opindex fno-writable-relocated-rdata
25108 This option is available for MinGW and Cygwin targets. It specifies
25109 that relocated-data in read-only section is put into the @code{.data}
25110 section. This is a necessary for older runtimes not supporting
25111 modification of @code{.rdata} sections for pseudo-relocation.
25112
25113 @item -mpe-aligned-commons
25114 @opindex mpe-aligned-commons
25115 This option is available for Cygwin and MinGW targets. It
25116 specifies that the GNU extension to the PE file format that
25117 permits the correct alignment of COMMON variables should be
25118 used when generating code. It is enabled by default if
25119 GCC detects that the target assembler found during configuration
25120 supports the feature.
25121 @end table
25122
25123 See also under @ref{x86 Options} for standard options.
25124
25125 @node Xstormy16 Options
25126 @subsection Xstormy16 Options
25127 @cindex Xstormy16 Options
25128
25129 These options are defined for Xstormy16:
25130
25131 @table @gcctabopt
25132 @item -msim
25133 @opindex msim
25134 Choose startup files and linker script suitable for the simulator.
25135 @end table
25136
25137 @node Xtensa Options
25138 @subsection Xtensa Options
25139 @cindex Xtensa Options
25140
25141 These options are supported for Xtensa targets:
25142
25143 @table @gcctabopt
25144 @item -mconst16
25145 @itemx -mno-const16
25146 @opindex mconst16
25147 @opindex mno-const16
25148 Enable or disable use of @code{CONST16} instructions for loading
25149 constant values. The @code{CONST16} instruction is currently not a
25150 standard option from Tensilica. When enabled, @code{CONST16}
25151 instructions are always used in place of the standard @code{L32R}
25152 instructions. The use of @code{CONST16} is enabled by default only if
25153 the @code{L32R} instruction is not available.
25154
25155 @item -mfused-madd
25156 @itemx -mno-fused-madd
25157 @opindex mfused-madd
25158 @opindex mno-fused-madd
25159 Enable or disable use of fused multiply/add and multiply/subtract
25160 instructions in the floating-point option. This has no effect if the
25161 floating-point option is not also enabled. Disabling fused multiply/add
25162 and multiply/subtract instructions forces the compiler to use separate
25163 instructions for the multiply and add/subtract operations. This may be
25164 desirable in some cases where strict IEEE 754-compliant results are
25165 required: the fused multiply add/subtract instructions do not round the
25166 intermediate result, thereby producing results with @emph{more} bits of
25167 precision than specified by the IEEE standard. Disabling fused multiply
25168 add/subtract instructions also ensures that the program output is not
25169 sensitive to the compiler's ability to combine multiply and add/subtract
25170 operations.
25171
25172 @item -mserialize-volatile
25173 @itemx -mno-serialize-volatile
25174 @opindex mserialize-volatile
25175 @opindex mno-serialize-volatile
25176 When this option is enabled, GCC inserts @code{MEMW} instructions before
25177 @code{volatile} memory references to guarantee sequential consistency.
25178 The default is @option{-mserialize-volatile}. Use
25179 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
25180
25181 @item -mforce-no-pic
25182 @opindex mforce-no-pic
25183 For targets, like GNU/Linux, where all user-mode Xtensa code must be
25184 position-independent code (PIC), this option disables PIC for compiling
25185 kernel code.
25186
25187 @item -mtext-section-literals
25188 @itemx -mno-text-section-literals
25189 @opindex mtext-section-literals
25190 @opindex mno-text-section-literals
25191 These options control the treatment of literal pools. The default is
25192 @option{-mno-text-section-literals}, which places literals in a separate
25193 section in the output file. This allows the literal pool to be placed
25194 in a data RAM/ROM, and it also allows the linker to combine literal
25195 pools from separate object files to remove redundant literals and
25196 improve code size. With @option{-mtext-section-literals}, the literals
25197 are interspersed in the text section in order to keep them as close as
25198 possible to their references. This may be necessary for large assembly
25199 files. Literals for each function are placed right before that function.
25200
25201 @item -mauto-litpools
25202 @itemx -mno-auto-litpools
25203 @opindex mauto-litpools
25204 @opindex mno-auto-litpools
25205 These options control the treatment of literal pools. The default is
25206 @option{-mno-auto-litpools}, which places literals in a separate
25207 section in the output file unless @option{-mtext-section-literals} is
25208 used. With @option{-mauto-litpools} the literals are interspersed in
25209 the text section by the assembler. Compiler does not produce explicit
25210 @code{.literal} directives and loads literals into registers with
25211 @code{MOVI} instructions instead of @code{L32R} to let the assembler
25212 do relaxation and place literals as necessary. This option allows
25213 assembler to create several literal pools per function and assemble
25214 very big functions, which may not be possible with
25215 @option{-mtext-section-literals}.
25216
25217 @item -mtarget-align
25218 @itemx -mno-target-align
25219 @opindex mtarget-align
25220 @opindex mno-target-align
25221 When this option is enabled, GCC instructs the assembler to
25222 automatically align instructions to reduce branch penalties at the
25223 expense of some code density. The assembler attempts to widen density
25224 instructions to align branch targets and the instructions following call
25225 instructions. If there are not enough preceding safe density
25226 instructions to align a target, no widening is performed. The
25227 default is @option{-mtarget-align}. These options do not affect the
25228 treatment of auto-aligned instructions like @code{LOOP}, which the
25229 assembler always aligns, either by widening density instructions or
25230 by inserting NOP instructions.
25231
25232 @item -mlongcalls
25233 @itemx -mno-longcalls
25234 @opindex mlongcalls
25235 @opindex mno-longcalls
25236 When this option is enabled, GCC instructs the assembler to translate
25237 direct calls to indirect calls unless it can determine that the target
25238 of a direct call is in the range allowed by the call instruction. This
25239 translation typically occurs for calls to functions in other source
25240 files. Specifically, the assembler translates a direct @code{CALL}
25241 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
25242 The default is @option{-mno-longcalls}. This option should be used in
25243 programs where the call target can potentially be out of range. This
25244 option is implemented in the assembler, not the compiler, so the
25245 assembly code generated by GCC still shows direct call
25246 instructions---look at the disassembled object code to see the actual
25247 instructions. Note that the assembler uses an indirect call for
25248 every cross-file call, not just those that really are out of range.
25249 @end table
25250
25251 @node zSeries Options
25252 @subsection zSeries Options
25253 @cindex zSeries options
25254
25255 These are listed under @xref{S/390 and zSeries Options}.
25256
25257
25258 @c man end
25259
25260 @node Spec Files
25261 @section Specifying Subprocesses and the Switches to Pass to Them
25262 @cindex Spec Files
25263
25264 @command{gcc} is a driver program. It performs its job by invoking a
25265 sequence of other programs to do the work of compiling, assembling and
25266 linking. GCC interprets its command-line parameters and uses these to
25267 deduce which programs it should invoke, and which command-line options
25268 it ought to place on their command lines. This behavior is controlled
25269 by @dfn{spec strings}. In most cases there is one spec string for each
25270 program that GCC can invoke, but a few programs have multiple spec
25271 strings to control their behavior. The spec strings built into GCC can
25272 be overridden by using the @option{-specs=} command-line switch to specify
25273 a spec file.
25274
25275 @dfn{Spec files} are plain-text files that are used to construct spec
25276 strings. They consist of a sequence of directives separated by blank
25277 lines. The type of directive is determined by the first non-whitespace
25278 character on the line, which can be one of the following:
25279
25280 @table @code
25281 @item %@var{command}
25282 Issues a @var{command} to the spec file processor. The commands that can
25283 appear here are:
25284
25285 @table @code
25286 @item %include <@var{file}>
25287 @cindex @code{%include}
25288 Search for @var{file} and insert its text at the current point in the
25289 specs file.
25290
25291 @item %include_noerr <@var{file}>
25292 @cindex @code{%include_noerr}
25293 Just like @samp{%include}, but do not generate an error message if the include
25294 file cannot be found.
25295
25296 @item %rename @var{old_name} @var{new_name}
25297 @cindex @code{%rename}
25298 Rename the spec string @var{old_name} to @var{new_name}.
25299
25300 @end table
25301
25302 @item *[@var{spec_name}]:
25303 This tells the compiler to create, override or delete the named spec
25304 string. All lines after this directive up to the next directive or
25305 blank line are considered to be the text for the spec string. If this
25306 results in an empty string then the spec is deleted. (Or, if the
25307 spec did not exist, then nothing happens.) Otherwise, if the spec
25308 does not currently exist a new spec is created. If the spec does
25309 exist then its contents are overridden by the text of this
25310 directive, unless the first character of that text is the @samp{+}
25311 character, in which case the text is appended to the spec.
25312
25313 @item [@var{suffix}]:
25314 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
25315 and up to the next directive or blank line are considered to make up the
25316 spec string for the indicated suffix. When the compiler encounters an
25317 input file with the named suffix, it processes the spec string in
25318 order to work out how to compile that file. For example:
25319
25320 @smallexample
25321 .ZZ:
25322 z-compile -input %i
25323 @end smallexample
25324
25325 This says that any input file whose name ends in @samp{.ZZ} should be
25326 passed to the program @samp{z-compile}, which should be invoked with the
25327 command-line switch @option{-input} and with the result of performing the
25328 @samp{%i} substitution. (See below.)
25329
25330 As an alternative to providing a spec string, the text following a
25331 suffix directive can be one of the following:
25332
25333 @table @code
25334 @item @@@var{language}
25335 This says that the suffix is an alias for a known @var{language}. This is
25336 similar to using the @option{-x} command-line switch to GCC to specify a
25337 language explicitly. For example:
25338
25339 @smallexample
25340 .ZZ:
25341 @@c++
25342 @end smallexample
25343
25344 Says that .ZZ files are, in fact, C++ source files.
25345
25346 @item #@var{name}
25347 This causes an error messages saying:
25348
25349 @smallexample
25350 @var{name} compiler not installed on this system.
25351 @end smallexample
25352 @end table
25353
25354 GCC already has an extensive list of suffixes built into it.
25355 This directive adds an entry to the end of the list of suffixes, but
25356 since the list is searched from the end backwards, it is effectively
25357 possible to override earlier entries using this technique.
25358
25359 @end table
25360
25361 GCC has the following spec strings built into it. Spec files can
25362 override these strings or create their own. Note that individual
25363 targets can also add their own spec strings to this list.
25364
25365 @smallexample
25366 asm Options to pass to the assembler
25367 asm_final Options to pass to the assembler post-processor
25368 cpp Options to pass to the C preprocessor
25369 cc1 Options to pass to the C compiler
25370 cc1plus Options to pass to the C++ compiler
25371 endfile Object files to include at the end of the link
25372 link Options to pass to the linker
25373 lib Libraries to include on the command line to the linker
25374 libgcc Decides which GCC support library to pass to the linker
25375 linker Sets the name of the linker
25376 predefines Defines to be passed to the C preprocessor
25377 signed_char Defines to pass to CPP to say whether @code{char} is signed
25378 by default
25379 startfile Object files to include at the start of the link
25380 @end smallexample
25381
25382 Here is a small example of a spec file:
25383
25384 @smallexample
25385 %rename lib old_lib
25386
25387 *lib:
25388 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
25389 @end smallexample
25390
25391 This example renames the spec called @samp{lib} to @samp{old_lib} and
25392 then overrides the previous definition of @samp{lib} with a new one.
25393 The new definition adds in some extra command-line options before
25394 including the text of the old definition.
25395
25396 @dfn{Spec strings} are a list of command-line options to be passed to their
25397 corresponding program. In addition, the spec strings can contain
25398 @samp{%}-prefixed sequences to substitute variable text or to
25399 conditionally insert text into the command line. Using these constructs
25400 it is possible to generate quite complex command lines.
25401
25402 Here is a table of all defined @samp{%}-sequences for spec
25403 strings. Note that spaces are not generated automatically around the
25404 results of expanding these sequences. Therefore you can concatenate them
25405 together or combine them with constant text in a single argument.
25406
25407 @table @code
25408 @item %%
25409 Substitute one @samp{%} into the program name or argument.
25410
25411 @item %i
25412 Substitute the name of the input file being processed.
25413
25414 @item %b
25415 Substitute the basename of the input file being processed.
25416 This is the substring up to (and not including) the last period
25417 and not including the directory.
25418
25419 @item %B
25420 This is the same as @samp{%b}, but include the file suffix (text after
25421 the last period).
25422
25423 @item %d
25424 Marks the argument containing or following the @samp{%d} as a
25425 temporary file name, so that that file is deleted if GCC exits
25426 successfully. Unlike @samp{%g}, this contributes no text to the
25427 argument.
25428
25429 @item %g@var{suffix}
25430 Substitute a file name that has suffix @var{suffix} and is chosen
25431 once per compilation, and mark the argument in the same way as
25432 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
25433 name is now chosen in a way that is hard to predict even when previously
25434 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
25435 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
25436 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
25437 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
25438 was simply substituted with a file name chosen once per compilation,
25439 without regard to any appended suffix (which was therefore treated
25440 just like ordinary text), making such attacks more likely to succeed.
25441
25442 @item %u@var{suffix}
25443 Like @samp{%g}, but generates a new temporary file name
25444 each time it appears instead of once per compilation.
25445
25446 @item %U@var{suffix}
25447 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
25448 new one if there is no such last file name. In the absence of any
25449 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
25450 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
25451 involves the generation of two distinct file names, one
25452 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
25453 simply substituted with a file name chosen for the previous @samp{%u},
25454 without regard to any appended suffix.
25455
25456 @item %j@var{suffix}
25457 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
25458 writable, and if @option{-save-temps} is not used;
25459 otherwise, substitute the name
25460 of a temporary file, just like @samp{%u}. This temporary file is not
25461 meant for communication between processes, but rather as a junk
25462 disposal mechanism.
25463
25464 @item %|@var{suffix}
25465 @itemx %m@var{suffix}
25466 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
25467 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
25468 all. These are the two most common ways to instruct a program that it
25469 should read from standard input or write to standard output. If you
25470 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
25471 construct: see for example @file{f/lang-specs.h}.
25472
25473 @item %.@var{SUFFIX}
25474 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
25475 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
25476 terminated by the next space or %.
25477
25478 @item %w
25479 Marks the argument containing or following the @samp{%w} as the
25480 designated output file of this compilation. This puts the argument
25481 into the sequence of arguments that @samp{%o} substitutes.
25482
25483 @item %o
25484 Substitutes the names of all the output files, with spaces
25485 automatically placed around them. You should write spaces
25486 around the @samp{%o} as well or the results are undefined.
25487 @samp{%o} is for use in the specs for running the linker.
25488 Input files whose names have no recognized suffix are not compiled
25489 at all, but they are included among the output files, so they are
25490 linked.
25491
25492 @item %O
25493 Substitutes the suffix for object files. Note that this is
25494 handled specially when it immediately follows @samp{%g, %u, or %U},
25495 because of the need for those to form complete file names. The
25496 handling is such that @samp{%O} is treated exactly as if it had already
25497 been substituted, except that @samp{%g, %u, and %U} do not currently
25498 support additional @var{suffix} characters following @samp{%O} as they do
25499 following, for example, @samp{.o}.
25500
25501 @item %p
25502 Substitutes the standard macro predefinitions for the
25503 current target machine. Use this when running @command{cpp}.
25504
25505 @item %P
25506 Like @samp{%p}, but puts @samp{__} before and after the name of each
25507 predefined macro, except for macros that start with @samp{__} or with
25508 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
25509 C@.
25510
25511 @item %I
25512 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
25513 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
25514 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
25515 and @option{-imultilib} as necessary.
25516
25517 @item %s
25518 Current argument is the name of a library or startup file of some sort.
25519 Search for that file in a standard list of directories and substitute
25520 the full name found. The current working directory is included in the
25521 list of directories scanned.
25522
25523 @item %T
25524 Current argument is the name of a linker script. Search for that file
25525 in the current list of directories to scan for libraries. If the file
25526 is located insert a @option{--script} option into the command line
25527 followed by the full path name found. If the file is not found then
25528 generate an error message. Note: the current working directory is not
25529 searched.
25530
25531 @item %e@var{str}
25532 Print @var{str} as an error message. @var{str} is terminated by a newline.
25533 Use this when inconsistent options are detected.
25534
25535 @item %(@var{name})
25536 Substitute the contents of spec string @var{name} at this point.
25537
25538 @item %x@{@var{option}@}
25539 Accumulate an option for @samp{%X}.
25540
25541 @item %X
25542 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
25543 spec string.
25544
25545 @item %Y
25546 Output the accumulated assembler options specified by @option{-Wa}.
25547
25548 @item %Z
25549 Output the accumulated preprocessor options specified by @option{-Wp}.
25550
25551 @item %a
25552 Process the @code{asm} spec. This is used to compute the
25553 switches to be passed to the assembler.
25554
25555 @item %A
25556 Process the @code{asm_final} spec. This is a spec string for
25557 passing switches to an assembler post-processor, if such a program is
25558 needed.
25559
25560 @item %l
25561 Process the @code{link} spec. This is the spec for computing the
25562 command line passed to the linker. Typically it makes use of the
25563 @samp{%L %G %S %D and %E} sequences.
25564
25565 @item %D
25566 Dump out a @option{-L} option for each directory that GCC believes might
25567 contain startup files. If the target supports multilibs then the
25568 current multilib directory is prepended to each of these paths.
25569
25570 @item %L
25571 Process the @code{lib} spec. This is a spec string for deciding which
25572 libraries are included on the command line to the linker.
25573
25574 @item %G
25575 Process the @code{libgcc} spec. This is a spec string for deciding
25576 which GCC support library is included on the command line to the linker.
25577
25578 @item %S
25579 Process the @code{startfile} spec. This is a spec for deciding which
25580 object files are the first ones passed to the linker. Typically
25581 this might be a file named @file{crt0.o}.
25582
25583 @item %E
25584 Process the @code{endfile} spec. This is a spec string that specifies
25585 the last object files that are passed to the linker.
25586
25587 @item %C
25588 Process the @code{cpp} spec. This is used to construct the arguments
25589 to be passed to the C preprocessor.
25590
25591 @item %1
25592 Process the @code{cc1} spec. This is used to construct the options to be
25593 passed to the actual C compiler (@command{cc1}).
25594
25595 @item %2
25596 Process the @code{cc1plus} spec. This is used to construct the options to be
25597 passed to the actual C++ compiler (@command{cc1plus}).
25598
25599 @item %*
25600 Substitute the variable part of a matched option. See below.
25601 Note that each comma in the substituted string is replaced by
25602 a single space.
25603
25604 @item %<@code{S}
25605 Remove all occurrences of @code{-S} from the command line. Note---this
25606 command is position dependent. @samp{%} commands in the spec string
25607 before this one see @code{-S}, @samp{%} commands in the spec string
25608 after this one do not.
25609
25610 @item %:@var{function}(@var{args})
25611 Call the named function @var{function}, passing it @var{args}.
25612 @var{args} is first processed as a nested spec string, then split
25613 into an argument vector in the usual fashion. The function returns
25614 a string which is processed as if it had appeared literally as part
25615 of the current spec.
25616
25617 The following built-in spec functions are provided:
25618
25619 @table @code
25620 @item @code{getenv}
25621 The @code{getenv} spec function takes two arguments: an environment
25622 variable name and a string. If the environment variable is not
25623 defined, a fatal error is issued. Otherwise, the return value is the
25624 value of the environment variable concatenated with the string. For
25625 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
25626
25627 @smallexample
25628 %:getenv(TOPDIR /include)
25629 @end smallexample
25630
25631 expands to @file{/path/to/top/include}.
25632
25633 @item @code{if-exists}
25634 The @code{if-exists} spec function takes one argument, an absolute
25635 pathname to a file. If the file exists, @code{if-exists} returns the
25636 pathname. Here is a small example of its usage:
25637
25638 @smallexample
25639 *startfile:
25640 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
25641 @end smallexample
25642
25643 @item @code{if-exists-else}
25644 The @code{if-exists-else} spec function is similar to the @code{if-exists}
25645 spec function, except that it takes two arguments. The first argument is
25646 an absolute pathname to a file. If the file exists, @code{if-exists-else}
25647 returns the pathname. If it does not exist, it returns the second argument.
25648 This way, @code{if-exists-else} can be used to select one file or another,
25649 based on the existence of the first. Here is a small example of its usage:
25650
25651 @smallexample
25652 *startfile:
25653 crt0%O%s %:if-exists(crti%O%s) \
25654 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
25655 @end smallexample
25656
25657 @item @code{replace-outfile}
25658 The @code{replace-outfile} spec function takes two arguments. It looks for the
25659 first argument in the outfiles array and replaces it with the second argument. Here
25660 is a small example of its usage:
25661
25662 @smallexample
25663 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
25664 @end smallexample
25665
25666 @item @code{remove-outfile}
25667 The @code{remove-outfile} spec function takes one argument. It looks for the
25668 first argument in the outfiles array and removes it. Here is a small example
25669 its usage:
25670
25671 @smallexample
25672 %:remove-outfile(-lm)
25673 @end smallexample
25674
25675 @item @code{pass-through-libs}
25676 The @code{pass-through-libs} spec function takes any number of arguments. It
25677 finds any @option{-l} options and any non-options ending in @file{.a} (which it
25678 assumes are the names of linker input library archive files) and returns a
25679 result containing all the found arguments each prepended by
25680 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
25681 intended to be passed to the LTO linker plugin.
25682
25683 @smallexample
25684 %:pass-through-libs(%G %L %G)
25685 @end smallexample
25686
25687 @item @code{print-asm-header}
25688 The @code{print-asm-header} function takes no arguments and simply
25689 prints a banner like:
25690
25691 @smallexample
25692 Assembler options
25693 =================
25694
25695 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
25696 @end smallexample
25697
25698 It is used to separate compiler options from assembler options
25699 in the @option{--target-help} output.
25700 @end table
25701
25702 @item %@{@code{S}@}
25703 Substitutes the @code{-S} switch, if that switch is given to GCC@.
25704 If that switch is not specified, this substitutes nothing. Note that
25705 the leading dash is omitted when specifying this option, and it is
25706 automatically inserted if the substitution is performed. Thus the spec
25707 string @samp{%@{foo@}} matches the command-line option @option{-foo}
25708 and outputs the command-line option @option{-foo}.
25709
25710 @item %W@{@code{S}@}
25711 Like %@{@code{S}@} but mark last argument supplied within as a file to be
25712 deleted on failure.
25713
25714 @item %@{@code{S}*@}
25715 Substitutes all the switches specified to GCC whose names start
25716 with @code{-S}, but which also take an argument. This is used for
25717 switches like @option{-o}, @option{-D}, @option{-I}, etc.
25718 GCC considers @option{-o foo} as being
25719 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
25720 text, including the space. Thus two arguments are generated.
25721
25722 @item %@{@code{S}*&@code{T}*@}
25723 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
25724 (the order of @code{S} and @code{T} in the spec is not significant).
25725 There can be any number of ampersand-separated variables; for each the
25726 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
25727
25728 @item %@{@code{S}:@code{X}@}
25729 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
25730
25731 @item %@{!@code{S}:@code{X}@}
25732 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
25733
25734 @item %@{@code{S}*:@code{X}@}
25735 Substitutes @code{X} if one or more switches whose names start with
25736 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
25737 once, no matter how many such switches appeared. However, if @code{%*}
25738 appears somewhere in @code{X}, then @code{X} is substituted once
25739 for each matching switch, with the @code{%*} replaced by the part of
25740 that switch matching the @code{*}.
25741
25742 If @code{%*} appears as the last part of a spec sequence then a space
25743 is added after the end of the last substitution. If there is more
25744 text in the sequence, however, then a space is not generated. This
25745 allows the @code{%*} substitution to be used as part of a larger
25746 string. For example, a spec string like this:
25747
25748 @smallexample
25749 %@{mcu=*:--script=%*/memory.ld@}
25750 @end smallexample
25751
25752 @noindent
25753 when matching an option like @option{-mcu=newchip} produces:
25754
25755 @smallexample
25756 --script=newchip/memory.ld
25757 @end smallexample
25758
25759 @item %@{.@code{S}:@code{X}@}
25760 Substitutes @code{X}, if processing a file with suffix @code{S}.
25761
25762 @item %@{!.@code{S}:@code{X}@}
25763 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
25764
25765 @item %@{,@code{S}:@code{X}@}
25766 Substitutes @code{X}, if processing a file for language @code{S}.
25767
25768 @item %@{!,@code{S}:@code{X}@}
25769 Substitutes @code{X}, if not processing a file for language @code{S}.
25770
25771 @item %@{@code{S}|@code{P}:@code{X}@}
25772 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
25773 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
25774 @code{*} sequences as well, although they have a stronger binding than
25775 the @samp{|}. If @code{%*} appears in @code{X}, all of the
25776 alternatives must be starred, and only the first matching alternative
25777 is substituted.
25778
25779 For example, a spec string like this:
25780
25781 @smallexample
25782 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
25783 @end smallexample
25784
25785 @noindent
25786 outputs the following command-line options from the following input
25787 command-line options:
25788
25789 @smallexample
25790 fred.c -foo -baz
25791 jim.d -bar -boggle
25792 -d fred.c -foo -baz -boggle
25793 -d jim.d -bar -baz -boggle
25794 @end smallexample
25795
25796 @item %@{S:X; T:Y; :D@}
25797
25798 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
25799 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
25800 be as many clauses as you need. This may be combined with @code{.},
25801 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
25802
25803
25804 @end table
25805
25806 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
25807 construct may contain other nested @samp{%} constructs or spaces, or
25808 even newlines. They are processed as usual, as described above.
25809 Trailing white space in @code{X} is ignored. White space may also
25810 appear anywhere on the left side of the colon in these constructs,
25811 except between @code{.} or @code{*} and the corresponding word.
25812
25813 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
25814 handled specifically in these constructs. If another value of
25815 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
25816 @option{-W} switch is found later in the command line, the earlier
25817 switch value is ignored, except with @{@code{S}*@} where @code{S} is
25818 just one letter, which passes all matching options.
25819
25820 The character @samp{|} at the beginning of the predicate text is used to
25821 indicate that a command should be piped to the following command, but
25822 only if @option{-pipe} is specified.
25823
25824 It is built into GCC which switches take arguments and which do not.
25825 (You might think it would be useful to generalize this to allow each
25826 compiler's spec to say which switches take arguments. But this cannot
25827 be done in a consistent fashion. GCC cannot even decide which input
25828 files have been specified without knowing which switches take arguments,
25829 and it must know which input files to compile in order to tell which
25830 compilers to run).
25831
25832 GCC also knows implicitly that arguments starting in @option{-l} are to be
25833 treated as compiler output files, and passed to the linker in their
25834 proper position among the other output files.
25835
25836 @node Environment Variables
25837 @section Environment Variables Affecting GCC
25838 @cindex environment variables
25839
25840 @c man begin ENVIRONMENT
25841 This section describes several environment variables that affect how GCC
25842 operates. Some of them work by specifying directories or prefixes to use
25843 when searching for various kinds of files. Some are used to specify other
25844 aspects of the compilation environment.
25845
25846 Note that you can also specify places to search using options such as
25847 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
25848 take precedence over places specified using environment variables, which
25849 in turn take precedence over those specified by the configuration of GCC@.
25850 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
25851 GNU Compiler Collection (GCC) Internals}.
25852
25853 @table @env
25854 @item LANG
25855 @itemx LC_CTYPE
25856 @c @itemx LC_COLLATE
25857 @itemx LC_MESSAGES
25858 @c @itemx LC_MONETARY
25859 @c @itemx LC_NUMERIC
25860 @c @itemx LC_TIME
25861 @itemx LC_ALL
25862 @findex LANG
25863 @findex LC_CTYPE
25864 @c @findex LC_COLLATE
25865 @findex LC_MESSAGES
25866 @c @findex LC_MONETARY
25867 @c @findex LC_NUMERIC
25868 @c @findex LC_TIME
25869 @findex LC_ALL
25870 @cindex locale
25871 These environment variables control the way that GCC uses
25872 localization information which allows GCC to work with different
25873 national conventions. GCC inspects the locale categories
25874 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
25875 so. These locale categories can be set to any value supported by your
25876 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
25877 Kingdom encoded in UTF-8.
25878
25879 The @env{LC_CTYPE} environment variable specifies character
25880 classification. GCC uses it to determine the character boundaries in
25881 a string; this is needed for some multibyte encodings that contain quote
25882 and escape characters that are otherwise interpreted as a string
25883 end or escape.
25884
25885 The @env{LC_MESSAGES} environment variable specifies the language to
25886 use in diagnostic messages.
25887
25888 If the @env{LC_ALL} environment variable is set, it overrides the value
25889 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
25890 and @env{LC_MESSAGES} default to the value of the @env{LANG}
25891 environment variable. If none of these variables are set, GCC
25892 defaults to traditional C English behavior.
25893
25894 @item TMPDIR
25895 @findex TMPDIR
25896 If @env{TMPDIR} is set, it specifies the directory to use for temporary
25897 files. GCC uses temporary files to hold the output of one stage of
25898 compilation which is to be used as input to the next stage: for example,
25899 the output of the preprocessor, which is the input to the compiler
25900 proper.
25901
25902 @item GCC_COMPARE_DEBUG
25903 @findex GCC_COMPARE_DEBUG
25904 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
25905 @option{-fcompare-debug} to the compiler driver. See the documentation
25906 of this option for more details.
25907
25908 @item GCC_EXEC_PREFIX
25909 @findex GCC_EXEC_PREFIX
25910 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
25911 names of the subprograms executed by the compiler. No slash is added
25912 when this prefix is combined with the name of a subprogram, but you can
25913 specify a prefix that ends with a slash if you wish.
25914
25915 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
25916 an appropriate prefix to use based on the pathname it is invoked with.
25917
25918 If GCC cannot find the subprogram using the specified prefix, it
25919 tries looking in the usual places for the subprogram.
25920
25921 The default value of @env{GCC_EXEC_PREFIX} is
25922 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
25923 the installed compiler. In many cases @var{prefix} is the value
25924 of @code{prefix} when you ran the @file{configure} script.
25925
25926 Other prefixes specified with @option{-B} take precedence over this prefix.
25927
25928 This prefix is also used for finding files such as @file{crt0.o} that are
25929 used for linking.
25930
25931 In addition, the prefix is used in an unusual way in finding the
25932 directories to search for header files. For each of the standard
25933 directories whose name normally begins with @samp{/usr/local/lib/gcc}
25934 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
25935 replacing that beginning with the specified prefix to produce an
25936 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
25937 @file{foo/bar} just before it searches the standard directory
25938 @file{/usr/local/lib/bar}.
25939 If a standard directory begins with the configured
25940 @var{prefix} then the value of @var{prefix} is replaced by
25941 @env{GCC_EXEC_PREFIX} when looking for header files.
25942
25943 @item COMPILER_PATH
25944 @findex COMPILER_PATH
25945 The value of @env{COMPILER_PATH} is a colon-separated list of
25946 directories, much like @env{PATH}. GCC tries the directories thus
25947 specified when searching for subprograms, if it can't find the
25948 subprograms using @env{GCC_EXEC_PREFIX}.
25949
25950 @item LIBRARY_PATH
25951 @findex LIBRARY_PATH
25952 The value of @env{LIBRARY_PATH} is a colon-separated list of
25953 directories, much like @env{PATH}. When configured as a native compiler,
25954 GCC tries the directories thus specified when searching for special
25955 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
25956 using GCC also uses these directories when searching for ordinary
25957 libraries for the @option{-l} option (but directories specified with
25958 @option{-L} come first).
25959
25960 @item LANG
25961 @findex LANG
25962 @cindex locale definition
25963 This variable is used to pass locale information to the compiler. One way in
25964 which this information is used is to determine the character set to be used
25965 when character literals, string literals and comments are parsed in C and C++.
25966 When the compiler is configured to allow multibyte characters,
25967 the following values for @env{LANG} are recognized:
25968
25969 @table @samp
25970 @item C-JIS
25971 Recognize JIS characters.
25972 @item C-SJIS
25973 Recognize SJIS characters.
25974 @item C-EUCJP
25975 Recognize EUCJP characters.
25976 @end table
25977
25978 If @env{LANG} is not defined, or if it has some other value, then the
25979 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
25980 recognize and translate multibyte characters.
25981 @end table
25982
25983 @noindent
25984 Some additional environment variables affect the behavior of the
25985 preprocessor.
25986
25987 @include cppenv.texi
25988
25989 @c man end
25990
25991 @node Precompiled Headers
25992 @section Using Precompiled Headers
25993 @cindex precompiled headers
25994 @cindex speed of compilation
25995
25996 Often large projects have many header files that are included in every
25997 source file. The time the compiler takes to process these header files
25998 over and over again can account for nearly all of the time required to
25999 build the project. To make builds faster, GCC allows you to
26000 @dfn{precompile} a header file.
26001
26002 To create a precompiled header file, simply compile it as you would any
26003 other file, if necessary using the @option{-x} option to make the driver
26004 treat it as a C or C++ header file. You may want to use a
26005 tool like @command{make} to keep the precompiled header up-to-date when
26006 the headers it contains change.
26007
26008 A precompiled header file is searched for when @code{#include} is
26009 seen in the compilation. As it searches for the included file
26010 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
26011 compiler looks for a precompiled header in each directory just before it
26012 looks for the include file in that directory. The name searched for is
26013 the name specified in the @code{#include} with @samp{.gch} appended. If
26014 the precompiled header file can't be used, it is ignored.
26015
26016 For instance, if you have @code{#include "all.h"}, and you have
26017 @file{all.h.gch} in the same directory as @file{all.h}, then the
26018 precompiled header file is used if possible, and the original
26019 header is used otherwise.
26020
26021 Alternatively, you might decide to put the precompiled header file in a
26022 directory and use @option{-I} to ensure that directory is searched
26023 before (or instead of) the directory containing the original header.
26024 Then, if you want to check that the precompiled header file is always
26025 used, you can put a file of the same name as the original header in this
26026 directory containing an @code{#error} command.
26027
26028 This also works with @option{-include}. So yet another way to use
26029 precompiled headers, good for projects not designed with precompiled
26030 header files in mind, is to simply take most of the header files used by
26031 a project, include them from another header file, precompile that header
26032 file, and @option{-include} the precompiled header. If the header files
26033 have guards against multiple inclusion, they are skipped because
26034 they've already been included (in the precompiled header).
26035
26036 If you need to precompile the same header file for different
26037 languages, targets, or compiler options, you can instead make a
26038 @emph{directory} named like @file{all.h.gch}, and put each precompiled
26039 header in the directory, perhaps using @option{-o}. It doesn't matter
26040 what you call the files in the directory; every precompiled header in
26041 the directory is considered. The first precompiled header
26042 encountered in the directory that is valid for this compilation is
26043 used; they're searched in no particular order.
26044
26045 There are many other possibilities, limited only by your imagination,
26046 good sense, and the constraints of your build system.
26047
26048 A precompiled header file can be used only when these conditions apply:
26049
26050 @itemize
26051 @item
26052 Only one precompiled header can be used in a particular compilation.
26053
26054 @item
26055 A precompiled header can't be used once the first C token is seen. You
26056 can have preprocessor directives before a precompiled header; you cannot
26057 include a precompiled header from inside another header.
26058
26059 @item
26060 The precompiled header file must be produced for the same language as
26061 the current compilation. You can't use a C precompiled header for a C++
26062 compilation.
26063
26064 @item
26065 The precompiled header file must have been produced by the same compiler
26066 binary as the current compilation is using.
26067
26068 @item
26069 Any macros defined before the precompiled header is included must
26070 either be defined in the same way as when the precompiled header was
26071 generated, or must not affect the precompiled header, which usually
26072 means that they don't appear in the precompiled header at all.
26073
26074 The @option{-D} option is one way to define a macro before a
26075 precompiled header is included; using a @code{#define} can also do it.
26076 There are also some options that define macros implicitly, like
26077 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
26078 defined this way.
26079
26080 @item If debugging information is output when using the precompiled
26081 header, using @option{-g} or similar, the same kind of debugging information
26082 must have been output when building the precompiled header. However,
26083 a precompiled header built using @option{-g} can be used in a compilation
26084 when no debugging information is being output.
26085
26086 @item The same @option{-m} options must generally be used when building
26087 and using the precompiled header. @xref{Submodel Options},
26088 for any cases where this rule is relaxed.
26089
26090 @item Each of the following options must be the same when building and using
26091 the precompiled header:
26092
26093 @gccoptlist{-fexceptions}
26094
26095 @item
26096 Some other command-line options starting with @option{-f},
26097 @option{-p}, or @option{-O} must be defined in the same way as when
26098 the precompiled header was generated. At present, it's not clear
26099 which options are safe to change and which are not; the safest choice
26100 is to use exactly the same options when generating and using the
26101 precompiled header. The following are known to be safe:
26102
26103 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
26104 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
26105 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
26106 -pedantic-errors}
26107
26108 @end itemize
26109
26110 For all of these except the last, the compiler automatically
26111 ignores the precompiled header if the conditions aren't met. If you
26112 find an option combination that doesn't work and doesn't cause the
26113 precompiled header to be ignored, please consider filing a bug report,
26114 see @ref{Bugs}.
26115
26116 If you do use differing options when generating and using the
26117 precompiled header, the actual behavior is a mixture of the
26118 behavior for the options. For instance, if you use @option{-g} to
26119 generate the precompiled header but not when using it, you may or may
26120 not get debugging information for routines in the precompiled header.