]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
extend.texi: Use lowercase "boolean".
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2016 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2016 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included in the gfdl(7) man page.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43 Only the most useful options are listed here; see below for the
44 remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
76
77 Other options are passed on to one or more stages of processing. Some options
78 control the preprocessor and others the compiler itself. Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
81
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly. If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
88
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++}
98 instead. @xref{Invoking G++,,Compiling C++ Programs},
99 for information about the differences in behavior between @command{gcc}
100 and @code{g++} when compiling C++ programs.
101
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands. Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
108
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments. For the most part, the order
112 you use doesn't matter. Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified. Also,
115 the placement of the @option{-l} option is significant.
116
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}. This manual documents
122 only one of these two forms, whichever one is not the default.
123
124 @c man end
125
126 @xref{Option Index}, for an index to GCC's options.
127
128 @menu
129 * Option Summary:: Brief list of all options, without explanations.
130 * Overall Options:: Controlling the kind of output:
131 an executable, object files, assembler files,
132 or preprocessed source.
133 * Invoking G++:: Compiling C++ programs.
134 * C Dialect Options:: Controlling the variant of C language compiled.
135 * C++ Dialect Options:: Variations on C++.
136 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
137 and Objective-C++.
138 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
139 be formatted.
140 * Warning Options:: How picky should the compiler be?
141 * Debugging Options:: Producing debuggable code.
142 * Optimize Options:: How much optimization?
143 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
144 * Preprocessor Options:: Controlling header files and macro definitions.
145 Also, getting dependency information for Make.
146 * Assembler Options:: Passing options to the assembler.
147 * Link Options:: Specifying libraries and so on.
148 * Directory Options:: Where to find header files and libraries.
149 Where to find the compiler executable files.
150 * Code Gen Options:: Specifying conventions for function calls, data layout
151 and register usage.
152 * Developer Options:: Printing GCC configuration info, statistics, and
153 debugging dumps.
154 * Submodel Options:: Target-specific options, such as compiling for a
155 specific processor variant.
156 * Spec Files:: How to pass switches to sub-processes.
157 * Environment Variables:: Env vars that affect GCC.
158 * Precompiled Headers:: Compiling a header once, and using it many times.
159 @end menu
160
161 @c man begin OPTIONS
162
163 @node Option Summary
164 @section Option Summary
165
166 Here is a summary of all the options, grouped by type. Explanations are
167 in the following sections.
168
169 @table @emph
170 @item Overall Options
171 @xref{Overall Options,,Options Controlling the Kind of Output}.
172 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
173 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
174 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
175 @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
176 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
177
178 @item C Language Options
179 @xref{C Dialect Options,,Options Controlling C Dialect}.
180 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
181 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
182 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
183 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
184 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness}
185 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
186 -fsigned-bitfields -fsigned-char @gol
187 -funsigned-bitfields -funsigned-char @gol
188 -trigraphs -traditional -traditional-cpp}
189
190 @item C++ Language Options
191 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
192 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
193 -faligned-new=@var{n} -fargs-in-order=@var{n} -fcheck-new @gol
194 -fconstexpr-depth=@var{n} -fconstexpr-loop-limit=@var{n} @gol
195 -ffriend-injection @gol
196 -fno-elide-constructors @gol
197 -fno-enforce-eh-specs @gol
198 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
199 -fno-implicit-templates @gol
200 -fno-implicit-inline-templates @gol
201 -fno-implement-inlines -fms-extensions @gol
202 -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 -Wno-builtin-macro-redefined @gol
260 -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-nonliteral @gol
272 -Wformat-security -Wformat-signedness -Wformat-y2k -Wframe-address @gol
273 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
274 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
275 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
276 -Winit-self -Winline -Wno-int-conversion @gol
277 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
278 -Winvalid-pch -Wlarger-than=@var{len} @gol
279 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
280 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
281 -Wmisleading-indentation -Wmissing-braces @gol
282 -Wmissing-field-initializers -Wmissing-include-dirs @gol
283 -Wno-multichar -Wnonnull -Wnonnull-compare @gol
284 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
285 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
286 -Woverride-init-side-effects -Woverlength-strings @gol
287 -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
288 -Wparentheses -Wno-pedantic-ms-format @gol
289 -Wplacement-new -Wplacement-new=@var{n} @gol
290 -Wpointer-arith -Wno-pointer-to-int-cast @gol
291 -Wno-pragmas -Wredundant-decls -Wno-return-local-addr @gol
292 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
293 -Wshift-overflow -Wshift-overflow=@var{n} @gol
294 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
295 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
296 -Wno-scalar-storage-order @gol
297 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
298 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
299 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
300 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
301 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
302 -Wmissing-format-attribute -Wsubobject-linkage @gol
303 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
304 -Wswitch-unreachable -Wsync-nand @gol
305 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
306 -Wtype-limits -Wundef @gol
307 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
308 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
309 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
310 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
311 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
312 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
313 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
314 -Wvla -Wvolatile-register-var -Wwrite-strings @gol
315 -Wzero-as-null-pointer-constant -Whsa}
316
317 @item C and Objective-C-only Warning Options
318 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
319 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
320 -Wold-style-declaration -Wold-style-definition @gol
321 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
322 -Wdeclaration-after-statement -Wpointer-sign}
323
324 @item Debugging Options
325 @xref{Debugging Options,,Options for Debugging Your Program}.
326 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
327 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
328 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
329 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
330 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
331 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
332 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
333 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
334 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
335 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
336 -fvar-tracking -fvar-tracking-assignments}
337
338 @item Optimization Options
339 @xref{Optimize Options,,Options that Control Optimization}.
340 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
341 -falign-jumps[=@var{n}] @gol
342 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
343 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
344 -fauto-inc-dec -fbranch-probabilities @gol
345 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
346 -fbtr-bb-exclusive -fcaller-saves @gol
347 -fcombine-stack-adjustments -fconserve-stack @gol
348 -fcompare-elim -fcprop-registers -fcrossjumping @gol
349 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
350 -fcx-limited-range @gol
351 -fdata-sections -fdce -fdelayed-branch @gol
352 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
353 -fdevirtualize-at-ltrans -fdse @gol
354 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
355 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
356 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
357 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
358 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
359 -fif-conversion2 -findirect-inlining @gol
360 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
361 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment -fipa-bit-cp @gol
362 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
363 -fira-algorithm=@var{algorithm} @gol
364 -fira-region=@var{region} -fira-hoist-pressure @gol
365 -fira-loop-pressure -fno-ira-share-save-slots @gol
366 -fno-ira-share-spill-slots @gol
367 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
368 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
369 -fkeep-static-consts -flive-range-shrinkage @gol
370 -floop-block -floop-interchange -floop-strip-mine @gol
371 -floop-unroll-and-jam -floop-nest-optimize @gol
372 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
373 -flto-partition=@var{alg} -fmerge-all-constants @gol
374 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
375 -fmove-loop-invariants -fno-branch-count-reg @gol
376 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
377 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
378 -fno-peephole2 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
379 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
380 -fomit-frame-pointer -foptimize-sibling-calls @gol
381 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
382 -fprefetch-loop-arrays @gol
383 -fprofile-correction @gol
384 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
385 -fprofile-reorder-functions @gol
386 -freciprocal-math -free -frename-registers -freorder-blocks @gol
387 -freorder-blocks-algorithm=@var{algorithm} @gol
388 -freorder-blocks-and-partition -freorder-functions @gol
389 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
390 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
391 -fsched-spec-load -fsched-spec-load-dangerous @gol
392 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
393 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
394 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
395 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
396 -fschedule-fusion @gol
397 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
398 -fselective-scheduling -fselective-scheduling2 @gol
399 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
400 -fsemantic-interposition -fshrink-wrap -fsignaling-nans @gol
401 -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
402 -fsplit-paths @gol
403 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
404 -fstdarg-opt -fstrict-aliasing @gol
405 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
406 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
407 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
408 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting -ftree-loop-if-convert @gol
409 -ftree-loop-if-convert-stores -ftree-loop-im @gol
410 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
411 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
412 -ftree-loop-vectorize @gol
413 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
414 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
415 -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
416 -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
417 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
418 -funsafe-math-optimizations -funswitch-loops @gol
419 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
420 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
421 --param @var{name}=@var{value}
422 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
423
424 @item Program Instrumentation Options
425 @xref{Instrumentation Options,,Program Instrumentation Options}.
426 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
427 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
428 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
429 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
430 -fsanitize-undefined-trap-on-error -fbounds-check @gol
431 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
432 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
433 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
434 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
435 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
436 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
437 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
438 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
439 -fchkp-use-wrappers @gol
440 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
441 -fstack-protector-explicit -fstack-check @gol
442 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
443 -fno-stack-limit -fsplit-stack @gol
444 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
445 -fvtv-counts -fvtv-debug @gol
446 -finstrument-functions @gol
447 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
448 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
449
450 @item Preprocessor Options
451 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
452 @gccoptlist{-A@var{question}=@var{answer} @gol
453 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
454 -C -dD -dI -dM -dN @gol
455 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
456 -idirafter @var{dir} @gol
457 -include @var{file} -imacros @var{file} @gol
458 -iprefix @var{file} -iwithprefix @var{dir} @gol
459 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
460 -imultilib @var{dir} -isysroot @var{dir} @gol
461 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
462 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
463 -remap -trigraphs -undef -U@var{macro} @gol
464 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
465
466 @item Assembler Option
467 @xref{Assembler Options,,Passing Options to the Assembler}.
468 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
469
470 @item Linker Options
471 @xref{Link Options,,Options for Linking}.
472 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
473 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
474 -s -static -static-libgcc -static-libstdc++ @gol
475 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
476 -static-libmpx -static-libmpxwrappers @gol
477 -shared -shared-libgcc -symbolic @gol
478 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
479 -u @var{symbol} -z @var{keyword}}
480
481 @item Directory Options
482 @xref{Directory Options,,Options for Directory Search}.
483 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
484 -iquote@var{dir} -L@var{dir} -no-canonical-prefixes -I- @gol
485 --sysroot=@var{dir} --no-sysroot-suffix}
486
487 @item Code Generation Options
488 @xref{Code Gen Options,,Options for Code Generation Conventions}.
489 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
490 -ffixed-@var{reg} -fexceptions @gol
491 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
492 -fasynchronous-unwind-tables @gol
493 -fno-gnu-unique @gol
494 -finhibit-size-directive -fno-common -fno-ident @gol
495 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
496 -fno-jump-tables @gol
497 -frecord-gcc-switches @gol
498 -freg-struct-return -fshort-enums -fshort-wchar @gol
499 -fverbose-asm -fpack-struct[=@var{n}] @gol
500 -fleading-underscore -ftls-model=@var{model} @gol
501 -fstack-reuse=@var{reuse_level} @gol
502 -ftrapv -fwrapv @gol
503 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
504 -fstrict-volatile-bitfields -fsync-libcalls}
505
506 @item Developer Options
507 @xref{Developer Options,,GCC Developer Options}.
508 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
509 -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
510 -fdbg-cnt=@var{counter-value-list} @gol
511 -fdisable-ipa-@var{pass_name} @gol
512 -fdisable-rtl-@var{pass_name} @gol
513 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
514 -fdisable-tree-@var{pass_name} @gol
515 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
516 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
517 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
518 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
519 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
520 -fdump-passes @gol
521 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
522 -fdump-statistics @gol
523 -fdump-tree-all @gol
524 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
525 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
526 -fdump-tree-cfg -fdump-tree-alias @gol
527 -fdump-tree-ch @gol
528 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
529 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
530 -fdump-tree-gimple@r{[}-raw@r{]} @gol
531 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
532 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
533 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
534 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
535 -fdump-tree-backprop@r{[}-@var{n}@r{]} @gol
536 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
537 -fdump-tree-nrv -fdump-tree-vect @gol
538 -fdump-tree-sink @gol
539 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
540 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
541 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
542 -fdump-tree-vtable-verify @gol
543 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
544 -fdump-tree-split-paths@r{[}-@var{n}@r{]} @gol
545 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
546 -fdump-final-insns=@var{file} @gol
547 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
548 -fenable-@var{kind}-@var{pass} @gol
549 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
550 -fira-verbose=@var{n} @gol
551 -flto-report -flto-report-wpa -fmem-report-wpa @gol
552 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
553 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
554 -fprofile-report @gol
555 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
556 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
557 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
558 -fvar-tracking-assignments-toggle -gtoggle @gol
559 -print-file-name=@var{library} -print-libgcc-file-name @gol
560 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
561 -print-prog-name=@var{program} -print-search-dirs -Q @gol
562 -print-sysroot -print-sysroot-headers-suffix @gol
563 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
564
565 @item Machine-Dependent Options
566 @xref{Submodel Options,,Machine-Dependent Options}.
567 @c This list is ordered alphanumerically by subsection name.
568 @c Try and put the significant identifier (CPU or system) first,
569 @c so users have a clue at guessing where the ones they want will be.
570
571 @emph{AArch64 Options}
572 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
573 -mgeneral-regs-only @gol
574 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
575 -mstrict-align @gol
576 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
577 -mtls-dialect=desc -mtls-dialect=traditional @gol
578 -mtls-size=@var{size} @gol
579 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
580 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol
581 -mlow-precision-recip-sqrt -mno-low-precision-recip-sqrt@gol
582 -mlow-precision-sqrt -mno-low-precision-sqrt@gol
583 -mlow-precision-div -mno-low-precision-div @gol
584 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
585
586 @emph{Adapteva Epiphany Options}
587 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
588 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
589 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
590 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
591 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
592 -msplit-vecmove-early -m1reg-@var{reg}}
593
594 @emph{ARC Options}
595 @gccoptlist{-mbarrel-shifter @gol
596 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
597 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
598 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
599 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
600 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
601 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
602 -mlong-calls -mmedium-calls -msdata @gol
603 -mucb-mcount -mvolatile-cache -mtp-regno=@var{regno} @gol
604 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
605 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
606 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
607 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
608 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
609 -mtune=@var{cpu} -mmultcost=@var{num} @gol
610 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
611 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
612
613 @emph{ARM Options}
614 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
615 -mabi=@var{name} @gol
616 -mapcs-stack-check -mno-apcs-stack-check @gol
617 -mapcs-float -mno-apcs-float @gol
618 -mapcs-reentrant -mno-apcs-reentrant @gol
619 -msched-prolog -mno-sched-prolog @gol
620 -mlittle-endian -mbig-endian @gol
621 -mfloat-abi=@var{name} @gol
622 -mfp16-format=@var{name}
623 -mthumb-interwork -mno-thumb-interwork @gol
624 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
625 -mtune=@var{name} -mprint-tune-info @gol
626 -mstructure-size-boundary=@var{n} @gol
627 -mabort-on-noreturn @gol
628 -mlong-calls -mno-long-calls @gol
629 -msingle-pic-base -mno-single-pic-base @gol
630 -mpic-register=@var{reg} @gol
631 -mnop-fun-dllimport @gol
632 -mpoke-function-name @gol
633 -mthumb -marm @gol
634 -mtpcs-frame -mtpcs-leaf-frame @gol
635 -mcaller-super-interworking -mcallee-super-interworking @gol
636 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
637 -mword-relocations @gol
638 -mfix-cortex-m3-ldrd @gol
639 -munaligned-access @gol
640 -mneon-for-64bits @gol
641 -mslow-flash-data @gol
642 -masm-syntax-unified @gol
643 -mrestrict-it}
644
645 @emph{AVR Options}
646 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
647 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
648 -mrelax -mrmw -mstrict-X -mtiny-stack -mfract-convert-truncate -nodevicelib @gol
649 -Waddr-space-convert -Wmisspelled-isr}
650
651 @emph{Blackfin Options}
652 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
653 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
654 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
655 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
656 -mno-id-shared-library -mshared-library-id=@var{n} @gol
657 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
658 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
659 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
660 -micplb}
661
662 @emph{C6X Options}
663 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
664 -msim -msdata=@var{sdata-type}}
665
666 @emph{CRIS Options}
667 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
668 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
669 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
670 -mstack-align -mdata-align -mconst-align @gol
671 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
672 -melf -maout -melinux -mlinux -sim -sim2 @gol
673 -mmul-bug-workaround -mno-mul-bug-workaround}
674
675 @emph{CR16 Options}
676 @gccoptlist{-mmac @gol
677 -mcr16cplus -mcr16c @gol
678 -msim -mint32 -mbit-ops
679 -mdata-model=@var{model}}
680
681 @emph{Darwin Options}
682 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
683 -arch_only -bind_at_load -bundle -bundle_loader @gol
684 -client_name -compatibility_version -current_version @gol
685 -dead_strip @gol
686 -dependency-file -dylib_file -dylinker_install_name @gol
687 -dynamic -dynamiclib -exported_symbols_list @gol
688 -filelist -flat_namespace -force_cpusubtype_ALL @gol
689 -force_flat_namespace -headerpad_max_install_names @gol
690 -iframework @gol
691 -image_base -init -install_name -keep_private_externs @gol
692 -multi_module -multiply_defined -multiply_defined_unused @gol
693 -noall_load -no_dead_strip_inits_and_terms @gol
694 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
695 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
696 -private_bundle -read_only_relocs -sectalign @gol
697 -sectobjectsymbols -whyload -seg1addr @gol
698 -sectcreate -sectobjectsymbols -sectorder @gol
699 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
700 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
701 -segprot -segs_read_only_addr -segs_read_write_addr @gol
702 -single_module -static -sub_library -sub_umbrella @gol
703 -twolevel_namespace -umbrella -undefined @gol
704 -unexported_symbols_list -weak_reference_mismatches @gol
705 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
706 -mkernel -mone-byte-bool}
707
708 @emph{DEC Alpha Options}
709 @gccoptlist{-mno-fp-regs -msoft-float @gol
710 -mieee -mieee-with-inexact -mieee-conformant @gol
711 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
712 -mtrap-precision=@var{mode} -mbuild-constants @gol
713 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
714 -mbwx -mmax -mfix -mcix @gol
715 -mfloat-vax -mfloat-ieee @gol
716 -mexplicit-relocs -msmall-data -mlarge-data @gol
717 -msmall-text -mlarge-text @gol
718 -mmemory-latency=@var{time}}
719
720 @emph{FR30 Options}
721 @gccoptlist{-msmall-model -mno-lsim}
722
723 @emph{FT32 Options}
724 @gccoptlist{-msim -mlra -mnodiv}
725
726 @emph{FRV Options}
727 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
728 -mhard-float -msoft-float @gol
729 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
730 -mdouble -mno-double @gol
731 -mmedia -mno-media -mmuladd -mno-muladd @gol
732 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
733 -mlinked-fp -mlong-calls -malign-labels @gol
734 -mlibrary-pic -macc-4 -macc-8 @gol
735 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
736 -moptimize-membar -mno-optimize-membar @gol
737 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
738 -mvliw-branch -mno-vliw-branch @gol
739 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
740 -mno-nested-cond-exec -mtomcat-stats @gol
741 -mTLS -mtls @gol
742 -mcpu=@var{cpu}}
743
744 @emph{GNU/Linux Options}
745 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
746 -tno-android-cc -tno-android-ld}
747
748 @emph{H8/300 Options}
749 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
750
751 @emph{HPPA Options}
752 @gccoptlist{-march=@var{architecture-type} @gol
753 -mdisable-fpregs -mdisable-indexing @gol
754 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
755 -mfixed-range=@var{register-range} @gol
756 -mjump-in-delay -mlinker-opt -mlong-calls @gol
757 -mlong-load-store -mno-disable-fpregs @gol
758 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
759 -mno-jump-in-delay -mno-long-load-store @gol
760 -mno-portable-runtime -mno-soft-float @gol
761 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
762 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
763 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
764 -munix=@var{unix-std} -nolibdld -static -threads}
765
766 @emph{IA-64 Options}
767 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
768 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
769 -mconstant-gp -mauto-pic -mfused-madd @gol
770 -minline-float-divide-min-latency @gol
771 -minline-float-divide-max-throughput @gol
772 -mno-inline-float-divide @gol
773 -minline-int-divide-min-latency @gol
774 -minline-int-divide-max-throughput @gol
775 -mno-inline-int-divide @gol
776 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
777 -mno-inline-sqrt @gol
778 -mdwarf2-asm -mearly-stop-bits @gol
779 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
780 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
781 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
782 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
783 -msched-spec-ldc -msched-spec-control-ldc @gol
784 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
785 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
786 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
787 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
788
789 @emph{LM32 Options}
790 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
791 -msign-extend-enabled -muser-enabled}
792
793 @emph{M32R/D Options}
794 @gccoptlist{-m32r2 -m32rx -m32r @gol
795 -mdebug @gol
796 -malign-loops -mno-align-loops @gol
797 -missue-rate=@var{number} @gol
798 -mbranch-cost=@var{number} @gol
799 -mmodel=@var{code-size-model-type} @gol
800 -msdata=@var{sdata-type} @gol
801 -mno-flush-func -mflush-func=@var{name} @gol
802 -mno-flush-trap -mflush-trap=@var{number} @gol
803 -G @var{num}}
804
805 @emph{M32C Options}
806 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
807
808 @emph{M680x0 Options}
809 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
810 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
811 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
812 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
813 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
814 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
815 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
816 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
817 -mxgot -mno-xgot}
818
819 @emph{MCore Options}
820 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
821 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
822 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
823 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
824 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
825
826 @emph{MeP Options}
827 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
828 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
829 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
830 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
831 -mtiny=@var{n}}
832
833 @emph{MicroBlaze Options}
834 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
835 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
836 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
837 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
838 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
839
840 @emph{MIPS Options}
841 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
842 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
843 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
844 -mips16 -mno-mips16 -mflip-mips16 @gol
845 -minterlink-compressed -mno-interlink-compressed @gol
846 -minterlink-mips16 -mno-interlink-mips16 @gol
847 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
848 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
849 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
850 -mno-float -msingle-float -mdouble-float @gol
851 -modd-spreg -mno-odd-spreg @gol
852 -mabs=@var{mode} -mnan=@var{encoding} @gol
853 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
854 -mmcu -mmno-mcu @gol
855 -meva -mno-eva @gol
856 -mvirt -mno-virt @gol
857 -mxpa -mno-xpa @gol
858 -mmicromips -mno-micromips @gol
859 -mmsa -mno-msa @gol
860 -mfpu=@var{fpu-type} @gol
861 -msmartmips -mno-smartmips @gol
862 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
863 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
864 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
865 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
866 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
867 -membedded-data -mno-embedded-data @gol
868 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
869 -mcode-readable=@var{setting} @gol
870 -msplit-addresses -mno-split-addresses @gol
871 -mexplicit-relocs -mno-explicit-relocs @gol
872 -mcheck-zero-division -mno-check-zero-division @gol
873 -mdivide-traps -mdivide-breaks @gol
874 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
875 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
876 -mfix-24k -mno-fix-24k @gol
877 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
878 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
879 -mfix-vr4120 -mno-fix-vr4120 @gol
880 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
881 -mflush-func=@var{func} -mno-flush-func @gol
882 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
883 -mcompact-branches=@var{policy} @gol
884 -mfp-exceptions -mno-fp-exceptions @gol
885 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
886 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
887 -mframe-header-opt -mno-frame-header-opt}
888
889 @emph{MMIX Options}
890 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
891 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
892 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
893 -mno-base-addresses -msingle-exit -mno-single-exit}
894
895 @emph{MN10300 Options}
896 @gccoptlist{-mmult-bug -mno-mult-bug @gol
897 -mno-am33 -mam33 -mam33-2 -mam34 @gol
898 -mtune=@var{cpu-type} @gol
899 -mreturn-pointer-on-d0 @gol
900 -mno-crt0 -mrelax -mliw -msetlb}
901
902 @emph{Moxie Options}
903 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
904
905 @emph{MSP430 Options}
906 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
907 -mwarn-mcu @gol
908 -mcode-region= -mdata-region= @gol
909 -msilicon-errata= -msilicon-errata-warn= @gol
910 -mhwmult= -minrt}
911
912 @emph{NDS32 Options}
913 @gccoptlist{-mbig-endian -mlittle-endian @gol
914 -mreduced-regs -mfull-regs @gol
915 -mcmov -mno-cmov @gol
916 -mperf-ext -mno-perf-ext @gol
917 -mv3push -mno-v3push @gol
918 -m16bit -mno-16bit @gol
919 -misr-vector-size=@var{num} @gol
920 -mcache-block-size=@var{num} @gol
921 -march=@var{arch} @gol
922 -mcmodel=@var{code-model} @gol
923 -mctor-dtor -mrelax}
924
925 @emph{Nios II Options}
926 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
927 -mel -meb @gol
928 -mno-bypass-cache -mbypass-cache @gol
929 -mno-cache-volatile -mcache-volatile @gol
930 -mno-fast-sw-div -mfast-sw-div @gol
931 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
932 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
933 -mcustom-fpu-cfg=@var{name} @gol
934 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
935 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
936
937 @emph{Nvidia PTX Options}
938 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
939
940 @emph{PDP-11 Options}
941 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
942 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
943 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
944 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
945 -mbranch-expensive -mbranch-cheap @gol
946 -munix-asm -mdec-asm}
947
948 @emph{picoChip Options}
949 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
950 -msymbol-as-address -mno-inefficient-warnings}
951
952 @emph{PowerPC Options}
953 See RS/6000 and PowerPC Options.
954
955 @emph{RL78 Options}
956 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
957 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
958 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
959
960 @emph{RS/6000 and PowerPC Options}
961 @gccoptlist{-mcpu=@var{cpu-type} @gol
962 -mtune=@var{cpu-type} @gol
963 -mcmodel=@var{code-model} @gol
964 -mpowerpc64 @gol
965 -maltivec -mno-altivec @gol
966 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
967 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
968 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
969 -mfprnd -mno-fprnd @gol
970 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
971 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
972 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
973 -malign-power -malign-natural @gol
974 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
975 -msingle-float -mdouble-float -msimple-fpu @gol
976 -mstring -mno-string -mupdate -mno-update @gol
977 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
978 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
979 -mstrict-align -mno-strict-align -mrelocatable @gol
980 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
981 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
982 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
983 -mprioritize-restricted-insns=@var{priority} @gol
984 -msched-costly-dep=@var{dependence_type} @gol
985 -minsert-sched-nops=@var{scheme} @gol
986 -mcall-sysv -mcall-netbsd @gol
987 -maix-struct-return -msvr4-struct-return @gol
988 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
989 -mblock-move-inline-limit=@var{num} @gol
990 -misel -mno-isel @gol
991 -misel=yes -misel=no @gol
992 -mspe -mno-spe @gol
993 -mspe=yes -mspe=no @gol
994 -mpaired @gol
995 -mgen-cell-microcode -mwarn-cell-microcode @gol
996 -mvrsave -mno-vrsave @gol
997 -mmulhw -mno-mulhw @gol
998 -mdlmzb -mno-dlmzb @gol
999 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1000 -mprototype -mno-prototype @gol
1001 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1002 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
1003 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1004 -mno-recip-precision @gol
1005 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1006 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1007 -msave-toc-indirect -mno-save-toc-indirect @gol
1008 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1009 -mcrypto -mno-crypto -mhtm -mno-htm -mdirect-move -mno-direct-move @gol
1010 -mquad-memory -mno-quad-memory @gol
1011 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1012 -mcompat-align-parm -mno-compat-align-parm @gol
1013 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
1014 -mupper-regs-di -mno-upper-regs-di @gol
1015 -mupper-regs -mno-upper-regs @gol
1016 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1017 -mlra -mno-lra}
1018
1019 @emph{RX Options}
1020 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1021 -mcpu=@gol
1022 -mbig-endian-data -mlittle-endian-data @gol
1023 -msmall-data @gol
1024 -msim -mno-sim@gol
1025 -mas100-syntax -mno-as100-syntax@gol
1026 -mrelax@gol
1027 -mmax-constant-size=@gol
1028 -mint-register=@gol
1029 -mpid@gol
1030 -mallow-string-insns -mno-allow-string-insns@gol
1031 -mjsr@gol
1032 -mno-warn-multiple-fast-interrupts@gol
1033 -msave-acc-in-interrupts}
1034
1035 @emph{S/390 and zSeries Options}
1036 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1037 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1038 -mlong-double-64 -mlong-double-128 @gol
1039 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1040 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1041 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1042 -mhtm -mvx -mzvector @gol
1043 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1044 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1045 -mhotpatch=@var{halfwords},@var{halfwords}}
1046
1047 @emph{Score Options}
1048 @gccoptlist{-meb -mel @gol
1049 -mnhwloop @gol
1050 -muls @gol
1051 -mmac @gol
1052 -mscore5 -mscore5u -mscore7 -mscore7d}
1053
1054 @emph{SH Options}
1055 @gccoptlist{-m1 -m2 -m2e @gol
1056 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1057 -m3 -m3e @gol
1058 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1059 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1060 -mb -ml -mdalign -mrelax @gol
1061 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1062 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1063 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1064 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1065 -maccumulate-outgoing-args @gol
1066 -matomic-model=@var{atomic-model} @gol
1067 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1068 -mcbranch-force-delay-slot @gol
1069 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1070 -mpretend-cmove -mtas}
1071
1072 @emph{Solaris 2 Options}
1073 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1074 -pthreads -pthread}
1075
1076 @emph{SPARC Options}
1077 @gccoptlist{-mcpu=@var{cpu-type} @gol
1078 -mtune=@var{cpu-type} @gol
1079 -mcmodel=@var{code-model} @gol
1080 -mmemory-model=@var{mem-model} @gol
1081 -m32 -m64 -mapp-regs -mno-app-regs @gol
1082 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1083 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1084 -mhard-quad-float -msoft-quad-float @gol
1085 -mstack-bias -mno-stack-bias @gol
1086 -mstd-struct-return -mno-std-struct-return @gol
1087 -munaligned-doubles -mno-unaligned-doubles @gol
1088 -muser-mode -mno-user-mode @gol
1089 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1090 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1091 -mcbcond -mno-cbcond @gol
1092 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
1093 -mfix-at697f -mfix-ut699}
1094
1095 @emph{SPU Options}
1096 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1097 -msafe-dma -munsafe-dma @gol
1098 -mbranch-hints @gol
1099 -msmall-mem -mlarge-mem -mstdmain @gol
1100 -mfixed-range=@var{register-range} @gol
1101 -mea32 -mea64 @gol
1102 -maddress-space-conversion -mno-address-space-conversion @gol
1103 -mcache-size=@var{cache-size} @gol
1104 -matomic-updates -mno-atomic-updates}
1105
1106 @emph{System V Options}
1107 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1108
1109 @emph{TILE-Gx Options}
1110 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1111 -mcmodel=@var{code-model}}
1112
1113 @emph{TILEPro Options}
1114 @gccoptlist{-mcpu=@var{cpu} -m32}
1115
1116 @emph{V850 Options}
1117 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1118 -mprolog-function -mno-prolog-function -mspace @gol
1119 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1120 -mapp-regs -mno-app-regs @gol
1121 -mdisable-callt -mno-disable-callt @gol
1122 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1123 -mv850e -mv850 -mv850e3v5 @gol
1124 -mloop @gol
1125 -mrelax @gol
1126 -mlong-jumps @gol
1127 -msoft-float @gol
1128 -mhard-float @gol
1129 -mgcc-abi @gol
1130 -mrh850-abi @gol
1131 -mbig-switch}
1132
1133 @emph{VAX Options}
1134 @gccoptlist{-mg -mgnu -munix}
1135
1136 @emph{Visium Options}
1137 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1138 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1139
1140 @emph{VMS Options}
1141 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1142 -mpointer-size=@var{size}}
1143
1144 @emph{VxWorks Options}
1145 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1146 -Xbind-lazy -Xbind-now}
1147
1148 @emph{x86 Options}
1149 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1150 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1151 -mfpmath=@var{unit} @gol
1152 -masm=@var{dialect} -mno-fancy-math-387 @gol
1153 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1154 -mno-wide-multiply -mrtd -malign-double @gol
1155 -mpreferred-stack-boundary=@var{num} @gol
1156 -mincoming-stack-boundary=@var{num} @gol
1157 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1158 -mrecip -mrecip=@var{opt} @gol
1159 -mvzeroupper -mprefer-avx128 @gol
1160 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1161 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1162 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1163 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1164 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1165 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
1166 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mclzero
1167 -mpku -mthreads @gol
1168 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1169 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1170 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1171 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1172 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1173 -mregparm=@var{num} -msseregparm @gol
1174 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1175 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1176 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1177 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1178 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1179 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1180 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1181 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1182 -mmitigate-rop -mgeneral-regs-only}
1183
1184 @emph{x86 Windows Options}
1185 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1186 -mnop-fun-dllimport -mthread @gol
1187 -municode -mwin32 -mwindows -fno-set-stack-executable}
1188
1189 @emph{Xstormy16 Options}
1190 @gccoptlist{-msim}
1191
1192 @emph{Xtensa Options}
1193 @gccoptlist{-mconst16 -mno-const16 @gol
1194 -mfused-madd -mno-fused-madd @gol
1195 -mforce-no-pic @gol
1196 -mserialize-volatile -mno-serialize-volatile @gol
1197 -mtext-section-literals -mno-text-section-literals @gol
1198 -mauto-litpools -mno-auto-litpools @gol
1199 -mtarget-align -mno-target-align @gol
1200 -mlongcalls -mno-longcalls}
1201
1202 @emph{zSeries Options}
1203 See S/390 and zSeries Options.
1204 @end table
1205
1206
1207 @node Overall Options
1208 @section Options Controlling the Kind of Output
1209
1210 Compilation can involve up to four stages: preprocessing, compilation
1211 proper, assembly and linking, always in that order. GCC is capable of
1212 preprocessing and compiling several files either into several
1213 assembler input files, or into one assembler input file; then each
1214 assembler input file produces an object file, and linking combines all
1215 the object files (those newly compiled, and those specified as input)
1216 into an executable file.
1217
1218 @cindex file name suffix
1219 For any given input file, the file name suffix determines what kind of
1220 compilation is done:
1221
1222 @table @gcctabopt
1223 @item @var{file}.c
1224 C source code that must be preprocessed.
1225
1226 @item @var{file}.i
1227 C source code that should not be preprocessed.
1228
1229 @item @var{file}.ii
1230 C++ source code that should not be preprocessed.
1231
1232 @item @var{file}.m
1233 Objective-C source code. Note that you must link with the @file{libobjc}
1234 library to make an Objective-C program work.
1235
1236 @item @var{file}.mi
1237 Objective-C source code that should not be preprocessed.
1238
1239 @item @var{file}.mm
1240 @itemx @var{file}.M
1241 Objective-C++ source code. Note that you must link with the @file{libobjc}
1242 library to make an Objective-C++ program work. Note that @samp{.M} refers
1243 to a literal capital M@.
1244
1245 @item @var{file}.mii
1246 Objective-C++ source code that should not be preprocessed.
1247
1248 @item @var{file}.h
1249 C, C++, Objective-C or Objective-C++ header file to be turned into a
1250 precompiled header (default), or C, C++ header file to be turned into an
1251 Ada spec (via the @option{-fdump-ada-spec} switch).
1252
1253 @item @var{file}.cc
1254 @itemx @var{file}.cp
1255 @itemx @var{file}.cxx
1256 @itemx @var{file}.cpp
1257 @itemx @var{file}.CPP
1258 @itemx @var{file}.c++
1259 @itemx @var{file}.C
1260 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1261 the last two letters must both be literally @samp{x}. Likewise,
1262 @samp{.C} refers to a literal capital C@.
1263
1264 @item @var{file}.mm
1265 @itemx @var{file}.M
1266 Objective-C++ source code that must be preprocessed.
1267
1268 @item @var{file}.mii
1269 Objective-C++ source code that should not be preprocessed.
1270
1271 @item @var{file}.hh
1272 @itemx @var{file}.H
1273 @itemx @var{file}.hp
1274 @itemx @var{file}.hxx
1275 @itemx @var{file}.hpp
1276 @itemx @var{file}.HPP
1277 @itemx @var{file}.h++
1278 @itemx @var{file}.tcc
1279 C++ header file to be turned into a precompiled header or Ada spec.
1280
1281 @item @var{file}.f
1282 @itemx @var{file}.for
1283 @itemx @var{file}.ftn
1284 Fixed form Fortran source code that should not be preprocessed.
1285
1286 @item @var{file}.F
1287 @itemx @var{file}.FOR
1288 @itemx @var{file}.fpp
1289 @itemx @var{file}.FPP
1290 @itemx @var{file}.FTN
1291 Fixed form Fortran source code that must be preprocessed (with the traditional
1292 preprocessor).
1293
1294 @item @var{file}.f90
1295 @itemx @var{file}.f95
1296 @itemx @var{file}.f03
1297 @itemx @var{file}.f08
1298 Free form Fortran source code that should not be preprocessed.
1299
1300 @item @var{file}.F90
1301 @itemx @var{file}.F95
1302 @itemx @var{file}.F03
1303 @itemx @var{file}.F08
1304 Free form Fortran source code that must be preprocessed (with the
1305 traditional preprocessor).
1306
1307 @item @var{file}.go
1308 Go source code.
1309
1310 @c FIXME: Descriptions of Java file types.
1311 @c @var{file}.java
1312 @c @var{file}.class
1313 @c @var{file}.zip
1314 @c @var{file}.jar
1315
1316 @item @var{file}.ads
1317 Ada source code file that contains a library unit declaration (a
1318 declaration of a package, subprogram, or generic, or a generic
1319 instantiation), or a library unit renaming declaration (a package,
1320 generic, or subprogram renaming declaration). Such files are also
1321 called @dfn{specs}.
1322
1323 @item @var{file}.adb
1324 Ada source code file containing a library unit body (a subprogram or
1325 package body). Such files are also called @dfn{bodies}.
1326
1327 @c GCC also knows about some suffixes for languages not yet included:
1328 @c Pascal:
1329 @c @var{file}.p
1330 @c @var{file}.pas
1331 @c Ratfor:
1332 @c @var{file}.r
1333
1334 @item @var{file}.s
1335 Assembler code.
1336
1337 @item @var{file}.S
1338 @itemx @var{file}.sx
1339 Assembler code that must be preprocessed.
1340
1341 @item @var{other}
1342 An object file to be fed straight into linking.
1343 Any file name with no recognized suffix is treated this way.
1344 @end table
1345
1346 @opindex x
1347 You can specify the input language explicitly with the @option{-x} option:
1348
1349 @table @gcctabopt
1350 @item -x @var{language}
1351 Specify explicitly the @var{language} for the following input files
1352 (rather than letting the compiler choose a default based on the file
1353 name suffix). This option applies to all following input files until
1354 the next @option{-x} option. Possible values for @var{language} are:
1355 @smallexample
1356 c c-header cpp-output
1357 c++ c++-header c++-cpp-output
1358 objective-c objective-c-header objective-c-cpp-output
1359 objective-c++ objective-c++-header objective-c++-cpp-output
1360 assembler assembler-with-cpp
1361 ada
1362 f77 f77-cpp-input f95 f95-cpp-input
1363 go
1364 java
1365 @end smallexample
1366
1367 @item -x none
1368 Turn off any specification of a language, so that subsequent files are
1369 handled according to their file name suffixes (as they are if @option{-x}
1370 has not been used at all).
1371 @end table
1372
1373 If you only want some of the stages of compilation, you can use
1374 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1375 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1376 @command{gcc} is to stop. Note that some combinations (for example,
1377 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1378
1379 @table @gcctabopt
1380 @item -c
1381 @opindex c
1382 Compile or assemble the source files, but do not link. The linking
1383 stage simply is not done. The ultimate output is in the form of an
1384 object file for each source file.
1385
1386 By default, the object file name for a source file is made by replacing
1387 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1388
1389 Unrecognized input files, not requiring compilation or assembly, are
1390 ignored.
1391
1392 @item -S
1393 @opindex S
1394 Stop after the stage of compilation proper; do not assemble. The output
1395 is in the form of an assembler code file for each non-assembler input
1396 file specified.
1397
1398 By default, the assembler file name for a source file is made by
1399 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1400
1401 Input files that don't require compilation are ignored.
1402
1403 @item -E
1404 @opindex E
1405 Stop after the preprocessing stage; do not run the compiler proper. The
1406 output is in the form of preprocessed source code, which is sent to the
1407 standard output.
1408
1409 Input files that don't require preprocessing are ignored.
1410
1411 @cindex output file option
1412 @item -o @var{file}
1413 @opindex o
1414 Place output in file @var{file}. This applies to whatever
1415 sort of output is being produced, whether it be an executable file,
1416 an object file, an assembler file or preprocessed C code.
1417
1418 If @option{-o} is not specified, the default is to put an executable
1419 file in @file{a.out}, the object file for
1420 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1421 assembler file in @file{@var{source}.s}, a precompiled header file in
1422 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1423 standard output.
1424
1425 @item -v
1426 @opindex v
1427 Print (on standard error output) the commands executed to run the stages
1428 of compilation. Also print the version number of the compiler driver
1429 program and of the preprocessor and the compiler proper.
1430
1431 @item -###
1432 @opindex ###
1433 Like @option{-v} except the commands are not executed and arguments
1434 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1435 This is useful for shell scripts to capture the driver-generated command lines.
1436
1437 @item --help
1438 @opindex help
1439 Print (on the standard output) a description of the command-line options
1440 understood by @command{gcc}. If the @option{-v} option is also specified
1441 then @option{--help} is also passed on to the various processes
1442 invoked by @command{gcc}, so that they can display the command-line options
1443 they accept. If the @option{-Wextra} option has also been specified
1444 (prior to the @option{--help} option), then command-line options that
1445 have no documentation associated with them are also displayed.
1446
1447 @item --target-help
1448 @opindex target-help
1449 Print (on the standard output) a description of target-specific command-line
1450 options for each tool. For some targets extra target-specific
1451 information may also be printed.
1452
1453 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1454 Print (on the standard output) a description of the command-line
1455 options understood by the compiler that fit into all specified classes
1456 and qualifiers. These are the supported classes:
1457
1458 @table @asis
1459 @item @samp{optimizers}
1460 Display all of the optimization options supported by the
1461 compiler.
1462
1463 @item @samp{warnings}
1464 Display all of the options controlling warning messages
1465 produced by the compiler.
1466
1467 @item @samp{target}
1468 Display target-specific options. Unlike the
1469 @option{--target-help} option however, target-specific options of the
1470 linker and assembler are not displayed. This is because those
1471 tools do not currently support the extended @option{--help=} syntax.
1472
1473 @item @samp{params}
1474 Display the values recognized by the @option{--param}
1475 option.
1476
1477 @item @var{language}
1478 Display the options supported for @var{language}, where
1479 @var{language} is the name of one of the languages supported in this
1480 version of GCC@.
1481
1482 @item @samp{common}
1483 Display the options that are common to all languages.
1484 @end table
1485
1486 These are the supported qualifiers:
1487
1488 @table @asis
1489 @item @samp{undocumented}
1490 Display only those options that are undocumented.
1491
1492 @item @samp{joined}
1493 Display options taking an argument that appears after an equal
1494 sign in the same continuous piece of text, such as:
1495 @samp{--help=target}.
1496
1497 @item @samp{separate}
1498 Display options taking an argument that appears as a separate word
1499 following the original option, such as: @samp{-o output-file}.
1500 @end table
1501
1502 Thus for example to display all the undocumented target-specific
1503 switches supported by the compiler, use:
1504
1505 @smallexample
1506 --help=target,undocumented
1507 @end smallexample
1508
1509 The sense of a qualifier can be inverted by prefixing it with the
1510 @samp{^} character, so for example to display all binary warning
1511 options (i.e., ones that are either on or off and that do not take an
1512 argument) that have a description, use:
1513
1514 @smallexample
1515 --help=warnings,^joined,^undocumented
1516 @end smallexample
1517
1518 The argument to @option{--help=} should not consist solely of inverted
1519 qualifiers.
1520
1521 Combining several classes is possible, although this usually
1522 restricts the output so much that there is nothing to display. One
1523 case where it does work, however, is when one of the classes is
1524 @var{target}. For example, to display all the target-specific
1525 optimization options, use:
1526
1527 @smallexample
1528 --help=target,optimizers
1529 @end smallexample
1530
1531 The @option{--help=} option can be repeated on the command line. Each
1532 successive use displays its requested class of options, skipping
1533 those that have already been displayed.
1534
1535 If the @option{-Q} option appears on the command line before the
1536 @option{--help=} option, then the descriptive text displayed by
1537 @option{--help=} is changed. Instead of describing the displayed
1538 options, an indication is given as to whether the option is enabled,
1539 disabled or set to a specific value (assuming that the compiler
1540 knows this at the point where the @option{--help=} option is used).
1541
1542 Here is a truncated example from the ARM port of @command{gcc}:
1543
1544 @smallexample
1545 % gcc -Q -mabi=2 --help=target -c
1546 The following options are target specific:
1547 -mabi= 2
1548 -mabort-on-noreturn [disabled]
1549 -mapcs [disabled]
1550 @end smallexample
1551
1552 The output is sensitive to the effects of previous command-line
1553 options, so for example it is possible to find out which optimizations
1554 are enabled at @option{-O2} by using:
1555
1556 @smallexample
1557 -Q -O2 --help=optimizers
1558 @end smallexample
1559
1560 Alternatively you can discover which binary optimizations are enabled
1561 by @option{-O3} by using:
1562
1563 @smallexample
1564 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1565 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1566 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1567 @end smallexample
1568
1569 @item --version
1570 @opindex version
1571 Display the version number and copyrights of the invoked GCC@.
1572
1573 @item -pass-exit-codes
1574 @opindex pass-exit-codes
1575 Normally the @command{gcc} program exits with the code of 1 if any
1576 phase of the compiler returns a non-success return code. If you specify
1577 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1578 the numerically highest error produced by any phase returning an error
1579 indication. The C, C++, and Fortran front ends return 4 if an internal
1580 compiler error is encountered.
1581
1582 @item -pipe
1583 @opindex pipe
1584 Use pipes rather than temporary files for communication between the
1585 various stages of compilation. This fails to work on some systems where
1586 the assembler is unable to read from a pipe; but the GNU assembler has
1587 no trouble.
1588
1589 @item -specs=@var{file}
1590 @opindex specs
1591 Process @var{file} after the compiler reads in the standard @file{specs}
1592 file, in order to override the defaults which the @command{gcc} driver
1593 program uses when determining what switches to pass to @command{cc1},
1594 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1595 @option{-specs=@var{file}} can be specified on the command line, and they
1596 are processed in order, from left to right. @xref{Spec Files}, for
1597 information about the format of the @var{file}.
1598
1599 @item -wrapper
1600 @opindex wrapper
1601 Invoke all subcommands under a wrapper program. The name of the
1602 wrapper program and its parameters are passed as a comma separated
1603 list.
1604
1605 @smallexample
1606 gcc -c t.c -wrapper gdb,--args
1607 @end smallexample
1608
1609 @noindent
1610 This invokes all subprograms of @command{gcc} under
1611 @samp{gdb --args}, thus the invocation of @command{cc1} is
1612 @samp{gdb --args cc1 @dots{}}.
1613
1614 @item -fplugin=@var{name}.so
1615 @opindex fplugin
1616 Load the plugin code in file @var{name}.so, assumed to be a
1617 shared object to be dlopen'd by the compiler. The base name of
1618 the shared object file is used to identify the plugin for the
1619 purposes of argument parsing (See
1620 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1621 Each plugin should define the callback functions specified in the
1622 Plugins API.
1623
1624 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1625 @opindex fplugin-arg
1626 Define an argument called @var{key} with a value of @var{value}
1627 for the plugin called @var{name}.
1628
1629 @item -fdump-ada-spec@r{[}-slim@r{]}
1630 @opindex fdump-ada-spec
1631 For C and C++ source and include files, generate corresponding Ada specs.
1632 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1633 GNAT User's Guide}, which provides detailed documentation on this feature.
1634
1635 @item -fada-spec-parent=@var{unit}
1636 @opindex fada-spec-parent
1637 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1638 Ada specs as child units of parent @var{unit}.
1639
1640 @item -fdump-go-spec=@var{file}
1641 @opindex fdump-go-spec
1642 For input files in any language, generate corresponding Go
1643 declarations in @var{file}. This generates Go @code{const},
1644 @code{type}, @code{var}, and @code{func} declarations which may be a
1645 useful way to start writing a Go interface to code written in some
1646 other language.
1647
1648 @include @value{srcdir}/../libiberty/at-file.texi
1649 @end table
1650
1651 @node Invoking G++
1652 @section Compiling C++ Programs
1653
1654 @cindex suffixes for C++ source
1655 @cindex C++ source file suffixes
1656 C++ source files conventionally use one of the suffixes @samp{.C},
1657 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1658 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1659 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1660 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1661 files with these names and compiles them as C++ programs even if you
1662 call the compiler the same way as for compiling C programs (usually
1663 with the name @command{gcc}).
1664
1665 @findex g++
1666 @findex c++
1667 However, the use of @command{gcc} does not add the C++ library.
1668 @command{g++} is a program that calls GCC and automatically specifies linking
1669 against the C++ library. It treats @samp{.c},
1670 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1671 files unless @option{-x} is used. This program is also useful when
1672 precompiling a C header file with a @samp{.h} extension for use in C++
1673 compilations. On many systems, @command{g++} is also installed with
1674 the name @command{c++}.
1675
1676 @cindex invoking @command{g++}
1677 When you compile C++ programs, you may specify many of the same
1678 command-line options that you use for compiling programs in any
1679 language; or command-line options meaningful for C and related
1680 languages; or options that are meaningful only for C++ programs.
1681 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1682 explanations of options for languages related to C@.
1683 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1684 explanations of options that are meaningful only for C++ programs.
1685
1686 @node C Dialect Options
1687 @section Options Controlling C Dialect
1688 @cindex dialect options
1689 @cindex language dialect options
1690 @cindex options, dialect
1691
1692 The following options control the dialect of C (or languages derived
1693 from C, such as C++, Objective-C and Objective-C++) that the compiler
1694 accepts:
1695
1696 @table @gcctabopt
1697 @cindex ANSI support
1698 @cindex ISO support
1699 @item -ansi
1700 @opindex ansi
1701 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1702 equivalent to @option{-std=c++98}.
1703
1704 This turns off certain features of GCC that are incompatible with ISO
1705 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1706 such as the @code{asm} and @code{typeof} keywords, and
1707 predefined macros such as @code{unix} and @code{vax} that identify the
1708 type of system you are using. It also enables the undesirable and
1709 rarely used ISO trigraph feature. For the C compiler,
1710 it disables recognition of C++ style @samp{//} comments as well as
1711 the @code{inline} keyword.
1712
1713 The alternate keywords @code{__asm__}, @code{__extension__},
1714 @code{__inline__} and @code{__typeof__} continue to work despite
1715 @option{-ansi}. You would not want to use them in an ISO C program, of
1716 course, but it is useful to put them in header files that might be included
1717 in compilations done with @option{-ansi}. Alternate predefined macros
1718 such as @code{__unix__} and @code{__vax__} are also available, with or
1719 without @option{-ansi}.
1720
1721 The @option{-ansi} option does not cause non-ISO programs to be
1722 rejected gratuitously. For that, @option{-Wpedantic} is required in
1723 addition to @option{-ansi}. @xref{Warning Options}.
1724
1725 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1726 option is used. Some header files may notice this macro and refrain
1727 from declaring certain functions or defining certain macros that the
1728 ISO standard doesn't call for; this is to avoid interfering with any
1729 programs that might use these names for other things.
1730
1731 Functions that are normally built in but do not have semantics
1732 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1733 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1734 built-in functions provided by GCC}, for details of the functions
1735 affected.
1736
1737 @item -std=
1738 @opindex std
1739 Determine the language standard. @xref{Standards,,Language Standards
1740 Supported by GCC}, for details of these standard versions. This option
1741 is currently only supported when compiling C or C++.
1742
1743 The compiler can accept several base standards, such as @samp{c90} or
1744 @samp{c++98}, and GNU dialects of those standards, such as
1745 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1746 compiler accepts all programs following that standard plus those
1747 using GNU extensions that do not contradict it. For example,
1748 @option{-std=c90} turns off certain features of GCC that are
1749 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1750 keywords, but not other GNU extensions that do not have a meaning in
1751 ISO C90, such as omitting the middle term of a @code{?:}
1752 expression. On the other hand, when a GNU dialect of a standard is
1753 specified, all features supported by the compiler are enabled, even when
1754 those features change the meaning of the base standard. As a result, some
1755 strict-conforming programs may be rejected. The particular standard
1756 is used by @option{-Wpedantic} to identify which features are GNU
1757 extensions given that version of the standard. For example
1758 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1759 comments, while @option{-std=gnu99 -Wpedantic} does not.
1760
1761 A value for this option must be provided; possible values are
1762
1763 @table @samp
1764 @item c90
1765 @itemx c89
1766 @itemx iso9899:1990
1767 Support all ISO C90 programs (certain GNU extensions that conflict
1768 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1769
1770 @item iso9899:199409
1771 ISO C90 as modified in amendment 1.
1772
1773 @item c99
1774 @itemx c9x
1775 @itemx iso9899:1999
1776 @itemx iso9899:199x
1777 ISO C99. This standard is substantially completely supported, modulo
1778 bugs and floating-point issues
1779 (mainly but not entirely relating to optional C99 features from
1780 Annexes F and G). See
1781 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1782 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1783
1784 @item c11
1785 @itemx c1x
1786 @itemx iso9899:2011
1787 ISO C11, the 2011 revision of the ISO C standard. This standard is
1788 substantially completely supported, modulo bugs, floating-point issues
1789 (mainly but not entirely relating to optional C11 features from
1790 Annexes F and G) and the optional Annexes K (Bounds-checking
1791 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1792
1793 @item gnu90
1794 @itemx gnu89
1795 GNU dialect of ISO C90 (including some C99 features).
1796
1797 @item gnu99
1798 @itemx gnu9x
1799 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1800
1801 @item gnu11
1802 @itemx gnu1x
1803 GNU dialect of ISO C11. This is the default for C code.
1804 The name @samp{gnu1x} is deprecated.
1805
1806 @item c++98
1807 @itemx c++03
1808 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1809 additional defect reports. Same as @option{-ansi} for C++ code.
1810
1811 @item gnu++98
1812 @itemx gnu++03
1813 GNU dialect of @option{-std=c++98}.
1814
1815 @item c++11
1816 @itemx c++0x
1817 The 2011 ISO C++ standard plus amendments.
1818 The name @samp{c++0x} is deprecated.
1819
1820 @item gnu++11
1821 @itemx gnu++0x
1822 GNU dialect of @option{-std=c++11}.
1823 The name @samp{gnu++0x} is deprecated.
1824
1825 @item c++14
1826 @itemx c++1y
1827 The 2014 ISO C++ standard plus amendments.
1828 The name @samp{c++1y} is deprecated.
1829
1830 @item gnu++14
1831 @itemx gnu++1y
1832 GNU dialect of @option{-std=c++14}.
1833 This is the default for C++ code.
1834 The name @samp{gnu++1y} is deprecated.
1835
1836 @item c++1z
1837 The next revision of the ISO C++ standard, tentatively planned for
1838 2017. Support is highly experimental, and will almost certainly
1839 change in incompatible ways in future releases.
1840
1841 @item gnu++1z
1842 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1843 and will almost certainly change in incompatible ways in future
1844 releases.
1845 @end table
1846
1847 @item -fgnu89-inline
1848 @opindex fgnu89-inline
1849 The option @option{-fgnu89-inline} tells GCC to use the traditional
1850 GNU semantics for @code{inline} functions when in C99 mode.
1851 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1852 Using this option is roughly equivalent to adding the
1853 @code{gnu_inline} function attribute to all inline functions
1854 (@pxref{Function Attributes}).
1855
1856 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1857 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1858 specifies the default behavior).
1859 This option is not supported in @option{-std=c90} or
1860 @option{-std=gnu90} mode.
1861
1862 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1863 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1864 in effect for @code{inline} functions. @xref{Common Predefined
1865 Macros,,,cpp,The C Preprocessor}.
1866
1867 @item -aux-info @var{filename}
1868 @opindex aux-info
1869 Output to the given filename prototyped declarations for all functions
1870 declared and/or defined in a translation unit, including those in header
1871 files. This option is silently ignored in any language other than C@.
1872
1873 Besides declarations, the file indicates, in comments, the origin of
1874 each declaration (source file and line), whether the declaration was
1875 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1876 @samp{O} for old, respectively, in the first character after the line
1877 number and the colon), and whether it came from a declaration or a
1878 definition (@samp{C} or @samp{F}, respectively, in the following
1879 character). In the case of function definitions, a K&R-style list of
1880 arguments followed by their declarations is also provided, inside
1881 comments, after the declaration.
1882
1883 @item -fallow-parameterless-variadic-functions
1884 @opindex fallow-parameterless-variadic-functions
1885 Accept variadic functions without named parameters.
1886
1887 Although it is possible to define such a function, this is not very
1888 useful as it is not possible to read the arguments. This is only
1889 supported for C as this construct is allowed by C++.
1890
1891 @item -fno-asm
1892 @opindex fno-asm
1893 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1894 keyword, so that code can use these words as identifiers. You can use
1895 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1896 instead. @option{-ansi} implies @option{-fno-asm}.
1897
1898 In C++, this switch only affects the @code{typeof} keyword, since
1899 @code{asm} and @code{inline} are standard keywords. You may want to
1900 use the @option{-fno-gnu-keywords} flag instead, which has the same
1901 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1902 switch only affects the @code{asm} and @code{typeof} keywords, since
1903 @code{inline} is a standard keyword in ISO C99.
1904
1905 @item -fno-builtin
1906 @itemx -fno-builtin-@var{function}
1907 @opindex fno-builtin
1908 @cindex built-in functions
1909 Don't recognize built-in functions that do not begin with
1910 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1911 functions provided by GCC}, for details of the functions affected,
1912 including those which are not built-in functions when @option{-ansi} or
1913 @option{-std} options for strict ISO C conformance are used because they
1914 do not have an ISO standard meaning.
1915
1916 GCC normally generates special code to handle certain built-in functions
1917 more efficiently; for instance, calls to @code{alloca} may become single
1918 instructions which adjust the stack directly, and calls to @code{memcpy}
1919 may become inline copy loops. The resulting code is often both smaller
1920 and faster, but since the function calls no longer appear as such, you
1921 cannot set a breakpoint on those calls, nor can you change the behavior
1922 of the functions by linking with a different library. In addition,
1923 when a function is recognized as a built-in function, GCC may use
1924 information about that function to warn about problems with calls to
1925 that function, or to generate more efficient code, even if the
1926 resulting code still contains calls to that function. For example,
1927 warnings are given with @option{-Wformat} for bad calls to
1928 @code{printf} when @code{printf} is built in and @code{strlen} is
1929 known not to modify global memory.
1930
1931 With the @option{-fno-builtin-@var{function}} option
1932 only the built-in function @var{function} is
1933 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1934 function is named that is not built-in in this version of GCC, this
1935 option is ignored. There is no corresponding
1936 @option{-fbuiltin-@var{function}} option; if you wish to enable
1937 built-in functions selectively when using @option{-fno-builtin} or
1938 @option{-ffreestanding}, you may define macros such as:
1939
1940 @smallexample
1941 #define abs(n) __builtin_abs ((n))
1942 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1943 @end smallexample
1944
1945 @item -fhosted
1946 @opindex fhosted
1947 @cindex hosted environment
1948
1949 Assert that compilation targets a hosted environment. This implies
1950 @option{-fbuiltin}. A hosted environment is one in which the
1951 entire standard library is available, and in which @code{main} has a return
1952 type of @code{int}. Examples are nearly everything except a kernel.
1953 This is equivalent to @option{-fno-freestanding}.
1954
1955 @item -ffreestanding
1956 @opindex ffreestanding
1957 @cindex hosted environment
1958
1959 Assert that compilation targets a freestanding environment. This
1960 implies @option{-fno-builtin}. A freestanding environment
1961 is one in which the standard library may not exist, and program startup may
1962 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1963 This is equivalent to @option{-fno-hosted}.
1964
1965 @xref{Standards,,Language Standards Supported by GCC}, for details of
1966 freestanding and hosted environments.
1967
1968 @item -fopenacc
1969 @opindex fopenacc
1970 @cindex OpenACC accelerator programming
1971 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
1972 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
1973 compiler generates accelerated code according to the OpenACC Application
1974 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
1975 implies @option{-pthread}, and thus is only supported on targets that
1976 have support for @option{-pthread}.
1977
1978 @item -fopenacc-dim=@var{geom}
1979 @opindex fopenacc-dim
1980 @cindex OpenACC accelerator programming
1981 Specify default compute dimensions for parallel offload regions that do
1982 not explicitly specify. The @var{geom} value is a triple of
1983 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
1984 can be omitted, to use a target-specific default value.
1985
1986 @item -fopenmp
1987 @opindex fopenmp
1988 @cindex OpenMP parallel
1989 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1990 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1991 compiler generates parallel code according to the OpenMP Application
1992 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
1993 implies @option{-pthread}, and thus is only supported on targets that
1994 have support for @option{-pthread}. @option{-fopenmp} implies
1995 @option{-fopenmp-simd}.
1996
1997 @item -fopenmp-simd
1998 @opindex fopenmp-simd
1999 @cindex OpenMP SIMD
2000 @cindex SIMD
2001 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2002 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2003 are ignored.
2004
2005 @item -fcilkplus
2006 @opindex fcilkplus
2007 @cindex Enable Cilk Plus
2008 Enable the usage of Cilk Plus language extension features for C/C++.
2009 When the option @option{-fcilkplus} is specified, enable the usage of
2010 the Cilk Plus Language extension features for C/C++. The present
2011 implementation follows ABI version 1.2. This is an experimental
2012 feature that is only partially complete, and whose interface may
2013 change in future versions of GCC as the official specification
2014 changes. Currently, all features but @code{_Cilk_for} have been
2015 implemented.
2016
2017 @item -fgnu-tm
2018 @opindex fgnu-tm
2019 When the option @option{-fgnu-tm} is specified, the compiler
2020 generates code for the Linux variant of Intel's current Transactional
2021 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2022 an experimental feature whose interface may change in future versions
2023 of GCC, as the official specification changes. Please note that not
2024 all architectures are supported for this feature.
2025
2026 For more information on GCC's support for transactional memory,
2027 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2028 Transactional Memory Library}.
2029
2030 Note that the transactional memory feature is not supported with
2031 non-call exceptions (@option{-fnon-call-exceptions}).
2032
2033 @item -fms-extensions
2034 @opindex fms-extensions
2035 Accept some non-standard constructs used in Microsoft header files.
2036
2037 In C++ code, this allows member names in structures to be similar
2038 to previous types declarations.
2039
2040 @smallexample
2041 typedef int UOW;
2042 struct ABC @{
2043 UOW UOW;
2044 @};
2045 @end smallexample
2046
2047 Some cases of unnamed fields in structures and unions are only
2048 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2049 fields within structs/unions}, for details.
2050
2051 Note that this option is off for all targets but x86
2052 targets using ms-abi.
2053
2054 @item -fplan9-extensions
2055 @opindex fplan9-extensions
2056 Accept some non-standard constructs used in Plan 9 code.
2057
2058 This enables @option{-fms-extensions}, permits passing pointers to
2059 structures with anonymous fields to functions that expect pointers to
2060 elements of the type of the field, and permits referring to anonymous
2061 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2062 struct/union fields within structs/unions}, for details. This is only
2063 supported for C, not C++.
2064
2065 @item -trigraphs
2066 @opindex trigraphs
2067 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
2068 options for strict ISO C conformance) implies @option{-trigraphs}.
2069
2070 @cindex traditional C language
2071 @cindex C language, traditional
2072 @item -traditional
2073 @itemx -traditional-cpp
2074 @opindex traditional-cpp
2075 @opindex traditional
2076 Formerly, these options caused GCC to attempt to emulate a pre-standard
2077 C compiler. They are now only supported with the @option{-E} switch.
2078 The preprocessor continues to support a pre-standard mode. See the GNU
2079 CPP manual for details.
2080
2081 @item -fcond-mismatch
2082 @opindex fcond-mismatch
2083 Allow conditional expressions with mismatched types in the second and
2084 third arguments. The value of such an expression is void. This option
2085 is not supported for C++.
2086
2087 @item -flax-vector-conversions
2088 @opindex flax-vector-conversions
2089 Allow implicit conversions between vectors with differing numbers of
2090 elements and/or incompatible element types. This option should not be
2091 used for new code.
2092
2093 @item -funsigned-char
2094 @opindex funsigned-char
2095 Let the type @code{char} be unsigned, like @code{unsigned char}.
2096
2097 Each kind of machine has a default for what @code{char} should
2098 be. It is either like @code{unsigned char} by default or like
2099 @code{signed char} by default.
2100
2101 Ideally, a portable program should always use @code{signed char} or
2102 @code{unsigned char} when it depends on the signedness of an object.
2103 But many programs have been written to use plain @code{char} and
2104 expect it to be signed, or expect it to be unsigned, depending on the
2105 machines they were written for. This option, and its inverse, let you
2106 make such a program work with the opposite default.
2107
2108 The type @code{char} is always a distinct type from each of
2109 @code{signed char} or @code{unsigned char}, even though its behavior
2110 is always just like one of those two.
2111
2112 @item -fsigned-char
2113 @opindex fsigned-char
2114 Let the type @code{char} be signed, like @code{signed char}.
2115
2116 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2117 the negative form of @option{-funsigned-char}. Likewise, the option
2118 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2119
2120 @item -fsigned-bitfields
2121 @itemx -funsigned-bitfields
2122 @itemx -fno-signed-bitfields
2123 @itemx -fno-unsigned-bitfields
2124 @opindex fsigned-bitfields
2125 @opindex funsigned-bitfields
2126 @opindex fno-signed-bitfields
2127 @opindex fno-unsigned-bitfields
2128 These options control whether a bit-field is signed or unsigned, when the
2129 declaration does not use either @code{signed} or @code{unsigned}. By
2130 default, such a bit-field is signed, because this is consistent: the
2131 basic integer types such as @code{int} are signed types.
2132
2133 @item -fsso-struct=@var{endianness}
2134 @opindex fsso-struct
2135 Set the default scalar storage order of structures and unions to the
2136 specified endianness. The accepted values are @samp{big-endian} and
2137 @samp{little-endian}. If the option is not passed, the compiler uses
2138 the native endianness of the target. This option is not supported for C++.
2139
2140 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2141 code that is not binary compatible with code generated without it if the
2142 specified endianness is not the native endianness of the target.
2143 @end table
2144
2145 @node C++ Dialect Options
2146 @section Options Controlling C++ Dialect
2147
2148 @cindex compiler options, C++
2149 @cindex C++ options, command-line
2150 @cindex options, C++
2151 This section describes the command-line options that are only meaningful
2152 for C++ programs. You can also use most of the GNU compiler options
2153 regardless of what language your program is in. For example, you
2154 might compile a file @file{firstClass.C} like this:
2155
2156 @smallexample
2157 g++ -g -fstrict-enums -O -c firstClass.C
2158 @end smallexample
2159
2160 @noindent
2161 In this example, only @option{-fstrict-enums} is an option meant
2162 only for C++ programs; you can use the other options with any
2163 language supported by GCC@.
2164
2165 Some options for compiling C programs, such as @option{-std}, are also
2166 relevant for C++ programs.
2167 @xref{C Dialect Options,,Options Controlling C Dialect}.
2168
2169 Here is a list of options that are @emph{only} for compiling C++ programs:
2170
2171 @table @gcctabopt
2172
2173 @item -fabi-version=@var{n}
2174 @opindex fabi-version
2175 Use version @var{n} of the C++ ABI@. The default is version 0.
2176
2177 Version 0 refers to the version conforming most closely to
2178 the C++ ABI specification. Therefore, the ABI obtained using version 0
2179 will change in different versions of G++ as ABI bugs are fixed.
2180
2181 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2182
2183 Version 2 is the version of the C++ ABI that first appeared in G++
2184 3.4, and was the default through G++ 4.9.
2185
2186 Version 3 corrects an error in mangling a constant address as a
2187 template argument.
2188
2189 Version 4, which first appeared in G++ 4.5, implements a standard
2190 mangling for vector types.
2191
2192 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2193 attribute const/volatile on function pointer types, decltype of a
2194 plain decl, and use of a function parameter in the declaration of
2195 another parameter.
2196
2197 Version 6, which first appeared in G++ 4.7, corrects the promotion
2198 behavior of C++11 scoped enums and the mangling of template argument
2199 packs, const/static_cast, prefix ++ and --, and a class scope function
2200 used as a template argument.
2201
2202 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2203 builtin type and corrects the mangling of lambdas in default argument
2204 scope.
2205
2206 Version 8, which first appeared in G++ 4.9, corrects the substitution
2207 behavior of function types with function-cv-qualifiers.
2208
2209 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2210 @code{nullptr_t}.
2211
2212 Version 10, which first appeared in G++ 6.1, adds mangling of
2213 attributes that affect type identity, such as ia32 calling convention
2214 attributes (e.g. @samp{stdcall}).
2215
2216 See also @option{-Wabi}.
2217
2218 @item -fabi-compat-version=@var{n}
2219 @opindex fabi-compat-version
2220 On targets that support strong aliases, G++
2221 works around mangling changes by creating an alias with the correct
2222 mangled name when defining a symbol with an incorrect mangled name.
2223 This switch specifies which ABI version to use for the alias.
2224
2225 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2226 compatibility). If another ABI version is explicitly selected, this
2227 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2228 use @option{-fabi-compat-version=2}.
2229
2230 If this option is not provided but @option{-Wabi=@var{n}} is, that
2231 version is used for compatibility aliases. If this option is provided
2232 along with @option{-Wabi} (without the version), the version from this
2233 option is used for the warning.
2234
2235 @item -fno-access-control
2236 @opindex fno-access-control
2237 Turn off all access checking. This switch is mainly useful for working
2238 around bugs in the access control code.
2239
2240 @item -faligned-new
2241 @opindex faligned-new
2242 Enable support for C++17 @code{new} of types that require more
2243 alignment than @code{void* ::operator new(std::size_t)} provides. A
2244 numeric argument such as @code{-faligned-new=32} can be used to
2245 specify how much alignment (in bytes) is provided by that function,
2246 but few users will need to override the default of
2247 @code{alignof(std::max_align_t)}.
2248
2249 @item -fcheck-new
2250 @opindex fcheck-new
2251 Check that the pointer returned by @code{operator new} is non-null
2252 before attempting to modify the storage allocated. This check is
2253 normally unnecessary because the C++ standard specifies that
2254 @code{operator new} only returns @code{0} if it is declared
2255 @code{throw()}, in which case the compiler always checks the
2256 return value even without this option. In all other cases, when
2257 @code{operator new} has a non-empty exception specification, memory
2258 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2259 @samp{new (nothrow)}.
2260
2261 @item -fconcepts
2262 @opindex fconcepts
2263 Enable support for the C++ Extensions for Concepts Technical
2264 Specification, ISO 19217 (2015), which allows code like
2265
2266 @smallexample
2267 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2268 template <Addable T> T add (T a, T b) @{ return a + b; @}
2269 @end smallexample
2270
2271 @item -fconstexpr-depth=@var{n}
2272 @opindex fconstexpr-depth
2273 Set the maximum nested evaluation depth for C++11 constexpr functions
2274 to @var{n}. A limit is needed to detect endless recursion during
2275 constant expression evaluation. The minimum specified by the standard
2276 is 512.
2277
2278 @item -fconstexpr-loop-limit=@var{n}
2279 @opindex fconstexpr-loop-limit
2280 Set the maximum number of iterations for a loop in C++14 constexpr functions
2281 to @var{n}. A limit is needed to detect infinite loops during
2282 constant expression evaluation. The default is 262144 (1<<18).
2283
2284 @item -fdeduce-init-list
2285 @opindex fdeduce-init-list
2286 Enable deduction of a template type parameter as
2287 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2288
2289 @smallexample
2290 template <class T> auto forward(T t) -> decltype (realfn (t))
2291 @{
2292 return realfn (t);
2293 @}
2294
2295 void f()
2296 @{
2297 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2298 @}
2299 @end smallexample
2300
2301 This deduction was implemented as a possible extension to the
2302 originally proposed semantics for the C++11 standard, but was not part
2303 of the final standard, so it is disabled by default. This option is
2304 deprecated, and may be removed in a future version of G++.
2305
2306 @item -ffriend-injection
2307 @opindex ffriend-injection
2308 Inject friend functions into the enclosing namespace, so that they are
2309 visible outside the scope of the class in which they are declared.
2310 Friend functions were documented to work this way in the old Annotated
2311 C++ Reference Manual.
2312 However, in ISO C++ a friend function that is not declared
2313 in an enclosing scope can only be found using argument dependent
2314 lookup. GCC defaults to the standard behavior.
2315
2316 This option is for compatibility, and may be removed in a future
2317 release of G++.
2318
2319 @item -fno-elide-constructors
2320 @opindex fno-elide-constructors
2321 The C++ standard allows an implementation to omit creating a temporary
2322 that is only used to initialize another object of the same type.
2323 Specifying this option disables that optimization, and forces G++ to
2324 call the copy constructor in all cases.
2325
2326 @item -fno-enforce-eh-specs
2327 @opindex fno-enforce-eh-specs
2328 Don't generate code to check for violation of exception specifications
2329 at run time. This option violates the C++ standard, but may be useful
2330 for reducing code size in production builds, much like defining
2331 @code{NDEBUG}. This does not give user code permission to throw
2332 exceptions in violation of the exception specifications; the compiler
2333 still optimizes based on the specifications, so throwing an
2334 unexpected exception results in undefined behavior at run time.
2335
2336 @item -fextern-tls-init
2337 @itemx -fno-extern-tls-init
2338 @opindex fextern-tls-init
2339 @opindex fno-extern-tls-init
2340 The C++11 and OpenMP standards allow @code{thread_local} and
2341 @code{threadprivate} variables to have dynamic (runtime)
2342 initialization. To support this, any use of such a variable goes
2343 through a wrapper function that performs any necessary initialization.
2344 When the use and definition of the variable are in the same
2345 translation unit, this overhead can be optimized away, but when the
2346 use is in a different translation unit there is significant overhead
2347 even if the variable doesn't actually need dynamic initialization. If
2348 the programmer can be sure that no use of the variable in a
2349 non-defining TU needs to trigger dynamic initialization (either
2350 because the variable is statically initialized, or a use of the
2351 variable in the defining TU will be executed before any uses in
2352 another TU), they can avoid this overhead with the
2353 @option{-fno-extern-tls-init} option.
2354
2355 On targets that support symbol aliases, the default is
2356 @option{-fextern-tls-init}. On targets that do not support symbol
2357 aliases, the default is @option{-fno-extern-tls-init}.
2358
2359 @item -ffor-scope
2360 @itemx -fno-for-scope
2361 @opindex ffor-scope
2362 @opindex fno-for-scope
2363 If @option{-ffor-scope} is specified, the scope of variables declared in
2364 a @i{for-init-statement} is limited to the @code{for} loop itself,
2365 as specified by the C++ standard.
2366 If @option{-fno-for-scope} is specified, the scope of variables declared in
2367 a @i{for-init-statement} extends to the end of the enclosing scope,
2368 as was the case in old versions of G++, and other (traditional)
2369 implementations of C++.
2370
2371 If neither flag is given, the default is to follow the standard,
2372 but to allow and give a warning for old-style code that would
2373 otherwise be invalid, or have different behavior.
2374
2375 @item -fno-gnu-keywords
2376 @opindex fno-gnu-keywords
2377 Do not recognize @code{typeof} as a keyword, so that code can use this
2378 word as an identifier. You can use the keyword @code{__typeof__} instead.
2379 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2380 @option{-std=c++98}, @option{-std=c++11}, etc.
2381
2382 @item -fno-implicit-templates
2383 @opindex fno-implicit-templates
2384 Never emit code for non-inline templates that are instantiated
2385 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2386 @xref{Template Instantiation}, for more information.
2387
2388 @item -fno-implicit-inline-templates
2389 @opindex fno-implicit-inline-templates
2390 Don't emit code for implicit instantiations of inline templates, either.
2391 The default is to handle inlines differently so that compiles with and
2392 without optimization need the same set of explicit instantiations.
2393
2394 @item -fno-implement-inlines
2395 @opindex fno-implement-inlines
2396 To save space, do not emit out-of-line copies of inline functions
2397 controlled by @code{#pragma implementation}. This causes linker
2398 errors if these functions are not inlined everywhere they are called.
2399
2400 @item -fms-extensions
2401 @opindex fms-extensions
2402 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2403 int and getting a pointer to member function via non-standard syntax.
2404
2405 @item -fno-nonansi-builtins
2406 @opindex fno-nonansi-builtins
2407 Disable built-in declarations of functions that are not mandated by
2408 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2409 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2410
2411 @item -fnothrow-opt
2412 @opindex fnothrow-opt
2413 Treat a @code{throw()} exception specification as if it were a
2414 @code{noexcept} specification to reduce or eliminate the text size
2415 overhead relative to a function with no exception specification. If
2416 the function has local variables of types with non-trivial
2417 destructors, the exception specification actually makes the
2418 function smaller because the EH cleanups for those variables can be
2419 optimized away. The semantic effect is that an exception thrown out of
2420 a function with such an exception specification results in a call
2421 to @code{terminate} rather than @code{unexpected}.
2422
2423 @item -fno-operator-names
2424 @opindex fno-operator-names
2425 Do not treat the operator name keywords @code{and}, @code{bitand},
2426 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2427 synonyms as keywords.
2428
2429 @item -fno-optional-diags
2430 @opindex fno-optional-diags
2431 Disable diagnostics that the standard says a compiler does not need to
2432 issue. Currently, the only such diagnostic issued by G++ is the one for
2433 a name having multiple meanings within a class.
2434
2435 @item -fpermissive
2436 @opindex fpermissive
2437 Downgrade some diagnostics about nonconformant code from errors to
2438 warnings. Thus, using @option{-fpermissive} allows some
2439 nonconforming code to compile.
2440
2441 @item -fno-pretty-templates
2442 @opindex fno-pretty-templates
2443 When an error message refers to a specialization of a function
2444 template, the compiler normally prints the signature of the
2445 template followed by the template arguments and any typedefs or
2446 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2447 rather than @code{void f(int)}) so that it's clear which template is
2448 involved. When an error message refers to a specialization of a class
2449 template, the compiler omits any template arguments that match
2450 the default template arguments for that template. If either of these
2451 behaviors make it harder to understand the error message rather than
2452 easier, you can use @option{-fno-pretty-templates} to disable them.
2453
2454 @item -frepo
2455 @opindex frepo
2456 Enable automatic template instantiation at link time. This option also
2457 implies @option{-fno-implicit-templates}. @xref{Template
2458 Instantiation}, for more information.
2459
2460 @item -fno-rtti
2461 @opindex fno-rtti
2462 Disable generation of information about every class with virtual
2463 functions for use by the C++ run-time type identification features
2464 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2465 of the language, you can save some space by using this flag. Note that
2466 exception handling uses the same information, but G++ generates it as
2467 needed. The @code{dynamic_cast} operator can still be used for casts that
2468 do not require run-time type information, i.e.@: casts to @code{void *} or to
2469 unambiguous base classes.
2470
2471 @item -fsized-deallocation
2472 @opindex fsized-deallocation
2473 Enable the built-in global declarations
2474 @smallexample
2475 void operator delete (void *, std::size_t) noexcept;
2476 void operator delete[] (void *, std::size_t) noexcept;
2477 @end smallexample
2478 as introduced in C++14. This is useful for user-defined replacement
2479 deallocation functions that, for example, use the size of the object
2480 to make deallocation faster. Enabled by default under
2481 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2482 warns about places that might want to add a definition.
2483
2484 @item -fstrict-enums
2485 @opindex fstrict-enums
2486 Allow the compiler to optimize using the assumption that a value of
2487 enumerated type can only be one of the values of the enumeration (as
2488 defined in the C++ standard; basically, a value that can be
2489 represented in the minimum number of bits needed to represent all the
2490 enumerators). This assumption may not be valid if the program uses a
2491 cast to convert an arbitrary integer value to the enumerated type.
2492
2493 @item -fstrong-eval-order
2494 @opindex fstrong-eval-order
2495 Evaluate member access, array subscripting, and shift expressions in
2496 left-to-right order, and evaluate assignment in right-to-left order,
2497 as adopted for C++17. Enabled by default with @option{-std=c++1z}.
2498 @option{-fstrong-eval-order=some} enables just the ordering of member
2499 access and shift expressions, and is the default without
2500 @option{-std=c++1z}.
2501
2502 @item -ftemplate-backtrace-limit=@var{n}
2503 @opindex ftemplate-backtrace-limit
2504 Set the maximum number of template instantiation notes for a single
2505 warning or error to @var{n}. The default value is 10.
2506
2507 @item -ftemplate-depth=@var{n}
2508 @opindex ftemplate-depth
2509 Set the maximum instantiation depth for template classes to @var{n}.
2510 A limit on the template instantiation depth is needed to detect
2511 endless recursions during template class instantiation. ANSI/ISO C++
2512 conforming programs must not rely on a maximum depth greater than 17
2513 (changed to 1024 in C++11). The default value is 900, as the compiler
2514 can run out of stack space before hitting 1024 in some situations.
2515
2516 @item -fno-threadsafe-statics
2517 @opindex fno-threadsafe-statics
2518 Do not emit the extra code to use the routines specified in the C++
2519 ABI for thread-safe initialization of local statics. You can use this
2520 option to reduce code size slightly in code that doesn't need to be
2521 thread-safe.
2522
2523 @item -fuse-cxa-atexit
2524 @opindex fuse-cxa-atexit
2525 Register destructors for objects with static storage duration with the
2526 @code{__cxa_atexit} function rather than the @code{atexit} function.
2527 This option is required for fully standards-compliant handling of static
2528 destructors, but only works if your C library supports
2529 @code{__cxa_atexit}.
2530
2531 @item -fno-use-cxa-get-exception-ptr
2532 @opindex fno-use-cxa-get-exception-ptr
2533 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2534 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2535 if the runtime routine is not available.
2536
2537 @item -fvisibility-inlines-hidden
2538 @opindex fvisibility-inlines-hidden
2539 This switch declares that the user does not attempt to compare
2540 pointers to inline functions or methods where the addresses of the two functions
2541 are taken in different shared objects.
2542
2543 The effect of this is that GCC may, effectively, mark inline methods with
2544 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2545 appear in the export table of a DSO and do not require a PLT indirection
2546 when used within the DSO@. Enabling this option can have a dramatic effect
2547 on load and link times of a DSO as it massively reduces the size of the
2548 dynamic export table when the library makes heavy use of templates.
2549
2550 The behavior of this switch is not quite the same as marking the
2551 methods as hidden directly, because it does not affect static variables
2552 local to the function or cause the compiler to deduce that
2553 the function is defined in only one shared object.
2554
2555 You may mark a method as having a visibility explicitly to negate the
2556 effect of the switch for that method. For example, if you do want to
2557 compare pointers to a particular inline method, you might mark it as
2558 having default visibility. Marking the enclosing class with explicit
2559 visibility has no effect.
2560
2561 Explicitly instantiated inline methods are unaffected by this option
2562 as their linkage might otherwise cross a shared library boundary.
2563 @xref{Template Instantiation}.
2564
2565 @item -fvisibility-ms-compat
2566 @opindex fvisibility-ms-compat
2567 This flag attempts to use visibility settings to make GCC's C++
2568 linkage model compatible with that of Microsoft Visual Studio.
2569
2570 The flag makes these changes to GCC's linkage model:
2571
2572 @enumerate
2573 @item
2574 It sets the default visibility to @code{hidden}, like
2575 @option{-fvisibility=hidden}.
2576
2577 @item
2578 Types, but not their members, are not hidden by default.
2579
2580 @item
2581 The One Definition Rule is relaxed for types without explicit
2582 visibility specifications that are defined in more than one
2583 shared object: those declarations are permitted if they are
2584 permitted when this option is not used.
2585 @end enumerate
2586
2587 In new code it is better to use @option{-fvisibility=hidden} and
2588 export those classes that are intended to be externally visible.
2589 Unfortunately it is possible for code to rely, perhaps accidentally,
2590 on the Visual Studio behavior.
2591
2592 Among the consequences of these changes are that static data members
2593 of the same type with the same name but defined in different shared
2594 objects are different, so changing one does not change the other;
2595 and that pointers to function members defined in different shared
2596 objects may not compare equal. When this flag is given, it is a
2597 violation of the ODR to define types with the same name differently.
2598
2599 @item -fno-weak
2600 @opindex fno-weak
2601 Do not use weak symbol support, even if it is provided by the linker.
2602 By default, G++ uses weak symbols if they are available. This
2603 option exists only for testing, and should not be used by end-users;
2604 it results in inferior code and has no benefits. This option may
2605 be removed in a future release of G++.
2606
2607 @item -nostdinc++
2608 @opindex nostdinc++
2609 Do not search for header files in the standard directories specific to
2610 C++, but do still search the other standard directories. (This option
2611 is used when building the C++ library.)
2612 @end table
2613
2614 In addition, these optimization, warning, and code generation options
2615 have meanings only for C++ programs:
2616
2617 @table @gcctabopt
2618 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2619 @opindex Wabi
2620 @opindex Wno-abi
2621 Warn when G++ it generates code that is probably not compatible with
2622 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2623 ABI with each major release, normally @option{-Wabi} will warn only if
2624 there is a check added later in a release series for an ABI issue
2625 discovered since the initial release. @option{-Wabi} will warn about
2626 more things if an older ABI version is selected (with
2627 @option{-fabi-version=@var{n}}).
2628
2629 @option{-Wabi} can also be used with an explicit version number to
2630 warn about compatibility with a particular @option{-fabi-version}
2631 level, e.g. @option{-Wabi=2} to warn about changes relative to
2632 @option{-fabi-version=2}.
2633
2634 If an explicit version number is provided and
2635 @option{-fabi-compat-version} is not specified, the version number
2636 from this option is used for compatibility aliases. If no explicit
2637 version number is provided with this option, but
2638 @option{-fabi-compat-version} is specified, that version number is
2639 used for ABI warnings.
2640
2641 Although an effort has been made to warn about
2642 all such cases, there are probably some cases that are not warned about,
2643 even though G++ is generating incompatible code. There may also be
2644 cases where warnings are emitted even though the code that is generated
2645 is compatible.
2646
2647 You should rewrite your code to avoid these warnings if you are
2648 concerned about the fact that code generated by G++ may not be binary
2649 compatible with code generated by other compilers.
2650
2651 Known incompatibilities in @option{-fabi-version=2} (which was the
2652 default from GCC 3.4 to 4.9) include:
2653
2654 @itemize @bullet
2655
2656 @item
2657 A template with a non-type template parameter of reference type was
2658 mangled incorrectly:
2659 @smallexample
2660 extern int N;
2661 template <int &> struct S @{@};
2662 void n (S<N>) @{2@}
2663 @end smallexample
2664
2665 This was fixed in @option{-fabi-version=3}.
2666
2667 @item
2668 SIMD vector types declared using @code{__attribute ((vector_size))} were
2669 mangled in a non-standard way that does not allow for overloading of
2670 functions taking vectors of different sizes.
2671
2672 The mangling was changed in @option{-fabi-version=4}.
2673
2674 @item
2675 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2676 qualifiers, and @code{decltype} of a plain declaration was folded away.
2677
2678 These mangling issues were fixed in @option{-fabi-version=5}.
2679
2680 @item
2681 Scoped enumerators passed as arguments to a variadic function are
2682 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2683 On most targets this does not actually affect the parameter passing
2684 ABI, as there is no way to pass an argument smaller than @code{int}.
2685
2686 Also, the ABI changed the mangling of template argument packs,
2687 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2688 a class scope function used as a template argument.
2689
2690 These issues were corrected in @option{-fabi-version=6}.
2691
2692 @item
2693 Lambdas in default argument scope were mangled incorrectly, and the
2694 ABI changed the mangling of @code{nullptr_t}.
2695
2696 These issues were corrected in @option{-fabi-version=7}.
2697
2698 @item
2699 When mangling a function type with function-cv-qualifiers, the
2700 un-qualified function type was incorrectly treated as a substitution
2701 candidate.
2702
2703 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2704
2705 @item
2706 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2707 unaligned accesses. Note that this did not affect the ABI of a
2708 function with a @code{nullptr_t} parameter, as parameters have a
2709 minimum alignment.
2710
2711 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2712
2713 @item
2714 Target-specific attributes that affect the identity of a type, such as
2715 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2716 did not affect the mangled name, leading to name collisions when
2717 function pointers were used as template arguments.
2718
2719 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2720
2721 @end itemize
2722
2723 It also warns about psABI-related changes. The known psABI changes at this
2724 point include:
2725
2726 @itemize @bullet
2727
2728 @item
2729 For SysV/x86-64, unions with @code{long double} members are
2730 passed in memory as specified in psABI. For example:
2731
2732 @smallexample
2733 union U @{
2734 long double ld;
2735 int i;
2736 @};
2737 @end smallexample
2738
2739 @noindent
2740 @code{union U} is always passed in memory.
2741
2742 @end itemize
2743
2744 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2745 @opindex Wabi-tag
2746 @opindex -Wabi-tag
2747 Warn when a type with an ABI tag is used in a context that does not
2748 have that ABI tag. See @ref{C++ Attributes} for more information
2749 about ABI tags.
2750
2751 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2752 @opindex Wctor-dtor-privacy
2753 @opindex Wno-ctor-dtor-privacy
2754 Warn when a class seems unusable because all the constructors or
2755 destructors in that class are private, and it has neither friends nor
2756 public static member functions. Also warn if there are no non-private
2757 methods, and there's at least one private member function that isn't
2758 a constructor or destructor.
2759
2760 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2761 @opindex Wdelete-non-virtual-dtor
2762 @opindex Wno-delete-non-virtual-dtor
2763 Warn when @code{delete} is used to destroy an instance of a class that
2764 has virtual functions and non-virtual destructor. It is unsafe to delete
2765 an instance of a derived class through a pointer to a base class if the
2766 base class does not have a virtual destructor. This warning is enabled
2767 by @option{-Wall}.
2768
2769 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2770 @opindex Wliteral-suffix
2771 @opindex Wno-literal-suffix
2772 Warn when a string or character literal is followed by a ud-suffix which does
2773 not begin with an underscore. As a conforming extension, GCC treats such
2774 suffixes as separate preprocessing tokens in order to maintain backwards
2775 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2776 For example:
2777
2778 @smallexample
2779 #define __STDC_FORMAT_MACROS
2780 #include <inttypes.h>
2781 #include <stdio.h>
2782
2783 int main() @{
2784 int64_t i64 = 123;
2785 printf("My int64: %" PRId64"\n", i64);
2786 @}
2787 @end smallexample
2788
2789 In this case, @code{PRId64} is treated as a separate preprocessing token.
2790
2791 This warning is enabled by default.
2792
2793 @item -Wlto-type-mismatch
2794 @opindex Wlto-type-mismatch
2795 @opindex Wno-lto-type-mismatch
2796
2797 During the link-time optimization warn about type mismatches in
2798 global declarations from different compilation units.
2799 Requires @option{-flto} to be enabled. Enabled by default.
2800
2801 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2802 @opindex Wnarrowing
2803 @opindex Wno-narrowing
2804 With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing
2805 conversion prohibited by C++11 occurs within
2806 @samp{@{ @}}, e.g.
2807
2808 @smallexample
2809 int i = @{ 2.2 @}; // error: narrowing from double to int
2810 @end smallexample
2811
2812 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2813
2814 When a later standard is in effect, e.g. when using @option{-std=c++11},
2815 narrowing conversions are diagnosed by default, as required by the standard.
2816 A narrowing conversion from a constant produces an error,
2817 and a narrowing conversion from a non-constant produces a warning,
2818 but @option{-Wno-narrowing} suppresses the diagnostic.
2819 Note that this does not affect the meaning of well-formed code;
2820 narrowing conversions are still considered ill-formed in SFINAE contexts.
2821
2822 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2823 @opindex Wnoexcept
2824 @opindex Wno-noexcept
2825 Warn when a noexcept-expression evaluates to false because of a call
2826 to a function that does not have a non-throwing exception
2827 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2828 the compiler to never throw an exception.
2829
2830 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2831 @opindex Wnon-virtual-dtor
2832 @opindex Wno-non-virtual-dtor
2833 Warn when a class has virtual functions and an accessible non-virtual
2834 destructor itself or in an accessible polymorphic base class, in which
2835 case it is possible but unsafe to delete an instance of a derived
2836 class through a pointer to the class itself or base class. This
2837 warning is automatically enabled if @option{-Weffc++} is specified.
2838
2839 @item -Wreorder @r{(C++ and Objective-C++ only)}
2840 @opindex Wreorder
2841 @opindex Wno-reorder
2842 @cindex reordering, warning
2843 @cindex warning for reordering of member initializers
2844 Warn when the order of member initializers given in the code does not
2845 match the order in which they must be executed. For instance:
2846
2847 @smallexample
2848 struct A @{
2849 int i;
2850 int j;
2851 A(): j (0), i (1) @{ @}
2852 @};
2853 @end smallexample
2854
2855 @noindent
2856 The compiler rearranges the member initializers for @code{i}
2857 and @code{j} to match the declaration order of the members, emitting
2858 a warning to that effect. This warning is enabled by @option{-Wall}.
2859
2860 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2861 @opindex fext-numeric-literals
2862 @opindex fno-ext-numeric-literals
2863 Accept imaginary, fixed-point, or machine-defined
2864 literal number suffixes as GNU extensions.
2865 When this option is turned off these suffixes are treated
2866 as C++11 user-defined literal numeric suffixes.
2867 This is on by default for all pre-C++11 dialects and all GNU dialects:
2868 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2869 @option{-std=gnu++14}.
2870 This option is off by default
2871 for ISO C++11 onwards (@option{-std=c++11}, ...).
2872 @end table
2873
2874 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2875
2876 @table @gcctabopt
2877 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2878 @opindex Weffc++
2879 @opindex Wno-effc++
2880 Warn about violations of the following style guidelines from Scott Meyers'
2881 @cite{Effective C++} series of books:
2882
2883 @itemize @bullet
2884 @item
2885 Define a copy constructor and an assignment operator for classes
2886 with dynamically-allocated memory.
2887
2888 @item
2889 Prefer initialization to assignment in constructors.
2890
2891 @item
2892 Have @code{operator=} return a reference to @code{*this}.
2893
2894 @item
2895 Don't try to return a reference when you must return an object.
2896
2897 @item
2898 Distinguish between prefix and postfix forms of increment and
2899 decrement operators.
2900
2901 @item
2902 Never overload @code{&&}, @code{||}, or @code{,}.
2903
2904 @end itemize
2905
2906 This option also enables @option{-Wnon-virtual-dtor}, which is also
2907 one of the effective C++ recommendations. However, the check is
2908 extended to warn about the lack of virtual destructor in accessible
2909 non-polymorphic bases classes too.
2910
2911 When selecting this option, be aware that the standard library
2912 headers do not obey all of these guidelines; use @samp{grep -v}
2913 to filter out those warnings.
2914
2915 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2916 @opindex Wstrict-null-sentinel
2917 @opindex Wno-strict-null-sentinel
2918 Warn about the use of an uncasted @code{NULL} as sentinel. When
2919 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2920 to @code{__null}. Although it is a null pointer constant rather than a
2921 null pointer, it is guaranteed to be of the same size as a pointer.
2922 But this use is not portable across different compilers.
2923
2924 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2925 @opindex Wno-non-template-friend
2926 @opindex Wnon-template-friend
2927 Disable warnings when non-templatized friend functions are declared
2928 within a template. Since the advent of explicit template specification
2929 support in G++, if the name of the friend is an unqualified-id (i.e.,
2930 @samp{friend foo(int)}), the C++ language specification demands that the
2931 friend declare or define an ordinary, nontemplate function. (Section
2932 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2933 could be interpreted as a particular specialization of a templatized
2934 function. Because this non-conforming behavior is no longer the default
2935 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2936 check existing code for potential trouble spots and is on by default.
2937 This new compiler behavior can be turned off with
2938 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2939 but disables the helpful warning.
2940
2941 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2942 @opindex Wold-style-cast
2943 @opindex Wno-old-style-cast
2944 Warn if an old-style (C-style) cast to a non-void type is used within
2945 a C++ program. The new-style casts (@code{dynamic_cast},
2946 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
2947 less vulnerable to unintended effects and much easier to search for.
2948
2949 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2950 @opindex Woverloaded-virtual
2951 @opindex Wno-overloaded-virtual
2952 @cindex overloaded virtual function, warning
2953 @cindex warning for overloaded virtual function
2954 Warn when a function declaration hides virtual functions from a
2955 base class. For example, in:
2956
2957 @smallexample
2958 struct A @{
2959 virtual void f();
2960 @};
2961
2962 struct B: public A @{
2963 void f(int);
2964 @};
2965 @end smallexample
2966
2967 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2968 like:
2969
2970 @smallexample
2971 B* b;
2972 b->f();
2973 @end smallexample
2974
2975 @noindent
2976 fails to compile.
2977
2978 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2979 @opindex Wno-pmf-conversions
2980 @opindex Wpmf-conversions
2981 Disable the diagnostic for converting a bound pointer to member function
2982 to a plain pointer.
2983
2984 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2985 @opindex Wsign-promo
2986 @opindex Wno-sign-promo
2987 Warn when overload resolution chooses a promotion from unsigned or
2988 enumerated type to a signed type, over a conversion to an unsigned type of
2989 the same size. Previous versions of G++ tried to preserve
2990 unsignedness, but the standard mandates the current behavior.
2991
2992 @item -Wtemplates @r{(C++ and Objective-C++ only)}
2993 @opindex Wtemplates
2994 Warn when a primary template declaration is encountered. Some coding
2995 rules disallow templates, and this may be used to enforce that rule.
2996 The warning is inactive inside a system header file, such as the STL, so
2997 one can still use the STL. One may also instantiate or specialize
2998 templates.
2999
3000 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3001 @opindex Wmultiple-inheritance
3002 Warn when a class is defined with multiple direct base classes. Some
3003 coding rules disallow multiple inheritance, and this may be used to
3004 enforce that rule. The warning is inactive inside a system header file,
3005 such as the STL, so one can still use the STL. One may also define
3006 classes that indirectly use multiple inheritance.
3007
3008 @item -Wvirtual-inheritance
3009 @opindex Wvirtual-inheritance
3010 Warn when a class is defined with a virtual direct base classe. Some
3011 coding rules disallow multiple inheritance, and this may be used to
3012 enforce that rule. The warning is inactive inside a system header file,
3013 such as the STL, so one can still use the STL. One may also define
3014 classes that indirectly use virtual inheritance.
3015
3016 @item -Wnamespaces
3017 @opindex Wnamespaces
3018 Warn when a namespace definition is opened. Some coding rules disallow
3019 namespaces, and this may be used to enforce that rule. The warning is
3020 inactive inside a system header file, such as the STL, so one can still
3021 use the STL. One may also use using directives and qualified names.
3022
3023 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3024 @opindex Wterminate
3025 @opindex Wno-terminate
3026 Disable the warning about a throw-expression that will immediately
3027 result in a call to @code{terminate}.
3028 @end table
3029
3030 @node Objective-C and Objective-C++ Dialect Options
3031 @section Options Controlling Objective-C and Objective-C++ Dialects
3032
3033 @cindex compiler options, Objective-C and Objective-C++
3034 @cindex Objective-C and Objective-C++ options, command-line
3035 @cindex options, Objective-C and Objective-C++
3036 (NOTE: This manual does not describe the Objective-C and Objective-C++
3037 languages themselves. @xref{Standards,,Language Standards
3038 Supported by GCC}, for references.)
3039
3040 This section describes the command-line options that are only meaningful
3041 for Objective-C and Objective-C++ programs. You can also use most of
3042 the language-independent GNU compiler options.
3043 For example, you might compile a file @file{some_class.m} like this:
3044
3045 @smallexample
3046 gcc -g -fgnu-runtime -O -c some_class.m
3047 @end smallexample
3048
3049 @noindent
3050 In this example, @option{-fgnu-runtime} is an option meant only for
3051 Objective-C and Objective-C++ programs; you can use the other options with
3052 any language supported by GCC@.
3053
3054 Note that since Objective-C is an extension of the C language, Objective-C
3055 compilations may also use options specific to the C front-end (e.g.,
3056 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3057 C++-specific options (e.g., @option{-Wabi}).
3058
3059 Here is a list of options that are @emph{only} for compiling Objective-C
3060 and Objective-C++ programs:
3061
3062 @table @gcctabopt
3063 @item -fconstant-string-class=@var{class-name}
3064 @opindex fconstant-string-class
3065 Use @var{class-name} as the name of the class to instantiate for each
3066 literal string specified with the syntax @code{@@"@dots{}"}. The default
3067 class name is @code{NXConstantString} if the GNU runtime is being used, and
3068 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3069 @option{-fconstant-cfstrings} option, if also present, overrides the
3070 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3071 to be laid out as constant CoreFoundation strings.
3072
3073 @item -fgnu-runtime
3074 @opindex fgnu-runtime
3075 Generate object code compatible with the standard GNU Objective-C
3076 runtime. This is the default for most types of systems.
3077
3078 @item -fnext-runtime
3079 @opindex fnext-runtime
3080 Generate output compatible with the NeXT runtime. This is the default
3081 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3082 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3083 used.
3084
3085 @item -fno-nil-receivers
3086 @opindex fno-nil-receivers
3087 Assume that all Objective-C message dispatches (@code{[receiver
3088 message:arg]}) in this translation unit ensure that the receiver is
3089 not @code{nil}. This allows for more efficient entry points in the
3090 runtime to be used. This option is only available in conjunction with
3091 the NeXT runtime and ABI version 0 or 1.
3092
3093 @item -fobjc-abi-version=@var{n}
3094 @opindex fobjc-abi-version
3095 Use version @var{n} of the Objective-C ABI for the selected runtime.
3096 This option is currently supported only for the NeXT runtime. In that
3097 case, Version 0 is the traditional (32-bit) ABI without support for
3098 properties and other Objective-C 2.0 additions. Version 1 is the
3099 traditional (32-bit) ABI with support for properties and other
3100 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3101 nothing is specified, the default is Version 0 on 32-bit target
3102 machines, and Version 2 on 64-bit target machines.
3103
3104 @item -fobjc-call-cxx-cdtors
3105 @opindex fobjc-call-cxx-cdtors
3106 For each Objective-C class, check if any of its instance variables is a
3107 C++ object with a non-trivial default constructor. If so, synthesize a
3108 special @code{- (id) .cxx_construct} instance method which runs
3109 non-trivial default constructors on any such instance variables, in order,
3110 and then return @code{self}. Similarly, check if any instance variable
3111 is a C++ object with a non-trivial destructor, and if so, synthesize a
3112 special @code{- (void) .cxx_destruct} method which runs
3113 all such default destructors, in reverse order.
3114
3115 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3116 methods thusly generated only operate on instance variables
3117 declared in the current Objective-C class, and not those inherited
3118 from superclasses. It is the responsibility of the Objective-C
3119 runtime to invoke all such methods in an object's inheritance
3120 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3121 by the runtime immediately after a new object instance is allocated;
3122 the @code{- (void) .cxx_destruct} methods are invoked immediately
3123 before the runtime deallocates an object instance.
3124
3125 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3126 support for invoking the @code{- (id) .cxx_construct} and
3127 @code{- (void) .cxx_destruct} methods.
3128
3129 @item -fobjc-direct-dispatch
3130 @opindex fobjc-direct-dispatch
3131 Allow fast jumps to the message dispatcher. On Darwin this is
3132 accomplished via the comm page.
3133
3134 @item -fobjc-exceptions
3135 @opindex fobjc-exceptions
3136 Enable syntactic support for structured exception handling in
3137 Objective-C, similar to what is offered by C++ and Java. This option
3138 is required to use the Objective-C keywords @code{@@try},
3139 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3140 @code{@@synchronized}. This option is available with both the GNU
3141 runtime and the NeXT runtime (but not available in conjunction with
3142 the NeXT runtime on Mac OS X 10.2 and earlier).
3143
3144 @item -fobjc-gc
3145 @opindex fobjc-gc
3146 Enable garbage collection (GC) in Objective-C and Objective-C++
3147 programs. This option is only available with the NeXT runtime; the
3148 GNU runtime has a different garbage collection implementation that
3149 does not require special compiler flags.
3150
3151 @item -fobjc-nilcheck
3152 @opindex fobjc-nilcheck
3153 For the NeXT runtime with version 2 of the ABI, check for a nil
3154 receiver in method invocations before doing the actual method call.
3155 This is the default and can be disabled using
3156 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3157 checked for nil in this way no matter what this flag is set to.
3158 Currently this flag does nothing when the GNU runtime, or an older
3159 version of the NeXT runtime ABI, is used.
3160
3161 @item -fobjc-std=objc1
3162 @opindex fobjc-std
3163 Conform to the language syntax of Objective-C 1.0, the language
3164 recognized by GCC 4.0. This only affects the Objective-C additions to
3165 the C/C++ language; it does not affect conformance to C/C++ standards,
3166 which is controlled by the separate C/C++ dialect option flags. When
3167 this option is used with the Objective-C or Objective-C++ compiler,
3168 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3169 This is useful if you need to make sure that your Objective-C code can
3170 be compiled with older versions of GCC@.
3171
3172 @item -freplace-objc-classes
3173 @opindex freplace-objc-classes
3174 Emit a special marker instructing @command{ld(1)} not to statically link in
3175 the resulting object file, and allow @command{dyld(1)} to load it in at
3176 run time instead. This is used in conjunction with the Fix-and-Continue
3177 debugging mode, where the object file in question may be recompiled and
3178 dynamically reloaded in the course of program execution, without the need
3179 to restart the program itself. Currently, Fix-and-Continue functionality
3180 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3181 and later.
3182
3183 @item -fzero-link
3184 @opindex fzero-link
3185 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3186 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3187 compile time) with static class references that get initialized at load time,
3188 which improves run-time performance. Specifying the @option{-fzero-link} flag
3189 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3190 to be retained. This is useful in Zero-Link debugging mode, since it allows
3191 for individual class implementations to be modified during program execution.
3192 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3193 regardless of command-line options.
3194
3195 @item -fno-local-ivars
3196 @opindex fno-local-ivars
3197 @opindex flocal-ivars
3198 By default instance variables in Objective-C can be accessed as if
3199 they were local variables from within the methods of the class they're
3200 declared in. This can lead to shadowing between instance variables
3201 and other variables declared either locally inside a class method or
3202 globally with the same name. Specifying the @option{-fno-local-ivars}
3203 flag disables this behavior thus avoiding variable shadowing issues.
3204
3205 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3206 @opindex fivar-visibility
3207 Set the default instance variable visibility to the specified option
3208 so that instance variables declared outside the scope of any access
3209 modifier directives default to the specified visibility.
3210
3211 @item -gen-decls
3212 @opindex gen-decls
3213 Dump interface declarations for all classes seen in the source file to a
3214 file named @file{@var{sourcename}.decl}.
3215
3216 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3217 @opindex Wassign-intercept
3218 @opindex Wno-assign-intercept
3219 Warn whenever an Objective-C assignment is being intercepted by the
3220 garbage collector.
3221
3222 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3223 @opindex Wno-protocol
3224 @opindex Wprotocol
3225 If a class is declared to implement a protocol, a warning is issued for
3226 every method in the protocol that is not implemented by the class. The
3227 default behavior is to issue a warning for every method not explicitly
3228 implemented in the class, even if a method implementation is inherited
3229 from the superclass. If you use the @option{-Wno-protocol} option, then
3230 methods inherited from the superclass are considered to be implemented,
3231 and no warning is issued for them.
3232
3233 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3234 @opindex Wselector
3235 @opindex Wno-selector
3236 Warn if multiple methods of different types for the same selector are
3237 found during compilation. The check is performed on the list of methods
3238 in the final stage of compilation. Additionally, a check is performed
3239 for each selector appearing in a @code{@@selector(@dots{})}
3240 expression, and a corresponding method for that selector has been found
3241 during compilation. Because these checks scan the method table only at
3242 the end of compilation, these warnings are not produced if the final
3243 stage of compilation is not reached, for example because an error is
3244 found during compilation, or because the @option{-fsyntax-only} option is
3245 being used.
3246
3247 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3248 @opindex Wstrict-selector-match
3249 @opindex Wno-strict-selector-match
3250 Warn if multiple methods with differing argument and/or return types are
3251 found for a given selector when attempting to send a message using this
3252 selector to a receiver of type @code{id} or @code{Class}. When this flag
3253 is off (which is the default behavior), the compiler omits such warnings
3254 if any differences found are confined to types that share the same size
3255 and alignment.
3256
3257 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3258 @opindex Wundeclared-selector
3259 @opindex Wno-undeclared-selector
3260 Warn if a @code{@@selector(@dots{})} expression referring to an
3261 undeclared selector is found. A selector is considered undeclared if no
3262 method with that name has been declared before the
3263 @code{@@selector(@dots{})} expression, either explicitly in an
3264 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3265 an @code{@@implementation} section. This option always performs its
3266 checks as soon as a @code{@@selector(@dots{})} expression is found,
3267 while @option{-Wselector} only performs its checks in the final stage of
3268 compilation. This also enforces the coding style convention
3269 that methods and selectors must be declared before being used.
3270
3271 @item -print-objc-runtime-info
3272 @opindex print-objc-runtime-info
3273 Generate C header describing the largest structure that is passed by
3274 value, if any.
3275
3276 @end table
3277
3278 @node Diagnostic Message Formatting Options
3279 @section Options to Control Diagnostic Messages Formatting
3280 @cindex options to control diagnostics formatting
3281 @cindex diagnostic messages
3282 @cindex message formatting
3283
3284 Traditionally, diagnostic messages have been formatted irrespective of
3285 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3286 options described below
3287 to control the formatting algorithm for diagnostic messages,
3288 e.g.@: how many characters per line, how often source location
3289 information should be reported. Note that some language front ends may not
3290 honor these options.
3291
3292 @table @gcctabopt
3293 @item -fmessage-length=@var{n}
3294 @opindex fmessage-length
3295 Try to format error messages so that they fit on lines of about
3296 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3297 done; each error message appears on a single line. This is the
3298 default for all front ends.
3299
3300 @item -fdiagnostics-show-location=once
3301 @opindex fdiagnostics-show-location
3302 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3303 reporter to emit source location information @emph{once}; that is, in
3304 case the message is too long to fit on a single physical line and has to
3305 be wrapped, the source location won't be emitted (as prefix) again,
3306 over and over, in subsequent continuation lines. This is the default
3307 behavior.
3308
3309 @item -fdiagnostics-show-location=every-line
3310 Only meaningful in line-wrapping mode. Instructs the diagnostic
3311 messages reporter to emit the same source location information (as
3312 prefix) for physical lines that result from the process of breaking
3313 a message which is too long to fit on a single line.
3314
3315 @item -fdiagnostics-color[=@var{WHEN}]
3316 @itemx -fno-diagnostics-color
3317 @opindex fdiagnostics-color
3318 @cindex highlight, color
3319 @vindex GCC_COLORS @r{environment variable}
3320 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3321 or @samp{auto}. The default depends on how the compiler has been configured,
3322 it can be any of the above @var{WHEN} options or also @samp{never}
3323 if @env{GCC_COLORS} environment variable isn't present in the environment,
3324 and @samp{auto} otherwise.
3325 @samp{auto} means to use color only when the standard error is a terminal.
3326 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3327 aliases for @option{-fdiagnostics-color=always} and
3328 @option{-fdiagnostics-color=never}, respectively.
3329
3330 The colors are defined by the environment variable @env{GCC_COLORS}.
3331 Its value is a colon-separated list of capabilities and Select Graphic
3332 Rendition (SGR) substrings. SGR commands are interpreted by the
3333 terminal or terminal emulator. (See the section in the documentation
3334 of your text terminal for permitted values and their meanings as
3335 character attributes.) These substring values are integers in decimal
3336 representation and can be concatenated with semicolons.
3337 Common values to concatenate include
3338 @samp{1} for bold,
3339 @samp{4} for underline,
3340 @samp{5} for blink,
3341 @samp{7} for inverse,
3342 @samp{39} for default foreground color,
3343 @samp{30} to @samp{37} for foreground colors,
3344 @samp{90} to @samp{97} for 16-color mode foreground colors,
3345 @samp{38;5;0} to @samp{38;5;255}
3346 for 88-color and 256-color modes foreground colors,
3347 @samp{49} for default background color,
3348 @samp{40} to @samp{47} for background colors,
3349 @samp{100} to @samp{107} for 16-color mode background colors,
3350 and @samp{48;5;0} to @samp{48;5;255}
3351 for 88-color and 256-color modes background colors.
3352
3353 The default @env{GCC_COLORS} is
3354 @smallexample
3355 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:quote=01:\
3356 fixit-insert=32:fixit-delete=31:\
3357 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32
3358 @end smallexample
3359 @noindent
3360 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3361 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3362 @samp{01} is bold, and @samp{31} is red.
3363 Setting @env{GCC_COLORS} to the empty string disables colors.
3364 Supported capabilities are as follows.
3365
3366 @table @code
3367 @item error=
3368 @vindex error GCC_COLORS @r{capability}
3369 SGR substring for error: markers.
3370
3371 @item warning=
3372 @vindex warning GCC_COLORS @r{capability}
3373 SGR substring for warning: markers.
3374
3375 @item note=
3376 @vindex note GCC_COLORS @r{capability}
3377 SGR substring for note: markers.
3378
3379 @item range1=
3380 @vindex range1 GCC_COLORS @r{capability}
3381 SGR substring for first additional range.
3382
3383 @item range2=
3384 @vindex range2 GCC_COLORS @r{capability}
3385 SGR substring for second additional range.
3386
3387 @item locus=
3388 @vindex locus GCC_COLORS @r{capability}
3389 SGR substring for location information, @samp{file:line} or
3390 @samp{file:line:column} etc.
3391
3392 @item quote=
3393 @vindex quote GCC_COLORS @r{capability}
3394 SGR substring for information printed within quotes.
3395
3396 @item fixit-insert=
3397 @vindex fixit-insert GCC_COLORS @r{capability}
3398 SGR substring for fix-it hints suggesting text to
3399 be inserted or replaced.
3400
3401 @item fixit-delete=
3402 @vindex fixit-delete GCC_COLORS @r{capability}
3403 SGR substring for fix-it hints suggesting text to
3404 be deleted.
3405
3406 @item diff-filename=
3407 @vindex diff-filename GCC_COLORS @r{capability}
3408 SGR substring for filename headers within generated patches.
3409
3410 @item diff-hunk=
3411 @vindex diff-hunk GCC_COLORS @r{capability}
3412 SGR substring for the starts of hunks within generated patches.
3413
3414 @item diff-delete=
3415 @vindex diff-delete GCC_COLORS @r{capability}
3416 SGR substring for deleted lines within generated patches.
3417
3418 @item diff-insert=
3419 @vindex diff-insert GCC_COLORS @r{capability}
3420 SGR substring for inserted lines within generated patches.
3421 @end table
3422
3423 @item -fno-diagnostics-show-option
3424 @opindex fno-diagnostics-show-option
3425 @opindex fdiagnostics-show-option
3426 By default, each diagnostic emitted includes text indicating the
3427 command-line option that directly controls the diagnostic (if such an
3428 option is known to the diagnostic machinery). Specifying the
3429 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3430
3431 @item -fno-diagnostics-show-caret
3432 @opindex fno-diagnostics-show-caret
3433 @opindex fdiagnostics-show-caret
3434 By default, each diagnostic emitted includes the original source line
3435 and a caret @samp{^} indicating the column. This option suppresses this
3436 information. The source line is truncated to @var{n} characters, if
3437 the @option{-fmessage-length=n} option is given. When the output is done
3438 to the terminal, the width is limited to the width given by the
3439 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3440
3441 @item -fdiagnostics-parseable-fixits
3442 @opindex fdiagnostics-parseable-fixits
3443 Emit fix-it hints in a machine-parseable format, suitable for consumption
3444 by IDEs. For each fix-it, a line will be printed after the relevant
3445 diagnostic, starting with the string ``fix-it:''. For example:
3446
3447 @smallexample
3448 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3449 @end smallexample
3450
3451 The location is expressed as a half-open range, expressed as a count of
3452 bytes, starting at byte 1 for the initial column. In the above example,
3453 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3454 given string:
3455
3456 @smallexample
3457 00000000011111111112222222222
3458 12345678901234567890123456789
3459 gtk_widget_showall (dlg);
3460 ^^^^^^^^^^^^^^^^^^
3461 gtk_widget_show_all
3462 @end smallexample
3463
3464 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3465 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3466 (e.g. vertical tab as ``\013'').
3467
3468 An empty replacement string indicates that the given range is to be removed.
3469 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3470 be inserted at the given position.
3471
3472 @item -fdiagnostics-generate-patch
3473 @opindex fdiagnostics-generate-patch
3474 Print fix-it hints to stderr in unified diff format, after any diagnostics
3475 are printed. For example:
3476
3477 @smallexample
3478 --- test.c
3479 +++ test.c
3480 @@ -42,5 +42,5 @@
3481
3482 void show_cb(GtkDialog *dlg)
3483 @{
3484 - gtk_widget_showall(dlg);
3485 + gtk_widget_show_all(dlg);
3486 @}
3487
3488 @end smallexample
3489
3490 The diff may or may not be colorized, following the same rules
3491 as for diagnostics (see @option{-fdiagnostics-color}).
3492
3493 @end table
3494
3495 @node Warning Options
3496 @section Options to Request or Suppress Warnings
3497 @cindex options to control warnings
3498 @cindex warning messages
3499 @cindex messages, warning
3500 @cindex suppressing warnings
3501
3502 Warnings are diagnostic messages that report constructions that
3503 are not inherently erroneous but that are risky or suggest there
3504 may have been an error.
3505
3506 The following language-independent options do not enable specific
3507 warnings but control the kinds of diagnostics produced by GCC@.
3508
3509 @table @gcctabopt
3510 @cindex syntax checking
3511 @item -fsyntax-only
3512 @opindex fsyntax-only
3513 Check the code for syntax errors, but don't do anything beyond that.
3514
3515 @item -fmax-errors=@var{n}
3516 @opindex fmax-errors
3517 Limits the maximum number of error messages to @var{n}, at which point
3518 GCC bails out rather than attempting to continue processing the source
3519 code. If @var{n} is 0 (the default), there is no limit on the number
3520 of error messages produced. If @option{-Wfatal-errors} is also
3521 specified, then @option{-Wfatal-errors} takes precedence over this
3522 option.
3523
3524 @item -w
3525 @opindex w
3526 Inhibit all warning messages.
3527
3528 @item -Werror
3529 @opindex Werror
3530 @opindex Wno-error
3531 Make all warnings into errors.
3532
3533 @item -Werror=
3534 @opindex Werror=
3535 @opindex Wno-error=
3536 Make the specified warning into an error. The specifier for a warning
3537 is appended; for example @option{-Werror=switch} turns the warnings
3538 controlled by @option{-Wswitch} into errors. This switch takes a
3539 negative form, to be used to negate @option{-Werror} for specific
3540 warnings; for example @option{-Wno-error=switch} makes
3541 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3542 is in effect.
3543
3544 The warning message for each controllable warning includes the
3545 option that controls the warning. That option can then be used with
3546 @option{-Werror=} and @option{-Wno-error=} as described above.
3547 (Printing of the option in the warning message can be disabled using the
3548 @option{-fno-diagnostics-show-option} flag.)
3549
3550 Note that specifying @option{-Werror=}@var{foo} automatically implies
3551 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3552 imply anything.
3553
3554 @item -Wfatal-errors
3555 @opindex Wfatal-errors
3556 @opindex Wno-fatal-errors
3557 This option causes the compiler to abort compilation on the first error
3558 occurred rather than trying to keep going and printing further error
3559 messages.
3560
3561 @end table
3562
3563 You can request many specific warnings with options beginning with
3564 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3565 implicit declarations. Each of these specific warning options also
3566 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3567 example, @option{-Wno-implicit}. This manual lists only one of the
3568 two forms, whichever is not the default. For further
3569 language-specific options also refer to @ref{C++ Dialect Options} and
3570 @ref{Objective-C and Objective-C++ Dialect Options}.
3571
3572 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3573 options, such as @option{-Wunused}, which may turn on further options,
3574 such as @option{-Wunused-value}. The combined effect of positive and
3575 negative forms is that more specific options have priority over less
3576 specific ones, independently of their position in the command-line. For
3577 options of the same specificity, the last one takes effect. Options
3578 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3579 as if they appeared at the end of the command-line.
3580
3581 When an unrecognized warning option is requested (e.g.,
3582 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3583 that the option is not recognized. However, if the @option{-Wno-} form
3584 is used, the behavior is slightly different: no diagnostic is
3585 produced for @option{-Wno-unknown-warning} unless other diagnostics
3586 are being produced. This allows the use of new @option{-Wno-} options
3587 with old compilers, but if something goes wrong, the compiler
3588 warns that an unrecognized option is present.
3589
3590 @table @gcctabopt
3591 @item -Wpedantic
3592 @itemx -pedantic
3593 @opindex pedantic
3594 @opindex Wpedantic
3595 Issue all the warnings demanded by strict ISO C and ISO C++;
3596 reject all programs that use forbidden extensions, and some other
3597 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3598 version of the ISO C standard specified by any @option{-std} option used.
3599
3600 Valid ISO C and ISO C++ programs should compile properly with or without
3601 this option (though a rare few require @option{-ansi} or a
3602 @option{-std} option specifying the required version of ISO C)@. However,
3603 without this option, certain GNU extensions and traditional C and C++
3604 features are supported as well. With this option, they are rejected.
3605
3606 @option{-Wpedantic} does not cause warning messages for use of the
3607 alternate keywords whose names begin and end with @samp{__}. Pedantic
3608 warnings are also disabled in the expression that follows
3609 @code{__extension__}. However, only system header files should use
3610 these escape routes; application programs should avoid them.
3611 @xref{Alternate Keywords}.
3612
3613 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3614 C conformance. They soon find that it does not do quite what they want:
3615 it finds some non-ISO practices, but not all---only those for which
3616 ISO C @emph{requires} a diagnostic, and some others for which
3617 diagnostics have been added.
3618
3619 A feature to report any failure to conform to ISO C might be useful in
3620 some instances, but would require considerable additional work and would
3621 be quite different from @option{-Wpedantic}. We don't have plans to
3622 support such a feature in the near future.
3623
3624 Where the standard specified with @option{-std} represents a GNU
3625 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3626 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3627 extended dialect is based. Warnings from @option{-Wpedantic} are given
3628 where they are required by the base standard. (It does not make sense
3629 for such warnings to be given only for features not in the specified GNU
3630 C dialect, since by definition the GNU dialects of C include all
3631 features the compiler supports with the given option, and there would be
3632 nothing to warn about.)
3633
3634 @item -pedantic-errors
3635 @opindex pedantic-errors
3636 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3637 requires a diagnostic, in some cases where there is undefined behavior
3638 at compile-time and in some other cases that do not prevent compilation
3639 of programs that are valid according to the standard. This is not
3640 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3641 by this option and not enabled by the latter and vice versa.
3642
3643 @item -Wall
3644 @opindex Wall
3645 @opindex Wno-all
3646 This enables all the warnings about constructions that some users
3647 consider questionable, and that are easy to avoid (or modify to
3648 prevent the warning), even in conjunction with macros. This also
3649 enables some language-specific warnings described in @ref{C++ Dialect
3650 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3651
3652 @option{-Wall} turns on the following warning flags:
3653
3654 @gccoptlist{-Waddress @gol
3655 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3656 -Wbool-compare @gol
3657 -Wc++11-compat -Wc++14-compat@gol
3658 -Wchar-subscripts @gol
3659 -Wcomment @gol
3660 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3661 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3662 -Wformat @gol
3663 -Wimplicit @r{(C and Objective-C only)} @gol
3664 -Wimplicit-int @r{(C and Objective-C only)} @gol
3665 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3666 -Winit-self @r{(only for C++)} @gol
3667 -Wlogical-not-parentheses
3668 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3669 -Wmaybe-uninitialized @gol
3670 -Wmemset-elt-size @gol
3671 -Wmemset-transposed-args @gol
3672 -Wmisleading-indentation @r{(only for C/C++)} @gol
3673 -Wmissing-braces @r{(only for C/ObjC)} @gol
3674 -Wnarrowing @r{(only for C++)} @gol
3675 -Wnonnull @gol
3676 -Wnonnull-compare @gol
3677 -Wopenmp-simd @gol
3678 -Wparentheses @gol
3679 -Wpointer-sign @gol
3680 -Wreorder @gol
3681 -Wreturn-type @gol
3682 -Wsequence-point @gol
3683 -Wsign-compare @r{(only in C++)} @gol
3684 -Wsizeof-pointer-memaccess @gol
3685 -Wstrict-aliasing @gol
3686 -Wstrict-overflow=1 @gol
3687 -Wswitch @gol
3688 -Wtautological-compare @gol
3689 -Wtrigraphs @gol
3690 -Wuninitialized @gol
3691 -Wunknown-pragmas @gol
3692 -Wunused-function @gol
3693 -Wunused-label @gol
3694 -Wunused-value @gol
3695 -Wunused-variable @gol
3696 -Wvolatile-register-var @gol
3697 }
3698
3699 Note that some warning flags are not implied by @option{-Wall}. Some of
3700 them warn about constructions that users generally do not consider
3701 questionable, but which occasionally you might wish to check for;
3702 others warn about constructions that are necessary or hard to avoid in
3703 some cases, and there is no simple way to modify the code to suppress
3704 the warning. Some of them are enabled by @option{-Wextra} but many of
3705 them must be enabled individually.
3706
3707 @item -Wextra
3708 @opindex W
3709 @opindex Wextra
3710 @opindex Wno-extra
3711 This enables some extra warning flags that are not enabled by
3712 @option{-Wall}. (This option used to be called @option{-W}. The older
3713 name is still supported, but the newer name is more descriptive.)
3714
3715 @gccoptlist{-Wclobbered @gol
3716 -Wempty-body @gol
3717 -Wignored-qualifiers @gol
3718 -Wmissing-field-initializers @gol
3719 -Wmissing-parameter-type @r{(C only)} @gol
3720 -Wold-style-declaration @r{(C only)} @gol
3721 -Woverride-init @gol
3722 -Wsign-compare @r{(C only)} @gol
3723 -Wtype-limits @gol
3724 -Wuninitialized @gol
3725 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3726 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3727 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3728 }
3729
3730 The option @option{-Wextra} also prints warning messages for the
3731 following cases:
3732
3733 @itemize @bullet
3734
3735 @item
3736 A pointer is compared against integer zero with @code{<}, @code{<=},
3737 @code{>}, or @code{>=}.
3738
3739 @item
3740 (C++ only) An enumerator and a non-enumerator both appear in a
3741 conditional expression.
3742
3743 @item
3744 (C++ only) Ambiguous virtual bases.
3745
3746 @item
3747 (C++ only) Subscripting an array that has been declared @code{register}.
3748
3749 @item
3750 (C++ only) Taking the address of a variable that has been declared
3751 @code{register}.
3752
3753 @item
3754 (C++ only) A base class is not initialized in a derived class's copy
3755 constructor.
3756
3757 @end itemize
3758
3759 @item -Wchar-subscripts
3760 @opindex Wchar-subscripts
3761 @opindex Wno-char-subscripts
3762 Warn if an array subscript has type @code{char}. This is a common cause
3763 of error, as programmers often forget that this type is signed on some
3764 machines.
3765 This warning is enabled by @option{-Wall}.
3766
3767 @item -Wcomment
3768 @opindex Wcomment
3769 @opindex Wno-comment
3770 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3771 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3772 This warning is enabled by @option{-Wall}.
3773
3774 @item -Wno-coverage-mismatch
3775 @opindex Wno-coverage-mismatch
3776 Warn if feedback profiles do not match when using the
3777 @option{-fprofile-use} option.
3778 If a source file is changed between compiling with @option{-fprofile-gen} and
3779 with @option{-fprofile-use}, the files with the profile feedback can fail
3780 to match the source file and GCC cannot use the profile feedback
3781 information. By default, this warning is enabled and is treated as an
3782 error. @option{-Wno-coverage-mismatch} can be used to disable the
3783 warning or @option{-Wno-error=coverage-mismatch} can be used to
3784 disable the error. Disabling the error for this warning can result in
3785 poorly optimized code and is useful only in the
3786 case of very minor changes such as bug fixes to an existing code-base.
3787 Completely disabling the warning is not recommended.
3788
3789 @item -Wno-cpp
3790 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3791
3792 Suppress warning messages emitted by @code{#warning} directives.
3793
3794 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3795 @opindex Wdouble-promotion
3796 @opindex Wno-double-promotion
3797 Give a warning when a value of type @code{float} is implicitly
3798 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3799 floating-point unit implement @code{float} in hardware, but emulate
3800 @code{double} in software. On such a machine, doing computations
3801 using @code{double} values is much more expensive because of the
3802 overhead required for software emulation.
3803
3804 It is easy to accidentally do computations with @code{double} because
3805 floating-point literals are implicitly of type @code{double}. For
3806 example, in:
3807 @smallexample
3808 @group
3809 float area(float radius)
3810 @{
3811 return 3.14159 * radius * radius;
3812 @}
3813 @end group
3814 @end smallexample
3815 the compiler performs the entire computation with @code{double}
3816 because the floating-point literal is a @code{double}.
3817
3818 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
3819 @opindex Wduplicate-decl-specifier
3820 @opindex Wno-duplicate-decl-specifier
3821 Warn if a declaration has duplicate @code{const}, @code{volatile},
3822 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
3823 @option{-Wall}.
3824
3825 @item -Wformat
3826 @itemx -Wformat=@var{n}
3827 @opindex Wformat
3828 @opindex Wno-format
3829 @opindex ffreestanding
3830 @opindex fno-builtin
3831 @opindex Wformat=
3832 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3833 the arguments supplied have types appropriate to the format string
3834 specified, and that the conversions specified in the format string make
3835 sense. This includes standard functions, and others specified by format
3836 attributes (@pxref{Function Attributes}), in the @code{printf},
3837 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3838 not in the C standard) families (or other target-specific families).
3839 Which functions are checked without format attributes having been
3840 specified depends on the standard version selected, and such checks of
3841 functions without the attribute specified are disabled by
3842 @option{-ffreestanding} or @option{-fno-builtin}.
3843
3844 The formats are checked against the format features supported by GNU
3845 libc version 2.2. These include all ISO C90 and C99 features, as well
3846 as features from the Single Unix Specification and some BSD and GNU
3847 extensions. Other library implementations may not support all these
3848 features; GCC does not support warning about features that go beyond a
3849 particular library's limitations. However, if @option{-Wpedantic} is used
3850 with @option{-Wformat}, warnings are given about format features not
3851 in the selected standard version (but not for @code{strfmon} formats,
3852 since those are not in any version of the C standard). @xref{C Dialect
3853 Options,,Options Controlling C Dialect}.
3854
3855 @table @gcctabopt
3856 @item -Wformat=1
3857 @itemx -Wformat
3858 @opindex Wformat
3859 @opindex Wformat=1
3860 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3861 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3862 @option{-Wformat} also checks for null format arguments for several
3863 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3864 aspects of this level of format checking can be disabled by the
3865 options: @option{-Wno-format-contains-nul},
3866 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3867 @option{-Wformat} is enabled by @option{-Wall}.
3868
3869 @item -Wno-format-contains-nul
3870 @opindex Wno-format-contains-nul
3871 @opindex Wformat-contains-nul
3872 If @option{-Wformat} is specified, do not warn about format strings that
3873 contain NUL bytes.
3874
3875 @item -Wno-format-extra-args
3876 @opindex Wno-format-extra-args
3877 @opindex Wformat-extra-args
3878 If @option{-Wformat} is specified, do not warn about excess arguments to a
3879 @code{printf} or @code{scanf} format function. The C standard specifies
3880 that such arguments are ignored.
3881
3882 Where the unused arguments lie between used arguments that are
3883 specified with @samp{$} operand number specifications, normally
3884 warnings are still given, since the implementation could not know what
3885 type to pass to @code{va_arg} to skip the unused arguments. However,
3886 in the case of @code{scanf} formats, this option suppresses the
3887 warning if the unused arguments are all pointers, since the Single
3888 Unix Specification says that such unused arguments are allowed.
3889
3890 @item -Wno-format-zero-length
3891 @opindex Wno-format-zero-length
3892 @opindex Wformat-zero-length
3893 If @option{-Wformat} is specified, do not warn about zero-length formats.
3894 The C standard specifies that zero-length formats are allowed.
3895
3896
3897 @item -Wformat=2
3898 @opindex Wformat=2
3899 Enable @option{-Wformat} plus additional format checks. Currently
3900 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3901 -Wformat-y2k}.
3902
3903 @item -Wformat-nonliteral
3904 @opindex Wformat-nonliteral
3905 @opindex Wno-format-nonliteral
3906 If @option{-Wformat} is specified, also warn if the format string is not a
3907 string literal and so cannot be checked, unless the format function
3908 takes its format arguments as a @code{va_list}.
3909
3910 @item -Wformat-security
3911 @opindex Wformat-security
3912 @opindex Wno-format-security
3913 If @option{-Wformat} is specified, also warn about uses of format
3914 functions that represent possible security problems. At present, this
3915 warns about calls to @code{printf} and @code{scanf} functions where the
3916 format string is not a string literal and there are no format arguments,
3917 as in @code{printf (foo);}. This may be a security hole if the format
3918 string came from untrusted input and contains @samp{%n}. (This is
3919 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3920 in future warnings may be added to @option{-Wformat-security} that are not
3921 included in @option{-Wformat-nonliteral}.)
3922
3923 @item -Wformat-signedness
3924 @opindex Wformat-signedness
3925 @opindex Wno-format-signedness
3926 If @option{-Wformat} is specified, also warn if the format string
3927 requires an unsigned argument and the argument is signed and vice versa.
3928
3929 @item -Wformat-y2k
3930 @opindex Wformat-y2k
3931 @opindex Wno-format-y2k
3932 If @option{-Wformat} is specified, also warn about @code{strftime}
3933 formats that may yield only a two-digit year.
3934 @end table
3935
3936 @item -Wnonnull
3937 @opindex Wnonnull
3938 @opindex Wno-nonnull
3939 Warn about passing a null pointer for arguments marked as
3940 requiring a non-null value by the @code{nonnull} function attribute.
3941
3942 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3943 can be disabled with the @option{-Wno-nonnull} option.
3944
3945 @item -Wnonnull-compare
3946 @opindex Wnonnull-compare
3947 @opindex Wno-nonnull-compare
3948 Warn when comparing an argument marked with the @code{nonnull}
3949 function attribute against null inside the function.
3950
3951 @option{-Wnonnull-compare} is included in @option{-Wall}. It
3952 can be disabled with the @option{-Wno-nonnull-compare} option.
3953
3954 @item -Wnull-dereference
3955 @opindex Wnull-dereference
3956 @opindex Wno-null-dereference
3957 Warn if the compiler detects paths that trigger erroneous or
3958 undefined behavior due to dereferencing a null pointer. This option
3959 is only active when @option{-fdelete-null-pointer-checks} is active,
3960 which is enabled by optimizations in most targets. The precision of
3961 the warnings depends on the optimization options used.
3962
3963 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3964 @opindex Winit-self
3965 @opindex Wno-init-self
3966 Warn about uninitialized variables that are initialized with themselves.
3967 Note this option can only be used with the @option{-Wuninitialized} option.
3968
3969 For example, GCC warns about @code{i} being uninitialized in the
3970 following snippet only when @option{-Winit-self} has been specified:
3971 @smallexample
3972 @group
3973 int f()
3974 @{
3975 int i = i;
3976 return i;
3977 @}
3978 @end group
3979 @end smallexample
3980
3981 This warning is enabled by @option{-Wall} in C++.
3982
3983 @item -Wimplicit-int @r{(C and Objective-C only)}
3984 @opindex Wimplicit-int
3985 @opindex Wno-implicit-int
3986 Warn when a declaration does not specify a type.
3987 This warning is enabled by @option{-Wall}.
3988
3989 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3990 @opindex Wimplicit-function-declaration
3991 @opindex Wno-implicit-function-declaration
3992 Give a warning whenever a function is used before being declared. In
3993 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3994 enabled by default and it is made into an error by
3995 @option{-pedantic-errors}. This warning is also enabled by
3996 @option{-Wall}.
3997
3998 @item -Wimplicit @r{(C and Objective-C only)}
3999 @opindex Wimplicit
4000 @opindex Wno-implicit
4001 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4002 This warning is enabled by @option{-Wall}.
4003
4004 @item -Wignored-qualifiers @r{(C and C++ only)}
4005 @opindex Wignored-qualifiers
4006 @opindex Wno-ignored-qualifiers
4007 Warn if the return type of a function has a type qualifier
4008 such as @code{const}. For ISO C such a type qualifier has no effect,
4009 since the value returned by a function is not an lvalue.
4010 For C++, the warning is only emitted for scalar types or @code{void}.
4011 ISO C prohibits qualified @code{void} return types on function
4012 definitions, so such return types always receive a warning
4013 even without this option.
4014
4015 This warning is also enabled by @option{-Wextra}.
4016
4017 @item -Wignored-attributes @r{(C and C++ only)}
4018 @opindex Wignored-attributes
4019 @opindex Wno-ignored-attributes
4020 Warn when an attribute is ignored. This is different from the
4021 @option{-Wattributes} option in that it warns whenever the compiler decides
4022 to drop an attribute, not that the attribute is either unknown, used in a
4023 wrong place, etc. This warning is enabled by default.
4024
4025 @item -Wmain
4026 @opindex Wmain
4027 @opindex Wno-main
4028 Warn if the type of @code{main} is suspicious. @code{main} should be
4029 a function with external linkage, returning int, taking either zero
4030 arguments, two, or three arguments of appropriate types. This warning
4031 is enabled by default in C++ and is enabled by either @option{-Wall}
4032 or @option{-Wpedantic}.
4033
4034 @item -Wmisleading-indentation @r{(C and C++ only)}
4035 @opindex Wmisleading-indentation
4036 @opindex Wno-misleading-indentation
4037 Warn when the indentation of the code does not reflect the block structure.
4038 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4039 @code{for} clauses with a guarded statement that does not use braces,
4040 followed by an unguarded statement with the same indentation.
4041
4042 In the following example, the call to ``bar'' is misleadingly indented as
4043 if it were guarded by the ``if'' conditional.
4044
4045 @smallexample
4046 if (some_condition ())
4047 foo ();
4048 bar (); /* Gotcha: this is not guarded by the "if". */
4049 @end smallexample
4050
4051 In the case of mixed tabs and spaces, the warning uses the
4052 @option{-ftabstop=} option to determine if the statements line up
4053 (defaulting to 8).
4054
4055 The warning is not issued for code involving multiline preprocessor logic
4056 such as the following example.
4057
4058 @smallexample
4059 if (flagA)
4060 foo (0);
4061 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4062 if (flagB)
4063 #endif
4064 foo (1);
4065 @end smallexample
4066
4067 The warning is not issued after a @code{#line} directive, since this
4068 typically indicates autogenerated code, and no assumptions can be made
4069 about the layout of the file that the directive references.
4070
4071 This warning is enabled by @option{-Wall} in C and C++.
4072
4073 @item -Wmissing-braces
4074 @opindex Wmissing-braces
4075 @opindex Wno-missing-braces
4076 Warn if an aggregate or union initializer is not fully bracketed. In
4077 the following example, the initializer for @code{a} is not fully
4078 bracketed, but that for @code{b} is fully bracketed. This warning is
4079 enabled by @option{-Wall} in C.
4080
4081 @smallexample
4082 int a[2][2] = @{ 0, 1, 2, 3 @};
4083 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4084 @end smallexample
4085
4086 This warning is enabled by @option{-Wall}.
4087
4088 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4089 @opindex Wmissing-include-dirs
4090 @opindex Wno-missing-include-dirs
4091 Warn if a user-supplied include directory does not exist.
4092
4093 @item -Wparentheses
4094 @opindex Wparentheses
4095 @opindex Wno-parentheses
4096 Warn if parentheses are omitted in certain contexts, such
4097 as when there is an assignment in a context where a truth value
4098 is expected, or when operators are nested whose precedence people
4099 often get confused about.
4100
4101 Also warn if a comparison like @code{x<=y<=z} appears; this is
4102 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4103 interpretation from that of ordinary mathematical notation.
4104
4105 Also warn for dangerous uses of the GNU extension to
4106 @code{?:} with omitted middle operand. When the condition
4107 in the @code{?}: operator is a boolean expression, the omitted value is
4108 always 1. Often programmers expect it to be a value computed
4109 inside the conditional expression instead.
4110
4111 This warning is enabled by @option{-Wall}.
4112
4113 @item -Wsequence-point
4114 @opindex Wsequence-point
4115 @opindex Wno-sequence-point
4116 Warn about code that may have undefined semantics because of violations
4117 of sequence point rules in the C and C++ standards.
4118
4119 The C and C++ standards define the order in which expressions in a C/C++
4120 program are evaluated in terms of @dfn{sequence points}, which represent
4121 a partial ordering between the execution of parts of the program: those
4122 executed before the sequence point, and those executed after it. These
4123 occur after the evaluation of a full expression (one which is not part
4124 of a larger expression), after the evaluation of the first operand of a
4125 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4126 function is called (but after the evaluation of its arguments and the
4127 expression denoting the called function), and in certain other places.
4128 Other than as expressed by the sequence point rules, the order of
4129 evaluation of subexpressions of an expression is not specified. All
4130 these rules describe only a partial order rather than a total order,
4131 since, for example, if two functions are called within one expression
4132 with no sequence point between them, the order in which the functions
4133 are called is not specified. However, the standards committee have
4134 ruled that function calls do not overlap.
4135
4136 It is not specified when between sequence points modifications to the
4137 values of objects take effect. Programs whose behavior depends on this
4138 have undefined behavior; the C and C++ standards specify that ``Between
4139 the previous and next sequence point an object shall have its stored
4140 value modified at most once by the evaluation of an expression.
4141 Furthermore, the prior value shall be read only to determine the value
4142 to be stored.''. If a program breaks these rules, the results on any
4143 particular implementation are entirely unpredictable.
4144
4145 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4146 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4147 diagnosed by this option, and it may give an occasional false positive
4148 result, but in general it has been found fairly effective at detecting
4149 this sort of problem in programs.
4150
4151 The C++17 standard will define the order of evaluation of operands in
4152 more cases: in particular it requires that the right-hand side of an
4153 assignment be evaluated before the left-hand side, so the above
4154 examples are no longer undefined. But this warning will still warn
4155 about them, to help people avoid writing code that is undefined in C
4156 and earlier revisions of C++.
4157
4158 The standard is worded confusingly, therefore there is some debate
4159 over the precise meaning of the sequence point rules in subtle cases.
4160 Links to discussions of the problem, including proposed formal
4161 definitions, may be found on the GCC readings page, at
4162 @uref{http://gcc.gnu.org/@/readings.html}.
4163
4164 This warning is enabled by @option{-Wall} for C and C++.
4165
4166 @item -Wno-return-local-addr
4167 @opindex Wno-return-local-addr
4168 @opindex Wreturn-local-addr
4169 Do not warn about returning a pointer (or in C++, a reference) to a
4170 variable that goes out of scope after the function returns.
4171
4172 @item -Wreturn-type
4173 @opindex Wreturn-type
4174 @opindex Wno-return-type
4175 Warn whenever a function is defined with a return type that defaults
4176 to @code{int}. Also warn about any @code{return} statement with no
4177 return value in a function whose return type is not @code{void}
4178 (falling off the end of the function body is considered returning
4179 without a value).
4180
4181 For C only, warn about a @code{return} statement with an expression in a
4182 function whose return type is @code{void}, unless the expression type is
4183 also @code{void}. As a GNU extension, the latter case is accepted
4184 without a warning unless @option{-Wpedantic} is used.
4185
4186 For C++, a function without return type always produces a diagnostic
4187 message, even when @option{-Wno-return-type} is specified. The only
4188 exceptions are @code{main} and functions defined in system headers.
4189
4190 This warning is enabled by @option{-Wall}.
4191
4192 @item -Wshift-count-negative
4193 @opindex Wshift-count-negative
4194 @opindex Wno-shift-count-negative
4195 Warn if shift count is negative. This warning is enabled by default.
4196
4197 @item -Wshift-count-overflow
4198 @opindex Wshift-count-overflow
4199 @opindex Wno-shift-count-overflow
4200 Warn if shift count >= width of type. This warning is enabled by default.
4201
4202 @item -Wshift-negative-value
4203 @opindex Wshift-negative-value
4204 @opindex Wno-shift-negative-value
4205 Warn if left shifting a negative value. This warning is enabled by
4206 @option{-Wextra} in C99 and C++11 modes (and newer).
4207
4208 @item -Wshift-overflow
4209 @itemx -Wshift-overflow=@var{n}
4210 @opindex Wshift-overflow
4211 @opindex Wno-shift-overflow
4212 Warn about left shift overflows. This warning is enabled by
4213 default in C99 and C++11 modes (and newer).
4214
4215 @table @gcctabopt
4216 @item -Wshift-overflow=1
4217 This is the warning level of @option{-Wshift-overflow} and is enabled
4218 by default in C99 and C++11 modes (and newer). This warning level does
4219 not warn about left-shifting 1 into the sign bit. (However, in C, such
4220 an overflow is still rejected in contexts where an integer constant expression
4221 is required.)
4222
4223 @item -Wshift-overflow=2
4224 This warning level also warns about left-shifting 1 into the sign bit,
4225 unless C++14 mode is active.
4226 @end table
4227
4228 @item -Wswitch
4229 @opindex Wswitch
4230 @opindex Wno-switch
4231 Warn whenever a @code{switch} statement has an index of enumerated type
4232 and lacks a @code{case} for one or more of the named codes of that
4233 enumeration. (The presence of a @code{default} label prevents this
4234 warning.) @code{case} labels outside the enumeration range also
4235 provoke warnings when this option is used (even if there is a
4236 @code{default} label).
4237 This warning is enabled by @option{-Wall}.
4238
4239 @item -Wswitch-default
4240 @opindex Wswitch-default
4241 @opindex Wno-switch-default
4242 Warn whenever a @code{switch} statement does not have a @code{default}
4243 case.
4244
4245 @item -Wswitch-enum
4246 @opindex Wswitch-enum
4247 @opindex Wno-switch-enum
4248 Warn whenever a @code{switch} statement has an index of enumerated type
4249 and lacks a @code{case} for one or more of the named codes of that
4250 enumeration. @code{case} labels outside the enumeration range also
4251 provoke warnings when this option is used. The only difference
4252 between @option{-Wswitch} and this option is that this option gives a
4253 warning about an omitted enumeration code even if there is a
4254 @code{default} label.
4255
4256 @item -Wswitch-bool
4257 @opindex Wswitch-bool
4258 @opindex Wno-switch-bool
4259 Warn whenever a @code{switch} statement has an index of boolean type
4260 and the case values are outside the range of a boolean type.
4261 It is possible to suppress this warning by casting the controlling
4262 expression to a type other than @code{bool}. For example:
4263 @smallexample
4264 @group
4265 switch ((int) (a == 4))
4266 @{
4267 @dots{}
4268 @}
4269 @end group
4270 @end smallexample
4271 This warning is enabled by default for C and C++ programs.
4272
4273 @item -Wswitch-unreachable
4274 @opindex Wswitch-unreachable
4275 @opindex Wno-switch-unreachable
4276 Warn whenever a @code{switch} statement contains statements between the
4277 controlling expression and the first case label, which will never be
4278 executed. For example:
4279 @smallexample
4280 @group
4281 switch (cond)
4282 @{
4283 i = 15;
4284 @dots{}
4285 case 5:
4286 @dots{}
4287 @}
4288 @end group
4289 @end smallexample
4290 @option{-Wswitch-unreachable} does not warn if the statement between the
4291 controlling expression and the first case label is just a declaration:
4292 @smallexample
4293 @group
4294 switch (cond)
4295 @{
4296 int i;
4297 @dots{}
4298 case 5:
4299 i = 5;
4300 @dots{}
4301 @}
4302 @end group
4303 @end smallexample
4304 This warning is enabled by default for C and C++ programs.
4305
4306 @item -Wsync-nand @r{(C and C++ only)}
4307 @opindex Wsync-nand
4308 @opindex Wno-sync-nand
4309 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4310 built-in functions are used. These functions changed semantics in GCC 4.4.
4311
4312 @item -Wtrigraphs
4313 @opindex Wtrigraphs
4314 @opindex Wno-trigraphs
4315 Warn if any trigraphs are encountered that might change the meaning of
4316 the program (trigraphs within comments are not warned about).
4317 This warning is enabled by @option{-Wall}.
4318
4319 @item -Wunused-but-set-parameter
4320 @opindex Wunused-but-set-parameter
4321 @opindex Wno-unused-but-set-parameter
4322 Warn whenever a function parameter is assigned to, but otherwise unused
4323 (aside from its declaration).
4324
4325 To suppress this warning use the @code{unused} attribute
4326 (@pxref{Variable Attributes}).
4327
4328 This warning is also enabled by @option{-Wunused} together with
4329 @option{-Wextra}.
4330
4331 @item -Wunused-but-set-variable
4332 @opindex Wunused-but-set-variable
4333 @opindex Wno-unused-but-set-variable
4334 Warn whenever a local variable is assigned to, but otherwise unused
4335 (aside from its declaration).
4336 This warning is enabled by @option{-Wall}.
4337
4338 To suppress this warning use the @code{unused} attribute
4339 (@pxref{Variable Attributes}).
4340
4341 This warning is also enabled by @option{-Wunused}, which is enabled
4342 by @option{-Wall}.
4343
4344 @item -Wunused-function
4345 @opindex Wunused-function
4346 @opindex Wno-unused-function
4347 Warn whenever a static function is declared but not defined or a
4348 non-inline static function is unused.
4349 This warning is enabled by @option{-Wall}.
4350
4351 @item -Wunused-label
4352 @opindex Wunused-label
4353 @opindex Wno-unused-label
4354 Warn whenever a label is declared but not used.
4355 This warning is enabled by @option{-Wall}.
4356
4357 To suppress this warning use the @code{unused} attribute
4358 (@pxref{Variable Attributes}).
4359
4360 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4361 @opindex Wunused-local-typedefs
4362 Warn when a typedef locally defined in a function is not used.
4363 This warning is enabled by @option{-Wall}.
4364
4365 @item -Wunused-parameter
4366 @opindex Wunused-parameter
4367 @opindex Wno-unused-parameter
4368 Warn whenever a function parameter is unused aside from its declaration.
4369
4370 To suppress this warning use the @code{unused} attribute
4371 (@pxref{Variable Attributes}).
4372
4373 @item -Wno-unused-result
4374 @opindex Wunused-result
4375 @opindex Wno-unused-result
4376 Do not warn if a caller of a function marked with attribute
4377 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4378 its return value. The default is @option{-Wunused-result}.
4379
4380 @item -Wunused-variable
4381 @opindex Wunused-variable
4382 @opindex Wno-unused-variable
4383 Warn whenever a local or static variable is unused aside from its
4384 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4385 but not for C++. This warning is enabled by @option{-Wall}.
4386
4387 To suppress this warning use the @code{unused} attribute
4388 (@pxref{Variable Attributes}).
4389
4390 @item -Wunused-const-variable
4391 @itemx -Wunused-const-variable=@var{n}
4392 @opindex Wunused-const-variable
4393 @opindex Wno-unused-const-variable
4394 Warn whenever a constant static variable is unused aside from its declaration.
4395 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4396 for C, but not for C++. In C this declares variable storage, but in C++ this
4397 is not an error since const variables take the place of @code{#define}s.
4398
4399 To suppress this warning use the @code{unused} attribute
4400 (@pxref{Variable Attributes}).
4401
4402 @table @gcctabopt
4403 @item -Wunused-const-variable=1
4404 This is the warning level that is enabled by @option{-Wunused-variable} for
4405 C. It warns only about unused static const variables defined in the main
4406 compilation unit, but not about static const variables declared in any
4407 header included.
4408
4409 @item -Wunused-const-variable=2
4410 This warning level also warns for unused constant static variables in
4411 headers (excluding system headers). This is the warning level of
4412 @option{-Wunused-const-variable} and must be explicitly requested since
4413 in C++ this isn't an error and in C it might be harder to clean up all
4414 headers included.
4415 @end table
4416
4417 @item -Wunused-value
4418 @opindex Wunused-value
4419 @opindex Wno-unused-value
4420 Warn whenever a statement computes a result that is explicitly not
4421 used. To suppress this warning cast the unused expression to
4422 @code{void}. This includes an expression-statement or the left-hand
4423 side of a comma expression that contains no side effects. For example,
4424 an expression such as @code{x[i,j]} causes a warning, while
4425 @code{x[(void)i,j]} does not.
4426
4427 This warning is enabled by @option{-Wall}.
4428
4429 @item -Wunused
4430 @opindex Wunused
4431 @opindex Wno-unused
4432 All the above @option{-Wunused} options combined.
4433
4434 In order to get a warning about an unused function parameter, you must
4435 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4436 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4437
4438 @item -Wuninitialized
4439 @opindex Wuninitialized
4440 @opindex Wno-uninitialized
4441 Warn if an automatic variable is used without first being initialized
4442 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4443 warn if a non-static reference or non-static @code{const} member
4444 appears in a class without constructors.
4445
4446 If you want to warn about code that uses the uninitialized value of the
4447 variable in its own initializer, use the @option{-Winit-self} option.
4448
4449 These warnings occur for individual uninitialized or clobbered
4450 elements of structure, union or array variables as well as for
4451 variables that are uninitialized or clobbered as a whole. They do
4452 not occur for variables or elements declared @code{volatile}. Because
4453 these warnings depend on optimization, the exact variables or elements
4454 for which there are warnings depends on the precise optimization
4455 options and version of GCC used.
4456
4457 Note that there may be no warning about a variable that is used only
4458 to compute a value that itself is never used, because such
4459 computations may be deleted by data flow analysis before the warnings
4460 are printed.
4461
4462 @item -Winvalid-memory-model
4463 @opindex Winvalid-memory-model
4464 @opindex Wno-invalid-memory-model
4465 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4466 and the C11 atomic generic functions with a memory consistency argument
4467 that is either invalid for the operation or outside the range of values
4468 of the @code{memory_order} enumeration. For example, since the
4469 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4470 defined for the relaxed, release, and sequentially consistent memory
4471 orders the following code is diagnosed:
4472
4473 @smallexample
4474 void store (int *i)
4475 @{
4476 __atomic_store_n (i, 0, memory_order_consume);
4477 @}
4478 @end smallexample
4479
4480 @option{-Winvalid-memory-model} is enabled by default.
4481
4482 @item -Wmaybe-uninitialized
4483 @opindex Wmaybe-uninitialized
4484 @opindex Wno-maybe-uninitialized
4485 For an automatic variable, if there exists a path from the function
4486 entry to a use of the variable that is initialized, but there exist
4487 some other paths for which the variable is not initialized, the compiler
4488 emits a warning if it cannot prove the uninitialized paths are not
4489 executed at run time. These warnings are made optional because GCC is
4490 not smart enough to see all the reasons why the code might be correct
4491 in spite of appearing to have an error. Here is one example of how
4492 this can happen:
4493
4494 @smallexample
4495 @group
4496 @{
4497 int x;
4498 switch (y)
4499 @{
4500 case 1: x = 1;
4501 break;
4502 case 2: x = 4;
4503 break;
4504 case 3: x = 5;
4505 @}
4506 foo (x);
4507 @}
4508 @end group
4509 @end smallexample
4510
4511 @noindent
4512 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4513 always initialized, but GCC doesn't know this. To suppress the
4514 warning, you need to provide a default case with assert(0) or
4515 similar code.
4516
4517 @cindex @code{longjmp} warnings
4518 This option also warns when a non-volatile automatic variable might be
4519 changed by a call to @code{longjmp}. These warnings as well are possible
4520 only in optimizing compilation.
4521
4522 The compiler sees only the calls to @code{setjmp}. It cannot know
4523 where @code{longjmp} will be called; in fact, a signal handler could
4524 call it at any point in the code. As a result, you may get a warning
4525 even when there is in fact no problem because @code{longjmp} cannot
4526 in fact be called at the place that would cause a problem.
4527
4528 Some spurious warnings can be avoided if you declare all the functions
4529 you use that never return as @code{noreturn}. @xref{Function
4530 Attributes}.
4531
4532 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4533
4534 @item -Wunknown-pragmas
4535 @opindex Wunknown-pragmas
4536 @opindex Wno-unknown-pragmas
4537 @cindex warning for unknown pragmas
4538 @cindex unknown pragmas, warning
4539 @cindex pragmas, warning of unknown
4540 Warn when a @code{#pragma} directive is encountered that is not understood by
4541 GCC@. If this command-line option is used, warnings are even issued
4542 for unknown pragmas in system header files. This is not the case if
4543 the warnings are only enabled by the @option{-Wall} command-line option.
4544
4545 @item -Wno-pragmas
4546 @opindex Wno-pragmas
4547 @opindex Wpragmas
4548 Do not warn about misuses of pragmas, such as incorrect parameters,
4549 invalid syntax, or conflicts between pragmas. See also
4550 @option{-Wunknown-pragmas}.
4551
4552 @item -Wstrict-aliasing
4553 @opindex Wstrict-aliasing
4554 @opindex Wno-strict-aliasing
4555 This option is only active when @option{-fstrict-aliasing} is active.
4556 It warns about code that might break the strict aliasing rules that the
4557 compiler is using for optimization. The warning does not catch all
4558 cases, but does attempt to catch the more common pitfalls. It is
4559 included in @option{-Wall}.
4560 It is equivalent to @option{-Wstrict-aliasing=3}
4561
4562 @item -Wstrict-aliasing=n
4563 @opindex Wstrict-aliasing=n
4564 This option is only active when @option{-fstrict-aliasing} is active.
4565 It warns about code that might break the strict aliasing rules that the
4566 compiler is using for optimization.
4567 Higher levels correspond to higher accuracy (fewer false positives).
4568 Higher levels also correspond to more effort, similar to the way @option{-O}
4569 works.
4570 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4571
4572 Level 1: Most aggressive, quick, least accurate.
4573 Possibly useful when higher levels
4574 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4575 false negatives. However, it has many false positives.
4576 Warns for all pointer conversions between possibly incompatible types,
4577 even if never dereferenced. Runs in the front end only.
4578
4579 Level 2: Aggressive, quick, not too precise.
4580 May still have many false positives (not as many as level 1 though),
4581 and few false negatives (but possibly more than level 1).
4582 Unlike level 1, it only warns when an address is taken. Warns about
4583 incomplete types. Runs in the front end only.
4584
4585 Level 3 (default for @option{-Wstrict-aliasing}):
4586 Should have very few false positives and few false
4587 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4588 Takes care of the common pun+dereference pattern in the front end:
4589 @code{*(int*)&some_float}.
4590 If optimization is enabled, it also runs in the back end, where it deals
4591 with multiple statement cases using flow-sensitive points-to information.
4592 Only warns when the converted pointer is dereferenced.
4593 Does not warn about incomplete types.
4594
4595 @item -Wstrict-overflow
4596 @itemx -Wstrict-overflow=@var{n}
4597 @opindex Wstrict-overflow
4598 @opindex Wno-strict-overflow
4599 This option is only active when @option{-fstrict-overflow} is active.
4600 It warns about cases where the compiler optimizes based on the
4601 assumption that signed overflow does not occur. Note that it does not
4602 warn about all cases where the code might overflow: it only warns
4603 about cases where the compiler implements some optimization. Thus
4604 this warning depends on the optimization level.
4605
4606 An optimization that assumes that signed overflow does not occur is
4607 perfectly safe if the values of the variables involved are such that
4608 overflow never does, in fact, occur. Therefore this warning can
4609 easily give a false positive: a warning about code that is not
4610 actually a problem. To help focus on important issues, several
4611 warning levels are defined. No warnings are issued for the use of
4612 undefined signed overflow when estimating how many iterations a loop
4613 requires, in particular when determining whether a loop will be
4614 executed at all.
4615
4616 @table @gcctabopt
4617 @item -Wstrict-overflow=1
4618 Warn about cases that are both questionable and easy to avoid. For
4619 example, with @option{-fstrict-overflow}, the compiler simplifies
4620 @code{x + 1 > x} to @code{1}. This level of
4621 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4622 are not, and must be explicitly requested.
4623
4624 @item -Wstrict-overflow=2
4625 Also warn about other cases where a comparison is simplified to a
4626 constant. For example: @code{abs (x) >= 0}. This can only be
4627 simplified when @option{-fstrict-overflow} is in effect, because
4628 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4629 zero. @option{-Wstrict-overflow} (with no level) is the same as
4630 @option{-Wstrict-overflow=2}.
4631
4632 @item -Wstrict-overflow=3
4633 Also warn about other cases where a comparison is simplified. For
4634 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4635
4636 @item -Wstrict-overflow=4
4637 Also warn about other simplifications not covered by the above cases.
4638 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4639
4640 @item -Wstrict-overflow=5
4641 Also warn about cases where the compiler reduces the magnitude of a
4642 constant involved in a comparison. For example: @code{x + 2 > y} is
4643 simplified to @code{x + 1 >= y}. This is reported only at the
4644 highest warning level because this simplification applies to many
4645 comparisons, so this warning level gives a very large number of
4646 false positives.
4647 @end table
4648
4649 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4650 @opindex Wsuggest-attribute=
4651 @opindex Wno-suggest-attribute=
4652 Warn for cases where adding an attribute may be beneficial. The
4653 attributes currently supported are listed below.
4654
4655 @table @gcctabopt
4656 @item -Wsuggest-attribute=pure
4657 @itemx -Wsuggest-attribute=const
4658 @itemx -Wsuggest-attribute=noreturn
4659 @opindex Wsuggest-attribute=pure
4660 @opindex Wno-suggest-attribute=pure
4661 @opindex Wsuggest-attribute=const
4662 @opindex Wno-suggest-attribute=const
4663 @opindex Wsuggest-attribute=noreturn
4664 @opindex Wno-suggest-attribute=noreturn
4665
4666 Warn about functions that might be candidates for attributes
4667 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4668 functions visible in other compilation units or (in the case of @code{pure} and
4669 @code{const}) if it cannot prove that the function returns normally. A function
4670 returns normally if it doesn't contain an infinite loop or return abnormally
4671 by throwing, calling @code{abort} or trapping. This analysis requires option
4672 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4673 higher. Higher optimization levels improve the accuracy of the analysis.
4674
4675 @item -Wsuggest-attribute=format
4676 @itemx -Wmissing-format-attribute
4677 @opindex Wsuggest-attribute=format
4678 @opindex Wmissing-format-attribute
4679 @opindex Wno-suggest-attribute=format
4680 @opindex Wno-missing-format-attribute
4681 @opindex Wformat
4682 @opindex Wno-format
4683
4684 Warn about function pointers that might be candidates for @code{format}
4685 attributes. Note these are only possible candidates, not absolute ones.
4686 GCC guesses that function pointers with @code{format} attributes that
4687 are used in assignment, initialization, parameter passing or return
4688 statements should have a corresponding @code{format} attribute in the
4689 resulting type. I.e.@: the left-hand side of the assignment or
4690 initialization, the type of the parameter variable, or the return type
4691 of the containing function respectively should also have a @code{format}
4692 attribute to avoid the warning.
4693
4694 GCC also warns about function definitions that might be
4695 candidates for @code{format} attributes. Again, these are only
4696 possible candidates. GCC guesses that @code{format} attributes
4697 might be appropriate for any function that calls a function like
4698 @code{vprintf} or @code{vscanf}, but this might not always be the
4699 case, and some functions for which @code{format} attributes are
4700 appropriate may not be detected.
4701 @end table
4702
4703 @item -Wsuggest-final-types
4704 @opindex Wno-suggest-final-types
4705 @opindex Wsuggest-final-types
4706 Warn about types with virtual methods where code quality would be improved
4707 if the type were declared with the C++11 @code{final} specifier,
4708 or, if possible,
4709 declared in an anonymous namespace. This allows GCC to more aggressively
4710 devirtualize the polymorphic calls. This warning is more effective with link
4711 time optimization, where the information about the class hierarchy graph is
4712 more complete.
4713
4714 @item -Wsuggest-final-methods
4715 @opindex Wno-suggest-final-methods
4716 @opindex Wsuggest-final-methods
4717 Warn about virtual methods where code quality would be improved if the method
4718 were declared with the C++11 @code{final} specifier,
4719 or, if possible, its type were
4720 declared in an anonymous namespace or with the @code{final} specifier.
4721 This warning is
4722 more effective with link time optimization, where the information about the
4723 class hierarchy graph is more complete. It is recommended to first consider
4724 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4725 annotations.
4726
4727 @item -Wsuggest-override
4728 Warn about overriding virtual functions that are not marked with the override
4729 keyword.
4730
4731 @item -Warray-bounds
4732 @itemx -Warray-bounds=@var{n}
4733 @opindex Wno-array-bounds
4734 @opindex Warray-bounds
4735 This option is only active when @option{-ftree-vrp} is active
4736 (default for @option{-O2} and above). It warns about subscripts to arrays
4737 that are always out of bounds. This warning is enabled by @option{-Wall}.
4738
4739 @table @gcctabopt
4740 @item -Warray-bounds=1
4741 This is the warning level of @option{-Warray-bounds} and is enabled
4742 by @option{-Wall}; higher levels are not, and must be explicitly requested.
4743
4744 @item -Warray-bounds=2
4745 This warning level also warns about out of bounds access for
4746 arrays at the end of a struct and for arrays accessed through
4747 pointers. This warning level may give a larger number of
4748 false positives and is deactivated by default.
4749 @end table
4750
4751 @item -Wbool-compare
4752 @opindex Wno-bool-compare
4753 @opindex Wbool-compare
4754 Warn about boolean expression compared with an integer value different from
4755 @code{true}/@code{false}. For instance, the following comparison is
4756 always false:
4757 @smallexample
4758 int n = 5;
4759 @dots{}
4760 if ((n > 1) == 2) @{ @dots{} @}
4761 @end smallexample
4762 This warning is enabled by @option{-Wall}.
4763
4764 @item -Wduplicated-cond
4765 @opindex Wno-duplicated-cond
4766 @opindex Wduplicated-cond
4767 Warn about duplicated conditions in an if-else-if chain. For instance,
4768 warn for the following code:
4769 @smallexample
4770 if (p->q != NULL) @{ @dots{} @}
4771 else if (p->q != NULL) @{ @dots{} @}
4772 @end smallexample
4773
4774 @item -Wframe-address
4775 @opindex Wno-frame-address
4776 @opindex Wframe-address
4777 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
4778 is called with an argument greater than 0. Such calls may return indeterminate
4779 values or crash the program. The warning is included in @option{-Wall}.
4780
4781 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
4782 @opindex Wno-discarded-qualifiers
4783 @opindex Wdiscarded-qualifiers
4784 Do not warn if type qualifiers on pointers are being discarded.
4785 Typically, the compiler warns if a @code{const char *} variable is
4786 passed to a function that takes a @code{char *} parameter. This option
4787 can be used to suppress such a warning.
4788
4789 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
4790 @opindex Wno-discarded-array-qualifiers
4791 @opindex Wdiscarded-array-qualifiers
4792 Do not warn if type qualifiers on arrays which are pointer targets
4793 are being discarded. Typically, the compiler warns if a
4794 @code{const int (*)[]} variable is passed to a function that
4795 takes a @code{int (*)[]} parameter. This option can be used to
4796 suppress such a warning.
4797
4798 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
4799 @opindex Wno-incompatible-pointer-types
4800 @opindex Wincompatible-pointer-types
4801 Do not warn when there is a conversion between pointers that have incompatible
4802 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
4803 which warns for pointer argument passing or assignment with different
4804 signedness.
4805
4806 @item -Wno-int-conversion @r{(C and Objective-C only)}
4807 @opindex Wno-int-conversion
4808 @opindex Wint-conversion
4809 Do not warn about incompatible integer to pointer and pointer to integer
4810 conversions. This warning is about implicit conversions; for explicit
4811 conversions the warnings @option{-Wno-int-to-pointer-cast} and
4812 @option{-Wno-pointer-to-int-cast} may be used.
4813
4814 @item -Wno-div-by-zero
4815 @opindex Wno-div-by-zero
4816 @opindex Wdiv-by-zero
4817 Do not warn about compile-time integer division by zero. Floating-point
4818 division by zero is not warned about, as it can be a legitimate way of
4819 obtaining infinities and NaNs.
4820
4821 @item -Wsystem-headers
4822 @opindex Wsystem-headers
4823 @opindex Wno-system-headers
4824 @cindex warnings from system headers
4825 @cindex system headers, warnings from
4826 Print warning messages for constructs found in system header files.
4827 Warnings from system headers are normally suppressed, on the assumption
4828 that they usually do not indicate real problems and would only make the
4829 compiler output harder to read. Using this command-line option tells
4830 GCC to emit warnings from system headers as if they occurred in user
4831 code. However, note that using @option{-Wall} in conjunction with this
4832 option does @emph{not} warn about unknown pragmas in system
4833 headers---for that, @option{-Wunknown-pragmas} must also be used.
4834
4835 @item -Wtautological-compare
4836 @opindex Wtautological-compare
4837 @opindex Wno-tautological-compare
4838 Warn if a self-comparison always evaluates to true or false. This
4839 warning detects various mistakes such as:
4840 @smallexample
4841 int i = 1;
4842 @dots{}
4843 if (i > i) @{ @dots{} @}
4844 @end smallexample
4845 This warning is enabled by @option{-Wall}.
4846
4847 @item -Wtrampolines
4848 @opindex Wtrampolines
4849 @opindex Wno-trampolines
4850 Warn about trampolines generated for pointers to nested functions.
4851 A trampoline is a small piece of data or code that is created at run
4852 time on the stack when the address of a nested function is taken, and is
4853 used to call the nested function indirectly. For some targets, it is
4854 made up of data only and thus requires no special treatment. But, for
4855 most targets, it is made up of code and thus requires the stack to be
4856 made executable in order for the program to work properly.
4857
4858 @item -Wfloat-equal
4859 @opindex Wfloat-equal
4860 @opindex Wno-float-equal
4861 Warn if floating-point values are used in equality comparisons.
4862
4863 The idea behind this is that sometimes it is convenient (for the
4864 programmer) to consider floating-point values as approximations to
4865 infinitely precise real numbers. If you are doing this, then you need
4866 to compute (by analyzing the code, or in some other way) the maximum or
4867 likely maximum error that the computation introduces, and allow for it
4868 when performing comparisons (and when producing output, but that's a
4869 different problem). In particular, instead of testing for equality, you
4870 should check to see whether the two values have ranges that overlap; and
4871 this is done with the relational operators, so equality comparisons are
4872 probably mistaken.
4873
4874 @item -Wtraditional @r{(C and Objective-C only)}
4875 @opindex Wtraditional
4876 @opindex Wno-traditional
4877 Warn about certain constructs that behave differently in traditional and
4878 ISO C@. Also warn about ISO C constructs that have no traditional C
4879 equivalent, and/or problematic constructs that should be avoided.
4880
4881 @itemize @bullet
4882 @item
4883 Macro parameters that appear within string literals in the macro body.
4884 In traditional C macro replacement takes place within string literals,
4885 but in ISO C it does not.
4886
4887 @item
4888 In traditional C, some preprocessor directives did not exist.
4889 Traditional preprocessors only considered a line to be a directive
4890 if the @samp{#} appeared in column 1 on the line. Therefore
4891 @option{-Wtraditional} warns about directives that traditional C
4892 understands but ignores because the @samp{#} does not appear as the
4893 first character on the line. It also suggests you hide directives like
4894 @code{#pragma} not understood by traditional C by indenting them. Some
4895 traditional implementations do not recognize @code{#elif}, so this option
4896 suggests avoiding it altogether.
4897
4898 @item
4899 A function-like macro that appears without arguments.
4900
4901 @item
4902 The unary plus operator.
4903
4904 @item
4905 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4906 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
4907 constants.) Note, these suffixes appear in macros defined in the system
4908 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4909 Use of these macros in user code might normally lead to spurious
4910 warnings, however GCC's integrated preprocessor has enough context to
4911 avoid warning in these cases.
4912
4913 @item
4914 A function declared external in one block and then used after the end of
4915 the block.
4916
4917 @item
4918 A @code{switch} statement has an operand of type @code{long}.
4919
4920 @item
4921 A non-@code{static} function declaration follows a @code{static} one.
4922 This construct is not accepted by some traditional C compilers.
4923
4924 @item
4925 The ISO type of an integer constant has a different width or
4926 signedness from its traditional type. This warning is only issued if
4927 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
4928 typically represent bit patterns, are not warned about.
4929
4930 @item
4931 Usage of ISO string concatenation is detected.
4932
4933 @item
4934 Initialization of automatic aggregates.
4935
4936 @item
4937 Identifier conflicts with labels. Traditional C lacks a separate
4938 namespace for labels.
4939
4940 @item
4941 Initialization of unions. If the initializer is zero, the warning is
4942 omitted. This is done under the assumption that the zero initializer in
4943 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4944 initializer warnings and relies on default initialization to zero in the
4945 traditional C case.
4946
4947 @item
4948 Conversions by prototypes between fixed/floating-point values and vice
4949 versa. The absence of these prototypes when compiling with traditional
4950 C causes serious problems. This is a subset of the possible
4951 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4952
4953 @item
4954 Use of ISO C style function definitions. This warning intentionally is
4955 @emph{not} issued for prototype declarations or variadic functions
4956 because these ISO C features appear in your code when using
4957 libiberty's traditional C compatibility macros, @code{PARAMS} and
4958 @code{VPARAMS}. This warning is also bypassed for nested functions
4959 because that feature is already a GCC extension and thus not relevant to
4960 traditional C compatibility.
4961 @end itemize
4962
4963 @item -Wtraditional-conversion @r{(C and Objective-C only)}
4964 @opindex Wtraditional-conversion
4965 @opindex Wno-traditional-conversion
4966 Warn if a prototype causes a type conversion that is different from what
4967 would happen to the same argument in the absence of a prototype. This
4968 includes conversions of fixed point to floating and vice versa, and
4969 conversions changing the width or signedness of a fixed-point argument
4970 except when the same as the default promotion.
4971
4972 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4973 @opindex Wdeclaration-after-statement
4974 @opindex Wno-declaration-after-statement
4975 Warn when a declaration is found after a statement in a block. This
4976 construct, known from C++, was introduced with ISO C99 and is by default
4977 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
4978
4979 @item -Wundef
4980 @opindex Wundef
4981 @opindex Wno-undef
4982 Warn if an undefined identifier is evaluated in an @code{#if} directive.
4983
4984 @item -Wno-endif-labels
4985 @opindex Wno-endif-labels
4986 @opindex Wendif-labels
4987 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
4988
4989 @item -Wshadow
4990 @opindex Wshadow
4991 @opindex Wno-shadow
4992 Warn whenever a local variable or type declaration shadows another
4993 variable, parameter, type, class member (in C++), or instance variable
4994 (in Objective-C) or whenever a built-in function is shadowed. Note
4995 that in C++, the compiler warns if a local variable shadows an
4996 explicit typedef, but not if it shadows a struct/class/enum.
4997
4998 @item -Wno-shadow-ivar @r{(Objective-C only)}
4999 @opindex Wno-shadow-ivar
5000 @opindex Wshadow-ivar
5001 Do not warn whenever a local variable shadows an instance variable in an
5002 Objective-C method.
5003
5004 @item -Wlarger-than=@var{len}
5005 @opindex Wlarger-than=@var{len}
5006 @opindex Wlarger-than-@var{len}
5007 Warn whenever an object of larger than @var{len} bytes is defined.
5008
5009 @item -Wframe-larger-than=@var{len}
5010 @opindex Wframe-larger-than
5011 Warn if the size of a function frame is larger than @var{len} bytes.
5012 The computation done to determine the stack frame size is approximate
5013 and not conservative.
5014 The actual requirements may be somewhat greater than @var{len}
5015 even if you do not get a warning. In addition, any space allocated
5016 via @code{alloca}, variable-length arrays, or related constructs
5017 is not included by the compiler when determining
5018 whether or not to issue a warning.
5019
5020 @item -Wno-free-nonheap-object
5021 @opindex Wno-free-nonheap-object
5022 @opindex Wfree-nonheap-object
5023 Do not warn when attempting to free an object that was not allocated
5024 on the heap.
5025
5026 @item -Wstack-usage=@var{len}
5027 @opindex Wstack-usage
5028 Warn if the stack usage of a function might be larger than @var{len} bytes.
5029 The computation done to determine the stack usage is conservative.
5030 Any space allocated via @code{alloca}, variable-length arrays, or related
5031 constructs is included by the compiler when determining whether or not to
5032 issue a warning.
5033
5034 The message is in keeping with the output of @option{-fstack-usage}.
5035
5036 @itemize
5037 @item
5038 If the stack usage is fully static but exceeds the specified amount, it's:
5039
5040 @smallexample
5041 warning: stack usage is 1120 bytes
5042 @end smallexample
5043 @item
5044 If the stack usage is (partly) dynamic but bounded, it's:
5045
5046 @smallexample
5047 warning: stack usage might be 1648 bytes
5048 @end smallexample
5049 @item
5050 If the stack usage is (partly) dynamic and not bounded, it's:
5051
5052 @smallexample
5053 warning: stack usage might be unbounded
5054 @end smallexample
5055 @end itemize
5056
5057 @item -Wunsafe-loop-optimizations
5058 @opindex Wunsafe-loop-optimizations
5059 @opindex Wno-unsafe-loop-optimizations
5060 Warn if the loop cannot be optimized because the compiler cannot
5061 assume anything on the bounds of the loop indices. With
5062 @option{-funsafe-loop-optimizations} warn if the compiler makes
5063 such assumptions.
5064
5065 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
5066 @opindex Wno-pedantic-ms-format
5067 @opindex Wpedantic-ms-format
5068 When used in combination with @option{-Wformat}
5069 and @option{-pedantic} without GNU extensions, this option
5070 disables the warnings about non-ISO @code{printf} / @code{scanf} format
5071 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
5072 which depend on the MS runtime.
5073
5074 @item -Waligned-new
5075 @opindex Waligned-new
5076 @opindex Wno-aligned-new
5077 Warn about a new-expression of a type that requires greater alignment
5078 than the @code{alignof(std::max_align_t)} but uses an allocation
5079 function without an explicit alignment parameter. This option is
5080 enabled by @option{-Wall}.
5081
5082 Normally this only warns about global allocation functions, but
5083 @option{-Waligned-new=all} also warns about class member allocation
5084 functions.
5085
5086 @item -Wplacement-new
5087 @itemx -Wplacement-new=@var{n}
5088 @opindex Wplacement-new
5089 @opindex Wno-placement-new
5090 Warn about placement new expressions with undefined behavior, such as
5091 constructing an object in a buffer that is smaller than the type of
5092 the object. For example, the placement new expression below is diagnosed
5093 because it attempts to construct an array of 64 integers in a buffer only
5094 64 bytes large.
5095 @smallexample
5096 char buf [64];
5097 new (buf) int[64];
5098 @end smallexample
5099 This warning is enabled by default.
5100
5101 @table @gcctabopt
5102 @item -Wplacement-new=1
5103 This is the default warning level of @option{-Wplacement-new}. At this
5104 level the warning is not issued for some strictly undefined constructs that
5105 GCC allows as extensions for compatibility with legacy code. For example,
5106 the following @code{new} expression is not diagnosed at this level even
5107 though it has undefined behavior according to the C++ standard because
5108 it writes past the end of the one-element array.
5109 @smallexample
5110 struct S @{ int n, a[1]; @};
5111 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5112 new (s->a)int [32]();
5113 @end smallexample
5114
5115 @item -Wplacement-new=2
5116 At this level, in addition to diagnosing all the same constructs as at level
5117 1, a diagnostic is also issued for placement new expressions that construct
5118 an object in the last member of structure whose type is an array of a single
5119 element and whose size is less than the size of the object being constructed.
5120 While the previous example would be diagnosed, the following construct makes
5121 use of the flexible member array extension to avoid the warning at level 2.
5122 @smallexample
5123 struct S @{ int n, a[]; @};
5124 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5125 new (s->a)int [32]();
5126 @end smallexample
5127
5128 @end table
5129
5130 @item -Wpointer-arith
5131 @opindex Wpointer-arith
5132 @opindex Wno-pointer-arith
5133 Warn about anything that depends on the ``size of'' a function type or
5134 of @code{void}. GNU C assigns these types a size of 1, for
5135 convenience in calculations with @code{void *} pointers and pointers
5136 to functions. In C++, warn also when an arithmetic operation involves
5137 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
5138
5139 @item -Wtype-limits
5140 @opindex Wtype-limits
5141 @opindex Wno-type-limits
5142 Warn if a comparison is always true or always false due to the limited
5143 range of the data type, but do not warn for constant expressions. For
5144 example, warn if an unsigned variable is compared against zero with
5145 @code{<} or @code{>=}. This warning is also enabled by
5146 @option{-Wextra}.
5147
5148 @item -Wbad-function-cast @r{(C and Objective-C only)}
5149 @opindex Wbad-function-cast
5150 @opindex Wno-bad-function-cast
5151 Warn when a function call is cast to a non-matching type.
5152 For example, warn if a call to a function returning an integer type
5153 is cast to a pointer type.
5154
5155 @item -Wc90-c99-compat @r{(C and Objective-C only)}
5156 @opindex Wc90-c99-compat
5157 @opindex Wno-c90-c99-compat
5158 Warn about features not present in ISO C90, but present in ISO C99.
5159 For instance, warn about use of variable length arrays, @code{long long}
5160 type, @code{bool} type, compound literals, designated initializers, and so
5161 on. This option is independent of the standards mode. Warnings are disabled
5162 in the expression that follows @code{__extension__}.
5163
5164 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5165 @opindex Wc99-c11-compat
5166 @opindex Wno-c99-c11-compat
5167 Warn about features not present in ISO C99, but present in ISO C11.
5168 For instance, warn about use of anonymous structures and unions,
5169 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5170 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5171 and so on. This option is independent of the standards mode. Warnings are
5172 disabled in the expression that follows @code{__extension__}.
5173
5174 @item -Wc++-compat @r{(C and Objective-C only)}
5175 @opindex Wc++-compat
5176 Warn about ISO C constructs that are outside of the common subset of
5177 ISO C and ISO C++, e.g.@: request for implicit conversion from
5178 @code{void *} to a pointer to non-@code{void} type.
5179
5180 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5181 @opindex Wc++11-compat
5182 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5183 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5184 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5185 enabled by @option{-Wall}.
5186
5187 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5188 @opindex Wc++14-compat
5189 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5190 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5191
5192 @item -Wcast-qual
5193 @opindex Wcast-qual
5194 @opindex Wno-cast-qual
5195 Warn whenever a pointer is cast so as to remove a type qualifier from
5196 the target type. For example, warn if a @code{const char *} is cast
5197 to an ordinary @code{char *}.
5198
5199 Also warn when making a cast that introduces a type qualifier in an
5200 unsafe way. For example, casting @code{char **} to @code{const char **}
5201 is unsafe, as in this example:
5202
5203 @smallexample
5204 /* p is char ** value. */
5205 const char **q = (const char **) p;
5206 /* Assignment of readonly string to const char * is OK. */
5207 *q = "string";
5208 /* Now char** pointer points to read-only memory. */
5209 **p = 'b';
5210 @end smallexample
5211
5212 @item -Wcast-align
5213 @opindex Wcast-align
5214 @opindex Wno-cast-align
5215 Warn whenever a pointer is cast such that the required alignment of the
5216 target is increased. For example, warn if a @code{char *} is cast to
5217 an @code{int *} on machines where integers can only be accessed at
5218 two- or four-byte boundaries.
5219
5220 @item -Wwrite-strings
5221 @opindex Wwrite-strings
5222 @opindex Wno-write-strings
5223 When compiling C, give string constants the type @code{const
5224 char[@var{length}]} so that copying the address of one into a
5225 non-@code{const} @code{char *} pointer produces a warning. These
5226 warnings help you find at compile time code that can try to write
5227 into a string constant, but only if you have been very careful about
5228 using @code{const} in declarations and prototypes. Otherwise, it is
5229 just a nuisance. This is why we did not make @option{-Wall} request
5230 these warnings.
5231
5232 When compiling C++, warn about the deprecated conversion from string
5233 literals to @code{char *}. This warning is enabled by default for C++
5234 programs.
5235
5236 @item -Wclobbered
5237 @opindex Wclobbered
5238 @opindex Wno-clobbered
5239 Warn for variables that might be changed by @code{longjmp} or
5240 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5241
5242 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5243 @opindex Wconditionally-supported
5244 @opindex Wno-conditionally-supported
5245 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5246
5247 @item -Wconversion
5248 @opindex Wconversion
5249 @opindex Wno-conversion
5250 Warn for implicit conversions that may alter a value. This includes
5251 conversions between real and integer, like @code{abs (x)} when
5252 @code{x} is @code{double}; conversions between signed and unsigned,
5253 like @code{unsigned ui = -1}; and conversions to smaller types, like
5254 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5255 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5256 changed by the conversion like in @code{abs (2.0)}. Warnings about
5257 conversions between signed and unsigned integers can be disabled by
5258 using @option{-Wno-sign-conversion}.
5259
5260 For C++, also warn for confusing overload resolution for user-defined
5261 conversions; and conversions that never use a type conversion
5262 operator: conversions to @code{void}, the same type, a base class or a
5263 reference to them. Warnings about conversions between signed and
5264 unsigned integers are disabled by default in C++ unless
5265 @option{-Wsign-conversion} is explicitly enabled.
5266
5267 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5268 @opindex Wconversion-null
5269 @opindex Wno-conversion-null
5270 Do not warn for conversions between @code{NULL} and non-pointer
5271 types. @option{-Wconversion-null} is enabled by default.
5272
5273 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5274 @opindex Wzero-as-null-pointer-constant
5275 @opindex Wno-zero-as-null-pointer-constant
5276 Warn when a literal @samp{0} is used as null pointer constant. This can
5277 be useful to facilitate the conversion to @code{nullptr} in C++11.
5278
5279 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5280 @opindex Wsubobject-linkage
5281 @opindex Wno-subobject-linkage
5282 Warn if a class type has a base or a field whose type uses the anonymous
5283 namespace or depends on a type with no linkage. If a type A depends on
5284 a type B with no or internal linkage, defining it in multiple
5285 translation units would be an ODR violation because the meaning of B
5286 is different in each translation unit. If A only appears in a single
5287 translation unit, the best way to silence the warning is to give it
5288 internal linkage by putting it in an anonymous namespace as well. The
5289 compiler doesn't give this warning for types defined in the main .C
5290 file, as those are unlikely to have multiple definitions.
5291 @option{-Wsubobject-linkage} is enabled by default.
5292
5293 @item -Wdangling-else
5294 @opindex Wdangling-else
5295 @opindex Wno-dangling-else
5296 Warn about constructions where there may be confusion to which
5297 @code{if} statement an @code{else} branch belongs. Here is an example of
5298 such a case:
5299
5300 @smallexample
5301 @group
5302 @{
5303 if (a)
5304 if (b)
5305 foo ();
5306 else
5307 bar ();
5308 @}
5309 @end group
5310 @end smallexample
5311
5312 In C/C++, every @code{else} branch belongs to the innermost possible
5313 @code{if} statement, which in this example is @code{if (b)}. This is
5314 often not what the programmer expected, as illustrated in the above
5315 example by indentation the programmer chose. When there is the
5316 potential for this confusion, GCC issues a warning when this flag
5317 is specified. To eliminate the warning, add explicit braces around
5318 the innermost @code{if} statement so there is no way the @code{else}
5319 can belong to the enclosing @code{if}. The resulting code
5320 looks like this:
5321
5322 @smallexample
5323 @group
5324 @{
5325 if (a)
5326 @{
5327 if (b)
5328 foo ();
5329 else
5330 bar ();
5331 @}
5332 @}
5333 @end group
5334 @end smallexample
5335
5336 This warning is enabled by @option{-Wparentheses}.
5337
5338 @item -Wdate-time
5339 @opindex Wdate-time
5340 @opindex Wno-date-time
5341 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5342 are encountered as they might prevent bit-wise-identical reproducible
5343 compilations.
5344
5345 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5346 @opindex Wdelete-incomplete
5347 @opindex Wno-delete-incomplete
5348 Warn when deleting a pointer to incomplete type, which may cause
5349 undefined behavior at runtime. This warning is enabled by default.
5350
5351 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5352 @opindex Wuseless-cast
5353 @opindex Wno-useless-cast
5354 Warn when an expression is casted to its own type.
5355
5356 @item -Wempty-body
5357 @opindex Wempty-body
5358 @opindex Wno-empty-body
5359 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5360 while} statement. This warning is also enabled by @option{-Wextra}.
5361
5362 @item -Wenum-compare
5363 @opindex Wenum-compare
5364 @opindex Wno-enum-compare
5365 Warn about a comparison between values of different enumerated types.
5366 In C++ enumeral mismatches in conditional expressions are also
5367 diagnosed and the warning is enabled by default. In C this warning is
5368 enabled by @option{-Wall}.
5369
5370 @item -Wjump-misses-init @r{(C, Objective-C only)}
5371 @opindex Wjump-misses-init
5372 @opindex Wno-jump-misses-init
5373 Warn if a @code{goto} statement or a @code{switch} statement jumps
5374 forward across the initialization of a variable, or jumps backward to a
5375 label after the variable has been initialized. This only warns about
5376 variables that are initialized when they are declared. This warning is
5377 only supported for C and Objective-C; in C++ this sort of branch is an
5378 error in any case.
5379
5380 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5381 can be disabled with the @option{-Wno-jump-misses-init} option.
5382
5383 @item -Wsign-compare
5384 @opindex Wsign-compare
5385 @opindex Wno-sign-compare
5386 @cindex warning for comparison of signed and unsigned values
5387 @cindex comparison of signed and unsigned values, warning
5388 @cindex signed and unsigned values, comparison warning
5389 Warn when a comparison between signed and unsigned values could produce
5390 an incorrect result when the signed value is converted to unsigned.
5391 In C++, this warning is also enabled by @option{-Wall}. In C, it is
5392 also enabled by @option{-Wextra}.
5393
5394 @item -Wsign-conversion
5395 @opindex Wsign-conversion
5396 @opindex Wno-sign-conversion
5397 Warn for implicit conversions that may change the sign of an integer
5398 value, like assigning a signed integer expression to an unsigned
5399 integer variable. An explicit cast silences the warning. In C, this
5400 option is enabled also by @option{-Wconversion}.
5401
5402 @item -Wfloat-conversion
5403 @opindex Wfloat-conversion
5404 @opindex Wno-float-conversion
5405 Warn for implicit conversions that reduce the precision of a real value.
5406 This includes conversions from real to integer, and from higher precision
5407 real to lower precision real values. This option is also enabled by
5408 @option{-Wconversion}.
5409
5410 @item -Wno-scalar-storage-order
5411 @opindex -Wno-scalar-storage-order
5412 @opindex -Wscalar-storage-order
5413 Do not warn on suspicious constructs involving reverse scalar storage order.
5414
5415 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
5416 @opindex Wsized-deallocation
5417 @opindex Wno-sized-deallocation
5418 Warn about a definition of an unsized deallocation function
5419 @smallexample
5420 void operator delete (void *) noexcept;
5421 void operator delete[] (void *) noexcept;
5422 @end smallexample
5423 without a definition of the corresponding sized deallocation function
5424 @smallexample
5425 void operator delete (void *, std::size_t) noexcept;
5426 void operator delete[] (void *, std::size_t) noexcept;
5427 @end smallexample
5428 or vice versa. Enabled by @option{-Wextra} along with
5429 @option{-fsized-deallocation}.
5430
5431 @item -Wsizeof-pointer-memaccess
5432 @opindex Wsizeof-pointer-memaccess
5433 @opindex Wno-sizeof-pointer-memaccess
5434 Warn for suspicious length parameters to certain string and memory built-in
5435 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
5436 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
5437 but a pointer, and suggests a possible fix, or about
5438 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
5439 @option{-Wall}.
5440
5441 @item -Wsizeof-array-argument
5442 @opindex Wsizeof-array-argument
5443 @opindex Wno-sizeof-array-argument
5444 Warn when the @code{sizeof} operator is applied to a parameter that is
5445 declared as an array in a function definition. This warning is enabled by
5446 default for C and C++ programs.
5447
5448 @item -Wmemset-elt-size
5449 @opindex Wmemset-elt-size
5450 @opindex Wno-memset-elt-size
5451 Warn for suspicious calls to the @code{memset} built-in function, if the
5452 first argument references an array, and the third argument is a number
5453 equal to the number of elements, but not equal to the size of the array
5454 in memory. This indicates that the user has omitted a multiplication by
5455 the element size. This warning is enabled by @option{-Wall}.
5456
5457 @item -Wmemset-transposed-args
5458 @opindex Wmemset-transposed-args
5459 @opindex Wno-memset-transposed-args
5460 Warn for suspicious calls to the @code{memset} built-in function, if the
5461 second argument is not zero and the third argument is zero. This warns e.g.@
5462 about @code{memset (buf, sizeof buf, 0)} where most probably
5463 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
5464 is only emitted if the third argument is literal zero. If it is some
5465 expression that is folded to zero, a cast of zero to some type, etc.,
5466 it is far less likely that the user has mistakenly exchanged the arguments
5467 and no warning is emitted. This warning is enabled by @option{-Wall}.
5468
5469 @item -Waddress
5470 @opindex Waddress
5471 @opindex Wno-address
5472 Warn about suspicious uses of memory addresses. These include using
5473 the address of a function in a conditional expression, such as
5474 @code{void func(void); if (func)}, and comparisons against the memory
5475 address of a string literal, such as @code{if (x == "abc")}. Such
5476 uses typically indicate a programmer error: the address of a function
5477 always evaluates to true, so their use in a conditional usually
5478 indicate that the programmer forgot the parentheses in a function
5479 call; and comparisons against string literals result in unspecified
5480 behavior and are not portable in C, so they usually indicate that the
5481 programmer intended to use @code{strcmp}. This warning is enabled by
5482 @option{-Wall}.
5483
5484 @item -Wlogical-op
5485 @opindex Wlogical-op
5486 @opindex Wno-logical-op
5487 Warn about suspicious uses of logical operators in expressions.
5488 This includes using logical operators in contexts where a
5489 bit-wise operator is likely to be expected. Also warns when
5490 the operands of a logical operator are the same:
5491 @smallexample
5492 extern int a;
5493 if (a < 0 && a < 0) @{ @dots{} @}
5494 @end smallexample
5495
5496 @item -Wlogical-not-parentheses
5497 @opindex Wlogical-not-parentheses
5498 @opindex Wno-logical-not-parentheses
5499 Warn about logical not used on the left hand side operand of a comparison.
5500 This option does not warn if the right operand is considered to be a boolean
5501 expression. Its purpose is to detect suspicious code like the following:
5502 @smallexample
5503 int a;
5504 @dots{}
5505 if (!a > 1) @{ @dots{} @}
5506 @end smallexample
5507
5508 It is possible to suppress the warning by wrapping the LHS into
5509 parentheses:
5510 @smallexample
5511 if ((!a) > 1) @{ @dots{} @}
5512 @end smallexample
5513
5514 This warning is enabled by @option{-Wall}.
5515
5516 @item -Waggregate-return
5517 @opindex Waggregate-return
5518 @opindex Wno-aggregate-return
5519 Warn if any functions that return structures or unions are defined or
5520 called. (In languages where you can return an array, this also elicits
5521 a warning.)
5522
5523 @item -Wno-aggressive-loop-optimizations
5524 @opindex Wno-aggressive-loop-optimizations
5525 @opindex Waggressive-loop-optimizations
5526 Warn if in a loop with constant number of iterations the compiler detects
5527 undefined behavior in some statement during one or more of the iterations.
5528
5529 @item -Wno-attributes
5530 @opindex Wno-attributes
5531 @opindex Wattributes
5532 Do not warn if an unexpected @code{__attribute__} is used, such as
5533 unrecognized attributes, function attributes applied to variables,
5534 etc. This does not stop errors for incorrect use of supported
5535 attributes.
5536
5537 @item -Wno-builtin-macro-redefined
5538 @opindex Wno-builtin-macro-redefined
5539 @opindex Wbuiltin-macro-redefined
5540 Do not warn if certain built-in macros are redefined. This suppresses
5541 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
5542 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
5543
5544 @item -Wstrict-prototypes @r{(C and Objective-C only)}
5545 @opindex Wstrict-prototypes
5546 @opindex Wno-strict-prototypes
5547 Warn if a function is declared or defined without specifying the
5548 argument types. (An old-style function definition is permitted without
5549 a warning if preceded by a declaration that specifies the argument
5550 types.)
5551
5552 @item -Wold-style-declaration @r{(C and Objective-C only)}
5553 @opindex Wold-style-declaration
5554 @opindex Wno-old-style-declaration
5555 Warn for obsolescent usages, according to the C Standard, in a
5556 declaration. For example, warn if storage-class specifiers like
5557 @code{static} are not the first things in a declaration. This warning
5558 is also enabled by @option{-Wextra}.
5559
5560 @item -Wold-style-definition @r{(C and Objective-C only)}
5561 @opindex Wold-style-definition
5562 @opindex Wno-old-style-definition
5563 Warn if an old-style function definition is used. A warning is given
5564 even if there is a previous prototype.
5565
5566 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5567 @opindex Wmissing-parameter-type
5568 @opindex Wno-missing-parameter-type
5569 A function parameter is declared without a type specifier in K&R-style
5570 functions:
5571
5572 @smallexample
5573 void foo(bar) @{ @}
5574 @end smallexample
5575
5576 This warning is also enabled by @option{-Wextra}.
5577
5578 @item -Wmissing-prototypes @r{(C and Objective-C only)}
5579 @opindex Wmissing-prototypes
5580 @opindex Wno-missing-prototypes
5581 Warn if a global function is defined without a previous prototype
5582 declaration. This warning is issued even if the definition itself
5583 provides a prototype. Use this option to detect global functions
5584 that do not have a matching prototype declaration in a header file.
5585 This option is not valid for C++ because all function declarations
5586 provide prototypes and a non-matching declaration declares an
5587 overload rather than conflict with an earlier declaration.
5588 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
5589
5590 @item -Wmissing-declarations
5591 @opindex Wmissing-declarations
5592 @opindex Wno-missing-declarations
5593 Warn if a global function is defined without a previous declaration.
5594 Do so even if the definition itself provides a prototype.
5595 Use this option to detect global functions that are not declared in
5596 header files. In C, no warnings are issued for functions with previous
5597 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
5598 missing prototypes. In C++, no warnings are issued for function templates,
5599 or for inline functions, or for functions in anonymous namespaces.
5600
5601 @item -Wmissing-field-initializers
5602 @opindex Wmissing-field-initializers
5603 @opindex Wno-missing-field-initializers
5604 @opindex W
5605 @opindex Wextra
5606 @opindex Wno-extra
5607 Warn if a structure's initializer has some fields missing. For
5608 example, the following code causes such a warning, because
5609 @code{x.h} is implicitly zero:
5610
5611 @smallexample
5612 struct s @{ int f, g, h; @};
5613 struct s x = @{ 3, 4 @};
5614 @end smallexample
5615
5616 This option does not warn about designated initializers, so the following
5617 modification does not trigger a warning:
5618
5619 @smallexample
5620 struct s @{ int f, g, h; @};
5621 struct s x = @{ .f = 3, .g = 4 @};
5622 @end smallexample
5623
5624 In C++ this option does not warn either about the empty @{ @}
5625 initializer, for example:
5626
5627 @smallexample
5628 struct s @{ int f, g, h; @};
5629 s x = @{ @};
5630 @end smallexample
5631
5632 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
5633 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
5634
5635 @item -Wno-multichar
5636 @opindex Wno-multichar
5637 @opindex Wmultichar
5638 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
5639 Usually they indicate a typo in the user's code, as they have
5640 implementation-defined values, and should not be used in portable code.
5641
5642 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
5643 @opindex Wnormalized=
5644 @opindex Wnormalized
5645 @opindex Wno-normalized
5646 @cindex NFC
5647 @cindex NFKC
5648 @cindex character set, input normalization
5649 In ISO C and ISO C++, two identifiers are different if they are
5650 different sequences of characters. However, sometimes when characters
5651 outside the basic ASCII character set are used, you can have two
5652 different character sequences that look the same. To avoid confusion,
5653 the ISO 10646 standard sets out some @dfn{normalization rules} which
5654 when applied ensure that two sequences that look the same are turned into
5655 the same sequence. GCC can warn you if you are using identifiers that
5656 have not been normalized; this option controls that warning.
5657
5658 There are four levels of warning supported by GCC@. The default is
5659 @option{-Wnormalized=nfc}, which warns about any identifier that is
5660 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
5661 recommended form for most uses. It is equivalent to
5662 @option{-Wnormalized}.
5663
5664 Unfortunately, there are some characters allowed in identifiers by
5665 ISO C and ISO C++ that, when turned into NFC, are not allowed in
5666 identifiers. That is, there's no way to use these symbols in portable
5667 ISO C or C++ and have all your identifiers in NFC@.
5668 @option{-Wnormalized=id} suppresses the warning for these characters.
5669 It is hoped that future versions of the standards involved will correct
5670 this, which is why this option is not the default.
5671
5672 You can switch the warning off for all characters by writing
5673 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
5674 only do this if you are using some other normalization scheme (like
5675 ``D''), because otherwise you can easily create bugs that are
5676 literally impossible to see.
5677
5678 Some characters in ISO 10646 have distinct meanings but look identical
5679 in some fonts or display methodologies, especially once formatting has
5680 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
5681 LETTER N'', displays just like a regular @code{n} that has been
5682 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
5683 normalization scheme to convert all these into a standard form as
5684 well, and GCC warns if your code is not in NFKC if you use
5685 @option{-Wnormalized=nfkc}. This warning is comparable to warning
5686 about every identifier that contains the letter O because it might be
5687 confused with the digit 0, and so is not the default, but may be
5688 useful as a local coding convention if the programming environment
5689 cannot be fixed to display these characters distinctly.
5690
5691 @item -Wno-deprecated
5692 @opindex Wno-deprecated
5693 @opindex Wdeprecated
5694 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
5695
5696 @item -Wno-deprecated-declarations
5697 @opindex Wno-deprecated-declarations
5698 @opindex Wdeprecated-declarations
5699 Do not warn about uses of functions (@pxref{Function Attributes}),
5700 variables (@pxref{Variable Attributes}), and types (@pxref{Type
5701 Attributes}) marked as deprecated by using the @code{deprecated}
5702 attribute.
5703
5704 @item -Wno-overflow
5705 @opindex Wno-overflow
5706 @opindex Woverflow
5707 Do not warn about compile-time overflow in constant expressions.
5708
5709 @item -Wno-odr
5710 @opindex Wno-odr
5711 @opindex Wodr
5712 Warn about One Definition Rule violations during link-time optimization.
5713 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
5714
5715 @item -Wopenmp-simd
5716 @opindex Wopenm-simd
5717 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
5718 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
5719 option can be used to relax the cost model.
5720
5721 @item -Woverride-init @r{(C and Objective-C only)}
5722 @opindex Woverride-init
5723 @opindex Wno-override-init
5724 @opindex W
5725 @opindex Wextra
5726 @opindex Wno-extra
5727 Warn if an initialized field without side effects is overridden when
5728 using designated initializers (@pxref{Designated Inits, , Designated
5729 Initializers}).
5730
5731 This warning is included in @option{-Wextra}. To get other
5732 @option{-Wextra} warnings without this one, use @option{-Wextra
5733 -Wno-override-init}.
5734
5735 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
5736 @opindex Woverride-init-side-effects
5737 @opindex Wno-override-init-side-effects
5738 Warn if an initialized field with side effects is overridden when
5739 using designated initializers (@pxref{Designated Inits, , Designated
5740 Initializers}). This warning is enabled by default.
5741
5742 @item -Wpacked
5743 @opindex Wpacked
5744 @opindex Wno-packed
5745 Warn if a structure is given the packed attribute, but the packed
5746 attribute has no effect on the layout or size of the structure.
5747 Such structures may be mis-aligned for little benefit. For
5748 instance, in this code, the variable @code{f.x} in @code{struct bar}
5749 is misaligned even though @code{struct bar} does not itself
5750 have the packed attribute:
5751
5752 @smallexample
5753 @group
5754 struct foo @{
5755 int x;
5756 char a, b, c, d;
5757 @} __attribute__((packed));
5758 struct bar @{
5759 char z;
5760 struct foo f;
5761 @};
5762 @end group
5763 @end smallexample
5764
5765 @item -Wpacked-bitfield-compat
5766 @opindex Wpacked-bitfield-compat
5767 @opindex Wno-packed-bitfield-compat
5768 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
5769 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
5770 the change can lead to differences in the structure layout. GCC
5771 informs you when the offset of such a field has changed in GCC 4.4.
5772 For example there is no longer a 4-bit padding between field @code{a}
5773 and @code{b} in this structure:
5774
5775 @smallexample
5776 struct foo
5777 @{
5778 char a:4;
5779 char b:8;
5780 @} __attribute__ ((packed));
5781 @end smallexample
5782
5783 This warning is enabled by default. Use
5784 @option{-Wno-packed-bitfield-compat} to disable this warning.
5785
5786 @item -Wpadded
5787 @opindex Wpadded
5788 @opindex Wno-padded
5789 Warn if padding is included in a structure, either to align an element
5790 of the structure or to align the whole structure. Sometimes when this
5791 happens it is possible to rearrange the fields of the structure to
5792 reduce the padding and so make the structure smaller.
5793
5794 @item -Wredundant-decls
5795 @opindex Wredundant-decls
5796 @opindex Wno-redundant-decls
5797 Warn if anything is declared more than once in the same scope, even in
5798 cases where multiple declaration is valid and changes nothing.
5799
5800 @item -Wnested-externs @r{(C and Objective-C only)}
5801 @opindex Wnested-externs
5802 @opindex Wno-nested-externs
5803 Warn if an @code{extern} declaration is encountered within a function.
5804
5805 @item -Wno-inherited-variadic-ctor
5806 @opindex Winherited-variadic-ctor
5807 @opindex Wno-inherited-variadic-ctor
5808 Suppress warnings about use of C++11 inheriting constructors when the
5809 base class inherited from has a C variadic constructor; the warning is
5810 on by default because the ellipsis is not inherited.
5811
5812 @item -Winline
5813 @opindex Winline
5814 @opindex Wno-inline
5815 Warn if a function that is declared as inline cannot be inlined.
5816 Even with this option, the compiler does not warn about failures to
5817 inline functions declared in system headers.
5818
5819 The compiler uses a variety of heuristics to determine whether or not
5820 to inline a function. For example, the compiler takes into account
5821 the size of the function being inlined and the amount of inlining
5822 that has already been done in the current function. Therefore,
5823 seemingly insignificant changes in the source program can cause the
5824 warnings produced by @option{-Winline} to appear or disappear.
5825
5826 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
5827 @opindex Wno-invalid-offsetof
5828 @opindex Winvalid-offsetof
5829 Suppress warnings from applying the @code{offsetof} macro to a non-POD
5830 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
5831 to a non-standard-layout type is undefined. In existing C++ implementations,
5832 however, @code{offsetof} typically gives meaningful results.
5833 This flag is for users who are aware that they are
5834 writing nonportable code and who have deliberately chosen to ignore the
5835 warning about it.
5836
5837 The restrictions on @code{offsetof} may be relaxed in a future version
5838 of the C++ standard.
5839
5840 @item -Wno-int-to-pointer-cast
5841 @opindex Wno-int-to-pointer-cast
5842 @opindex Wint-to-pointer-cast
5843 Suppress warnings from casts to pointer type of an integer of a
5844 different size. In C++, casting to a pointer type of smaller size is
5845 an error. @option{Wint-to-pointer-cast} is enabled by default.
5846
5847
5848 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
5849 @opindex Wno-pointer-to-int-cast
5850 @opindex Wpointer-to-int-cast
5851 Suppress warnings from casts from a pointer to an integer type of a
5852 different size.
5853
5854 @item -Winvalid-pch
5855 @opindex Winvalid-pch
5856 @opindex Wno-invalid-pch
5857 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
5858 the search path but can't be used.
5859
5860 @item -Wlong-long
5861 @opindex Wlong-long
5862 @opindex Wno-long-long
5863 Warn if @code{long long} type is used. This is enabled by either
5864 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
5865 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
5866
5867 @item -Wvariadic-macros
5868 @opindex Wvariadic-macros
5869 @opindex Wno-variadic-macros
5870 Warn if variadic macros are used in ISO C90 mode, or if the GNU
5871 alternate syntax is used in ISO C99 mode. This is enabled by either
5872 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
5873 messages, use @option{-Wno-variadic-macros}.
5874
5875 @item -Wvarargs
5876 @opindex Wvarargs
5877 @opindex Wno-varargs
5878 Warn upon questionable usage of the macros used to handle variable
5879 arguments like @code{va_start}. This is default. To inhibit the
5880 warning messages, use @option{-Wno-varargs}.
5881
5882 @item -Wvector-operation-performance
5883 @opindex Wvector-operation-performance
5884 @opindex Wno-vector-operation-performance
5885 Warn if vector operation is not implemented via SIMD capabilities of the
5886 architecture. Mainly useful for the performance tuning.
5887 Vector operation can be implemented @code{piecewise}, which means that the
5888 scalar operation is performed on every vector element;
5889 @code{in parallel}, which means that the vector operation is implemented
5890 using scalars of wider type, which normally is more performance efficient;
5891 and @code{as a single scalar}, which means that vector fits into a
5892 scalar type.
5893
5894 @item -Wno-virtual-move-assign
5895 @opindex Wvirtual-move-assign
5896 @opindex Wno-virtual-move-assign
5897 Suppress warnings about inheriting from a virtual base with a
5898 non-trivial C++11 move assignment operator. This is dangerous because
5899 if the virtual base is reachable along more than one path, it is
5900 moved multiple times, which can mean both objects end up in the
5901 moved-from state. If the move assignment operator is written to avoid
5902 moving from a moved-from object, this warning can be disabled.
5903
5904 @item -Wvla
5905 @opindex Wvla
5906 @opindex Wno-vla
5907 Warn if variable length array is used in the code.
5908 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
5909 the variable length array.
5910
5911 @item -Wvolatile-register-var
5912 @opindex Wvolatile-register-var
5913 @opindex Wno-volatile-register-var
5914 Warn if a register variable is declared volatile. The volatile
5915 modifier does not inhibit all optimizations that may eliminate reads
5916 and/or writes to register variables. This warning is enabled by
5917 @option{-Wall}.
5918
5919 @item -Wdisabled-optimization
5920 @opindex Wdisabled-optimization
5921 @opindex Wno-disabled-optimization
5922 Warn if a requested optimization pass is disabled. This warning does
5923 not generally indicate that there is anything wrong with your code; it
5924 merely indicates that GCC's optimizers are unable to handle the code
5925 effectively. Often, the problem is that your code is too big or too
5926 complex; GCC refuses to optimize programs when the optimization
5927 itself is likely to take inordinate amounts of time.
5928
5929 @item -Wpointer-sign @r{(C and Objective-C only)}
5930 @opindex Wpointer-sign
5931 @opindex Wno-pointer-sign
5932 Warn for pointer argument passing or assignment with different signedness.
5933 This option is only supported for C and Objective-C@. It is implied by
5934 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
5935 @option{-Wno-pointer-sign}.
5936
5937 @item -Wstack-protector
5938 @opindex Wstack-protector
5939 @opindex Wno-stack-protector
5940 This option is only active when @option{-fstack-protector} is active. It
5941 warns about functions that are not protected against stack smashing.
5942
5943 @item -Woverlength-strings
5944 @opindex Woverlength-strings
5945 @opindex Wno-overlength-strings
5946 Warn about string constants that are longer than the ``minimum
5947 maximum'' length specified in the C standard. Modern compilers
5948 generally allow string constants that are much longer than the
5949 standard's minimum limit, but very portable programs should avoid
5950 using longer strings.
5951
5952 The limit applies @emph{after} string constant concatenation, and does
5953 not count the trailing NUL@. In C90, the limit was 509 characters; in
5954 C99, it was raised to 4095. C++98 does not specify a normative
5955 minimum maximum, so we do not diagnose overlength strings in C++@.
5956
5957 This option is implied by @option{-Wpedantic}, and can be disabled with
5958 @option{-Wno-overlength-strings}.
5959
5960 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
5961 @opindex Wunsuffixed-float-constants
5962
5963 Issue a warning for any floating constant that does not have
5964 a suffix. When used together with @option{-Wsystem-headers} it
5965 warns about such constants in system header files. This can be useful
5966 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
5967 from the decimal floating-point extension to C99.
5968
5969 @item -Wno-designated-init @r{(C and Objective-C only)}
5970 Suppress warnings when a positional initializer is used to initialize
5971 a structure that has been marked with the @code{designated_init}
5972 attribute.
5973
5974 @item -Whsa
5975 Issue a warning when HSAIL cannot be emitted for the compiled function or
5976 OpenMP construct.
5977
5978 @end table
5979
5980 @node Debugging Options
5981 @section Options for Debugging Your Program
5982 @cindex options, debugging
5983 @cindex debugging information options
5984
5985 To tell GCC to emit extra information for use by a debugger, in almost
5986 all cases you need only to add @option{-g} to your other options.
5987
5988 GCC allows you to use @option{-g} with
5989 @option{-O}. The shortcuts taken by optimized code may occasionally
5990 be surprising: some variables you declared may not exist
5991 at all; flow of control may briefly move where you did not expect it;
5992 some statements may not be executed because they compute constant
5993 results or their values are already at hand; some statements may
5994 execute in different places because they have been moved out of loops.
5995 Nevertheless it is possible to debug optimized output. This makes
5996 it reasonable to use the optimizer for programs that might have bugs.
5997
5998 If you are not using some other optimization option, consider
5999 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
6000 With no @option{-O} option at all, some compiler passes that collect
6001 information useful for debugging do not run at all, so that
6002 @option{-Og} may result in a better debugging experience.
6003
6004 @table @gcctabopt
6005 @item -g
6006 @opindex g
6007 Produce debugging information in the operating system's native format
6008 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
6009 information.
6010
6011 On most systems that use stabs format, @option{-g} enables use of extra
6012 debugging information that only GDB can use; this extra information
6013 makes debugging work better in GDB but probably makes other debuggers
6014 crash or
6015 refuse to read the program. If you want to control for certain whether
6016 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
6017 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
6018
6019 @item -ggdb
6020 @opindex ggdb
6021 Produce debugging information for use by GDB@. This means to use the
6022 most expressive format available (DWARF, stabs, or the native format
6023 if neither of those are supported), including GDB extensions if at all
6024 possible.
6025
6026 @item -gdwarf
6027 @itemx -gdwarf-@var{version}
6028 @opindex gdwarf
6029 Produce debugging information in DWARF format (if that is supported).
6030 The value of @var{version} may be either 2, 3, 4 or 5; the default version
6031 for most targets is 4. DWARF Version 5 is only experimental.
6032
6033 Note that with DWARF Version 2, some ports require and always
6034 use some non-conflicting DWARF 3 extensions in the unwind tables.
6035
6036 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
6037 for maximum benefit.
6038
6039 GCC no longer supports DWARF Version 1, which is substantially
6040 different than Version 2 and later. For historical reasons, some
6041 other DWARF-related options (including @option{-feliminate-dwarf2-dups}
6042 and @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
6043 in their names, but apply to all currently-supported versions of DWARF.
6044
6045 @item -gstabs
6046 @opindex gstabs
6047 Produce debugging information in stabs format (if that is supported),
6048 without GDB extensions. This is the format used by DBX on most BSD
6049 systems. On MIPS, Alpha and System V Release 4 systems this option
6050 produces stabs debugging output that is not understood by DBX or SDB@.
6051 On System V Release 4 systems this option requires the GNU assembler.
6052
6053 @item -gstabs+
6054 @opindex gstabs+
6055 Produce debugging information in stabs format (if that is supported),
6056 using GNU extensions understood only by the GNU debugger (GDB)@. The
6057 use of these extensions is likely to make other debuggers crash or
6058 refuse to read the program.
6059
6060 @item -gcoff
6061 @opindex gcoff
6062 Produce debugging information in COFF format (if that is supported).
6063 This is the format used by SDB on most System V systems prior to
6064 System V Release 4.
6065
6066 @item -gxcoff
6067 @opindex gxcoff
6068 Produce debugging information in XCOFF format (if that is supported).
6069 This is the format used by the DBX debugger on IBM RS/6000 systems.
6070
6071 @item -gxcoff+
6072 @opindex gxcoff+
6073 Produce debugging information in XCOFF format (if that is supported),
6074 using GNU extensions understood only by the GNU debugger (GDB)@. The
6075 use of these extensions is likely to make other debuggers crash or
6076 refuse to read the program, and may cause assemblers other than the GNU
6077 assembler (GAS) to fail with an error.
6078
6079 @item -gvms
6080 @opindex gvms
6081 Produce debugging information in Alpha/VMS debug format (if that is
6082 supported). This is the format used by DEBUG on Alpha/VMS systems.
6083
6084 @item -g@var{level}
6085 @itemx -ggdb@var{level}
6086 @itemx -gstabs@var{level}
6087 @itemx -gcoff@var{level}
6088 @itemx -gxcoff@var{level}
6089 @itemx -gvms@var{level}
6090 Request debugging information and also use @var{level} to specify how
6091 much information. The default level is 2.
6092
6093 Level 0 produces no debug information at all. Thus, @option{-g0} negates
6094 @option{-g}.
6095
6096 Level 1 produces minimal information, enough for making backtraces in
6097 parts of the program that you don't plan to debug. This includes
6098 descriptions of functions and external variables, and line number
6099 tables, but no information about local variables.
6100
6101 Level 3 includes extra information, such as all the macro definitions
6102 present in the program. Some debuggers support macro expansion when
6103 you use @option{-g3}.
6104
6105 @option{-gdwarf} does not accept a concatenated debug level, to avoid
6106 confusion with @option{-gdwarf-@var{level}}.
6107 Instead use an additional @option{-g@var{level}} option to change the
6108 debug level for DWARF.
6109
6110 @item -feliminate-unused-debug-symbols
6111 @opindex feliminate-unused-debug-symbols
6112 Produce debugging information in stabs format (if that is supported),
6113 for only symbols that are actually used.
6114
6115 @item -femit-class-debug-always
6116 @opindex femit-class-debug-always
6117 Instead of emitting debugging information for a C++ class in only one
6118 object file, emit it in all object files using the class. This option
6119 should be used only with debuggers that are unable to handle the way GCC
6120 normally emits debugging information for classes because using this
6121 option increases the size of debugging information by as much as a
6122 factor of two.
6123
6124 @item -fno-merge-debug-strings
6125 @opindex fmerge-debug-strings
6126 @opindex fno-merge-debug-strings
6127 Direct the linker to not merge together strings in the debugging
6128 information that are identical in different object files. Merging is
6129 not supported by all assemblers or linkers. Merging decreases the size
6130 of the debug information in the output file at the cost of increasing
6131 link processing time. Merging is enabled by default.
6132
6133 @item -fdebug-prefix-map=@var{old}=@var{new}
6134 @opindex fdebug-prefix-map
6135 When compiling files in directory @file{@var{old}}, record debugging
6136 information describing them as in @file{@var{new}} instead.
6137
6138 @item -fvar-tracking
6139 @opindex fvar-tracking
6140 Run variable tracking pass. It computes where variables are stored at each
6141 position in code. Better debugging information is then generated
6142 (if the debugging information format supports this information).
6143
6144 It is enabled by default when compiling with optimization (@option{-Os},
6145 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6146 the debug info format supports it.
6147
6148 @item -fvar-tracking-assignments
6149 @opindex fvar-tracking-assignments
6150 @opindex fno-var-tracking-assignments
6151 Annotate assignments to user variables early in the compilation and
6152 attempt to carry the annotations over throughout the compilation all the
6153 way to the end, in an attempt to improve debug information while
6154 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6155
6156 It can be enabled even if var-tracking is disabled, in which case
6157 annotations are created and maintained, but discarded at the end.
6158 By default, this flag is enabled together with @option{-fvar-tracking},
6159 except when selective scheduling is enabled.
6160
6161 @item -gsplit-dwarf
6162 @opindex gsplit-dwarf
6163 Separate as much DWARF debugging information as possible into a
6164 separate output file with the extension @file{.dwo}. This option allows
6165 the build system to avoid linking files with debug information. To
6166 be useful, this option requires a debugger capable of reading @file{.dwo}
6167 files.
6168
6169 @item -gpubnames
6170 @opindex gpubnames
6171 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
6172
6173 @item -ggnu-pubnames
6174 @opindex ggnu-pubnames
6175 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
6176 suitable for conversion into a GDB@ index. This option is only useful
6177 with a linker that can produce GDB@ index version 7.
6178
6179 @item -fdebug-types-section
6180 @opindex fdebug-types-section
6181 @opindex fno-debug-types-section
6182 When using DWARF Version 4 or higher, type DIEs can be put into
6183 their own @code{.debug_types} section instead of making them part of the
6184 @code{.debug_info} section. It is more efficient to put them in a separate
6185 comdat sections since the linker can then remove duplicates.
6186 But not all DWARF consumers support @code{.debug_types} sections yet
6187 and on some objects @code{.debug_types} produces larger instead of smaller
6188 debugging information.
6189
6190 @item -grecord-gcc-switches
6191 @item -gno-record-gcc-switches
6192 @opindex grecord-gcc-switches
6193 @opindex gno-record-gcc-switches
6194 This switch causes the command-line options used to invoke the
6195 compiler that may affect code generation to be appended to the
6196 DW_AT_producer attribute in DWARF debugging information. The options
6197 are concatenated with spaces separating them from each other and from
6198 the compiler version.
6199 It is enabled by default.
6200 See also @option{-frecord-gcc-switches} for another
6201 way of storing compiler options into the object file.
6202
6203 @item -gstrict-dwarf
6204 @opindex gstrict-dwarf
6205 Disallow using extensions of later DWARF standard version than selected
6206 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
6207 DWARF extensions from later standard versions is allowed.
6208
6209 @item -gno-strict-dwarf
6210 @opindex gno-strict-dwarf
6211 Allow using extensions of later DWARF standard version than selected with
6212 @option{-gdwarf-@var{version}}.
6213
6214 @item -gz@r{[}=@var{type}@r{]}
6215 @opindex gz
6216 Produce compressed debug sections in DWARF format, if that is supported.
6217 If @var{type} is not given, the default type depends on the capabilities
6218 of the assembler and linker used. @var{type} may be one of
6219 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
6220 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
6221 compression in traditional GNU format). If the linker doesn't support
6222 writing compressed debug sections, the option is rejected. Otherwise,
6223 if the assembler does not support them, @option{-gz} is silently ignored
6224 when producing object files.
6225
6226 @item -feliminate-dwarf2-dups
6227 @opindex feliminate-dwarf2-dups
6228 Compress DWARF debugging information by eliminating duplicated
6229 information about each symbol. This option only makes sense when
6230 generating DWARF debugging information.
6231
6232 @item -femit-struct-debug-baseonly
6233 @opindex femit-struct-debug-baseonly
6234 Emit debug information for struct-like types
6235 only when the base name of the compilation source file
6236 matches the base name of file in which the struct is defined.
6237
6238 This option substantially reduces the size of debugging information,
6239 but at significant potential loss in type information to the debugger.
6240 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6241 See @option{-femit-struct-debug-detailed} for more detailed control.
6242
6243 This option works only with DWARF debug output.
6244
6245 @item -femit-struct-debug-reduced
6246 @opindex femit-struct-debug-reduced
6247 Emit debug information for struct-like types
6248 only when the base name of the compilation source file
6249 matches the base name of file in which the type is defined,
6250 unless the struct is a template or defined in a system header.
6251
6252 This option significantly reduces the size of debugging information,
6253 with some potential loss in type information to the debugger.
6254 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6255 See @option{-femit-struct-debug-detailed} for more detailed control.
6256
6257 This option works only with DWARF debug output.
6258
6259 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6260 @opindex femit-struct-debug-detailed
6261 Specify the struct-like types
6262 for which the compiler generates debug information.
6263 The intent is to reduce duplicate struct debug information
6264 between different object files within the same program.
6265
6266 This option is a detailed version of
6267 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6268 which serves for most needs.
6269
6270 A specification has the syntax@*
6271 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6272
6273 The optional first word limits the specification to
6274 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6275 A struct type is used directly when it is the type of a variable, member.
6276 Indirect uses arise through pointers to structs.
6277 That is, when use of an incomplete struct is valid, the use is indirect.
6278 An example is
6279 @samp{struct one direct; struct two * indirect;}.
6280
6281 The optional second word limits the specification to
6282 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6283 Generic structs are a bit complicated to explain.
6284 For C++, these are non-explicit specializations of template classes,
6285 or non-template classes within the above.
6286 Other programming languages have generics,
6287 but @option{-femit-struct-debug-detailed} does not yet implement them.
6288
6289 The third word specifies the source files for those
6290 structs for which the compiler should emit debug information.
6291 The values @samp{none} and @samp{any} have the normal meaning.
6292 The value @samp{base} means that
6293 the base of name of the file in which the type declaration appears
6294 must match the base of the name of the main compilation file.
6295 In practice, this means that when compiling @file{foo.c}, debug information
6296 is generated for types declared in that file and @file{foo.h},
6297 but not other header files.
6298 The value @samp{sys} means those types satisfying @samp{base}
6299 or declared in system or compiler headers.
6300
6301 You may need to experiment to determine the best settings for your application.
6302
6303 The default is @option{-femit-struct-debug-detailed=all}.
6304
6305 This option works only with DWARF debug output.
6306
6307 @item -fno-dwarf2-cfi-asm
6308 @opindex fdwarf2-cfi-asm
6309 @opindex fno-dwarf2-cfi-asm
6310 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
6311 instead of using GAS @code{.cfi_*} directives.
6312
6313 @item -fno-eliminate-unused-debug-types
6314 @opindex feliminate-unused-debug-types
6315 @opindex fno-eliminate-unused-debug-types
6316 Normally, when producing DWARF output, GCC avoids producing debug symbol
6317 output for types that are nowhere used in the source file being compiled.
6318 Sometimes it is useful to have GCC emit debugging
6319 information for all types declared in a compilation
6320 unit, regardless of whether or not they are actually used
6321 in that compilation unit, for example
6322 if, in the debugger, you want to cast a value to a type that is
6323 not actually used in your program (but is declared). More often,
6324 however, this results in a significant amount of wasted space.
6325 @end table
6326
6327 @node Optimize Options
6328 @section Options That Control Optimization
6329 @cindex optimize options
6330 @cindex options, optimization
6331
6332 These options control various sorts of optimizations.
6333
6334 Without any optimization option, the compiler's goal is to reduce the
6335 cost of compilation and to make debugging produce the expected
6336 results. Statements are independent: if you stop the program with a
6337 breakpoint between statements, you can then assign a new value to any
6338 variable or change the program counter to any other statement in the
6339 function and get exactly the results you expect from the source
6340 code.
6341
6342 Turning on optimization flags makes the compiler attempt to improve
6343 the performance and/or code size at the expense of compilation time
6344 and possibly the ability to debug the program.
6345
6346 The compiler performs optimization based on the knowledge it has of the
6347 program. Compiling multiple files at once to a single output file mode allows
6348 the compiler to use information gained from all of the files when compiling
6349 each of them.
6350
6351 Not all optimizations are controlled directly by a flag. Only
6352 optimizations that have a flag are listed in this section.
6353
6354 Most optimizations are only enabled if an @option{-O} level is set on
6355 the command line. Otherwise they are disabled, even if individual
6356 optimization flags are specified.
6357
6358 Depending on the target and how GCC was configured, a slightly different
6359 set of optimizations may be enabled at each @option{-O} level than
6360 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6361 to find out the exact set of optimizations that are enabled at each level.
6362 @xref{Overall Options}, for examples.
6363
6364 @table @gcctabopt
6365 @item -O
6366 @itemx -O1
6367 @opindex O
6368 @opindex O1
6369 Optimize. Optimizing compilation takes somewhat more time, and a lot
6370 more memory for a large function.
6371
6372 With @option{-O}, the compiler tries to reduce code size and execution
6373 time, without performing any optimizations that take a great deal of
6374 compilation time.
6375
6376 @option{-O} turns on the following optimization flags:
6377 @gccoptlist{
6378 -fauto-inc-dec @gol
6379 -fbranch-count-reg @gol
6380 -fcombine-stack-adjustments @gol
6381 -fcompare-elim @gol
6382 -fcprop-registers @gol
6383 -fdce @gol
6384 -fdefer-pop @gol
6385 -fdelayed-branch @gol
6386 -fdse @gol
6387 -fforward-propagate @gol
6388 -fguess-branch-probability @gol
6389 -fif-conversion2 @gol
6390 -fif-conversion @gol
6391 -finline-functions-called-once @gol
6392 -fipa-pure-const @gol
6393 -fipa-profile @gol
6394 -fipa-reference @gol
6395 -fmerge-constants @gol
6396 -fmove-loop-invariants @gol
6397 -freorder-blocks @gol
6398 -fshrink-wrap @gol
6399 -fsplit-wide-types @gol
6400 -fssa-backprop @gol
6401 -fssa-phiopt @gol
6402 -ftree-bit-ccp @gol
6403 -ftree-ccp @gol
6404 -ftree-ch @gol
6405 -ftree-coalesce-vars @gol
6406 -ftree-copy-prop @gol
6407 -ftree-dce @gol
6408 -ftree-dominator-opts @gol
6409 -ftree-dse @gol
6410 -ftree-forwprop @gol
6411 -ftree-fre @gol
6412 -ftree-phiprop @gol
6413 -ftree-sink @gol
6414 -ftree-slsr @gol
6415 -ftree-sra @gol
6416 -ftree-pta @gol
6417 -ftree-ter @gol
6418 -funit-at-a-time}
6419
6420 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6421 where doing so does not interfere with debugging.
6422
6423 @item -O2
6424 @opindex O2
6425 Optimize even more. GCC performs nearly all supported optimizations
6426 that do not involve a space-speed tradeoff.
6427 As compared to @option{-O}, this option increases both compilation time
6428 and the performance of the generated code.
6429
6430 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6431 also turns on the following optimization flags:
6432 @gccoptlist{-fthread-jumps @gol
6433 -falign-functions -falign-jumps @gol
6434 -falign-loops -falign-labels @gol
6435 -fcaller-saves @gol
6436 -fcrossjumping @gol
6437 -fcse-follow-jumps -fcse-skip-blocks @gol
6438 -fdelete-null-pointer-checks @gol
6439 -fdevirtualize -fdevirtualize-speculatively @gol
6440 -fexpensive-optimizations @gol
6441 -fgcse -fgcse-lm @gol
6442 -fhoist-adjacent-loads @gol
6443 -finline-small-functions @gol
6444 -findirect-inlining @gol
6445 -fipa-cp @gol
6446 -fipa-cp-alignment @gol
6447 -fipa-bit-cp @gol
6448 -fipa-sra @gol
6449 -fipa-icf @gol
6450 -fisolate-erroneous-paths-dereference @gol
6451 -flra-remat @gol
6452 -foptimize-sibling-calls @gol
6453 -foptimize-strlen @gol
6454 -fpartial-inlining @gol
6455 -fpeephole2 @gol
6456 -freorder-blocks-algorithm=stc @gol
6457 -freorder-blocks-and-partition -freorder-functions @gol
6458 -frerun-cse-after-loop @gol
6459 -fsched-interblock -fsched-spec @gol
6460 -fschedule-insns -fschedule-insns2 @gol
6461 -fstrict-aliasing -fstrict-overflow @gol
6462 -ftree-builtin-call-dce @gol
6463 -ftree-switch-conversion -ftree-tail-merge @gol
6464 -fcode-hoisting @gol
6465 -ftree-pre @gol
6466 -ftree-vrp @gol
6467 -fipa-ra}
6468
6469 Please note the warning under @option{-fgcse} about
6470 invoking @option{-O2} on programs that use computed gotos.
6471
6472 @item -O3
6473 @opindex O3
6474 Optimize yet more. @option{-O3} turns on all optimizations specified
6475 by @option{-O2} and also turns on the @option{-finline-functions},
6476 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6477 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
6478 @option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
6479 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
6480 @option{-ftree-partial-pre}, @option{-fpeel-loops}
6481 and @option{-fipa-cp-clone} options.
6482
6483 @item -O0
6484 @opindex O0
6485 Reduce compilation time and make debugging produce the expected
6486 results. This is the default.
6487
6488 @item -Os
6489 @opindex Os
6490 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6491 do not typically increase code size. It also performs further
6492 optimizations designed to reduce code size.
6493
6494 @option{-Os} disables the following optimization flags:
6495 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6496 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
6497 -freorder-blocks-and-partition -fprefetch-loop-arrays}
6498
6499 @item -Ofast
6500 @opindex Ofast
6501 Disregard strict standards compliance. @option{-Ofast} enables all
6502 @option{-O3} optimizations. It also enables optimizations that are not
6503 valid for all standard-compliant programs.
6504 It turns on @option{-ffast-math} and the Fortran-specific
6505 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6506
6507 @item -Og
6508 @opindex Og
6509 Optimize debugging experience. @option{-Og} enables optimizations
6510 that do not interfere with debugging. It should be the optimization
6511 level of choice for the standard edit-compile-debug cycle, offering
6512 a reasonable level of optimization while maintaining fast compilation
6513 and a good debugging experience.
6514 @end table
6515
6516 If you use multiple @option{-O} options, with or without level numbers,
6517 the last such option is the one that is effective.
6518
6519 Options of the form @option{-f@var{flag}} specify machine-independent
6520 flags. Most flags have both positive and negative forms; the negative
6521 form of @option{-ffoo} is @option{-fno-foo}. In the table
6522 below, only one of the forms is listed---the one you typically
6523 use. You can figure out the other form by either removing @samp{no-}
6524 or adding it.
6525
6526 The following options control specific optimizations. They are either
6527 activated by @option{-O} options or are related to ones that are. You
6528 can use the following flags in the rare cases when ``fine-tuning'' of
6529 optimizations to be performed is desired.
6530
6531 @table @gcctabopt
6532 @item -fno-defer-pop
6533 @opindex fno-defer-pop
6534 Always pop the arguments to each function call as soon as that function
6535 returns. For machines that must pop arguments after a function call,
6536 the compiler normally lets arguments accumulate on the stack for several
6537 function calls and pops them all at once.
6538
6539 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6540
6541 @item -fforward-propagate
6542 @opindex fforward-propagate
6543 Perform a forward propagation pass on RTL@. The pass tries to combine two
6544 instructions and checks if the result can be simplified. If loop unrolling
6545 is active, two passes are performed and the second is scheduled after
6546 loop unrolling.
6547
6548 This option is enabled by default at optimization levels @option{-O},
6549 @option{-O2}, @option{-O3}, @option{-Os}.
6550
6551 @item -ffp-contract=@var{style}
6552 @opindex ffp-contract
6553 @option{-ffp-contract=off} disables floating-point expression contraction.
6554 @option{-ffp-contract=fast} enables floating-point expression contraction
6555 such as forming of fused multiply-add operations if the target has
6556 native support for them.
6557 @option{-ffp-contract=on} enables floating-point expression contraction
6558 if allowed by the language standard. This is currently not implemented
6559 and treated equal to @option{-ffp-contract=off}.
6560
6561 The default is @option{-ffp-contract=fast}.
6562
6563 @item -fomit-frame-pointer
6564 @opindex fomit-frame-pointer
6565 Don't keep the frame pointer in a register for functions that
6566 don't need one. This avoids the instructions to save, set up and
6567 restore frame pointers; it also makes an extra register available
6568 in many functions. @strong{It also makes debugging impossible on
6569 some machines.}
6570
6571 On some machines, such as the VAX, this flag has no effect, because
6572 the standard calling sequence automatically handles the frame pointer
6573 and nothing is saved by pretending it doesn't exist. The
6574 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6575 whether a target machine supports this flag. @xref{Registers,,Register
6576 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6577
6578 The default setting (when not optimizing for
6579 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
6580 @option{-fomit-frame-pointer}. You can configure GCC with the
6581 @option{--enable-frame-pointer} configure option to change the default.
6582
6583 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6584
6585 @item -foptimize-sibling-calls
6586 @opindex foptimize-sibling-calls
6587 Optimize sibling and tail recursive calls.
6588
6589 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6590
6591 @item -foptimize-strlen
6592 @opindex foptimize-strlen
6593 Optimize various standard C string functions (e.g. @code{strlen},
6594 @code{strchr} or @code{strcpy}) and
6595 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
6596
6597 Enabled at levels @option{-O2}, @option{-O3}.
6598
6599 @item -fno-inline
6600 @opindex fno-inline
6601 Do not expand any functions inline apart from those marked with
6602 the @code{always_inline} attribute. This is the default when not
6603 optimizing.
6604
6605 Single functions can be exempted from inlining by marking them
6606 with the @code{noinline} attribute.
6607
6608 @item -finline-small-functions
6609 @opindex finline-small-functions
6610 Integrate functions into their callers when their body is smaller than expected
6611 function call code (so overall size of program gets smaller). The compiler
6612 heuristically decides which functions are simple enough to be worth integrating
6613 in this way. This inlining applies to all functions, even those not declared
6614 inline.
6615
6616 Enabled at level @option{-O2}.
6617
6618 @item -findirect-inlining
6619 @opindex findirect-inlining
6620 Inline also indirect calls that are discovered to be known at compile
6621 time thanks to previous inlining. This option has any effect only
6622 when inlining itself is turned on by the @option{-finline-functions}
6623 or @option{-finline-small-functions} options.
6624
6625 Enabled at level @option{-O2}.
6626
6627 @item -finline-functions
6628 @opindex finline-functions
6629 Consider all functions for inlining, even if they are not declared inline.
6630 The compiler heuristically decides which functions are worth integrating
6631 in this way.
6632
6633 If all calls to a given function are integrated, and the function is
6634 declared @code{static}, then the function is normally not output as
6635 assembler code in its own right.
6636
6637 Enabled at level @option{-O3}.
6638
6639 @item -finline-functions-called-once
6640 @opindex finline-functions-called-once
6641 Consider all @code{static} functions called once for inlining into their
6642 caller even if they are not marked @code{inline}. If a call to a given
6643 function is integrated, then the function is not output as assembler code
6644 in its own right.
6645
6646 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6647
6648 @item -fearly-inlining
6649 @opindex fearly-inlining
6650 Inline functions marked by @code{always_inline} and functions whose body seems
6651 smaller than the function call overhead early before doing
6652 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
6653 makes profiling significantly cheaper and usually inlining faster on programs
6654 having large chains of nested wrapper functions.
6655
6656 Enabled by default.
6657
6658 @item -fipa-sra
6659 @opindex fipa-sra
6660 Perform interprocedural scalar replacement of aggregates, removal of
6661 unused parameters and replacement of parameters passed by reference
6662 by parameters passed by value.
6663
6664 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6665
6666 @item -finline-limit=@var{n}
6667 @opindex finline-limit
6668 By default, GCC limits the size of functions that can be inlined. This flag
6669 allows coarse control of this limit. @var{n} is the size of functions that
6670 can be inlined in number of pseudo instructions.
6671
6672 Inlining is actually controlled by a number of parameters, which may be
6673 specified individually by using @option{--param @var{name}=@var{value}}.
6674 The @option{-finline-limit=@var{n}} option sets some of these parameters
6675 as follows:
6676
6677 @table @gcctabopt
6678 @item max-inline-insns-single
6679 is set to @var{n}/2.
6680 @item max-inline-insns-auto
6681 is set to @var{n}/2.
6682 @end table
6683
6684 See below for a documentation of the individual
6685 parameters controlling inlining and for the defaults of these parameters.
6686
6687 @emph{Note:} there may be no value to @option{-finline-limit} that results
6688 in default behavior.
6689
6690 @emph{Note:} pseudo instruction represents, in this particular context, an
6691 abstract measurement of function's size. In no way does it represent a count
6692 of assembly instructions and as such its exact meaning might change from one
6693 release to an another.
6694
6695 @item -fno-keep-inline-dllexport
6696 @opindex fno-keep-inline-dllexport
6697 This is a more fine-grained version of @option{-fkeep-inline-functions},
6698 which applies only to functions that are declared using the @code{dllexport}
6699 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6700 Functions}.)
6701
6702 @item -fkeep-inline-functions
6703 @opindex fkeep-inline-functions
6704 In C, emit @code{static} functions that are declared @code{inline}
6705 into the object file, even if the function has been inlined into all
6706 of its callers. This switch does not affect functions using the
6707 @code{extern inline} extension in GNU C90@. In C++, emit any and all
6708 inline functions into the object file.
6709
6710 @item -fkeep-static-functions
6711 @opindex fkeep-static-functions
6712 Emit @code{static} functions into the object file, even if the function
6713 is never used.
6714
6715 @item -fkeep-static-consts
6716 @opindex fkeep-static-consts
6717 Emit variables declared @code{static const} when optimization isn't turned
6718 on, even if the variables aren't referenced.
6719
6720 GCC enables this option by default. If you want to force the compiler to
6721 check if a variable is referenced, regardless of whether or not
6722 optimization is turned on, use the @option{-fno-keep-static-consts} option.
6723
6724 @item -fmerge-constants
6725 @opindex fmerge-constants
6726 Attempt to merge identical constants (string constants and floating-point
6727 constants) across compilation units.
6728
6729 This option is the default for optimized compilation if the assembler and
6730 linker support it. Use @option{-fno-merge-constants} to inhibit this
6731 behavior.
6732
6733 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6734
6735 @item -fmerge-all-constants
6736 @opindex fmerge-all-constants
6737 Attempt to merge identical constants and identical variables.
6738
6739 This option implies @option{-fmerge-constants}. In addition to
6740 @option{-fmerge-constants} this considers e.g.@: even constant initialized
6741 arrays or initialized constant variables with integral or floating-point
6742 types. Languages like C or C++ require each variable, including multiple
6743 instances of the same variable in recursive calls, to have distinct locations,
6744 so using this option results in non-conforming
6745 behavior.
6746
6747 @item -fmodulo-sched
6748 @opindex fmodulo-sched
6749 Perform swing modulo scheduling immediately before the first scheduling
6750 pass. This pass looks at innermost loops and reorders their
6751 instructions by overlapping different iterations.
6752
6753 @item -fmodulo-sched-allow-regmoves
6754 @opindex fmodulo-sched-allow-regmoves
6755 Perform more aggressive SMS-based modulo scheduling with register moves
6756 allowed. By setting this flag certain anti-dependences edges are
6757 deleted, which triggers the generation of reg-moves based on the
6758 life-range analysis. This option is effective only with
6759 @option{-fmodulo-sched} enabled.
6760
6761 @item -fno-branch-count-reg
6762 @opindex fno-branch-count-reg
6763 Avoid running a pass scanning for opportunities to use ``decrement and
6764 branch'' instructions on a count register instead of generating sequences
6765 of instructions that decrement a register, compare it against zero, and
6766 then branch based upon the result. This option is only meaningful on
6767 architectures that support such instructions, which include x86, PowerPC,
6768 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
6769 doesn't remove the decrement and branch instructions from the generated
6770 instruction stream introduced by other optimization passes.
6771
6772 Enabled by default at @option{-O1} and higher.
6773
6774 The default is @option{-fbranch-count-reg}.
6775
6776 @item -fno-function-cse
6777 @opindex fno-function-cse
6778 Do not put function addresses in registers; make each instruction that
6779 calls a constant function contain the function's address explicitly.
6780
6781 This option results in less efficient code, but some strange hacks
6782 that alter the assembler output may be confused by the optimizations
6783 performed when this option is not used.
6784
6785 The default is @option{-ffunction-cse}
6786
6787 @item -fno-zero-initialized-in-bss
6788 @opindex fno-zero-initialized-in-bss
6789 If the target supports a BSS section, GCC by default puts variables that
6790 are initialized to zero into BSS@. This can save space in the resulting
6791 code.
6792
6793 This option turns off this behavior because some programs explicitly
6794 rely on variables going to the data section---e.g., so that the
6795 resulting executable can find the beginning of that section and/or make
6796 assumptions based on that.
6797
6798 The default is @option{-fzero-initialized-in-bss}.
6799
6800 @item -fthread-jumps
6801 @opindex fthread-jumps
6802 Perform optimizations that check to see if a jump branches to a
6803 location where another comparison subsumed by the first is found. If
6804 so, the first branch is redirected to either the destination of the
6805 second branch or a point immediately following it, depending on whether
6806 the condition is known to be true or false.
6807
6808 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6809
6810 @item -fsplit-wide-types
6811 @opindex fsplit-wide-types
6812 When using a type that occupies multiple registers, such as @code{long
6813 long} on a 32-bit system, split the registers apart and allocate them
6814 independently. This normally generates better code for those types,
6815 but may make debugging more difficult.
6816
6817 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6818 @option{-Os}.
6819
6820 @item -fcse-follow-jumps
6821 @opindex fcse-follow-jumps
6822 In common subexpression elimination (CSE), scan through jump instructions
6823 when the target of the jump is not reached by any other path. For
6824 example, when CSE encounters an @code{if} statement with an
6825 @code{else} clause, CSE follows the jump when the condition
6826 tested is false.
6827
6828 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6829
6830 @item -fcse-skip-blocks
6831 @opindex fcse-skip-blocks
6832 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6833 follow jumps that conditionally skip over blocks. When CSE
6834 encounters a simple @code{if} statement with no else clause,
6835 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
6836 body of the @code{if}.
6837
6838 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6839
6840 @item -frerun-cse-after-loop
6841 @opindex frerun-cse-after-loop
6842 Re-run common subexpression elimination after loop optimizations are
6843 performed.
6844
6845 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6846
6847 @item -fgcse
6848 @opindex fgcse
6849 Perform a global common subexpression elimination pass.
6850 This pass also performs global constant and copy propagation.
6851
6852 @emph{Note:} When compiling a program using computed gotos, a GCC
6853 extension, you may get better run-time performance if you disable
6854 the global common subexpression elimination pass by adding
6855 @option{-fno-gcse} to the command line.
6856
6857 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6858
6859 @item -fgcse-lm
6860 @opindex fgcse-lm
6861 When @option{-fgcse-lm} is enabled, global common subexpression elimination
6862 attempts to move loads that are only killed by stores into themselves. This
6863 allows a loop containing a load/store sequence to be changed to a load outside
6864 the loop, and a copy/store within the loop.
6865
6866 Enabled by default when @option{-fgcse} is enabled.
6867
6868 @item -fgcse-sm
6869 @opindex fgcse-sm
6870 When @option{-fgcse-sm} is enabled, a store motion pass is run after
6871 global common subexpression elimination. This pass attempts to move
6872 stores out of loops. When used in conjunction with @option{-fgcse-lm},
6873 loops containing a load/store sequence can be changed to a load before
6874 the loop and a store after the loop.
6875
6876 Not enabled at any optimization level.
6877
6878 @item -fgcse-las
6879 @opindex fgcse-las
6880 When @option{-fgcse-las} is enabled, the global common subexpression
6881 elimination pass eliminates redundant loads that come after stores to the
6882 same memory location (both partial and full redundancies).
6883
6884 Not enabled at any optimization level.
6885
6886 @item -fgcse-after-reload
6887 @opindex fgcse-after-reload
6888 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6889 pass is performed after reload. The purpose of this pass is to clean up
6890 redundant spilling.
6891
6892 @item -faggressive-loop-optimizations
6893 @opindex faggressive-loop-optimizations
6894 This option tells the loop optimizer to use language constraints to
6895 derive bounds for the number of iterations of a loop. This assumes that
6896 loop code does not invoke undefined behavior by for example causing signed
6897 integer overflows or out-of-bound array accesses. The bounds for the
6898 number of iterations of a loop are used to guide loop unrolling and peeling
6899 and loop exit test optimizations.
6900 This option is enabled by default.
6901
6902 @item -funconstrained-commons
6903 @opindex funconstrained-commons
6904 This option tells the compiler that variables declared in common blocks
6905 (e.g. Fortran) may later be overridden with longer trailing arrays. This
6906 prevents certain optimizations that depend on knowing the array bounds.
6907
6908 @item -fcrossjumping
6909 @opindex fcrossjumping
6910 Perform cross-jumping transformation.
6911 This transformation unifies equivalent code and saves code size. The
6912 resulting code may or may not perform better than without cross-jumping.
6913
6914 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6915
6916 @item -fauto-inc-dec
6917 @opindex fauto-inc-dec
6918 Combine increments or decrements of addresses with memory accesses.
6919 This pass is always skipped on architectures that do not have
6920 instructions to support this. Enabled by default at @option{-O} and
6921 higher on architectures that support this.
6922
6923 @item -fdce
6924 @opindex fdce
6925 Perform dead code elimination (DCE) on RTL@.
6926 Enabled by default at @option{-O} and higher.
6927
6928 @item -fdse
6929 @opindex fdse
6930 Perform dead store elimination (DSE) on RTL@.
6931 Enabled by default at @option{-O} and higher.
6932
6933 @item -fif-conversion
6934 @opindex fif-conversion
6935 Attempt to transform conditional jumps into branch-less equivalents. This
6936 includes use of conditional moves, min, max, set flags and abs instructions, and
6937 some tricks doable by standard arithmetics. The use of conditional execution
6938 on chips where it is available is controlled by @option{-fif-conversion2}.
6939
6940 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6941
6942 @item -fif-conversion2
6943 @opindex fif-conversion2
6944 Use conditional execution (where available) to transform conditional jumps into
6945 branch-less equivalents.
6946
6947 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6948
6949 @item -fdeclone-ctor-dtor
6950 @opindex fdeclone-ctor-dtor
6951 The C++ ABI requires multiple entry points for constructors and
6952 destructors: one for a base subobject, one for a complete object, and
6953 one for a virtual destructor that calls operator delete afterwards.
6954 For a hierarchy with virtual bases, the base and complete variants are
6955 clones, which means two copies of the function. With this option, the
6956 base and complete variants are changed to be thunks that call a common
6957 implementation.
6958
6959 Enabled by @option{-Os}.
6960
6961 @item -fdelete-null-pointer-checks
6962 @opindex fdelete-null-pointer-checks
6963 Assume that programs cannot safely dereference null pointers, and that
6964 no code or data element resides at address zero.
6965 This option enables simple constant
6966 folding optimizations at all optimization levels. In addition, other
6967 optimization passes in GCC use this flag to control global dataflow
6968 analyses that eliminate useless checks for null pointers; these assume
6969 that a memory access to address zero always results in a trap, so
6970 that if a pointer is checked after it has already been dereferenced,
6971 it cannot be null.
6972
6973 Note however that in some environments this assumption is not true.
6974 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
6975 for programs that depend on that behavior.
6976
6977 This option is enabled by default on most targets. On Nios II ELF, it
6978 defaults to off. On AVR and CR16, this option is completely disabled.
6979
6980 Passes that use the dataflow information
6981 are enabled independently at different optimization levels.
6982
6983 @item -fdevirtualize
6984 @opindex fdevirtualize
6985 Attempt to convert calls to virtual functions to direct calls. This
6986 is done both within a procedure and interprocedurally as part of
6987 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
6988 propagation (@option{-fipa-cp}).
6989 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6990
6991 @item -fdevirtualize-speculatively
6992 @opindex fdevirtualize-speculatively
6993 Attempt to convert calls to virtual functions to speculative direct calls.
6994 Based on the analysis of the type inheritance graph, determine for a given call
6995 the set of likely targets. If the set is small, preferably of size 1, change
6996 the call into a conditional deciding between direct and indirect calls. The
6997 speculative calls enable more optimizations, such as inlining. When they seem
6998 useless after further optimization, they are converted back into original form.
6999
7000 @item -fdevirtualize-at-ltrans
7001 @opindex fdevirtualize-at-ltrans
7002 Stream extra information needed for aggressive devirtualization when running
7003 the link-time optimizer in local transformation mode.
7004 This option enables more devirtualization but
7005 significantly increases the size of streamed data. For this reason it is
7006 disabled by default.
7007
7008 @item -fexpensive-optimizations
7009 @opindex fexpensive-optimizations
7010 Perform a number of minor optimizations that are relatively expensive.
7011
7012 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7013
7014 @item -free
7015 @opindex free
7016 Attempt to remove redundant extension instructions. This is especially
7017 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
7018 registers after writing to their lower 32-bit half.
7019
7020 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
7021 @option{-O3}, @option{-Os}.
7022
7023 @item -fno-lifetime-dse
7024 @opindex fno-lifetime-dse
7025 In C++ the value of an object is only affected by changes within its
7026 lifetime: when the constructor begins, the object has an indeterminate
7027 value, and any changes during the lifetime of the object are dead when
7028 the object is destroyed. Normally dead store elimination will take
7029 advantage of this; if your code relies on the value of the object
7030 storage persisting beyond the lifetime of the object, you can use this
7031 flag to disable this optimization. To preserve stores before the
7032 constructor starts (e.g. because your operator new clears the object
7033 storage) but still treat the object as dead after the destructor you,
7034 can use @option{-flifetime-dse=1}. The default behavior can be
7035 explicitly selected with @option{-flifetime-dse=2}.
7036 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
7037
7038 @item -flive-range-shrinkage
7039 @opindex flive-range-shrinkage
7040 Attempt to decrease register pressure through register live range
7041 shrinkage. This is helpful for fast processors with small or moderate
7042 size register sets.
7043
7044 @item -fira-algorithm=@var{algorithm}
7045 @opindex fira-algorithm
7046 Use the specified coloring algorithm for the integrated register
7047 allocator. The @var{algorithm} argument can be @samp{priority}, which
7048 specifies Chow's priority coloring, or @samp{CB}, which specifies
7049 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
7050 for all architectures, but for those targets that do support it, it is
7051 the default because it generates better code.
7052
7053 @item -fira-region=@var{region}
7054 @opindex fira-region
7055 Use specified regions for the integrated register allocator. The
7056 @var{region} argument should be one of the following:
7057
7058 @table @samp
7059
7060 @item all
7061 Use all loops as register allocation regions.
7062 This can give the best results for machines with a small and/or
7063 irregular register set.
7064
7065 @item mixed
7066 Use all loops except for loops with small register pressure
7067 as the regions. This value usually gives
7068 the best results in most cases and for most architectures,
7069 and is enabled by default when compiling with optimization for speed
7070 (@option{-O}, @option{-O2}, @dots{}).
7071
7072 @item one
7073 Use all functions as a single region.
7074 This typically results in the smallest code size, and is enabled by default for
7075 @option{-Os} or @option{-O0}.
7076
7077 @end table
7078
7079 @item -fira-hoist-pressure
7080 @opindex fira-hoist-pressure
7081 Use IRA to evaluate register pressure in the code hoisting pass for
7082 decisions to hoist expressions. This option usually results in smaller
7083 code, but it can slow the compiler down.
7084
7085 This option is enabled at level @option{-Os} for all targets.
7086
7087 @item -fira-loop-pressure
7088 @opindex fira-loop-pressure
7089 Use IRA to evaluate register pressure in loops for decisions to move
7090 loop invariants. This option usually results in generation
7091 of faster and smaller code on machines with large register files (>= 32
7092 registers), but it can slow the compiler down.
7093
7094 This option is enabled at level @option{-O3} for some targets.
7095
7096 @item -fno-ira-share-save-slots
7097 @opindex fno-ira-share-save-slots
7098 Disable sharing of stack slots used for saving call-used hard
7099 registers living through a call. Each hard register gets a
7100 separate stack slot, and as a result function stack frames are
7101 larger.
7102
7103 @item -fno-ira-share-spill-slots
7104 @opindex fno-ira-share-spill-slots
7105 Disable sharing of stack slots allocated for pseudo-registers. Each
7106 pseudo-register that does not get a hard register gets a separate
7107 stack slot, and as a result function stack frames are larger.
7108
7109 @item -flra-remat
7110 @opindex flra-remat
7111 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7112 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7113 values if it is profitable.
7114
7115 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7116
7117 @item -fdelayed-branch
7118 @opindex fdelayed-branch
7119 If supported for the target machine, attempt to reorder instructions
7120 to exploit instruction slots available after delayed branch
7121 instructions.
7122
7123 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7124
7125 @item -fschedule-insns
7126 @opindex fschedule-insns
7127 If supported for the target machine, attempt to reorder instructions to
7128 eliminate execution stalls due to required data being unavailable. This
7129 helps machines that have slow floating point or memory load instructions
7130 by allowing other instructions to be issued until the result of the load
7131 or floating-point instruction is required.
7132
7133 Enabled at levels @option{-O2}, @option{-O3}.
7134
7135 @item -fschedule-insns2
7136 @opindex fschedule-insns2
7137 Similar to @option{-fschedule-insns}, but requests an additional pass of
7138 instruction scheduling after register allocation has been done. This is
7139 especially useful on machines with a relatively small number of
7140 registers and where memory load instructions take more than one cycle.
7141
7142 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7143
7144 @item -fno-sched-interblock
7145 @opindex fno-sched-interblock
7146 Don't schedule instructions across basic blocks. This is normally
7147 enabled by default when scheduling before register allocation, i.e.@:
7148 with @option{-fschedule-insns} or at @option{-O2} or higher.
7149
7150 @item -fno-sched-spec
7151 @opindex fno-sched-spec
7152 Don't allow speculative motion of non-load instructions. This is normally
7153 enabled by default when scheduling before register allocation, i.e.@:
7154 with @option{-fschedule-insns} or at @option{-O2} or higher.
7155
7156 @item -fsched-pressure
7157 @opindex fsched-pressure
7158 Enable register pressure sensitive insn scheduling before register
7159 allocation. This only makes sense when scheduling before register
7160 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7161 @option{-O2} or higher. Usage of this option can improve the
7162 generated code and decrease its size by preventing register pressure
7163 increase above the number of available hard registers and subsequent
7164 spills in register allocation.
7165
7166 @item -fsched-spec-load
7167 @opindex fsched-spec-load
7168 Allow speculative motion of some load instructions. This only makes
7169 sense when scheduling before register allocation, i.e.@: with
7170 @option{-fschedule-insns} or at @option{-O2} or higher.
7171
7172 @item -fsched-spec-load-dangerous
7173 @opindex fsched-spec-load-dangerous
7174 Allow speculative motion of more load instructions. This only makes
7175 sense when scheduling before register allocation, i.e.@: with
7176 @option{-fschedule-insns} or at @option{-O2} or higher.
7177
7178 @item -fsched-stalled-insns
7179 @itemx -fsched-stalled-insns=@var{n}
7180 @opindex fsched-stalled-insns
7181 Define how many insns (if any) can be moved prematurely from the queue
7182 of stalled insns into the ready list during the second scheduling pass.
7183 @option{-fno-sched-stalled-insns} means that no insns are moved
7184 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7185 on how many queued insns can be moved prematurely.
7186 @option{-fsched-stalled-insns} without a value is equivalent to
7187 @option{-fsched-stalled-insns=1}.
7188
7189 @item -fsched-stalled-insns-dep
7190 @itemx -fsched-stalled-insns-dep=@var{n}
7191 @opindex fsched-stalled-insns-dep
7192 Define how many insn groups (cycles) are examined for a dependency
7193 on a stalled insn that is a candidate for premature removal from the queue
7194 of stalled insns. This has an effect only during the second scheduling pass,
7195 and only if @option{-fsched-stalled-insns} is used.
7196 @option{-fno-sched-stalled-insns-dep} is equivalent to
7197 @option{-fsched-stalled-insns-dep=0}.
7198 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7199 @option{-fsched-stalled-insns-dep=1}.
7200
7201 @item -fsched2-use-superblocks
7202 @opindex fsched2-use-superblocks
7203 When scheduling after register allocation, use superblock scheduling.
7204 This allows motion across basic block boundaries,
7205 resulting in faster schedules. This option is experimental, as not all machine
7206 descriptions used by GCC model the CPU closely enough to avoid unreliable
7207 results from the algorithm.
7208
7209 This only makes sense when scheduling after register allocation, i.e.@: with
7210 @option{-fschedule-insns2} or at @option{-O2} or higher.
7211
7212 @item -fsched-group-heuristic
7213 @opindex fsched-group-heuristic
7214 Enable the group heuristic in the scheduler. This heuristic favors
7215 the instruction that belongs to a schedule group. This is enabled
7216 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7217 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7218
7219 @item -fsched-critical-path-heuristic
7220 @opindex fsched-critical-path-heuristic
7221 Enable the critical-path heuristic in the scheduler. This heuristic favors
7222 instructions on the critical path. This is enabled by default when
7223 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7224 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7225
7226 @item -fsched-spec-insn-heuristic
7227 @opindex fsched-spec-insn-heuristic
7228 Enable the speculative instruction heuristic in the scheduler. This
7229 heuristic favors speculative instructions with greater dependency weakness.
7230 This is enabled by default when scheduling is enabled, i.e.@:
7231 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7232 or at @option{-O2} or higher.
7233
7234 @item -fsched-rank-heuristic
7235 @opindex fsched-rank-heuristic
7236 Enable the rank heuristic in the scheduler. This heuristic favors
7237 the instruction belonging to a basic block with greater size or frequency.
7238 This is enabled by default when scheduling is enabled, i.e.@:
7239 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7240 at @option{-O2} or higher.
7241
7242 @item -fsched-last-insn-heuristic
7243 @opindex fsched-last-insn-heuristic
7244 Enable the last-instruction heuristic in the scheduler. This heuristic
7245 favors the instruction that is less dependent on the last instruction
7246 scheduled. This is enabled by default when scheduling is enabled,
7247 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7248 at @option{-O2} or higher.
7249
7250 @item -fsched-dep-count-heuristic
7251 @opindex fsched-dep-count-heuristic
7252 Enable the dependent-count heuristic in the scheduler. This heuristic
7253 favors the instruction that has more instructions depending on it.
7254 This is enabled by default when scheduling is enabled, i.e.@:
7255 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7256 at @option{-O2} or higher.
7257
7258 @item -freschedule-modulo-scheduled-loops
7259 @opindex freschedule-modulo-scheduled-loops
7260 Modulo scheduling is performed before traditional scheduling. If a loop
7261 is modulo scheduled, later scheduling passes may change its schedule.
7262 Use this option to control that behavior.
7263
7264 @item -fselective-scheduling
7265 @opindex fselective-scheduling
7266 Schedule instructions using selective scheduling algorithm. Selective
7267 scheduling runs instead of the first scheduler pass.
7268
7269 @item -fselective-scheduling2
7270 @opindex fselective-scheduling2
7271 Schedule instructions using selective scheduling algorithm. Selective
7272 scheduling runs instead of the second scheduler pass.
7273
7274 @item -fsel-sched-pipelining
7275 @opindex fsel-sched-pipelining
7276 Enable software pipelining of innermost loops during selective scheduling.
7277 This option has no effect unless one of @option{-fselective-scheduling} or
7278 @option{-fselective-scheduling2} is turned on.
7279
7280 @item -fsel-sched-pipelining-outer-loops
7281 @opindex fsel-sched-pipelining-outer-loops
7282 When pipelining loops during selective scheduling, also pipeline outer loops.
7283 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7284
7285 @item -fsemantic-interposition
7286 @opindex fsemantic-interposition
7287 Some object formats, like ELF, allow interposing of symbols by the
7288 dynamic linker.
7289 This means that for symbols exported from the DSO, the compiler cannot perform
7290 interprocedural propagation, inlining and other optimizations in anticipation
7291 that the function or variable in question may change. While this feature is
7292 useful, for example, to rewrite memory allocation functions by a debugging
7293 implementation, it is expensive in the terms of code quality.
7294 With @option{-fno-semantic-interposition} the compiler assumes that
7295 if interposition happens for functions the overwriting function will have
7296 precisely the same semantics (and side effects).
7297 Similarly if interposition happens
7298 for variables, the constructor of the variable will be the same. The flag
7299 has no effect for functions explicitly declared inline
7300 (where it is never allowed for interposition to change semantics)
7301 and for symbols explicitly declared weak.
7302
7303 @item -fshrink-wrap
7304 @opindex fshrink-wrap
7305 Emit function prologues only before parts of the function that need it,
7306 rather than at the top of the function. This flag is enabled by default at
7307 @option{-O} and higher.
7308
7309 @item -fcaller-saves
7310 @opindex fcaller-saves
7311 Enable allocation of values to registers that are clobbered by
7312 function calls, by emitting extra instructions to save and restore the
7313 registers around such calls. Such allocation is done only when it
7314 seems to result in better code.
7315
7316 This option is always enabled by default on certain machines, usually
7317 those which have no call-preserved registers to use instead.
7318
7319 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7320
7321 @item -fcombine-stack-adjustments
7322 @opindex fcombine-stack-adjustments
7323 Tracks stack adjustments (pushes and pops) and stack memory references
7324 and then tries to find ways to combine them.
7325
7326 Enabled by default at @option{-O1} and higher.
7327
7328 @item -fipa-ra
7329 @opindex fipa-ra
7330 Use caller save registers for allocation if those registers are not used by
7331 any called function. In that case it is not necessary to save and restore
7332 them around calls. This is only possible if called functions are part of
7333 same compilation unit as current function and they are compiled before it.
7334
7335 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
7336 is disabled if generated code will be instrumented for profiling
7337 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
7338 exactly (this happens on targets that do not expose prologues
7339 and epilogues in RTL).
7340
7341 @item -fconserve-stack
7342 @opindex fconserve-stack
7343 Attempt to minimize stack usage. The compiler attempts to use less
7344 stack space, even if that makes the program slower. This option
7345 implies setting the @option{large-stack-frame} parameter to 100
7346 and the @option{large-stack-frame-growth} parameter to 400.
7347
7348 @item -ftree-reassoc
7349 @opindex ftree-reassoc
7350 Perform reassociation on trees. This flag is enabled by default
7351 at @option{-O} and higher.
7352
7353 @item -fcode-hoisting
7354 @opindex fcode-hoisting
7355 Perform code hoisting. Code hoisting tries to move the
7356 evaluation of expressions executed on all paths to the function exit
7357 as early as possible. This is especially useful as a code size
7358 optimization, but it often helps for code speed as well.
7359 This flag is enabled by default at @option{-O2} and higher.
7360
7361 @item -ftree-pre
7362 @opindex ftree-pre
7363 Perform partial redundancy elimination (PRE) on trees. This flag is
7364 enabled by default at @option{-O2} and @option{-O3}.
7365
7366 @item -ftree-partial-pre
7367 @opindex ftree-partial-pre
7368 Make partial redundancy elimination (PRE) more aggressive. This flag is
7369 enabled by default at @option{-O3}.
7370
7371 @item -ftree-forwprop
7372 @opindex ftree-forwprop
7373 Perform forward propagation on trees. This flag is enabled by default
7374 at @option{-O} and higher.
7375
7376 @item -ftree-fre
7377 @opindex ftree-fre
7378 Perform full redundancy elimination (FRE) on trees. The difference
7379 between FRE and PRE is that FRE only considers expressions
7380 that are computed on all paths leading to the redundant computation.
7381 This analysis is faster than PRE, though it exposes fewer redundancies.
7382 This flag is enabled by default at @option{-O} and higher.
7383
7384 @item -ftree-phiprop
7385 @opindex ftree-phiprop
7386 Perform hoisting of loads from conditional pointers on trees. This
7387 pass is enabled by default at @option{-O} and higher.
7388
7389 @item -fhoist-adjacent-loads
7390 @opindex fhoist-adjacent-loads
7391 Speculatively hoist loads from both branches of an if-then-else if the
7392 loads are from adjacent locations in the same structure and the target
7393 architecture has a conditional move instruction. This flag is enabled
7394 by default at @option{-O2} and higher.
7395
7396 @item -ftree-copy-prop
7397 @opindex ftree-copy-prop
7398 Perform copy propagation on trees. This pass eliminates unnecessary
7399 copy operations. This flag is enabled by default at @option{-O} and
7400 higher.
7401
7402 @item -fipa-pure-const
7403 @opindex fipa-pure-const
7404 Discover which functions are pure or constant.
7405 Enabled by default at @option{-O} and higher.
7406
7407 @item -fipa-reference
7408 @opindex fipa-reference
7409 Discover which static variables do not escape the
7410 compilation unit.
7411 Enabled by default at @option{-O} and higher.
7412
7413 @item -fipa-pta
7414 @opindex fipa-pta
7415 Perform interprocedural pointer analysis and interprocedural modification
7416 and reference analysis. This option can cause excessive memory and
7417 compile-time usage on large compilation units. It is not enabled by
7418 default at any optimization level.
7419
7420 @item -fipa-profile
7421 @opindex fipa-profile
7422 Perform interprocedural profile propagation. The functions called only from
7423 cold functions are marked as cold. Also functions executed once (such as
7424 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7425 functions and loop less parts of functions executed once are then optimized for
7426 size.
7427 Enabled by default at @option{-O} and higher.
7428
7429 @item -fipa-cp
7430 @opindex fipa-cp
7431 Perform interprocedural constant propagation.
7432 This optimization analyzes the program to determine when values passed
7433 to functions are constants and then optimizes accordingly.
7434 This optimization can substantially increase performance
7435 if the application has constants passed to functions.
7436 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7437
7438 @item -fipa-cp-clone
7439 @opindex fipa-cp-clone
7440 Perform function cloning to make interprocedural constant propagation stronger.
7441 When enabled, interprocedural constant propagation performs function cloning
7442 when externally visible function can be called with constant arguments.
7443 Because this optimization can create multiple copies of functions,
7444 it may significantly increase code size
7445 (see @option{--param ipcp-unit-growth=@var{value}}).
7446 This flag is enabled by default at @option{-O3}.
7447
7448 @item -fipa-cp-alignment
7449 @opindex -fipa-cp-alignment
7450 When enabled, this optimization propagates alignment of function
7451 parameters to support better vectorization and string operations.
7452
7453 This flag is enabled by default at @option{-O2} and @option{-Os}. It
7454 requires that @option{-fipa-cp} is enabled.
7455
7456 @item -fipa-bit-cp
7457 @opindex -fipa-bit-cp
7458 When enabled, perform ipa bitwise constant propagation. This flag is
7459 enabled by default at @option{-O2}. It requires that @option{-fipa-cp}
7460 is enabled.
7461
7462 @item -fipa-icf
7463 @opindex fipa-icf
7464 Perform Identical Code Folding for functions and read-only variables.
7465 The optimization reduces code size and may disturb unwind stacks by replacing
7466 a function by equivalent one with a different name. The optimization works
7467 more effectively with link time optimization enabled.
7468
7469 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
7470 works on different levels and thus the optimizations are not same - there are
7471 equivalences that are found only by GCC and equivalences found only by Gold.
7472
7473 This flag is enabled by default at @option{-O2} and @option{-Os}.
7474
7475 @item -fisolate-erroneous-paths-dereference
7476 @opindex fisolate-erroneous-paths-dereference
7477 Detect paths that trigger erroneous or undefined behavior due to
7478 dereferencing a null pointer. Isolate those paths from the main control
7479 flow and turn the statement with erroneous or undefined behavior into a trap.
7480 This flag is enabled by default at @option{-O2} and higher and depends on
7481 @option{-fdelete-null-pointer-checks} also being enabled.
7482
7483 @item -fisolate-erroneous-paths-attribute
7484 @opindex fisolate-erroneous-paths-attribute
7485 Detect paths that trigger erroneous or undefined behavior due a null value
7486 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
7487 attribute. Isolate those paths from the main control flow and turn the
7488 statement with erroneous or undefined behavior into a trap. This is not
7489 currently enabled, but may be enabled by @option{-O2} in the future.
7490
7491 @item -ftree-sink
7492 @opindex ftree-sink
7493 Perform forward store motion on trees. This flag is
7494 enabled by default at @option{-O} and higher.
7495
7496 @item -ftree-bit-ccp
7497 @opindex ftree-bit-ccp
7498 Perform sparse conditional bit constant propagation on trees and propagate
7499 pointer alignment information.
7500 This pass only operates on local scalar variables and is enabled by default
7501 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7502
7503 @item -ftree-ccp
7504 @opindex ftree-ccp
7505 Perform sparse conditional constant propagation (CCP) on trees. This
7506 pass only operates on local scalar variables and is enabled by default
7507 at @option{-O} and higher.
7508
7509 @item -fssa-backprop
7510 @opindex fssa-backprop
7511 Propagate information about uses of a value up the definition chain
7512 in order to simplify the definitions. For example, this pass strips
7513 sign operations if the sign of a value never matters. The flag is
7514 enabled by default at @option{-O} and higher.
7515
7516 @item -fssa-phiopt
7517 @opindex fssa-phiopt
7518 Perform pattern matching on SSA PHI nodes to optimize conditional
7519 code. This pass is enabled by default at @option{-O} and higher.
7520
7521 @item -ftree-switch-conversion
7522 @opindex ftree-switch-conversion
7523 Perform conversion of simple initializations in a switch to
7524 initializations from a scalar array. This flag is enabled by default
7525 at @option{-O2} and higher.
7526
7527 @item -ftree-tail-merge
7528 @opindex ftree-tail-merge
7529 Look for identical code sequences. When found, replace one with a jump to the
7530 other. This optimization is known as tail merging or cross jumping. This flag
7531 is enabled by default at @option{-O2} and higher. The compilation time
7532 in this pass can
7533 be limited using @option{max-tail-merge-comparisons} parameter and
7534 @option{max-tail-merge-iterations} parameter.
7535
7536 @item -ftree-dce
7537 @opindex ftree-dce
7538 Perform dead code elimination (DCE) on trees. This flag is enabled by
7539 default at @option{-O} and higher.
7540
7541 @item -ftree-builtin-call-dce
7542 @opindex ftree-builtin-call-dce
7543 Perform conditional dead code elimination (DCE) for calls to built-in functions
7544 that may set @code{errno} but are otherwise side-effect free. This flag is
7545 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7546 specified.
7547
7548 @item -ftree-dominator-opts
7549 @opindex ftree-dominator-opts
7550 Perform a variety of simple scalar cleanups (constant/copy
7551 propagation, redundancy elimination, range propagation and expression
7552 simplification) based on a dominator tree traversal. This also
7553 performs jump threading (to reduce jumps to jumps). This flag is
7554 enabled by default at @option{-O} and higher.
7555
7556 @item -ftree-dse
7557 @opindex ftree-dse
7558 Perform dead store elimination (DSE) on trees. A dead store is a store into
7559 a memory location that is later overwritten by another store without
7560 any intervening loads. In this case the earlier store can be deleted. This
7561 flag is enabled by default at @option{-O} and higher.
7562
7563 @item -ftree-ch
7564 @opindex ftree-ch
7565 Perform loop header copying on trees. This is beneficial since it increases
7566 effectiveness of code motion optimizations. It also saves one jump. This flag
7567 is enabled by default at @option{-O} and higher. It is not enabled
7568 for @option{-Os}, since it usually increases code size.
7569
7570 @item -ftree-loop-optimize
7571 @opindex ftree-loop-optimize
7572 Perform loop optimizations on trees. This flag is enabled by default
7573 at @option{-O} and higher.
7574
7575 @item -ftree-loop-linear
7576 @itemx -floop-interchange
7577 @itemx -floop-strip-mine
7578 @itemx -floop-block
7579 @itemx -floop-unroll-and-jam
7580 @opindex ftree-loop-linear
7581 @opindex floop-interchange
7582 @opindex floop-strip-mine
7583 @opindex floop-block
7584 @opindex floop-unroll-and-jam
7585 Perform loop nest optimizations. Same as
7586 @option{-floop-nest-optimize}. To use this code transformation, GCC has
7587 to be configured with @option{--with-isl} to enable the Graphite loop
7588 transformation infrastructure.
7589
7590 @item -fgraphite-identity
7591 @opindex fgraphite-identity
7592 Enable the identity transformation for graphite. For every SCoP we generate
7593 the polyhedral representation and transform it back to gimple. Using
7594 @option{-fgraphite-identity} we can check the costs or benefits of the
7595 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
7596 are also performed by the code generator isl, like index splitting and
7597 dead code elimination in loops.
7598
7599 @item -floop-nest-optimize
7600 @opindex floop-nest-optimize
7601 Enable the isl based loop nest optimizer. This is a generic loop nest
7602 optimizer based on the Pluto optimization algorithms. It calculates a loop
7603 structure optimized for data-locality and parallelism. This option
7604 is experimental.
7605
7606 @item -floop-parallelize-all
7607 @opindex floop-parallelize-all
7608 Use the Graphite data dependence analysis to identify loops that can
7609 be parallelized. Parallelize all the loops that can be analyzed to
7610 not contain loop carried dependences without checking that it is
7611 profitable to parallelize the loops.
7612
7613 @item -ftree-coalesce-vars
7614 @opindex ftree-coalesce-vars
7615 While transforming the program out of the SSA representation, attempt to
7616 reduce copying by coalescing versions of different user-defined
7617 variables, instead of just compiler temporaries. This may severely
7618 limit the ability to debug an optimized program compiled with
7619 @option{-fno-var-tracking-assignments}. In the negated form, this flag
7620 prevents SSA coalescing of user variables. This option is enabled by
7621 default if optimization is enabled, and it does very little otherwise.
7622
7623 @item -ftree-loop-if-convert
7624 @opindex ftree-loop-if-convert
7625 Attempt to transform conditional jumps in the innermost loops to
7626 branch-less equivalents. The intent is to remove control-flow from
7627 the innermost loops in order to improve the ability of the
7628 vectorization pass to handle these loops. This is enabled by default
7629 if vectorization is enabled.
7630
7631 @item -ftree-loop-if-convert-stores
7632 @opindex ftree-loop-if-convert-stores
7633 Attempt to also if-convert conditional jumps containing memory writes.
7634 This transformation can be unsafe for multi-threaded programs as it
7635 transforms conditional memory writes into unconditional memory writes.
7636 For example,
7637 @smallexample
7638 for (i = 0; i < N; i++)
7639 if (cond)
7640 A[i] = expr;
7641 @end smallexample
7642 is transformed to
7643 @smallexample
7644 for (i = 0; i < N; i++)
7645 A[i] = cond ? expr : A[i];
7646 @end smallexample
7647 potentially producing data races.
7648
7649 @item -ftree-loop-distribution
7650 @opindex ftree-loop-distribution
7651 Perform loop distribution. This flag can improve cache performance on
7652 big loop bodies and allow further loop optimizations, like
7653 parallelization or vectorization, to take place. For example, the loop
7654 @smallexample
7655 DO I = 1, N
7656 A(I) = B(I) + C
7657 D(I) = E(I) * F
7658 ENDDO
7659 @end smallexample
7660 is transformed to
7661 @smallexample
7662 DO I = 1, N
7663 A(I) = B(I) + C
7664 ENDDO
7665 DO I = 1, N
7666 D(I) = E(I) * F
7667 ENDDO
7668 @end smallexample
7669
7670 @item -ftree-loop-distribute-patterns
7671 @opindex ftree-loop-distribute-patterns
7672 Perform loop distribution of patterns that can be code generated with
7673 calls to a library. This flag is enabled by default at @option{-O3}.
7674
7675 This pass distributes the initialization loops and generates a call to
7676 memset zero. For example, the loop
7677 @smallexample
7678 DO I = 1, N
7679 A(I) = 0
7680 B(I) = A(I) + I
7681 ENDDO
7682 @end smallexample
7683 is transformed to
7684 @smallexample
7685 DO I = 1, N
7686 A(I) = 0
7687 ENDDO
7688 DO I = 1, N
7689 B(I) = A(I) + I
7690 ENDDO
7691 @end smallexample
7692 and the initialization loop is transformed into a call to memset zero.
7693
7694 @item -ftree-loop-im
7695 @opindex ftree-loop-im
7696 Perform loop invariant motion on trees. This pass moves only invariants that
7697 are hard to handle at RTL level (function calls, operations that expand to
7698 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
7699 operands of conditions that are invariant out of the loop, so that we can use
7700 just trivial invariantness analysis in loop unswitching. The pass also includes
7701 store motion.
7702
7703 @item -ftree-loop-ivcanon
7704 @opindex ftree-loop-ivcanon
7705 Create a canonical counter for number of iterations in loops for which
7706 determining number of iterations requires complicated analysis. Later
7707 optimizations then may determine the number easily. Useful especially
7708 in connection with unrolling.
7709
7710 @item -fivopts
7711 @opindex fivopts
7712 Perform induction variable optimizations (strength reduction, induction
7713 variable merging and induction variable elimination) on trees.
7714
7715 @item -ftree-parallelize-loops=n
7716 @opindex ftree-parallelize-loops
7717 Parallelize loops, i.e., split their iteration space to run in n threads.
7718 This is only possible for loops whose iterations are independent
7719 and can be arbitrarily reordered. The optimization is only
7720 profitable on multiprocessor machines, for loops that are CPU-intensive,
7721 rather than constrained e.g.@: by memory bandwidth. This option
7722 implies @option{-pthread}, and thus is only supported on targets
7723 that have support for @option{-pthread}.
7724
7725 @item -ftree-pta
7726 @opindex ftree-pta
7727 Perform function-local points-to analysis on trees. This flag is
7728 enabled by default at @option{-O} and higher.
7729
7730 @item -ftree-sra
7731 @opindex ftree-sra
7732 Perform scalar replacement of aggregates. This pass replaces structure
7733 references with scalars to prevent committing structures to memory too
7734 early. This flag is enabled by default at @option{-O} and higher.
7735
7736 @item -ftree-ter
7737 @opindex ftree-ter
7738 Perform temporary expression replacement during the SSA->normal phase. Single
7739 use/single def temporaries are replaced at their use location with their
7740 defining expression. This results in non-GIMPLE code, but gives the expanders
7741 much more complex trees to work on resulting in better RTL generation. This is
7742 enabled by default at @option{-O} and higher.
7743
7744 @item -ftree-slsr
7745 @opindex ftree-slsr
7746 Perform straight-line strength reduction on trees. This recognizes related
7747 expressions involving multiplications and replaces them by less expensive
7748 calculations when possible. This is enabled by default at @option{-O} and
7749 higher.
7750
7751 @item -ftree-vectorize
7752 @opindex ftree-vectorize
7753 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
7754 and @option{-ftree-slp-vectorize} if not explicitly specified.
7755
7756 @item -ftree-loop-vectorize
7757 @opindex ftree-loop-vectorize
7758 Perform loop vectorization on trees. This flag is enabled by default at
7759 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7760
7761 @item -ftree-slp-vectorize
7762 @opindex ftree-slp-vectorize
7763 Perform basic block vectorization on trees. This flag is enabled by default at
7764 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7765
7766 @item -fvect-cost-model=@var{model}
7767 @opindex fvect-cost-model
7768 Alter the cost model used for vectorization. The @var{model} argument
7769 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
7770 With the @samp{unlimited} model the vectorized code-path is assumed
7771 to be profitable while with the @samp{dynamic} model a runtime check
7772 guards the vectorized code-path to enable it only for iteration
7773 counts that will likely execute faster than when executing the original
7774 scalar loop. The @samp{cheap} model disables vectorization of
7775 loops where doing so would be cost prohibitive for example due to
7776 required runtime checks for data dependence or alignment but otherwise
7777 is equal to the @samp{dynamic} model.
7778 The default cost model depends on other optimization flags and is
7779 either @samp{dynamic} or @samp{cheap}.
7780
7781 @item -fsimd-cost-model=@var{model}
7782 @opindex fsimd-cost-model
7783 Alter the cost model used for vectorization of loops marked with the OpenMP
7784 or Cilk Plus simd directive. The @var{model} argument should be one of
7785 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
7786 have the same meaning as described in @option{-fvect-cost-model} and by
7787 default a cost model defined with @option{-fvect-cost-model} is used.
7788
7789 @item -ftree-vrp
7790 @opindex ftree-vrp
7791 Perform Value Range Propagation on trees. This is similar to the
7792 constant propagation pass, but instead of values, ranges of values are
7793 propagated. This allows the optimizers to remove unnecessary range
7794 checks like array bound checks and null pointer checks. This is
7795 enabled by default at @option{-O2} and higher. Null pointer check
7796 elimination is only done if @option{-fdelete-null-pointer-checks} is
7797 enabled.
7798
7799 @item -fsplit-paths
7800 @opindex fsplit-paths
7801 Split paths leading to loop backedges. This can improve dead code
7802 elimination and common subexpression elimination. This is enabled by
7803 default at @option{-O2} and above.
7804
7805 @item -fsplit-ivs-in-unroller
7806 @opindex fsplit-ivs-in-unroller
7807 Enables expression of values of induction variables in later iterations
7808 of the unrolled loop using the value in the first iteration. This breaks
7809 long dependency chains, thus improving efficiency of the scheduling passes.
7810
7811 A combination of @option{-fweb} and CSE is often sufficient to obtain the
7812 same effect. However, that is not reliable in cases where the loop body
7813 is more complicated than a single basic block. It also does not work at all
7814 on some architectures due to restrictions in the CSE pass.
7815
7816 This optimization is enabled by default.
7817
7818 @item -fvariable-expansion-in-unroller
7819 @opindex fvariable-expansion-in-unroller
7820 With this option, the compiler creates multiple copies of some
7821 local variables when unrolling a loop, which can result in superior code.
7822
7823 @item -fpartial-inlining
7824 @opindex fpartial-inlining
7825 Inline parts of functions. This option has any effect only
7826 when inlining itself is turned on by the @option{-finline-functions}
7827 or @option{-finline-small-functions} options.
7828
7829 Enabled at level @option{-O2}.
7830
7831 @item -fpredictive-commoning
7832 @opindex fpredictive-commoning
7833 Perform predictive commoning optimization, i.e., reusing computations
7834 (especially memory loads and stores) performed in previous
7835 iterations of loops.
7836
7837 This option is enabled at level @option{-O3}.
7838
7839 @item -fprefetch-loop-arrays
7840 @opindex fprefetch-loop-arrays
7841 If supported by the target machine, generate instructions to prefetch
7842 memory to improve the performance of loops that access large arrays.
7843
7844 This option may generate better or worse code; results are highly
7845 dependent on the structure of loops within the source code.
7846
7847 Disabled at level @option{-Os}.
7848
7849 @item -fno-peephole
7850 @itemx -fno-peephole2
7851 @opindex fno-peephole
7852 @opindex fno-peephole2
7853 Disable any machine-specific peephole optimizations. The difference
7854 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
7855 are implemented in the compiler; some targets use one, some use the
7856 other, a few use both.
7857
7858 @option{-fpeephole} is enabled by default.
7859 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7860
7861 @item -fno-guess-branch-probability
7862 @opindex fno-guess-branch-probability
7863 Do not guess branch probabilities using heuristics.
7864
7865 GCC uses heuristics to guess branch probabilities if they are
7866 not provided by profiling feedback (@option{-fprofile-arcs}). These
7867 heuristics are based on the control flow graph. If some branch probabilities
7868 are specified by @code{__builtin_expect}, then the heuristics are
7869 used to guess branch probabilities for the rest of the control flow graph,
7870 taking the @code{__builtin_expect} info into account. The interactions
7871 between the heuristics and @code{__builtin_expect} can be complex, and in
7872 some cases, it may be useful to disable the heuristics so that the effects
7873 of @code{__builtin_expect} are easier to understand.
7874
7875 The default is @option{-fguess-branch-probability} at levels
7876 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7877
7878 @item -freorder-blocks
7879 @opindex freorder-blocks
7880 Reorder basic blocks in the compiled function in order to reduce number of
7881 taken branches and improve code locality.
7882
7883 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7884
7885 @item -freorder-blocks-algorithm=@var{algorithm}
7886 @opindex freorder-blocks-algorithm
7887 Use the specified algorithm for basic block reordering. The
7888 @var{algorithm} argument can be @samp{simple}, which does not increase
7889 code size (except sometimes due to secondary effects like alignment),
7890 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
7891 put all often executed code together, minimizing the number of branches
7892 executed by making extra copies of code.
7893
7894 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
7895 @samp{stc} at levels @option{-O2}, @option{-O3}.
7896
7897 @item -freorder-blocks-and-partition
7898 @opindex freorder-blocks-and-partition
7899 In addition to reordering basic blocks in the compiled function, in order
7900 to reduce number of taken branches, partitions hot and cold basic blocks
7901 into separate sections of the assembly and @file{.o} files, to improve
7902 paging and cache locality performance.
7903
7904 This optimization is automatically turned off in the presence of
7905 exception handling, for linkonce sections, for functions with a user-defined
7906 section attribute and on any architecture that does not support named
7907 sections.
7908
7909 Enabled for x86 at levels @option{-O2}, @option{-O3}.
7910
7911 @item -freorder-functions
7912 @opindex freorder-functions
7913 Reorder functions in the object file in order to
7914 improve code locality. This is implemented by using special
7915 subsections @code{.text.hot} for most frequently executed functions and
7916 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
7917 the linker so object file format must support named sections and linker must
7918 place them in a reasonable way.
7919
7920 Also profile feedback must be available to make this option effective. See
7921 @option{-fprofile-arcs} for details.
7922
7923 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7924
7925 @item -fstrict-aliasing
7926 @opindex fstrict-aliasing
7927 Allow the compiler to assume the strictest aliasing rules applicable to
7928 the language being compiled. For C (and C++), this activates
7929 optimizations based on the type of expressions. In particular, an
7930 object of one type is assumed never to reside at the same address as an
7931 object of a different type, unless the types are almost the same. For
7932 example, an @code{unsigned int} can alias an @code{int}, but not a
7933 @code{void*} or a @code{double}. A character type may alias any other
7934 type.
7935
7936 @anchor{Type-punning}Pay special attention to code like this:
7937 @smallexample
7938 union a_union @{
7939 int i;
7940 double d;
7941 @};
7942
7943 int f() @{
7944 union a_union t;
7945 t.d = 3.0;
7946 return t.i;
7947 @}
7948 @end smallexample
7949 The practice of reading from a different union member than the one most
7950 recently written to (called ``type-punning'') is common. Even with
7951 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
7952 is accessed through the union type. So, the code above works as
7953 expected. @xref{Structures unions enumerations and bit-fields
7954 implementation}. However, this code might not:
7955 @smallexample
7956 int f() @{
7957 union a_union t;
7958 int* ip;
7959 t.d = 3.0;
7960 ip = &t.i;
7961 return *ip;
7962 @}
7963 @end smallexample
7964
7965 Similarly, access by taking the address, casting the resulting pointer
7966 and dereferencing the result has undefined behavior, even if the cast
7967 uses a union type, e.g.:
7968 @smallexample
7969 int f() @{
7970 double d = 3.0;
7971 return ((union a_union *) &d)->i;
7972 @}
7973 @end smallexample
7974
7975 The @option{-fstrict-aliasing} option is enabled at levels
7976 @option{-O2}, @option{-O3}, @option{-Os}.
7977
7978 @item -fstrict-overflow
7979 @opindex fstrict-overflow
7980 Allow the compiler to assume strict signed overflow rules, depending
7981 on the language being compiled. For C (and C++) this means that
7982 overflow when doing arithmetic with signed numbers is undefined, which
7983 means that the compiler may assume that it does not happen. This
7984 permits various optimizations. For example, the compiler assumes
7985 that an expression like @code{i + 10 > i} is always true for
7986 signed @code{i}. This assumption is only valid if signed overflow is
7987 undefined, as the expression is false if @code{i + 10} overflows when
7988 using twos complement arithmetic. When this option is in effect any
7989 attempt to determine whether an operation on signed numbers
7990 overflows must be written carefully to not actually involve overflow.
7991
7992 This option also allows the compiler to assume strict pointer
7993 semantics: given a pointer to an object, if adding an offset to that
7994 pointer does not produce a pointer to the same object, the addition is
7995 undefined. This permits the compiler to conclude that @code{p + u >
7996 p} is always true for a pointer @code{p} and unsigned integer
7997 @code{u}. This assumption is only valid because pointer wraparound is
7998 undefined, as the expression is false if @code{p + u} overflows using
7999 twos complement arithmetic.
8000
8001 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
8002 that integer signed overflow is fully defined: it wraps. When
8003 @option{-fwrapv} is used, there is no difference between
8004 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
8005 integers. With @option{-fwrapv} certain types of overflow are
8006 permitted. For example, if the compiler gets an overflow when doing
8007 arithmetic on constants, the overflowed value can still be used with
8008 @option{-fwrapv}, but not otherwise.
8009
8010 The @option{-fstrict-overflow} option is enabled at levels
8011 @option{-O2}, @option{-O3}, @option{-Os}.
8012
8013 @item -falign-functions
8014 @itemx -falign-functions=@var{n}
8015 @opindex falign-functions
8016 Align the start of functions to the next power-of-two greater than
8017 @var{n}, skipping up to @var{n} bytes. For instance,
8018 @option{-falign-functions=32} aligns functions to the next 32-byte
8019 boundary, but @option{-falign-functions=24} aligns to the next
8020 32-byte boundary only if this can be done by skipping 23 bytes or less.
8021
8022 @option{-fno-align-functions} and @option{-falign-functions=1} are
8023 equivalent and mean that functions are not aligned.
8024
8025 Some assemblers only support this flag when @var{n} is a power of two;
8026 in that case, it is rounded up.
8027
8028 If @var{n} is not specified or is zero, use a machine-dependent default.
8029
8030 Enabled at levels @option{-O2}, @option{-O3}.
8031
8032 @item -falign-labels
8033 @itemx -falign-labels=@var{n}
8034 @opindex falign-labels
8035 Align all branch targets to a power-of-two boundary, skipping up to
8036 @var{n} bytes like @option{-falign-functions}. This option can easily
8037 make code slower, because it must insert dummy operations for when the
8038 branch target is reached in the usual flow of the code.
8039
8040 @option{-fno-align-labels} and @option{-falign-labels=1} are
8041 equivalent and mean that labels are not aligned.
8042
8043 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8044 are greater than this value, then their values are used instead.
8045
8046 If @var{n} is not specified or is zero, use a machine-dependent default
8047 which is very likely to be @samp{1}, meaning no alignment.
8048
8049 Enabled at levels @option{-O2}, @option{-O3}.
8050
8051 @item -falign-loops
8052 @itemx -falign-loops=@var{n}
8053 @opindex falign-loops
8054 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8055 like @option{-falign-functions}. If the loops are
8056 executed many times, this makes up for any execution of the dummy
8057 operations.
8058
8059 @option{-fno-align-loops} and @option{-falign-loops=1} are
8060 equivalent and mean that loops are not aligned.
8061
8062 If @var{n} is not specified or is zero, use a machine-dependent default.
8063
8064 Enabled at levels @option{-O2}, @option{-O3}.
8065
8066 @item -falign-jumps
8067 @itemx -falign-jumps=@var{n}
8068 @opindex falign-jumps
8069 Align branch targets to a power-of-two boundary, for branch targets
8070 where the targets can only be reached by jumping, skipping up to @var{n}
8071 bytes like @option{-falign-functions}. In this case, no dummy operations
8072 need be executed.
8073
8074 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
8075 equivalent and mean that loops are not aligned.
8076
8077 If @var{n} is not specified or is zero, use a machine-dependent default.
8078
8079 Enabled at levels @option{-O2}, @option{-O3}.
8080
8081 @item -funit-at-a-time
8082 @opindex funit-at-a-time
8083 This option is left for compatibility reasons. @option{-funit-at-a-time}
8084 has no effect, while @option{-fno-unit-at-a-time} implies
8085 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8086
8087 Enabled by default.
8088
8089 @item -fno-toplevel-reorder
8090 @opindex fno-toplevel-reorder
8091 Do not reorder top-level functions, variables, and @code{asm}
8092 statements. Output them in the same order that they appear in the
8093 input file. When this option is used, unreferenced static variables
8094 are not removed. This option is intended to support existing code
8095 that relies on a particular ordering. For new code, it is better to
8096 use attributes when possible.
8097
8098 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8099 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8100 targets.
8101
8102 @item -fweb
8103 @opindex fweb
8104 Constructs webs as commonly used for register allocation purposes and assign
8105 each web individual pseudo register. This allows the register allocation pass
8106 to operate on pseudos directly, but also strengthens several other optimization
8107 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8108 however, make debugging impossible, since variables no longer stay in a
8109 ``home register''.
8110
8111 Enabled by default with @option{-funroll-loops}.
8112
8113 @item -fwhole-program
8114 @opindex fwhole-program
8115 Assume that the current compilation unit represents the whole program being
8116 compiled. All public functions and variables with the exception of @code{main}
8117 and those merged by attribute @code{externally_visible} become static functions
8118 and in effect are optimized more aggressively by interprocedural optimizers.
8119
8120 This option should not be used in combination with @option{-flto}.
8121 Instead relying on a linker plugin should provide safer and more precise
8122 information.
8123
8124 @item -flto[=@var{n}]
8125 @opindex flto
8126 This option runs the standard link-time optimizer. When invoked
8127 with source code, it generates GIMPLE (one of GCC's internal
8128 representations) and writes it to special ELF sections in the object
8129 file. When the object files are linked together, all the function
8130 bodies are read from these ELF sections and instantiated as if they
8131 had been part of the same translation unit.
8132
8133 To use the link-time optimizer, @option{-flto} and optimization
8134 options should be specified at compile time and during the final link.
8135 It is recommended that you compile all the files participating in the
8136 same link with the same options and also specify those options at
8137 link time.
8138 For example:
8139
8140 @smallexample
8141 gcc -c -O2 -flto foo.c
8142 gcc -c -O2 -flto bar.c
8143 gcc -o myprog -flto -O2 foo.o bar.o
8144 @end smallexample
8145
8146 The first two invocations to GCC save a bytecode representation
8147 of GIMPLE into special ELF sections inside @file{foo.o} and
8148 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8149 @file{foo.o} and @file{bar.o}, merges the two files into a single
8150 internal image, and compiles the result as usual. Since both
8151 @file{foo.o} and @file{bar.o} are merged into a single image, this
8152 causes all the interprocedural analyses and optimizations in GCC to
8153 work across the two files as if they were a single one. This means,
8154 for example, that the inliner is able to inline functions in
8155 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8156
8157 Another (simpler) way to enable link-time optimization is:
8158
8159 @smallexample
8160 gcc -o myprog -flto -O2 foo.c bar.c
8161 @end smallexample
8162
8163 The above generates bytecode for @file{foo.c} and @file{bar.c},
8164 merges them together into a single GIMPLE representation and optimizes
8165 them as usual to produce @file{myprog}.
8166
8167 The only important thing to keep in mind is that to enable link-time
8168 optimizations you need to use the GCC driver to perform the link step.
8169 GCC then automatically performs link-time optimization if any of the
8170 objects involved were compiled with the @option{-flto} command-line option.
8171 You generally
8172 should specify the optimization options to be used for link-time
8173 optimization though GCC tries to be clever at guessing an
8174 optimization level to use from the options used at compile time
8175 if you fail to specify one at link time. You can always override
8176 the automatic decision to do link-time optimization at link time
8177 by passing @option{-fno-lto} to the link command.
8178
8179 To make whole program optimization effective, it is necessary to make
8180 certain whole program assumptions. The compiler needs to know
8181 what functions and variables can be accessed by libraries and runtime
8182 outside of the link-time optimized unit. When supported by the linker,
8183 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8184 to the compiler about used and externally visible symbols. When
8185 the linker plugin is not available, @option{-fwhole-program} should be
8186 used to allow the compiler to make these assumptions, which leads
8187 to more aggressive optimization decisions.
8188
8189 When @option{-fuse-linker-plugin} is not enabled, when a file is
8190 compiled with @option{-flto}, the generated object file is larger than
8191 a regular object file because it contains GIMPLE bytecodes and the usual
8192 final code (see @option{-ffat-lto-objects}. This means that
8193 object files with LTO information can be linked as normal object
8194 files; if @option{-fno-lto} is passed to the linker, no
8195 interprocedural optimizations are applied. Note that when
8196 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
8197 but you cannot perform a regular, non-LTO link on them.
8198
8199 Additionally, the optimization flags used to compile individual files
8200 are not necessarily related to those used at link time. For instance,
8201
8202 @smallexample
8203 gcc -c -O0 -ffat-lto-objects -flto foo.c
8204 gcc -c -O0 -ffat-lto-objects -flto bar.c
8205 gcc -o myprog -O3 foo.o bar.o
8206 @end smallexample
8207
8208 This produces individual object files with unoptimized assembler
8209 code, but the resulting binary @file{myprog} is optimized at
8210 @option{-O3}. If, instead, the final binary is generated with
8211 @option{-fno-lto}, then @file{myprog} is not optimized.
8212
8213 When producing the final binary, GCC only
8214 applies link-time optimizations to those files that contain bytecode.
8215 Therefore, you can mix and match object files and libraries with
8216 GIMPLE bytecodes and final object code. GCC automatically selects
8217 which files to optimize in LTO mode and which files to link without
8218 further processing.
8219
8220 There are some code generation flags preserved by GCC when
8221 generating bytecodes, as they need to be used during the final link
8222 stage. Generally options specified at link time override those
8223 specified at compile time.
8224
8225 If you do not specify an optimization level option @option{-O} at
8226 link time, then GCC uses the highest optimization level
8227 used when compiling the object files.
8228
8229 Currently, the following options and their settings are taken from
8230 the first object file that explicitly specifies them:
8231 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8232 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8233 and all the @option{-m} target flags.
8234
8235 Certain ABI-changing flags are required to match in all compilation units,
8236 and trying to override this at link time with a conflicting value
8237 is ignored. This includes options such as @option{-freg-struct-return}
8238 and @option{-fpcc-struct-return}.
8239
8240 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8241 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8242 are passed through to the link stage and merged conservatively for
8243 conflicting translation units. Specifically
8244 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8245 precedence; and for example @option{-ffp-contract=off} takes precedence
8246 over @option{-ffp-contract=fast}. You can override them at link time.
8247
8248 If LTO encounters objects with C linkage declared with incompatible
8249 types in separate translation units to be linked together (undefined
8250 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8251 issued. The behavior is still undefined at run time. Similar
8252 diagnostics may be raised for other languages.
8253
8254 Another feature of LTO is that it is possible to apply interprocedural
8255 optimizations on files written in different languages:
8256
8257 @smallexample
8258 gcc -c -flto foo.c
8259 g++ -c -flto bar.cc
8260 gfortran -c -flto baz.f90
8261 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8262 @end smallexample
8263
8264 Notice that the final link is done with @command{g++} to get the C++
8265 runtime libraries and @option{-lgfortran} is added to get the Fortran
8266 runtime libraries. In general, when mixing languages in LTO mode, you
8267 should use the same link command options as when mixing languages in a
8268 regular (non-LTO) compilation.
8269
8270 If object files containing GIMPLE bytecode are stored in a library archive, say
8271 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8272 are using a linker with plugin support. To create static libraries suitable
8273 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8274 and @command{ranlib};
8275 to show the symbols of object files with GIMPLE bytecode, use
8276 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8277 and @command{nm} have been compiled with plugin support. At link time, use the the
8278 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8279 the LTO optimization process:
8280
8281 @smallexample
8282 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8283 @end smallexample
8284
8285 With the linker plugin enabled, the linker extracts the needed
8286 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8287 to make them part of the aggregated GIMPLE image to be optimized.
8288
8289 If you are not using a linker with plugin support and/or do not
8290 enable the linker plugin, then the objects inside @file{libfoo.a}
8291 are extracted and linked as usual, but they do not participate
8292 in the LTO optimization process. In order to make a static library suitable
8293 for both LTO optimization and usual linkage, compile its object files with
8294 @option{-flto} @option{-ffat-lto-objects}.
8295
8296 Link-time optimizations do not require the presence of the whole program to
8297 operate. If the program does not require any symbols to be exported, it is
8298 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8299 the interprocedural optimizers to use more aggressive assumptions which may
8300 lead to improved optimization opportunities.
8301 Use of @option{-fwhole-program} is not needed when linker plugin is
8302 active (see @option{-fuse-linker-plugin}).
8303
8304 The current implementation of LTO makes no
8305 attempt to generate bytecode that is portable between different
8306 types of hosts. The bytecode files are versioned and there is a
8307 strict version check, so bytecode files generated in one version of
8308 GCC do not work with an older or newer version of GCC.
8309
8310 Link-time optimization does not work well with generation of debugging
8311 information. Combining @option{-flto} with
8312 @option{-g} is currently experimental and expected to produce unexpected
8313 results.
8314
8315 If you specify the optional @var{n}, the optimization and code
8316 generation done at link time is executed in parallel using @var{n}
8317 parallel jobs by utilizing an installed @command{make} program. The
8318 environment variable @env{MAKE} may be used to override the program
8319 used. The default value for @var{n} is 1.
8320
8321 You can also specify @option{-flto=jobserver} to use GNU make's
8322 job server mode to determine the number of parallel jobs. This
8323 is useful when the Makefile calling GCC is already executing in parallel.
8324 You must prepend a @samp{+} to the command recipe in the parent Makefile
8325 for this to work. This option likely only works if @env{MAKE} is
8326 GNU make.
8327
8328 @item -flto-partition=@var{alg}
8329 @opindex flto-partition
8330 Specify the partitioning algorithm used by the link-time optimizer.
8331 The value is either @samp{1to1} to specify a partitioning mirroring
8332 the original source files or @samp{balanced} to specify partitioning
8333 into equally sized chunks (whenever possible) or @samp{max} to create
8334 new partition for every symbol where possible. Specifying @samp{none}
8335 as an algorithm disables partitioning and streaming completely.
8336 The default value is @samp{balanced}. While @samp{1to1} can be used
8337 as an workaround for various code ordering issues, the @samp{max}
8338 partitioning is intended for internal testing only.
8339 The value @samp{one} specifies that exactly one partition should be
8340 used while the value @samp{none} bypasses partitioning and executes
8341 the link-time optimization step directly from the WPA phase.
8342
8343 @item -flto-odr-type-merging
8344 @opindex flto-odr-type-merging
8345 Enable streaming of mangled types names of C++ types and their unification
8346 at link time. This increases size of LTO object files, but enables
8347 diagnostics about One Definition Rule violations.
8348
8349 @item -flto-compression-level=@var{n}
8350 @opindex flto-compression-level
8351 This option specifies the level of compression used for intermediate
8352 language written to LTO object files, and is only meaningful in
8353 conjunction with LTO mode (@option{-flto}). Valid
8354 values are 0 (no compression) to 9 (maximum compression). Values
8355 outside this range are clamped to either 0 or 9. If the option is not
8356 given, a default balanced compression setting is used.
8357
8358 @item -fuse-linker-plugin
8359 @opindex fuse-linker-plugin
8360 Enables the use of a linker plugin during link-time optimization. This
8361 option relies on plugin support in the linker, which is available in gold
8362 or in GNU ld 2.21 or newer.
8363
8364 This option enables the extraction of object files with GIMPLE bytecode out
8365 of library archives. This improves the quality of optimization by exposing
8366 more code to the link-time optimizer. This information specifies what
8367 symbols can be accessed externally (by non-LTO object or during dynamic
8368 linking). Resulting code quality improvements on binaries (and shared
8369 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
8370 See @option{-flto} for a description of the effect of this flag and how to
8371 use it.
8372
8373 This option is enabled by default when LTO support in GCC is enabled
8374 and GCC was configured for use with
8375 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8376
8377 @item -ffat-lto-objects
8378 @opindex ffat-lto-objects
8379 Fat LTO objects are object files that contain both the intermediate language
8380 and the object code. This makes them usable for both LTO linking and normal
8381 linking. This option is effective only when compiling with @option{-flto}
8382 and is ignored at link time.
8383
8384 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8385 requires the complete toolchain to be aware of LTO. It requires a linker with
8386 linker plugin support for basic functionality. Additionally,
8387 @command{nm}, @command{ar} and @command{ranlib}
8388 need to support linker plugins to allow a full-featured build environment
8389 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
8390 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8391 to these tools. With non fat LTO makefiles need to be modified to use them.
8392
8393 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
8394 support.
8395
8396 @item -fcompare-elim
8397 @opindex fcompare-elim
8398 After register allocation and post-register allocation instruction splitting,
8399 identify arithmetic instructions that compute processor flags similar to a
8400 comparison operation based on that arithmetic. If possible, eliminate the
8401 explicit comparison operation.
8402
8403 This pass only applies to certain targets that cannot explicitly represent
8404 the comparison operation before register allocation is complete.
8405
8406 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8407
8408 @item -fcprop-registers
8409 @opindex fcprop-registers
8410 After register allocation and post-register allocation instruction splitting,
8411 perform a copy-propagation pass to try to reduce scheduling dependencies
8412 and occasionally eliminate the copy.
8413
8414 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8415
8416 @item -fprofile-correction
8417 @opindex fprofile-correction
8418 Profiles collected using an instrumented binary for multi-threaded programs may
8419 be inconsistent due to missed counter updates. When this option is specified,
8420 GCC uses heuristics to correct or smooth out such inconsistencies. By
8421 default, GCC emits an error message when an inconsistent profile is detected.
8422
8423 @item -fprofile-use
8424 @itemx -fprofile-use=@var{path}
8425 @opindex fprofile-use
8426 Enable profile feedback-directed optimizations,
8427 and the following optimizations
8428 which are generally profitable only with profile feedback available:
8429 @option{-fbranch-probabilities}, @option{-fvpt},
8430 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8431 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
8432
8433 Before you can use this option, you must first generate profiling information.
8434 @xref{Optimize Options}, for information about the @option{-fprofile-generate}
8435 option.
8436
8437 By default, GCC emits an error message if the feedback profiles do not
8438 match the source code. This error can be turned into a warning by using
8439 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8440 code.
8441
8442 If @var{path} is specified, GCC looks at the @var{path} to find
8443 the profile feedback data files. See @option{-fprofile-dir}.
8444
8445 @item -fauto-profile
8446 @itemx -fauto-profile=@var{path}
8447 @opindex fauto-profile
8448 Enable sampling-based feedback-directed optimizations,
8449 and the following optimizations
8450 which are generally profitable only with profile feedback available:
8451 @option{-fbranch-probabilities}, @option{-fvpt},
8452 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8453 @option{-ftree-vectorize},
8454 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
8455 @option{-fpredictive-commoning}, @option{-funswitch-loops},
8456 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
8457
8458 @var{path} is the name of a file containing AutoFDO profile information.
8459 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
8460
8461 Producing an AutoFDO profile data file requires running your program
8462 with the @command{perf} utility on a supported GNU/Linux target system.
8463 For more information, see @uref{https://perf.wiki.kernel.org/}.
8464
8465 E.g.
8466 @smallexample
8467 perf record -e br_inst_retired:near_taken -b -o perf.data \
8468 -- your_program
8469 @end smallexample
8470
8471 Then use the @command{create_gcov} tool to convert the raw profile data
8472 to a format that can be used by GCC.@ You must also supply the
8473 unstripped binary for your program to this tool.
8474 See @uref{https://github.com/google/autofdo}.
8475
8476 E.g.
8477 @smallexample
8478 create_gcov --binary=your_program.unstripped --profile=perf.data \
8479 --gcov=profile.afdo
8480 @end smallexample
8481 @end table
8482
8483 The following options control compiler behavior regarding floating-point
8484 arithmetic. These options trade off between speed and
8485 correctness. All must be specifically enabled.
8486
8487 @table @gcctabopt
8488 @item -ffloat-store
8489 @opindex ffloat-store
8490 Do not store floating-point variables in registers, and inhibit other
8491 options that might change whether a floating-point value is taken from a
8492 register or memory.
8493
8494 @cindex floating-point precision
8495 This option prevents undesirable excess precision on machines such as
8496 the 68000 where the floating registers (of the 68881) keep more
8497 precision than a @code{double} is supposed to have. Similarly for the
8498 x86 architecture. For most programs, the excess precision does only
8499 good, but a few programs rely on the precise definition of IEEE floating
8500 point. Use @option{-ffloat-store} for such programs, after modifying
8501 them to store all pertinent intermediate computations into variables.
8502
8503 @item -fexcess-precision=@var{style}
8504 @opindex fexcess-precision
8505 This option allows further control over excess precision on machines
8506 where floating-point registers have more precision than the IEEE
8507 @code{float} and @code{double} types and the processor does not
8508 support operations rounding to those types. By default,
8509 @option{-fexcess-precision=fast} is in effect; this means that
8510 operations are carried out in the precision of the registers and that
8511 it is unpredictable when rounding to the types specified in the source
8512 code takes place. When compiling C, if
8513 @option{-fexcess-precision=standard} is specified then excess
8514 precision follows the rules specified in ISO C99; in particular,
8515 both casts and assignments cause values to be rounded to their
8516 semantic types (whereas @option{-ffloat-store} only affects
8517 assignments). This option is enabled by default for C if a strict
8518 conformance option such as @option{-std=c99} is used.
8519
8520 @opindex mfpmath
8521 @option{-fexcess-precision=standard} is not implemented for languages
8522 other than C, and has no effect if
8523 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8524 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8525 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8526 semantics apply without excess precision, and in the latter, rounding
8527 is unpredictable.
8528
8529 @item -ffast-math
8530 @opindex ffast-math
8531 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8532 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8533 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8534
8535 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8536
8537 This option is not turned on by any @option{-O} option besides
8538 @option{-Ofast} since it can result in incorrect output for programs
8539 that depend on an exact implementation of IEEE or ISO rules/specifications
8540 for math functions. It may, however, yield faster code for programs
8541 that do not require the guarantees of these specifications.
8542
8543 @item -fno-math-errno
8544 @opindex fno-math-errno
8545 Do not set @code{errno} after calling math functions that are executed
8546 with a single instruction, e.g., @code{sqrt}. A program that relies on
8547 IEEE exceptions for math error handling may want to use this flag
8548 for speed while maintaining IEEE arithmetic compatibility.
8549
8550 This option is not turned on by any @option{-O} option since
8551 it can result in incorrect output for programs that depend on
8552 an exact implementation of IEEE or ISO rules/specifications for
8553 math functions. It may, however, yield faster code for programs
8554 that do not require the guarantees of these specifications.
8555
8556 The default is @option{-fmath-errno}.
8557
8558 On Darwin systems, the math library never sets @code{errno}. There is
8559 therefore no reason for the compiler to consider the possibility that
8560 it might, and @option{-fno-math-errno} is the default.
8561
8562 @item -funsafe-math-optimizations
8563 @opindex funsafe-math-optimizations
8564
8565 Allow optimizations for floating-point arithmetic that (a) assume
8566 that arguments and results are valid and (b) may violate IEEE or
8567 ANSI standards. When used at link time, it may include libraries
8568 or startup files that change the default FPU control word or other
8569 similar optimizations.
8570
8571 This option is not turned on by any @option{-O} option since
8572 it can result in incorrect output for programs that depend on
8573 an exact implementation of IEEE or ISO rules/specifications for
8574 math functions. It may, however, yield faster code for programs
8575 that do not require the guarantees of these specifications.
8576 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
8577 @option{-fassociative-math} and @option{-freciprocal-math}.
8578
8579 The default is @option{-fno-unsafe-math-optimizations}.
8580
8581 @item -fassociative-math
8582 @opindex fassociative-math
8583
8584 Allow re-association of operands in series of floating-point operations.
8585 This violates the ISO C and C++ language standard by possibly changing
8586 computation result. NOTE: re-ordering may change the sign of zero as
8587 well as ignore NaNs and inhibit or create underflow or overflow (and
8588 thus cannot be used on code that relies on rounding behavior like
8589 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
8590 and thus may not be used when ordered comparisons are required.
8591 This option requires that both @option{-fno-signed-zeros} and
8592 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
8593 much sense with @option{-frounding-math}. For Fortran the option
8594 is automatically enabled when both @option{-fno-signed-zeros} and
8595 @option{-fno-trapping-math} are in effect.
8596
8597 The default is @option{-fno-associative-math}.
8598
8599 @item -freciprocal-math
8600 @opindex freciprocal-math
8601
8602 Allow the reciprocal of a value to be used instead of dividing by
8603 the value if this enables optimizations. For example @code{x / y}
8604 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
8605 is subject to common subexpression elimination. Note that this loses
8606 precision and increases the number of flops operating on the value.
8607
8608 The default is @option{-fno-reciprocal-math}.
8609
8610 @item -ffinite-math-only
8611 @opindex ffinite-math-only
8612 Allow optimizations for floating-point arithmetic that assume
8613 that arguments and results are not NaNs or +-Infs.
8614
8615 This option is not turned on by any @option{-O} option since
8616 it can result in incorrect output for programs that depend on
8617 an exact implementation of IEEE or ISO rules/specifications for
8618 math functions. It may, however, yield faster code for programs
8619 that do not require the guarantees of these specifications.
8620
8621 The default is @option{-fno-finite-math-only}.
8622
8623 @item -fno-signed-zeros
8624 @opindex fno-signed-zeros
8625 Allow optimizations for floating-point arithmetic that ignore the
8626 signedness of zero. IEEE arithmetic specifies the behavior of
8627 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
8628 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
8629 This option implies that the sign of a zero result isn't significant.
8630
8631 The default is @option{-fsigned-zeros}.
8632
8633 @item -fno-trapping-math
8634 @opindex fno-trapping-math
8635 Compile code assuming that floating-point operations cannot generate
8636 user-visible traps. These traps include division by zero, overflow,
8637 underflow, inexact result and invalid operation. This option requires
8638 that @option{-fno-signaling-nans} be in effect. Setting this option may
8639 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
8640
8641 This option should never be turned on by any @option{-O} option since
8642 it can result in incorrect output for programs that depend on
8643 an exact implementation of IEEE or ISO rules/specifications for
8644 math functions.
8645
8646 The default is @option{-ftrapping-math}.
8647
8648 @item -frounding-math
8649 @opindex frounding-math
8650 Disable transformations and optimizations that assume default floating-point
8651 rounding behavior. This is round-to-zero for all floating point
8652 to integer conversions, and round-to-nearest for all other arithmetic
8653 truncations. This option should be specified for programs that change
8654 the FP rounding mode dynamically, or that may be executed with a
8655 non-default rounding mode. This option disables constant folding of
8656 floating-point expressions at compile time (which may be affected by
8657 rounding mode) and arithmetic transformations that are unsafe in the
8658 presence of sign-dependent rounding modes.
8659
8660 The default is @option{-fno-rounding-math}.
8661
8662 This option is experimental and does not currently guarantee to
8663 disable all GCC optimizations that are affected by rounding mode.
8664 Future versions of GCC may provide finer control of this setting
8665 using C99's @code{FENV_ACCESS} pragma. This command-line option
8666 will be used to specify the default state for @code{FENV_ACCESS}.
8667
8668 @item -fsignaling-nans
8669 @opindex fsignaling-nans
8670 Compile code assuming that IEEE signaling NaNs may generate user-visible
8671 traps during floating-point operations. Setting this option disables
8672 optimizations that may change the number of exceptions visible with
8673 signaling NaNs. This option implies @option{-ftrapping-math}.
8674
8675 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
8676 be defined.
8677
8678 The default is @option{-fno-signaling-nans}.
8679
8680 This option is experimental and does not currently guarantee to
8681 disable all GCC optimizations that affect signaling NaN behavior.
8682
8683 @item -fno-fp-int-builtin-inexact
8684 @opindex fno-fp-int-builtin-inexact
8685 Do not allow the built-in functions @code{ceil}, @code{floor},
8686 @code{round} and @code{trunc}, and their @code{float} and @code{long
8687 double} variants, to generate code that raises the ``inexact''
8688 floating-point exception for noninteger arguments. ISO C99 and C11
8689 allow these functions to raise the ``inexact'' exception, but ISO/IEC
8690 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
8691 functions to do so.
8692
8693 The default is @option{-ffp-int-builtin-inexact}, allowing the
8694 exception to be raised. This option does nothing unless
8695 @option{-ftrapping-math} is in effect.
8696
8697 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
8698 generate a call to a library function then the ``inexact'' exception
8699 may be raised if the library implementation does not follow TS 18661.
8700
8701 @item -fsingle-precision-constant
8702 @opindex fsingle-precision-constant
8703 Treat floating-point constants as single precision instead of
8704 implicitly converting them to double-precision constants.
8705
8706 @item -fcx-limited-range
8707 @opindex fcx-limited-range
8708 When enabled, this option states that a range reduction step is not
8709 needed when performing complex division. Also, there is no checking
8710 whether the result of a complex multiplication or division is @code{NaN
8711 + I*NaN}, with an attempt to rescue the situation in that case. The
8712 default is @option{-fno-cx-limited-range}, but is enabled by
8713 @option{-ffast-math}.
8714
8715 This option controls the default setting of the ISO C99
8716 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
8717 all languages.
8718
8719 @item -fcx-fortran-rules
8720 @opindex fcx-fortran-rules
8721 Complex multiplication and division follow Fortran rules. Range
8722 reduction is done as part of complex division, but there is no checking
8723 whether the result of a complex multiplication or division is @code{NaN
8724 + I*NaN}, with an attempt to rescue the situation in that case.
8725
8726 The default is @option{-fno-cx-fortran-rules}.
8727
8728 @end table
8729
8730 The following options control optimizations that may improve
8731 performance, but are not enabled by any @option{-O} options. This
8732 section includes experimental options that may produce broken code.
8733
8734 @table @gcctabopt
8735 @item -fbranch-probabilities
8736 @opindex fbranch-probabilities
8737 After running a program compiled with @option{-fprofile-arcs}
8738 (@pxref{Instrumentation Options}),
8739 you can compile it a second time using
8740 @option{-fbranch-probabilities}, to improve optimizations based on
8741 the number of times each branch was taken. When a program
8742 compiled with @option{-fprofile-arcs} exits, it saves arc execution
8743 counts to a file called @file{@var{sourcename}.gcda} for each source
8744 file. The information in this data file is very dependent on the
8745 structure of the generated code, so you must use the same source code
8746 and the same optimization options for both compilations.
8747
8748 With @option{-fbranch-probabilities}, GCC puts a
8749 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8750 These can be used to improve optimization. Currently, they are only
8751 used in one place: in @file{reorg.c}, instead of guessing which path a
8752 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8753 exactly determine which path is taken more often.
8754
8755 @item -fprofile-values
8756 @opindex fprofile-values
8757 If combined with @option{-fprofile-arcs}, it adds code so that some
8758 data about values of expressions in the program is gathered.
8759
8760 With @option{-fbranch-probabilities}, it reads back the data gathered
8761 from profiling values of expressions for usage in optimizations.
8762
8763 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8764
8765 @item -fprofile-reorder-functions
8766 @opindex fprofile-reorder-functions
8767 Function reordering based on profile instrumentation collects
8768 first time of execution of a function and orders these functions
8769 in ascending order.
8770
8771 Enabled with @option{-fprofile-use}.
8772
8773 @item -fvpt
8774 @opindex fvpt
8775 If combined with @option{-fprofile-arcs}, this option instructs the compiler
8776 to add code to gather information about values of expressions.
8777
8778 With @option{-fbranch-probabilities}, it reads back the data gathered
8779 and actually performs the optimizations based on them.
8780 Currently the optimizations include specialization of division operations
8781 using the knowledge about the value of the denominator.
8782
8783 @item -frename-registers
8784 @opindex frename-registers
8785 Attempt to avoid false dependencies in scheduled code by making use
8786 of registers left over after register allocation. This optimization
8787 most benefits processors with lots of registers. Depending on the
8788 debug information format adopted by the target, however, it can
8789 make debugging impossible, since variables no longer stay in
8790 a ``home register''.
8791
8792 Enabled by default with @option{-funroll-loops}.
8793
8794 @item -fschedule-fusion
8795 @opindex fschedule-fusion
8796 Performs a target dependent pass over the instruction stream to schedule
8797 instructions of same type together because target machine can execute them
8798 more efficiently if they are adjacent to each other in the instruction flow.
8799
8800 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8801
8802 @item -ftracer
8803 @opindex ftracer
8804 Perform tail duplication to enlarge superblock size. This transformation
8805 simplifies the control flow of the function allowing other optimizations to do
8806 a better job.
8807
8808 Enabled with @option{-fprofile-use}.
8809
8810 @item -funroll-loops
8811 @opindex funroll-loops
8812 Unroll loops whose number of iterations can be determined at compile time or
8813 upon entry to the loop. @option{-funroll-loops} implies
8814 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
8815 It also turns on complete loop peeling (i.e.@: complete removal of loops with
8816 a small constant number of iterations). This option makes code larger, and may
8817 or may not make it run faster.
8818
8819 Enabled with @option{-fprofile-use}.
8820
8821 @item -funroll-all-loops
8822 @opindex funroll-all-loops
8823 Unroll all loops, even if their number of iterations is uncertain when
8824 the loop is entered. This usually makes programs run more slowly.
8825 @option{-funroll-all-loops} implies the same options as
8826 @option{-funroll-loops}.
8827
8828 @item -fpeel-loops
8829 @opindex fpeel-loops
8830 Peels loops for which there is enough information that they do not
8831 roll much (from profile feedback or static analysis). It also turns on
8832 complete loop peeling (i.e.@: complete removal of loops with small constant
8833 number of iterations).
8834
8835 Enabled with @option{-O3} and/or @option{-fprofile-use}.
8836
8837 @item -fmove-loop-invariants
8838 @opindex fmove-loop-invariants
8839 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
8840 at level @option{-O1}
8841
8842 @item -funswitch-loops
8843 @opindex funswitch-loops
8844 Move branches with loop invariant conditions out of the loop, with duplicates
8845 of the loop on both branches (modified according to result of the condition).
8846
8847 @item -ffunction-sections
8848 @itemx -fdata-sections
8849 @opindex ffunction-sections
8850 @opindex fdata-sections
8851 Place each function or data item into its own section in the output
8852 file if the target supports arbitrary sections. The name of the
8853 function or the name of the data item determines the section's name
8854 in the output file.
8855
8856 Use these options on systems where the linker can perform optimizations
8857 to improve locality of reference in the instruction space. Most systems
8858 using the ELF object format and SPARC processors running Solaris 2 have
8859 linkers with such optimizations. AIX may have these optimizations in
8860 the future.
8861
8862 Only use these options when there are significant benefits from doing
8863 so. When you specify these options, the assembler and linker
8864 create larger object and executable files and are also slower.
8865 You cannot use @command{gprof} on all systems if you
8866 specify this option, and you may have problems with debugging if
8867 you specify both this option and @option{-g}.
8868
8869 @item -fbranch-target-load-optimize
8870 @opindex fbranch-target-load-optimize
8871 Perform branch target register load optimization before prologue / epilogue
8872 threading.
8873 The use of target registers can typically be exposed only during reload,
8874 thus hoisting loads out of loops and doing inter-block scheduling needs
8875 a separate optimization pass.
8876
8877 @item -fbranch-target-load-optimize2
8878 @opindex fbranch-target-load-optimize2
8879 Perform branch target register load optimization after prologue / epilogue
8880 threading.
8881
8882 @item -fbtr-bb-exclusive
8883 @opindex fbtr-bb-exclusive
8884 When performing branch target register load optimization, don't reuse
8885 branch target registers within any basic block.
8886
8887 @item -fstdarg-opt
8888 @opindex fstdarg-opt
8889 Optimize the prologue of variadic argument functions with respect to usage of
8890 those arguments.
8891
8892 @item -fsection-anchors
8893 @opindex fsection-anchors
8894 Try to reduce the number of symbolic address calculations by using
8895 shared ``anchor'' symbols to address nearby objects. This transformation
8896 can help to reduce the number of GOT entries and GOT accesses on some
8897 targets.
8898
8899 For example, the implementation of the following function @code{foo}:
8900
8901 @smallexample
8902 static int a, b, c;
8903 int foo (void) @{ return a + b + c; @}
8904 @end smallexample
8905
8906 @noindent
8907 usually calculates the addresses of all three variables, but if you
8908 compile it with @option{-fsection-anchors}, it accesses the variables
8909 from a common anchor point instead. The effect is similar to the
8910 following pseudocode (which isn't valid C):
8911
8912 @smallexample
8913 int foo (void)
8914 @{
8915 register int *xr = &x;
8916 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8917 @}
8918 @end smallexample
8919
8920 Not all targets support this option.
8921
8922 @item --param @var{name}=@var{value}
8923 @opindex param
8924 In some places, GCC uses various constants to control the amount of
8925 optimization that is done. For example, GCC does not inline functions
8926 that contain more than a certain number of instructions. You can
8927 control some of these constants on the command line using the
8928 @option{--param} option.
8929
8930 The names of specific parameters, and the meaning of the values, are
8931 tied to the internals of the compiler, and are subject to change
8932 without notice in future releases.
8933
8934 In each case, the @var{value} is an integer. The allowable choices for
8935 @var{name} are:
8936
8937 @table @gcctabopt
8938 @item predictable-branch-outcome
8939 When branch is predicted to be taken with probability lower than this threshold
8940 (in percent), then it is considered well predictable. The default is 10.
8941
8942 @item max-rtl-if-conversion-insns
8943 RTL if-conversion tries to remove conditional branches around a block and
8944 replace them with conditionally executed instructions. This parameter
8945 gives the maximum number of instructions in a block which should be
8946 considered for if-conversion. The default is 10, though the compiler will
8947 also use other heuristics to decide whether if-conversion is likely to be
8948 profitable.
8949
8950 @item max-rtl-if-conversion-predictable-cost
8951 @item max-rtl-if-conversion-unpredictable-cost
8952 RTL if-conversion will try to remove conditional branches around a block
8953 and replace them with conditionally executed instructions. These parameters
8954 give the maximum permissible cost for the sequence that would be generated
8955 by if-conversion depending on whether the branch is statically determined
8956 to be predictable or not. The units for this parameter are the same as
8957 those for the GCC internal seq_cost metric. The compiler will try to
8958 provide a reasonable default for this parameter using the BRANCH_COST
8959 target macro.
8960
8961 @item max-crossjump-edges
8962 The maximum number of incoming edges to consider for cross-jumping.
8963 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
8964 the number of edges incoming to each block. Increasing values mean
8965 more aggressive optimization, making the compilation time increase with
8966 probably small improvement in executable size.
8967
8968 @item min-crossjump-insns
8969 The minimum number of instructions that must be matched at the end
8970 of two blocks before cross-jumping is performed on them. This
8971 value is ignored in the case where all instructions in the block being
8972 cross-jumped from are matched. The default value is 5.
8973
8974 @item max-grow-copy-bb-insns
8975 The maximum code size expansion factor when copying basic blocks
8976 instead of jumping. The expansion is relative to a jump instruction.
8977 The default value is 8.
8978
8979 @item max-goto-duplication-insns
8980 The maximum number of instructions to duplicate to a block that jumps
8981 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
8982 passes, GCC factors computed gotos early in the compilation process,
8983 and unfactors them as late as possible. Only computed jumps at the
8984 end of a basic blocks with no more than max-goto-duplication-insns are
8985 unfactored. The default value is 8.
8986
8987 @item max-delay-slot-insn-search
8988 The maximum number of instructions to consider when looking for an
8989 instruction to fill a delay slot. If more than this arbitrary number of
8990 instructions are searched, the time savings from filling the delay slot
8991 are minimal, so stop searching. Increasing values mean more
8992 aggressive optimization, making the compilation time increase with probably
8993 small improvement in execution time.
8994
8995 @item max-delay-slot-live-search
8996 When trying to fill delay slots, the maximum number of instructions to
8997 consider when searching for a block with valid live register
8998 information. Increasing this arbitrarily chosen value means more
8999 aggressive optimization, increasing the compilation time. This parameter
9000 should be removed when the delay slot code is rewritten to maintain the
9001 control-flow graph.
9002
9003 @item max-gcse-memory
9004 The approximate maximum amount of memory that can be allocated in
9005 order to perform the global common subexpression elimination
9006 optimization. If more memory than specified is required, the
9007 optimization is not done.
9008
9009 @item max-gcse-insertion-ratio
9010 If the ratio of expression insertions to deletions is larger than this value
9011 for any expression, then RTL PRE inserts or removes the expression and thus
9012 leaves partially redundant computations in the instruction stream. The default value is 20.
9013
9014 @item max-pending-list-length
9015 The maximum number of pending dependencies scheduling allows
9016 before flushing the current state and starting over. Large functions
9017 with few branches or calls can create excessively large lists which
9018 needlessly consume memory and resources.
9019
9020 @item max-modulo-backtrack-attempts
9021 The maximum number of backtrack attempts the scheduler should make
9022 when modulo scheduling a loop. Larger values can exponentially increase
9023 compilation time.
9024
9025 @item max-inline-insns-single
9026 Several parameters control the tree inliner used in GCC@.
9027 This number sets the maximum number of instructions (counted in GCC's
9028 internal representation) in a single function that the tree inliner
9029 considers for inlining. This only affects functions declared
9030 inline and methods implemented in a class declaration (C++).
9031 The default value is 400.
9032
9033 @item max-inline-insns-auto
9034 When you use @option{-finline-functions} (included in @option{-O3}),
9035 a lot of functions that would otherwise not be considered for inlining
9036 by the compiler are investigated. To those functions, a different
9037 (more restrictive) limit compared to functions declared inline can
9038 be applied.
9039 The default value is 40.
9040
9041 @item inline-min-speedup
9042 When estimated performance improvement of caller + callee runtime exceeds this
9043 threshold (in precent), the function can be inlined regardless the limit on
9044 @option{--param max-inline-insns-single} and @option{--param
9045 max-inline-insns-auto}.
9046
9047 @item large-function-insns
9048 The limit specifying really large functions. For functions larger than this
9049 limit after inlining, inlining is constrained by
9050 @option{--param large-function-growth}. This parameter is useful primarily
9051 to avoid extreme compilation time caused by non-linear algorithms used by the
9052 back end.
9053 The default value is 2700.
9054
9055 @item large-function-growth
9056 Specifies maximal growth of large function caused by inlining in percents.
9057 The default value is 100 which limits large function growth to 2.0 times
9058 the original size.
9059
9060 @item large-unit-insns
9061 The limit specifying large translation unit. Growth caused by inlining of
9062 units larger than this limit is limited by @option{--param inline-unit-growth}.
9063 For small units this might be too tight.
9064 For example, consider a unit consisting of function A
9065 that is inline and B that just calls A three times. If B is small relative to
9066 A, the growth of unit is 300\% and yet such inlining is very sane. For very
9067 large units consisting of small inlineable functions, however, the overall unit
9068 growth limit is needed to avoid exponential explosion of code size. Thus for
9069 smaller units, the size is increased to @option{--param large-unit-insns}
9070 before applying @option{--param inline-unit-growth}. The default is 10000.
9071
9072 @item inline-unit-growth
9073 Specifies maximal overall growth of the compilation unit caused by inlining.
9074 The default value is 20 which limits unit growth to 1.2 times the original
9075 size. Cold functions (either marked cold via an attribute or by profile
9076 feedback) are not accounted into the unit size.
9077
9078 @item ipcp-unit-growth
9079 Specifies maximal overall growth of the compilation unit caused by
9080 interprocedural constant propagation. The default value is 10 which limits
9081 unit growth to 1.1 times the original size.
9082
9083 @item large-stack-frame
9084 The limit specifying large stack frames. While inlining the algorithm is trying
9085 to not grow past this limit too much. The default value is 256 bytes.
9086
9087 @item large-stack-frame-growth
9088 Specifies maximal growth of large stack frames caused by inlining in percents.
9089 The default value is 1000 which limits large stack frame growth to 11 times
9090 the original size.
9091
9092 @item max-inline-insns-recursive
9093 @itemx max-inline-insns-recursive-auto
9094 Specifies the maximum number of instructions an out-of-line copy of a
9095 self-recursive inline
9096 function can grow into by performing recursive inlining.
9097
9098 @option{--param max-inline-insns-recursive} applies to functions
9099 declared inline.
9100 For functions not declared inline, recursive inlining
9101 happens only when @option{-finline-functions} (included in @option{-O3}) is
9102 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
9103 default value is 450.
9104
9105 @item max-inline-recursive-depth
9106 @itemx max-inline-recursive-depth-auto
9107 Specifies the maximum recursion depth used for recursive inlining.
9108
9109 @option{--param max-inline-recursive-depth} applies to functions
9110 declared inline. For functions not declared inline, recursive inlining
9111 happens only when @option{-finline-functions} (included in @option{-O3}) is
9112 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
9113 default value is 8.
9114
9115 @item min-inline-recursive-probability
9116 Recursive inlining is profitable only for function having deep recursion
9117 in average and can hurt for function having little recursion depth by
9118 increasing the prologue size or complexity of function body to other
9119 optimizers.
9120
9121 When profile feedback is available (see @option{-fprofile-generate}) the actual
9122 recursion depth can be guessed from probability that function recurses via a
9123 given call expression. This parameter limits inlining only to call expressions
9124 whose probability exceeds the given threshold (in percents).
9125 The default value is 10.
9126
9127 @item early-inlining-insns
9128 Specify growth that the early inliner can make. In effect it increases
9129 the amount of inlining for code having a large abstraction penalty.
9130 The default value is 14.
9131
9132 @item max-early-inliner-iterations
9133 Limit of iterations of the early inliner. This basically bounds
9134 the number of nested indirect calls the early inliner can resolve.
9135 Deeper chains are still handled by late inlining.
9136
9137 @item comdat-sharing-probability
9138 Probability (in percent) that C++ inline function with comdat visibility
9139 are shared across multiple compilation units. The default value is 20.
9140
9141 @item profile-func-internal-id
9142 A parameter to control whether to use function internal id in profile
9143 database lookup. If the value is 0, the compiler uses an id that
9144 is based on function assembler name and filename, which makes old profile
9145 data more tolerant to source changes such as function reordering etc.
9146 The default value is 0.
9147
9148 @item min-vect-loop-bound
9149 The minimum number of iterations under which loops are not vectorized
9150 when @option{-ftree-vectorize} is used. The number of iterations after
9151 vectorization needs to be greater than the value specified by this option
9152 to allow vectorization. The default value is 0.
9153
9154 @item gcse-cost-distance-ratio
9155 Scaling factor in calculation of maximum distance an expression
9156 can be moved by GCSE optimizations. This is currently supported only in the
9157 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9158 is with simple expressions, i.e., the expressions that have cost
9159 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9160 hoisting of simple expressions. The default value is 10.
9161
9162 @item gcse-unrestricted-cost
9163 Cost, roughly measured as the cost of a single typical machine
9164 instruction, at which GCSE optimizations do not constrain
9165 the distance an expression can travel. This is currently
9166 supported only in the code hoisting pass. The lesser the cost,
9167 the more aggressive code hoisting is. Specifying 0
9168 allows all expressions to travel unrestricted distances.
9169 The default value is 3.
9170
9171 @item max-hoist-depth
9172 The depth of search in the dominator tree for expressions to hoist.
9173 This is used to avoid quadratic behavior in hoisting algorithm.
9174 The value of 0 does not limit on the search, but may slow down compilation
9175 of huge functions. The default value is 30.
9176
9177 @item max-tail-merge-comparisons
9178 The maximum amount of similar bbs to compare a bb with. This is used to
9179 avoid quadratic behavior in tree tail merging. The default value is 10.
9180
9181 @item max-tail-merge-iterations
9182 The maximum amount of iterations of the pass over the function. This is used to
9183 limit compilation time in tree tail merging. The default value is 2.
9184
9185 @item max-unrolled-insns
9186 The maximum number of instructions that a loop may have to be unrolled.
9187 If a loop is unrolled, this parameter also determines how many times
9188 the loop code is unrolled.
9189
9190 @item max-average-unrolled-insns
9191 The maximum number of instructions biased by probabilities of their execution
9192 that a loop may have to be unrolled. If a loop is unrolled,
9193 this parameter also determines how many times the loop code is unrolled.
9194
9195 @item max-unroll-times
9196 The maximum number of unrollings of a single loop.
9197
9198 @item max-peeled-insns
9199 The maximum number of instructions that a loop may have to be peeled.
9200 If a loop is peeled, this parameter also determines how many times
9201 the loop code is peeled.
9202
9203 @item max-peel-times
9204 The maximum number of peelings of a single loop.
9205
9206 @item max-peel-branches
9207 The maximum number of branches on the hot path through the peeled sequence.
9208
9209 @item max-completely-peeled-insns
9210 The maximum number of insns of a completely peeled loop.
9211
9212 @item max-completely-peel-times
9213 The maximum number of iterations of a loop to be suitable for complete peeling.
9214
9215 @item max-completely-peel-loop-nest-depth
9216 The maximum depth of a loop nest suitable for complete peeling.
9217
9218 @item max-unswitch-insns
9219 The maximum number of insns of an unswitched loop.
9220
9221 @item max-unswitch-level
9222 The maximum number of branches unswitched in a single loop.
9223
9224 @item max-loop-headers-insns
9225 The maximum number of insns in loop header duplicated by he copy loop headers
9226 pass.
9227
9228 @item lim-expensive
9229 The minimum cost of an expensive expression in the loop invariant motion.
9230
9231 @item iv-consider-all-candidates-bound
9232 Bound on number of candidates for induction variables, below which
9233 all candidates are considered for each use in induction variable
9234 optimizations. If there are more candidates than this,
9235 only the most relevant ones are considered to avoid quadratic time complexity.
9236
9237 @item iv-max-considered-uses
9238 The induction variable optimizations give up on loops that contain more
9239 induction variable uses.
9240
9241 @item iv-always-prune-cand-set-bound
9242 If the number of candidates in the set is smaller than this value,
9243 always try to remove unnecessary ivs from the set
9244 when adding a new one.
9245
9246 @item avg-loop-niter
9247 Average number of iterations of a loop.
9248
9249 @item scev-max-expr-size
9250 Bound on size of expressions used in the scalar evolutions analyzer.
9251 Large expressions slow the analyzer.
9252
9253 @item scev-max-expr-complexity
9254 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9255 Complex expressions slow the analyzer.
9256
9257 @item max-tree-if-conversion-phi-args
9258 Maximum number of arguments in a PHI supported by TREE if conversion
9259 unless the loop is marked with simd pragma.
9260
9261 @item vect-max-version-for-alignment-checks
9262 The maximum number of run-time checks that can be performed when
9263 doing loop versioning for alignment in the vectorizer.
9264
9265 @item vect-max-version-for-alias-checks
9266 The maximum number of run-time checks that can be performed when
9267 doing loop versioning for alias in the vectorizer.
9268
9269 @item vect-max-peeling-for-alignment
9270 The maximum number of loop peels to enhance access alignment
9271 for vectorizer. Value -1 means no limit.
9272
9273 @item max-iterations-to-track
9274 The maximum number of iterations of a loop the brute-force algorithm
9275 for analysis of the number of iterations of the loop tries to evaluate.
9276
9277 @item hot-bb-count-ws-permille
9278 A basic block profile count is considered hot if it contributes to
9279 the given permillage (i.e. 0...1000) of the entire profiled execution.
9280
9281 @item hot-bb-frequency-fraction
9282 Select fraction of the entry block frequency of executions of basic block in
9283 function given basic block needs to have to be considered hot.
9284
9285 @item max-predicted-iterations
9286 The maximum number of loop iterations we predict statically. This is useful
9287 in cases where a function contains a single loop with known bound and
9288 another loop with unknown bound.
9289 The known number of iterations is predicted correctly, while
9290 the unknown number of iterations average to roughly 10. This means that the
9291 loop without bounds appears artificially cold relative to the other one.
9292
9293 @item builtin-expect-probability
9294 Control the probability of the expression having the specified value. This
9295 parameter takes a percentage (i.e. 0 ... 100) as input.
9296 The default probability of 90 is obtained empirically.
9297
9298 @item align-threshold
9299
9300 Select fraction of the maximal frequency of executions of a basic block in
9301 a function to align the basic block.
9302
9303 @item align-loop-iterations
9304
9305 A loop expected to iterate at least the selected number of iterations is
9306 aligned.
9307
9308 @item tracer-dynamic-coverage
9309 @itemx tracer-dynamic-coverage-feedback
9310
9311 This value is used to limit superblock formation once the given percentage of
9312 executed instructions is covered. This limits unnecessary code size
9313 expansion.
9314
9315 The @option{tracer-dynamic-coverage-feedback} parameter
9316 is used only when profile
9317 feedback is available. The real profiles (as opposed to statically estimated
9318 ones) are much less balanced allowing the threshold to be larger value.
9319
9320 @item tracer-max-code-growth
9321 Stop tail duplication once code growth has reached given percentage. This is
9322 a rather artificial limit, as most of the duplicates are eliminated later in
9323 cross jumping, so it may be set to much higher values than is the desired code
9324 growth.
9325
9326 @item tracer-min-branch-ratio
9327
9328 Stop reverse growth when the reverse probability of best edge is less than this
9329 threshold (in percent).
9330
9331 @item tracer-min-branch-probability
9332 @itemx tracer-min-branch-probability-feedback
9333
9334 Stop forward growth if the best edge has probability lower than this
9335 threshold.
9336
9337 Similarly to @option{tracer-dynamic-coverage} two parameters are
9338 provided. @option{tracer-min-branch-probability-feedback} is used for
9339 compilation with profile feedback and @option{tracer-min-branch-probability}
9340 compilation without. The value for compilation with profile feedback
9341 needs to be more conservative (higher) in order to make tracer
9342 effective.
9343
9344 @item max-cse-path-length
9345
9346 The maximum number of basic blocks on path that CSE considers.
9347 The default is 10.
9348
9349 @item max-cse-insns
9350 The maximum number of instructions CSE processes before flushing.
9351 The default is 1000.
9352
9353 @item ggc-min-expand
9354
9355 GCC uses a garbage collector to manage its own memory allocation. This
9356 parameter specifies the minimum percentage by which the garbage
9357 collector's heap should be allowed to expand between collections.
9358 Tuning this may improve compilation speed; it has no effect on code
9359 generation.
9360
9361 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9362 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9363 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9364 GCC is not able to calculate RAM on a particular platform, the lower
9365 bound of 30% is used. Setting this parameter and
9366 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9367 every opportunity. This is extremely slow, but can be useful for
9368 debugging.
9369
9370 @item ggc-min-heapsize
9371
9372 Minimum size of the garbage collector's heap before it begins bothering
9373 to collect garbage. The first collection occurs after the heap expands
9374 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9375 tuning this may improve compilation speed, and has no effect on code
9376 generation.
9377
9378 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9379 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9380 with a lower bound of 4096 (four megabytes) and an upper bound of
9381 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9382 particular platform, the lower bound is used. Setting this parameter
9383 very large effectively disables garbage collection. Setting this
9384 parameter and @option{ggc-min-expand} to zero causes a full collection
9385 to occur at every opportunity.
9386
9387 @item max-reload-search-insns
9388 The maximum number of instruction reload should look backward for equivalent
9389 register. Increasing values mean more aggressive optimization, making the
9390 compilation time increase with probably slightly better performance.
9391 The default value is 100.
9392
9393 @item max-cselib-memory-locations
9394 The maximum number of memory locations cselib should take into account.
9395 Increasing values mean more aggressive optimization, making the compilation time
9396 increase with probably slightly better performance. The default value is 500.
9397
9398 @item max-sched-ready-insns
9399 The maximum number of instructions ready to be issued the scheduler should
9400 consider at any given time during the first scheduling pass. Increasing
9401 values mean more thorough searches, making the compilation time increase
9402 with probably little benefit. The default value is 100.
9403
9404 @item max-sched-region-blocks
9405 The maximum number of blocks in a region to be considered for
9406 interblock scheduling. The default value is 10.
9407
9408 @item max-pipeline-region-blocks
9409 The maximum number of blocks in a region to be considered for
9410 pipelining in the selective scheduler. The default value is 15.
9411
9412 @item max-sched-region-insns
9413 The maximum number of insns in a region to be considered for
9414 interblock scheduling. The default value is 100.
9415
9416 @item max-pipeline-region-insns
9417 The maximum number of insns in a region to be considered for
9418 pipelining in the selective scheduler. The default value is 200.
9419
9420 @item min-spec-prob
9421 The minimum probability (in percents) of reaching a source block
9422 for interblock speculative scheduling. The default value is 40.
9423
9424 @item max-sched-extend-regions-iters
9425 The maximum number of iterations through CFG to extend regions.
9426 A value of 0 (the default) disables region extensions.
9427
9428 @item max-sched-insn-conflict-delay
9429 The maximum conflict delay for an insn to be considered for speculative motion.
9430 The default value is 3.
9431
9432 @item sched-spec-prob-cutoff
9433 The minimal probability of speculation success (in percents), so that
9434 speculative insns are scheduled.
9435 The default value is 40.
9436
9437 @item sched-state-edge-prob-cutoff
9438 The minimum probability an edge must have for the scheduler to save its
9439 state across it.
9440 The default value is 10.
9441
9442 @item sched-mem-true-dep-cost
9443 Minimal distance (in CPU cycles) between store and load targeting same
9444 memory locations. The default value is 1.
9445
9446 @item selsched-max-lookahead
9447 The maximum size of the lookahead window of selective scheduling. It is a
9448 depth of search for available instructions.
9449 The default value is 50.
9450
9451 @item selsched-max-sched-times
9452 The maximum number of times that an instruction is scheduled during
9453 selective scheduling. This is the limit on the number of iterations
9454 through which the instruction may be pipelined. The default value is 2.
9455
9456 @item selsched-insns-to-rename
9457 The maximum number of best instructions in the ready list that are considered
9458 for renaming in the selective scheduler. The default value is 2.
9459
9460 @item sms-min-sc
9461 The minimum value of stage count that swing modulo scheduler
9462 generates. The default value is 2.
9463
9464 @item max-last-value-rtl
9465 The maximum size measured as number of RTLs that can be recorded in an expression
9466 in combiner for a pseudo register as last known value of that register. The default
9467 is 10000.
9468
9469 @item max-combine-insns
9470 The maximum number of instructions the RTL combiner tries to combine.
9471 The default value is 2 at @option{-Og} and 4 otherwise.
9472
9473 @item integer-share-limit
9474 Small integer constants can use a shared data structure, reducing the
9475 compiler's memory usage and increasing its speed. This sets the maximum
9476 value of a shared integer constant. The default value is 256.
9477
9478 @item ssp-buffer-size
9479 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9480 protection when @option{-fstack-protection} is used.
9481
9482 @item min-size-for-stack-sharing
9483 The minimum size of variables taking part in stack slot sharing when not
9484 optimizing. The default value is 32.
9485
9486 @item max-jump-thread-duplication-stmts
9487 Maximum number of statements allowed in a block that needs to be
9488 duplicated when threading jumps.
9489
9490 @item max-fields-for-field-sensitive
9491 Maximum number of fields in a structure treated in
9492 a field sensitive manner during pointer analysis. The default is zero
9493 for @option{-O0} and @option{-O1},
9494 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9495
9496 @item prefetch-latency
9497 Estimate on average number of instructions that are executed before
9498 prefetch finishes. The distance prefetched ahead is proportional
9499 to this constant. Increasing this number may also lead to less
9500 streams being prefetched (see @option{simultaneous-prefetches}).
9501
9502 @item simultaneous-prefetches
9503 Maximum number of prefetches that can run at the same time.
9504
9505 @item l1-cache-line-size
9506 The size of cache line in L1 cache, in bytes.
9507
9508 @item l1-cache-size
9509 The size of L1 cache, in kilobytes.
9510
9511 @item l2-cache-size
9512 The size of L2 cache, in kilobytes.
9513
9514 @item min-insn-to-prefetch-ratio
9515 The minimum ratio between the number of instructions and the
9516 number of prefetches to enable prefetching in a loop.
9517
9518 @item prefetch-min-insn-to-mem-ratio
9519 The minimum ratio between the number of instructions and the
9520 number of memory references to enable prefetching in a loop.
9521
9522 @item use-canonical-types
9523 Whether the compiler should use the ``canonical'' type system. By
9524 default, this should always be 1, which uses a more efficient internal
9525 mechanism for comparing types in C++ and Objective-C++. However, if
9526 bugs in the canonical type system are causing compilation failures,
9527 set this value to 0 to disable canonical types.
9528
9529 @item switch-conversion-max-branch-ratio
9530 Switch initialization conversion refuses to create arrays that are
9531 bigger than @option{switch-conversion-max-branch-ratio} times the number of
9532 branches in the switch.
9533
9534 @item max-partial-antic-length
9535 Maximum length of the partial antic set computed during the tree
9536 partial redundancy elimination optimization (@option{-ftree-pre}) when
9537 optimizing at @option{-O3} and above. For some sorts of source code
9538 the enhanced partial redundancy elimination optimization can run away,
9539 consuming all of the memory available on the host machine. This
9540 parameter sets a limit on the length of the sets that are computed,
9541 which prevents the runaway behavior. Setting a value of 0 for
9542 this parameter allows an unlimited set length.
9543
9544 @item sccvn-max-scc-size
9545 Maximum size of a strongly connected component (SCC) during SCCVN
9546 processing. If this limit is hit, SCCVN processing for the whole
9547 function is not done and optimizations depending on it are
9548 disabled. The default maximum SCC size is 10000.
9549
9550 @item sccvn-max-alias-queries-per-access
9551 Maximum number of alias-oracle queries we perform when looking for
9552 redundancies for loads and stores. If this limit is hit the search
9553 is aborted and the load or store is not considered redundant. The
9554 number of queries is algorithmically limited to the number of
9555 stores on all paths from the load to the function entry.
9556 The default maximum number of queries is 1000.
9557
9558 @item ira-max-loops-num
9559 IRA uses regional register allocation by default. If a function
9560 contains more loops than the number given by this parameter, only at most
9561 the given number of the most frequently-executed loops form regions
9562 for regional register allocation. The default value of the
9563 parameter is 100.
9564
9565 @item ira-max-conflict-table-size
9566 Although IRA uses a sophisticated algorithm to compress the conflict
9567 table, the table can still require excessive amounts of memory for
9568 huge functions. If the conflict table for a function could be more
9569 than the size in MB given by this parameter, the register allocator
9570 instead uses a faster, simpler, and lower-quality
9571 algorithm that does not require building a pseudo-register conflict table.
9572 The default value of the parameter is 2000.
9573
9574 @item ira-loop-reserved-regs
9575 IRA can be used to evaluate more accurate register pressure in loops
9576 for decisions to move loop invariants (see @option{-O3}). The number
9577 of available registers reserved for some other purposes is given
9578 by this parameter. The default value of the parameter is 2, which is
9579 the minimal number of registers needed by typical instructions.
9580 This value is the best found from numerous experiments.
9581
9582 @item lra-inheritance-ebb-probability-cutoff
9583 LRA tries to reuse values reloaded in registers in subsequent insns.
9584 This optimization is called inheritance. EBB is used as a region to
9585 do this optimization. The parameter defines a minimal fall-through
9586 edge probability in percentage used to add BB to inheritance EBB in
9587 LRA. The default value of the parameter is 40. The value was chosen
9588 from numerous runs of SPEC2000 on x86-64.
9589
9590 @item loop-invariant-max-bbs-in-loop
9591 Loop invariant motion can be very expensive, both in compilation time and
9592 in amount of needed compile-time memory, with very large loops. Loops
9593 with more basic blocks than this parameter won't have loop invariant
9594 motion optimization performed on them. The default value of the
9595 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
9596
9597 @item loop-max-datarefs-for-datadeps
9598 Building data dependencies is expensive for very large loops. This
9599 parameter limits the number of data references in loops that are
9600 considered for data dependence analysis. These large loops are no
9601 handled by the optimizations using loop data dependencies.
9602 The default value is 1000.
9603
9604 @item max-vartrack-size
9605 Sets a maximum number of hash table slots to use during variable
9606 tracking dataflow analysis of any function. If this limit is exceeded
9607 with variable tracking at assignments enabled, analysis for that
9608 function is retried without it, after removing all debug insns from
9609 the function. If the limit is exceeded even without debug insns, var
9610 tracking analysis is completely disabled for the function. Setting
9611 the parameter to zero makes it unlimited.
9612
9613 @item max-vartrack-expr-depth
9614 Sets a maximum number of recursion levels when attempting to map
9615 variable names or debug temporaries to value expressions. This trades
9616 compilation time for more complete debug information. If this is set too
9617 low, value expressions that are available and could be represented in
9618 debug information may end up not being used; setting this higher may
9619 enable the compiler to find more complex debug expressions, but compile
9620 time and memory use may grow. The default is 12.
9621
9622 @item min-nondebug-insn-uid
9623 Use uids starting at this parameter for nondebug insns. The range below
9624 the parameter is reserved exclusively for debug insns created by
9625 @option{-fvar-tracking-assignments}, but debug insns may get
9626 (non-overlapping) uids above it if the reserved range is exhausted.
9627
9628 @item ipa-sra-ptr-growth-factor
9629 IPA-SRA replaces a pointer to an aggregate with one or more new
9630 parameters only when their cumulative size is less or equal to
9631 @option{ipa-sra-ptr-growth-factor} times the size of the original
9632 pointer parameter.
9633
9634 @item sra-max-scalarization-size-Ospeed
9635 @item sra-max-scalarization-size-Osize
9636 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
9637 replace scalar parts of aggregates with uses of independent scalar
9638 variables. These parameters control the maximum size, in storage units,
9639 of aggregate which is considered for replacement when compiling for
9640 speed
9641 (@option{sra-max-scalarization-size-Ospeed}) or size
9642 (@option{sra-max-scalarization-size-Osize}) respectively.
9643
9644 @item tm-max-aggregate-size
9645 When making copies of thread-local variables in a transaction, this
9646 parameter specifies the size in bytes after which variables are
9647 saved with the logging functions as opposed to save/restore code
9648 sequence pairs. This option only applies when using
9649 @option{-fgnu-tm}.
9650
9651 @item graphite-max-nb-scop-params
9652 To avoid exponential effects in the Graphite loop transforms, the
9653 number of parameters in a Static Control Part (SCoP) is bounded. The
9654 default value is 10 parameters. A variable whose value is unknown at
9655 compilation time and defined outside a SCoP is a parameter of the SCoP.
9656
9657 @item graphite-max-bbs-per-function
9658 To avoid exponential effects in the detection of SCoPs, the size of
9659 the functions analyzed by Graphite is bounded. The default value is
9660 100 basic blocks.
9661
9662 @item loop-block-tile-size
9663 Loop blocking or strip mining transforms, enabled with
9664 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
9665 loop in the loop nest by a given number of iterations. The strip
9666 length can be changed using the @option{loop-block-tile-size}
9667 parameter. The default value is 51 iterations.
9668
9669 @item loop-unroll-jam-size
9670 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
9671 default value is 4.
9672
9673 @item loop-unroll-jam-depth
9674 Specify the dimension to be unrolled (counting from the most inner loop)
9675 for the @option{-floop-unroll-and-jam}. The default value is 2.
9676
9677 @item ipa-cp-value-list-size
9678 IPA-CP attempts to track all possible values and types passed to a function's
9679 parameter in order to propagate them and perform devirtualization.
9680 @option{ipa-cp-value-list-size} is the maximum number of values and types it
9681 stores per one formal parameter of a function.
9682
9683 @item ipa-cp-eval-threshold
9684 IPA-CP calculates its own score of cloning profitability heuristics
9685 and performs those cloning opportunities with scores that exceed
9686 @option{ipa-cp-eval-threshold}.
9687
9688 @item ipa-cp-recursion-penalty
9689 Percentage penalty the recursive functions will receive when they
9690 are evaluated for cloning.
9691
9692 @item ipa-cp-single-call-penalty
9693 Percentage penalty functions containg a single call to another
9694 function will receive when they are evaluated for cloning.
9695
9696
9697 @item ipa-max-agg-items
9698 IPA-CP is also capable to propagate a number of scalar values passed
9699 in an aggregate. @option{ipa-max-agg-items} controls the maximum
9700 number of such values per one parameter.
9701
9702 @item ipa-cp-loop-hint-bonus
9703 When IPA-CP determines that a cloning candidate would make the number
9704 of iterations of a loop known, it adds a bonus of
9705 @option{ipa-cp-loop-hint-bonus} to the profitability score of
9706 the candidate.
9707
9708 @item ipa-cp-array-index-hint-bonus
9709 When IPA-CP determines that a cloning candidate would make the index of
9710 an array access known, it adds a bonus of
9711 @option{ipa-cp-array-index-hint-bonus} to the profitability
9712 score of the candidate.
9713
9714 @item ipa-max-aa-steps
9715 During its analysis of function bodies, IPA-CP employs alias analysis
9716 in order to track values pointed to by function parameters. In order
9717 not spend too much time analyzing huge functions, it gives up and
9718 consider all memory clobbered after examining
9719 @option{ipa-max-aa-steps} statements modifying memory.
9720
9721 @item lto-partitions
9722 Specify desired number of partitions produced during WHOPR compilation.
9723 The number of partitions should exceed the number of CPUs used for compilation.
9724 The default value is 32.
9725
9726 @item lto-min-partition
9727 Size of minimal partition for WHOPR (in estimated instructions).
9728 This prevents expenses of splitting very small programs into too many
9729 partitions.
9730
9731 @item lto-max-partition
9732 Size of max partition for WHOPR (in estimated instructions).
9733 to provide an upper bound for individual size of partition.
9734 Meant to be used only with balanced partitioning.
9735
9736 @item cxx-max-namespaces-for-diagnostic-help
9737 The maximum number of namespaces to consult for suggestions when C++
9738 name lookup fails for an identifier. The default is 1000.
9739
9740 @item sink-frequency-threshold
9741 The maximum relative execution frequency (in percents) of the target block
9742 relative to a statement's original block to allow statement sinking of a
9743 statement. Larger numbers result in more aggressive statement sinking.
9744 The default value is 75. A small positive adjustment is applied for
9745 statements with memory operands as those are even more profitable so sink.
9746
9747 @item max-stores-to-sink
9748 The maximum number of conditional store pairs that can be sunk. Set to 0
9749 if either vectorization (@option{-ftree-vectorize}) or if-conversion
9750 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
9751
9752 @item allow-store-data-races
9753 Allow optimizers to introduce new data races on stores.
9754 Set to 1 to allow, otherwise to 0. This option is enabled by default
9755 at optimization level @option{-Ofast}.
9756
9757 @item case-values-threshold
9758 The smallest number of different values for which it is best to use a
9759 jump-table instead of a tree of conditional branches. If the value is
9760 0, use the default for the machine. The default is 0.
9761
9762 @item tree-reassoc-width
9763 Set the maximum number of instructions executed in parallel in
9764 reassociated tree. This parameter overrides target dependent
9765 heuristics used by default if has non zero value.
9766
9767 @item sched-pressure-algorithm
9768 Choose between the two available implementations of
9769 @option{-fsched-pressure}. Algorithm 1 is the original implementation
9770 and is the more likely to prevent instructions from being reordered.
9771 Algorithm 2 was designed to be a compromise between the relatively
9772 conservative approach taken by algorithm 1 and the rather aggressive
9773 approach taken by the default scheduler. It relies more heavily on
9774 having a regular register file and accurate register pressure classes.
9775 See @file{haifa-sched.c} in the GCC sources for more details.
9776
9777 The default choice depends on the target.
9778
9779 @item max-slsr-cand-scan
9780 Set the maximum number of existing candidates that are considered when
9781 seeking a basis for a new straight-line strength reduction candidate.
9782
9783 @item asan-globals
9784 Enable buffer overflow detection for global objects. This kind
9785 of protection is enabled by default if you are using
9786 @option{-fsanitize=address} option.
9787 To disable global objects protection use @option{--param asan-globals=0}.
9788
9789 @item asan-stack
9790 Enable buffer overflow detection for stack objects. This kind of
9791 protection is enabled by default when using @option{-fsanitize=address}.
9792 To disable stack protection use @option{--param asan-stack=0} option.
9793
9794 @item asan-instrument-reads
9795 Enable buffer overflow detection for memory reads. This kind of
9796 protection is enabled by default when using @option{-fsanitize=address}.
9797 To disable memory reads protection use
9798 @option{--param asan-instrument-reads=0}.
9799
9800 @item asan-instrument-writes
9801 Enable buffer overflow detection for memory writes. This kind of
9802 protection is enabled by default when using @option{-fsanitize=address}.
9803 To disable memory writes protection use
9804 @option{--param asan-instrument-writes=0} option.
9805
9806 @item asan-memintrin
9807 Enable detection for built-in functions. This kind of protection
9808 is enabled by default when using @option{-fsanitize=address}.
9809 To disable built-in functions protection use
9810 @option{--param asan-memintrin=0}.
9811
9812 @item asan-use-after-return
9813 Enable detection of use-after-return. This kind of protection
9814 is enabled by default when using @option{-fsanitize=address} option.
9815 To disable use-after-return detection use
9816 @option{--param asan-use-after-return=0}.
9817
9818 @item asan-instrumentation-with-call-threshold
9819 If number of memory accesses in function being instrumented
9820 is greater or equal to this number, use callbacks instead of inline checks.
9821 E.g. to disable inline code use
9822 @option{--param asan-instrumentation-with-call-threshold=0}.
9823
9824 @item chkp-max-ctor-size
9825 Static constructors generated by Pointer Bounds Checker may become very
9826 large and significantly increase compile time at optimization level
9827 @option{-O1} and higher. This parameter is a maximum nubmer of statements
9828 in a single generated constructor. Default value is 5000.
9829
9830 @item max-fsm-thread-path-insns
9831 Maximum number of instructions to copy when duplicating blocks on a
9832 finite state automaton jump thread path. The default is 100.
9833
9834 @item max-fsm-thread-length
9835 Maximum number of basic blocks on a finite state automaton jump thread
9836 path. The default is 10.
9837
9838 @item max-fsm-thread-paths
9839 Maximum number of new jump thread paths to create for a finite state
9840 automaton. The default is 50.
9841
9842 @item parloops-chunk-size
9843 Chunk size of omp schedule for loops parallelized by parloops. The default
9844 is 0.
9845
9846 @item parloops-schedule
9847 Schedule type of omp schedule for loops parallelized by parloops (static,
9848 dynamic, guided, auto, runtime). The default is static.
9849
9850 @item max-ssa-name-query-depth
9851 Maximum depth of recursion when querying properties of SSA names in things
9852 like fold routines. One level of recursion corresponds to following a
9853 use-def chain.
9854
9855 @item hsa-gen-debug-stores
9856 Enable emission of special debug stores within HSA kernels which are
9857 then read and reported by libgomp plugin. Generation of these stores
9858 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
9859 enable it.
9860
9861 @item max-speculative-devirt-maydefs
9862 The maximum number of may-defs we analyze when looking for a must-def
9863 specifying the dynamic type of an object that invokes a virtual call
9864 we may be able to devirtualize speculatively.
9865
9866 @item max-vrp-switch-assertions
9867 The maximum number of assertions to add along the default edge of a switch
9868 statement during VRP. The default is 10.
9869 @end table
9870 @end table
9871
9872 @node Instrumentation Options
9873 @section Program Instrumentation Options
9874 @cindex instrumentation options
9875 @cindex program instrumentation options
9876 @cindex run-time error checking options
9877 @cindex profiling options
9878 @cindex options, program instrumentation
9879 @cindex options, run-time error checking
9880 @cindex options, profiling
9881
9882 GCC supports a number of command-line options that control adding
9883 run-time instrumentation to the code it normally generates.
9884 For example, one purpose of instrumentation is collect profiling
9885 statistics for use in finding program hot spots, code coverage
9886 analysis, or profile-guided optimizations.
9887 Another class of program instrumentation is adding run-time checking
9888 to detect programming errors like invalid pointer
9889 dereferences or out-of-bounds array accesses, as well as deliberately
9890 hostile attacks such as stack smashing or C++ vtable hijacking.
9891 There is also a general hook which can be used to implement other
9892 forms of tracing or function-level instrumentation for debug or
9893 program analysis purposes.
9894
9895 @table @gcctabopt
9896 @cindex @command{prof}
9897 @item -p
9898 @opindex p
9899 Generate extra code to write profile information suitable for the
9900 analysis program @command{prof}. You must use this option when compiling
9901 the source files you want data about, and you must also use it when
9902 linking.
9903
9904 @cindex @command{gprof}
9905 @item -pg
9906 @opindex pg
9907 Generate extra code to write profile information suitable for the
9908 analysis program @command{gprof}. You must use this option when compiling
9909 the source files you want data about, and you must also use it when
9910 linking.
9911
9912 @item -fprofile-arcs
9913 @opindex fprofile-arcs
9914 Add code so that program flow @dfn{arcs} are instrumented. During
9915 execution the program records how many times each branch and call is
9916 executed and how many times it is taken or returns. When the compiled
9917 program exits it saves this data to a file called
9918 @file{@var{auxname}.gcda} for each source file. The data may be used for
9919 profile-directed optimizations (@option{-fbranch-probabilities}), or for
9920 test coverage analysis (@option{-ftest-coverage}). Each object file's
9921 @var{auxname} is generated from the name of the output file, if
9922 explicitly specified and it is not the final executable, otherwise it is
9923 the basename of the source file. In both cases any suffix is removed
9924 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
9925 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
9926 @xref{Cross-profiling}.
9927
9928 @cindex @command{gcov}
9929 @item --coverage
9930 @opindex coverage
9931
9932 This option is used to compile and link code instrumented for coverage
9933 analysis. The option is a synonym for @option{-fprofile-arcs}
9934 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
9935 linking). See the documentation for those options for more details.
9936
9937 @itemize
9938
9939 @item
9940 Compile the source files with @option{-fprofile-arcs} plus optimization
9941 and code generation options. For test coverage analysis, use the
9942 additional @option{-ftest-coverage} option. You do not need to profile
9943 every source file in a program.
9944
9945 @item
9946 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
9947 (the latter implies the former).
9948
9949 @item
9950 Run the program on a representative workload to generate the arc profile
9951 information. This may be repeated any number of times. You can run
9952 concurrent instances of your program, and provided that the file system
9953 supports locking, the data files will be correctly updated. Also
9954 @code{fork} calls are detected and correctly handled (double counting
9955 will not happen).
9956
9957 @item
9958 For profile-directed optimizations, compile the source files again with
9959 the same optimization and code generation options plus
9960 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
9961 Control Optimization}).
9962
9963 @item
9964 For test coverage analysis, use @command{gcov} to produce human readable
9965 information from the @file{.gcno} and @file{.gcda} files. Refer to the
9966 @command{gcov} documentation for further information.
9967
9968 @end itemize
9969
9970 With @option{-fprofile-arcs}, for each function of your program GCC
9971 creates a program flow graph, then finds a spanning tree for the graph.
9972 Only arcs that are not on the spanning tree have to be instrumented: the
9973 compiler adds code to count the number of times that these arcs are
9974 executed. When an arc is the only exit or only entrance to a block, the
9975 instrumentation code can be added to the block; otherwise, a new basic
9976 block must be created to hold the instrumentation code.
9977
9978 @need 2000
9979 @item -ftest-coverage
9980 @opindex ftest-coverage
9981 Produce a notes file that the @command{gcov} code-coverage utility
9982 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
9983 show program coverage. Each source file's note file is called
9984 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
9985 above for a description of @var{auxname} and instructions on how to
9986 generate test coverage data. Coverage data matches the source files
9987 more closely if you do not optimize.
9988
9989 @item -fprofile-dir=@var{path}
9990 @opindex fprofile-dir
9991
9992 Set the directory to search for the profile data files in to @var{path}.
9993 This option affects only the profile data generated by
9994 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
9995 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
9996 and its related options. Both absolute and relative paths can be used.
9997 By default, GCC uses the current directory as @var{path}, thus the
9998 profile data file appears in the same directory as the object file.
9999
10000 @item -fprofile-generate
10001 @itemx -fprofile-generate=@var{path}
10002 @opindex fprofile-generate
10003
10004 Enable options usually used for instrumenting application to produce
10005 profile useful for later recompilation with profile feedback based
10006 optimization. You must use @option{-fprofile-generate} both when
10007 compiling and when linking your program.
10008
10009 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
10010
10011 If @var{path} is specified, GCC looks at the @var{path} to find
10012 the profile feedback data files. See @option{-fprofile-dir}.
10013
10014 To optimize the program based on the collected profile information, use
10015 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
10016
10017 @item -fprofile-update=@var{method}
10018 @opindex fprofile-update
10019
10020 Alter the update method for an application instrumented for profile
10021 feedback based optimization. The @var{method} argument should be one of
10022 @samp{single} or @samp{atomic}. The first one is useful for single-threaded
10023 applications, while the second one prevents profile corruption by emitting
10024 thread-safe code.
10025
10026 @strong{Warning:} When an application does not properly join all threads
10027 (or creates an detached thread), a profile file can be still corrupted.
10028
10029 @item -fsanitize=address
10030 @opindex fsanitize=address
10031 Enable AddressSanitizer, a fast memory error detector.
10032 Memory access instructions are instrumented to detect
10033 out-of-bounds and use-after-free bugs.
10034 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
10035 more details. The run-time behavior can be influenced using the
10036 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
10037 the available options are shown at startup of the instrumented program. See
10038 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
10039 for a list of supported options.
10040
10041 @item -fsanitize=kernel-address
10042 @opindex fsanitize=kernel-address
10043 Enable AddressSanitizer for Linux kernel.
10044 See @uref{https://github.com/google/kasan/wiki} for more details.
10045
10046 @item -fsanitize=thread
10047 @opindex fsanitize=thread
10048 Enable ThreadSanitizer, a fast data race detector.
10049 Memory access instructions are instrumented to detect
10050 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
10051 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
10052 environment variable; see
10053 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
10054 supported options.
10055
10056 @item -fsanitize=leak
10057 @opindex fsanitize=leak
10058 Enable LeakSanitizer, a memory leak detector.
10059 This option only matters for linking of executables and if neither
10060 @option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that
10061 case the executable is linked against a library that overrides @code{malloc}
10062 and other allocator functions. See
10063 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
10064 details. The run-time behavior can be influenced using the
10065 @env{LSAN_OPTIONS} environment variable.
10066
10067 @item -fsanitize=undefined
10068 @opindex fsanitize=undefined
10069 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
10070 Various computations are instrumented to detect undefined behavior
10071 at runtime. Current suboptions are:
10072
10073 @table @gcctabopt
10074
10075 @item -fsanitize=shift
10076 @opindex fsanitize=shift
10077 This option enables checking that the result of a shift operation is
10078 not undefined. Note that what exactly is considered undefined differs
10079 slightly between C and C++, as well as between ISO C90 and C99, etc.
10080
10081 @item -fsanitize=integer-divide-by-zero
10082 @opindex fsanitize=integer-divide-by-zero
10083 Detect integer division by zero as well as @code{INT_MIN / -1} division.
10084
10085 @item -fsanitize=unreachable
10086 @opindex fsanitize=unreachable
10087 With this option, the compiler turns the @code{__builtin_unreachable}
10088 call into a diagnostics message call instead. When reaching the
10089 @code{__builtin_unreachable} call, the behavior is undefined.
10090
10091 @item -fsanitize=vla-bound
10092 @opindex fsanitize=vla-bound
10093 This option instructs the compiler to check that the size of a variable
10094 length array is positive.
10095
10096 @item -fsanitize=null
10097 @opindex fsanitize=null
10098 This option enables pointer checking. Particularly, the application
10099 built with this option turned on will issue an error message when it
10100 tries to dereference a NULL pointer, or if a reference (possibly an
10101 rvalue reference) is bound to a NULL pointer, or if a method is invoked
10102 on an object pointed by a NULL pointer.
10103
10104 @item -fsanitize=return
10105 @opindex fsanitize=return
10106 This option enables return statement checking. Programs
10107 built with this option turned on will issue an error message
10108 when the end of a non-void function is reached without actually
10109 returning a value. This option works in C++ only.
10110
10111 @item -fsanitize=signed-integer-overflow
10112 @opindex fsanitize=signed-integer-overflow
10113 This option enables signed integer overflow checking. We check that
10114 the result of @code{+}, @code{*}, and both unary and binary @code{-}
10115 does not overflow in the signed arithmetics. Note, integer promotion
10116 rules must be taken into account. That is, the following is not an
10117 overflow:
10118 @smallexample
10119 signed char a = SCHAR_MAX;
10120 a++;
10121 @end smallexample
10122
10123 @item -fsanitize=bounds
10124 @opindex fsanitize=bounds
10125 This option enables instrumentation of array bounds. Various out of bounds
10126 accesses are detected. Flexible array members, flexible array member-like
10127 arrays, and initializers of variables with static storage are not instrumented.
10128
10129 @item -fsanitize=bounds-strict
10130 @opindex fsanitize=bounds-strict
10131 This option enables strict instrumentation of array bounds. Most out of bounds
10132 accesses are detected, including flexible array members and flexible array
10133 member-like arrays. Initializers of variables with static storage are not
10134 instrumented.
10135
10136 @item -fsanitize=alignment
10137 @opindex fsanitize=alignment
10138
10139 This option enables checking of alignment of pointers when they are
10140 dereferenced, or when a reference is bound to insufficiently aligned target,
10141 or when a method or constructor is invoked on insufficiently aligned object.
10142
10143 @item -fsanitize=object-size
10144 @opindex fsanitize=object-size
10145 This option enables instrumentation of memory references using the
10146 @code{__builtin_object_size} function. Various out of bounds pointer
10147 accesses are detected.
10148
10149 @item -fsanitize=float-divide-by-zero
10150 @opindex fsanitize=float-divide-by-zero
10151 Detect floating-point division by zero. Unlike other similar options,
10152 @option{-fsanitize=float-divide-by-zero} is not enabled by
10153 @option{-fsanitize=undefined}, since floating-point division by zero can
10154 be a legitimate way of obtaining infinities and NaNs.
10155
10156 @item -fsanitize=float-cast-overflow
10157 @opindex fsanitize=float-cast-overflow
10158 This option enables floating-point type to integer conversion checking.
10159 We check that the result of the conversion does not overflow.
10160 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
10161 not enabled by @option{-fsanitize=undefined}.
10162 This option does not work well with @code{FE_INVALID} exceptions enabled.
10163
10164 @item -fsanitize=nonnull-attribute
10165 @opindex fsanitize=nonnull-attribute
10166
10167 This option enables instrumentation of calls, checking whether null values
10168 are not passed to arguments marked as requiring a non-null value by the
10169 @code{nonnull} function attribute.
10170
10171 @item -fsanitize=returns-nonnull-attribute
10172 @opindex fsanitize=returns-nonnull-attribute
10173
10174 This option enables instrumentation of return statements in functions
10175 marked with @code{returns_nonnull} function attribute, to detect returning
10176 of null values from such functions.
10177
10178 @item -fsanitize=bool
10179 @opindex fsanitize=bool
10180
10181 This option enables instrumentation of loads from bool. If a value other
10182 than 0/1 is loaded, a run-time error is issued.
10183
10184 @item -fsanitize=enum
10185 @opindex fsanitize=enum
10186
10187 This option enables instrumentation of loads from an enum type. If
10188 a value outside the range of values for the enum type is loaded,
10189 a run-time error is issued.
10190
10191 @item -fsanitize=vptr
10192 @opindex fsanitize=vptr
10193
10194 This option enables instrumentation of C++ member function calls, member
10195 accesses and some conversions between pointers to base and derived classes,
10196 to verify the referenced object has the correct dynamic type.
10197
10198 @end table
10199
10200 While @option{-ftrapv} causes traps for signed overflows to be emitted,
10201 @option{-fsanitize=undefined} gives a diagnostic message.
10202 This currently works only for the C family of languages.
10203
10204 @item -fno-sanitize=all
10205 @opindex fno-sanitize=all
10206
10207 This option disables all previously enabled sanitizers.
10208 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
10209 together.
10210
10211 @item -fasan-shadow-offset=@var{number}
10212 @opindex fasan-shadow-offset
10213 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
10214 It is useful for experimenting with different shadow memory layouts in
10215 Kernel AddressSanitizer.
10216
10217 @item -fsanitize-sections=@var{s1},@var{s2},...
10218 @opindex fsanitize-sections
10219 Sanitize global variables in selected user-defined sections. @var{si} may
10220 contain wildcards.
10221
10222 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
10223 @opindex fsanitize-recover
10224 @opindex fno-sanitize-recover
10225 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
10226 mentioned in comma-separated list of @var{opts}. Enabling this option
10227 for a sanitizer component causes it to attempt to continue
10228 running the program as if no error happened. This means multiple
10229 runtime errors can be reported in a single program run, and the exit
10230 code of the program may indicate success even when errors
10231 have been reported. The @option{-fno-sanitize-recover=} option
10232 can be used to alter
10233 this behavior: only the first detected error is reported
10234 and program then exits with a non-zero exit code.
10235
10236 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
10237 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
10238 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
10239 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
10240 For these sanitizers error recovery is turned on by default, except @option{-fsanitize=address},
10241 for which this feature is experimental.
10242 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
10243 accepted, the former enables recovery for all sanitizers that support it,
10244 the latter disables recovery for all sanitizers that support it.
10245
10246 Even if a recovery mode is turned on the compiler side, it needs to be also
10247 enabled on the runtime library side, otherwise the failures are still fatal.
10248 The runtime library defaults to @code{halt_on_error=0} for
10249 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
10250 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
10251 setting the @code{halt_on_error} flag in the corresponding environment variable.
10252
10253 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
10254 @smallexample
10255 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10256 @end smallexample
10257 @noindent
10258 Similarly @option{-fno-sanitize-recover} is equivalent to
10259 @smallexample
10260 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10261 @end smallexample
10262
10263 @item -fsanitize-undefined-trap-on-error
10264 @opindex fsanitize-undefined-trap-on-error
10265 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
10266 report undefined behavior using @code{__builtin_trap} rather than
10267 a @code{libubsan} library routine. The advantage of this is that the
10268 @code{libubsan} library is not needed and is not linked in, so this
10269 is usable even in freestanding environments.
10270
10271 @item -fsanitize-coverage=trace-pc
10272 @opindex fsanitize-coverage=trace-pc
10273 Enable coverage-guided fuzzing code instrumentation.
10274 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
10275
10276 @item -fbounds-check
10277 @opindex fbounds-check
10278 For front ends that support it, generate additional code to check that
10279 indices used to access arrays are within the declared range. This is
10280 currently only supported by the Java and Fortran front ends, where
10281 this option defaults to true and false respectively.
10282
10283 @item -fcheck-pointer-bounds
10284 @opindex fcheck-pointer-bounds
10285 @opindex fno-check-pointer-bounds
10286 @cindex Pointer Bounds Checker options
10287 Enable Pointer Bounds Checker instrumentation. Each memory reference
10288 is instrumented with checks of the pointer used for memory access against
10289 bounds associated with that pointer.
10290
10291 Currently there
10292 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
10293 and @option{-mmpx} are required to enable this feature.
10294 MPX-based instrumentation requires
10295 a runtime library to enable MPX in hardware and handle bounds
10296 violation signals. By default when @option{-fcheck-pointer-bounds}
10297 and @option{-mmpx} options are used to link a program, the GCC driver
10298 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
10299 Bounds checking on calls to dynamic libraries requires a linker
10300 with @option{-z bndplt} support; if GCC was configured with a linker
10301 without support for this option (including the Gold linker and older
10302 versions of ld), a warning is given if you link with @option{-mmpx}
10303 without also specifying @option{-static}, since the overall effectiveness
10304 of the bounds checking protection is reduced.
10305 See also @option{-static-libmpxwrappers}.
10306
10307 MPX-based instrumentation
10308 may be used for debugging and also may be included in production code
10309 to increase program security. Depending on usage, you may
10310 have different requirements for the runtime library. The current version
10311 of the MPX runtime library is more oriented for use as a debugging
10312 tool. MPX runtime library usage implies @option{-lpthread}. See
10313 also @option{-static-libmpx}. The runtime library behavior can be
10314 influenced using various @env{CHKP_RT_*} environment variables. See
10315 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
10316 for more details.
10317
10318 Generated instrumentation may be controlled by various
10319 @option{-fchkp-*} options and by the @code{bnd_variable_size}
10320 structure field attribute (@pxref{Type Attributes}) and
10321 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
10322 (@pxref{Function Attributes}). GCC also provides a number of built-in
10323 functions for controlling the Pointer Bounds Checker. @xref{Pointer
10324 Bounds Checker builtins}, for more information.
10325
10326 @item -fchkp-check-incomplete-type
10327 @opindex fchkp-check-incomplete-type
10328 @opindex fno-chkp-check-incomplete-type
10329 Generate pointer bounds checks for variables with incomplete type.
10330 Enabled by default.
10331
10332 @item -fchkp-narrow-bounds
10333 @opindex fchkp-narrow-bounds
10334 @opindex fno-chkp-narrow-bounds
10335 Controls bounds used by Pointer Bounds Checker for pointers to object
10336 fields. If narrowing is enabled then field bounds are used. Otherwise
10337 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
10338 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
10339
10340 @item -fchkp-first-field-has-own-bounds
10341 @opindex fchkp-first-field-has-own-bounds
10342 @opindex fno-chkp-first-field-has-own-bounds
10343 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
10344 first field in the structure. By default a pointer to the first field has
10345 the same bounds as a pointer to the whole structure.
10346
10347 @item -fchkp-narrow-to-innermost-array
10348 @opindex fchkp-narrow-to-innermost-array
10349 @opindex fno-chkp-narrow-to-innermost-array
10350 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
10351 case of nested static array access. By default this option is disabled and
10352 bounds of the outermost array are used.
10353
10354 @item -fchkp-optimize
10355 @opindex fchkp-optimize
10356 @opindex fno-chkp-optimize
10357 Enables Pointer Bounds Checker optimizations. Enabled by default at
10358 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
10359
10360 @item -fchkp-use-fast-string-functions
10361 @opindex fchkp-use-fast-string-functions
10362 @opindex fno-chkp-use-fast-string-functions
10363 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
10364 by Pointer Bounds Checker. Disabled by default.
10365
10366 @item -fchkp-use-nochk-string-functions
10367 @opindex fchkp-use-nochk-string-functions
10368 @opindex fno-chkp-use-nochk-string-functions
10369 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
10370 by Pointer Bounds Checker. Disabled by default.
10371
10372 @item -fchkp-use-static-bounds
10373 @opindex fchkp-use-static-bounds
10374 @opindex fno-chkp-use-static-bounds
10375 Allow Pointer Bounds Checker to generate static bounds holding
10376 bounds of static variables. Enabled by default.
10377
10378 @item -fchkp-use-static-const-bounds
10379 @opindex fchkp-use-static-const-bounds
10380 @opindex fno-chkp-use-static-const-bounds
10381 Use statically-initialized bounds for constant bounds instead of
10382 generating them each time they are required. By default enabled when
10383 @option{-fchkp-use-static-bounds} is enabled.
10384
10385 @item -fchkp-treat-zero-dynamic-size-as-infinite
10386 @opindex fchkp-treat-zero-dynamic-size-as-infinite
10387 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
10388 With this option, objects with incomplete type whose
10389 dynamically-obtained size is zero are treated as having infinite size
10390 instead by Pointer Bounds
10391 Checker. This option may be helpful if a program is linked with a library
10392 missing size information for some symbols. Disabled by default.
10393
10394 @item -fchkp-check-read
10395 @opindex fchkp-check-read
10396 @opindex fno-chkp-check-read
10397 Instructs Pointer Bounds Checker to generate checks for all read
10398 accesses to memory. Enabled by default.
10399
10400 @item -fchkp-check-write
10401 @opindex fchkp-check-write
10402 @opindex fno-chkp-check-write
10403 Instructs Pointer Bounds Checker to generate checks for all write
10404 accesses to memory. Enabled by default.
10405
10406 @item -fchkp-store-bounds
10407 @opindex fchkp-store-bounds
10408 @opindex fno-chkp-store-bounds
10409 Instructs Pointer Bounds Checker to generate bounds stores for
10410 pointer writes. Enabled by default.
10411
10412 @item -fchkp-instrument-calls
10413 @opindex fchkp-instrument-calls
10414 @opindex fno-chkp-instrument-calls
10415 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
10416 Enabled by default.
10417
10418 @item -fchkp-instrument-marked-only
10419 @opindex fchkp-instrument-marked-only
10420 @opindex fno-chkp-instrument-marked-only
10421 Instructs Pointer Bounds Checker to instrument only functions
10422 marked with the @code{bnd_instrument} attribute
10423 (@pxref{Function Attributes}). Disabled by default.
10424
10425 @item -fchkp-use-wrappers
10426 @opindex fchkp-use-wrappers
10427 @opindex fno-chkp-use-wrappers
10428 Allows Pointer Bounds Checker to replace calls to built-in functions
10429 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
10430 is used to link a program, the GCC driver automatically links
10431 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
10432 Enabled by default.
10433
10434 @item -fstack-protector
10435 @opindex fstack-protector
10436 Emit extra code to check for buffer overflows, such as stack smashing
10437 attacks. This is done by adding a guard variable to functions with
10438 vulnerable objects. This includes functions that call @code{alloca}, and
10439 functions with buffers larger than 8 bytes. The guards are initialized
10440 when a function is entered and then checked when the function exits.
10441 If a guard check fails, an error message is printed and the program exits.
10442
10443 @item -fstack-protector-all
10444 @opindex fstack-protector-all
10445 Like @option{-fstack-protector} except that all functions are protected.
10446
10447 @item -fstack-protector-strong
10448 @opindex fstack-protector-strong
10449 Like @option{-fstack-protector} but includes additional functions to
10450 be protected --- those that have local array definitions, or have
10451 references to local frame addresses.
10452
10453 @item -fstack-protector-explicit
10454 @opindex fstack-protector-explicit
10455 Like @option{-fstack-protector} but only protects those functions which
10456 have the @code{stack_protect} attribute.
10457
10458 @item -fstack-check
10459 @opindex fstack-check
10460 Generate code to verify that you do not go beyond the boundary of the
10461 stack. You should specify this flag if you are running in an
10462 environment with multiple threads, but you only rarely need to specify it in
10463 a single-threaded environment since stack overflow is automatically
10464 detected on nearly all systems if there is only one stack.
10465
10466 Note that this switch does not actually cause checking to be done; the
10467 operating system or the language runtime must do that. The switch causes
10468 generation of code to ensure that they see the stack being extended.
10469
10470 You can additionally specify a string parameter: @samp{no} means no
10471 checking, @samp{generic} means force the use of old-style checking,
10472 @samp{specific} means use the best checking method and is equivalent
10473 to bare @option{-fstack-check}.
10474
10475 Old-style checking is a generic mechanism that requires no specific
10476 target support in the compiler but comes with the following drawbacks:
10477
10478 @enumerate
10479 @item
10480 Modified allocation strategy for large objects: they are always
10481 allocated dynamically if their size exceeds a fixed threshold.
10482
10483 @item
10484 Fixed limit on the size of the static frame of functions: when it is
10485 topped by a particular function, stack checking is not reliable and
10486 a warning is issued by the compiler.
10487
10488 @item
10489 Inefficiency: because of both the modified allocation strategy and the
10490 generic implementation, code performance is hampered.
10491 @end enumerate
10492
10493 Note that old-style stack checking is also the fallback method for
10494 @samp{specific} if no target support has been added in the compiler.
10495
10496 @item -fstack-limit-register=@var{reg}
10497 @itemx -fstack-limit-symbol=@var{sym}
10498 @itemx -fno-stack-limit
10499 @opindex fstack-limit-register
10500 @opindex fstack-limit-symbol
10501 @opindex fno-stack-limit
10502 Generate code to ensure that the stack does not grow beyond a certain value,
10503 either the value of a register or the address of a symbol. If a larger
10504 stack is required, a signal is raised at run time. For most targets,
10505 the signal is raised before the stack overruns the boundary, so
10506 it is possible to catch the signal without taking special precautions.
10507
10508 For instance, if the stack starts at absolute address @samp{0x80000000}
10509 and grows downwards, you can use the flags
10510 @option{-fstack-limit-symbol=__stack_limit} and
10511 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10512 of 128KB@. Note that this may only work with the GNU linker.
10513
10514 You can locally override stack limit checking by using the
10515 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
10516
10517 @item -fsplit-stack
10518 @opindex fsplit-stack
10519 Generate code to automatically split the stack before it overflows.
10520 The resulting program has a discontiguous stack which can only
10521 overflow if the program is unable to allocate any more memory. This
10522 is most useful when running threaded programs, as it is no longer
10523 necessary to calculate a good stack size to use for each thread. This
10524 is currently only implemented for the x86 targets running
10525 GNU/Linux.
10526
10527 When code compiled with @option{-fsplit-stack} calls code compiled
10528 without @option{-fsplit-stack}, there may not be much stack space
10529 available for the latter code to run. If compiling all code,
10530 including library code, with @option{-fsplit-stack} is not an option,
10531 then the linker can fix up these calls so that the code compiled
10532 without @option{-fsplit-stack} always has a large stack. Support for
10533 this is implemented in the gold linker in GNU binutils release 2.21
10534 and later.
10535
10536 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
10537 @opindex fvtable-verify
10538 This option is only available when compiling C++ code.
10539 It turns on (or off, if using @option{-fvtable-verify=none}) the security
10540 feature that verifies at run time, for every virtual call, that
10541 the vtable pointer through which the call is made is valid for the type of
10542 the object, and has not been corrupted or overwritten. If an invalid vtable
10543 pointer is detected at run time, an error is reported and execution of the
10544 program is immediately halted.
10545
10546 This option causes run-time data structures to be built at program startup,
10547 which are used for verifying the vtable pointers.
10548 The options @samp{std} and @samp{preinit}
10549 control the timing of when these data structures are built. In both cases the
10550 data structures are built before execution reaches @code{main}. Using
10551 @option{-fvtable-verify=std} causes the data structures to be built after
10552 shared libraries have been loaded and initialized.
10553 @option{-fvtable-verify=preinit} causes them to be built before shared
10554 libraries have been loaded and initialized.
10555
10556 If this option appears multiple times in the command line with different
10557 values specified, @samp{none} takes highest priority over both @samp{std} and
10558 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
10559
10560 @item -fvtv-debug
10561 @opindex fvtv-debug
10562 When used in conjunction with @option{-fvtable-verify=std} or
10563 @option{-fvtable-verify=preinit}, causes debug versions of the
10564 runtime functions for the vtable verification feature to be called.
10565 This flag also causes the compiler to log information about which
10566 vtable pointers it finds for each class.
10567 This information is written to a file named @file{vtv_set_ptr_data.log}
10568 in the directory named by the environment variable @env{VTV_LOGS_DIR}
10569 if that is defined or the current working directory otherwise.
10570
10571 Note: This feature @emph{appends} data to the log file. If you want a fresh log
10572 file, be sure to delete any existing one.
10573
10574 @item -fvtv-counts
10575 @opindex fvtv-counts
10576 This is a debugging flag. When used in conjunction with
10577 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
10578 causes the compiler to keep track of the total number of virtual calls
10579 it encounters and the number of verifications it inserts. It also
10580 counts the number of calls to certain run-time library functions
10581 that it inserts and logs this information for each compilation unit.
10582 The compiler writes this information to a file named
10583 @file{vtv_count_data.log} in the directory named by the environment
10584 variable @env{VTV_LOGS_DIR} if that is defined or the current working
10585 directory otherwise. It also counts the size of the vtable pointer sets
10586 for each class, and writes this information to @file{vtv_class_set_sizes.log}
10587 in the same directory.
10588
10589 Note: This feature @emph{appends} data to the log files. To get fresh log
10590 files, be sure to delete any existing ones.
10591
10592 @item -finstrument-functions
10593 @opindex finstrument-functions
10594 Generate instrumentation calls for entry and exit to functions. Just
10595 after function entry and just before function exit, the following
10596 profiling functions are called with the address of the current
10597 function and its call site. (On some platforms,
10598 @code{__builtin_return_address} does not work beyond the current
10599 function, so the call site information may not be available to the
10600 profiling functions otherwise.)
10601
10602 @smallexample
10603 void __cyg_profile_func_enter (void *this_fn,
10604 void *call_site);
10605 void __cyg_profile_func_exit (void *this_fn,
10606 void *call_site);
10607 @end smallexample
10608
10609 The first argument is the address of the start of the current function,
10610 which may be looked up exactly in the symbol table.
10611
10612 This instrumentation is also done for functions expanded inline in other
10613 functions. The profiling calls indicate where, conceptually, the
10614 inline function is entered and exited. This means that addressable
10615 versions of such functions must be available. If all your uses of a
10616 function are expanded inline, this may mean an additional expansion of
10617 code size. If you use @code{extern inline} in your C code, an
10618 addressable version of such functions must be provided. (This is
10619 normally the case anyway, but if you get lucky and the optimizer always
10620 expands the functions inline, you might have gotten away without
10621 providing static copies.)
10622
10623 A function may be given the attribute @code{no_instrument_function}, in
10624 which case this instrumentation is not done. This can be used, for
10625 example, for the profiling functions listed above, high-priority
10626 interrupt routines, and any functions from which the profiling functions
10627 cannot safely be called (perhaps signal handlers, if the profiling
10628 routines generate output or allocate memory).
10629
10630 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
10631 @opindex finstrument-functions-exclude-file-list
10632
10633 Set the list of functions that are excluded from instrumentation (see
10634 the description of @option{-finstrument-functions}). If the file that
10635 contains a function definition matches with one of @var{file}, then
10636 that function is not instrumented. The match is done on substrings:
10637 if the @var{file} parameter is a substring of the file name, it is
10638 considered to be a match.
10639
10640 For example:
10641
10642 @smallexample
10643 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
10644 @end smallexample
10645
10646 @noindent
10647 excludes any inline function defined in files whose pathnames
10648 contain @file{/bits/stl} or @file{include/sys}.
10649
10650 If, for some reason, you want to include letter @samp{,} in one of
10651 @var{sym}, write @samp{\,}. For example,
10652 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
10653 (note the single quote surrounding the option).
10654
10655 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
10656 @opindex finstrument-functions-exclude-function-list
10657
10658 This is similar to @option{-finstrument-functions-exclude-file-list},
10659 but this option sets the list of function names to be excluded from
10660 instrumentation. The function name to be matched is its user-visible
10661 name, such as @code{vector<int> blah(const vector<int> &)}, not the
10662 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
10663 match is done on substrings: if the @var{sym} parameter is a substring
10664 of the function name, it is considered to be a match. For C99 and C++
10665 extended identifiers, the function name must be given in UTF-8, not
10666 using universal character names.
10667
10668 @end table
10669
10670
10671 @node Preprocessor Options
10672 @section Options Controlling the Preprocessor
10673 @cindex preprocessor options
10674 @cindex options, preprocessor
10675
10676 These options control the C preprocessor, which is run on each C source
10677 file before actual compilation.
10678
10679 If you use the @option{-E} option, nothing is done except preprocessing.
10680 Some of these options make sense only together with @option{-E} because
10681 they cause the preprocessor output to be unsuitable for actual
10682 compilation.
10683
10684 @table @gcctabopt
10685 @item -Wp,@var{option}
10686 @opindex Wp
10687 You can use @option{-Wp,@var{option}} to bypass the compiler driver
10688 and pass @var{option} directly through to the preprocessor. If
10689 @var{option} contains commas, it is split into multiple options at the
10690 commas. However, many options are modified, translated or interpreted
10691 by the compiler driver before being passed to the preprocessor, and
10692 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
10693 interface is undocumented and subject to change, so whenever possible
10694 you should avoid using @option{-Wp} and let the driver handle the
10695 options instead.
10696
10697 @item -Xpreprocessor @var{option}
10698 @opindex Xpreprocessor
10699 Pass @var{option} as an option to the preprocessor. You can use this to
10700 supply system-specific preprocessor options that GCC does not
10701 recognize.
10702
10703 If you want to pass an option that takes an argument, you must use
10704 @option{-Xpreprocessor} twice, once for the option and once for the argument.
10705
10706 @item -no-integrated-cpp
10707 @opindex no-integrated-cpp
10708 Perform preprocessing as a separate pass before compilation.
10709 By default, GCC performs preprocessing as an integrated part of
10710 input tokenization and parsing.
10711 If this option is provided, the appropriate language front end
10712 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
10713 and Objective-C, respectively) is instead invoked twice,
10714 once for preprocessing only and once for actual compilation
10715 of the preprocessed input.
10716 This option may be useful in conjunction with the @option{-B} or
10717 @option{-wrapper} options to specify an alternate preprocessor or
10718 perform additional processing of the program source between
10719 normal preprocessing and compilation.
10720 @end table
10721
10722 @include cppopts.texi
10723
10724 @node Assembler Options
10725 @section Passing Options to the Assembler
10726
10727 @c prevent bad page break with this line
10728 You can pass options to the assembler.
10729
10730 @table @gcctabopt
10731 @item -Wa,@var{option}
10732 @opindex Wa
10733 Pass @var{option} as an option to the assembler. If @var{option}
10734 contains commas, it is split into multiple options at the commas.
10735
10736 @item -Xassembler @var{option}
10737 @opindex Xassembler
10738 Pass @var{option} as an option to the assembler. You can use this to
10739 supply system-specific assembler options that GCC does not
10740 recognize.
10741
10742 If you want to pass an option that takes an argument, you must use
10743 @option{-Xassembler} twice, once for the option and once for the argument.
10744
10745 @end table
10746
10747 @node Link Options
10748 @section Options for Linking
10749 @cindex link options
10750 @cindex options, linking
10751
10752 These options come into play when the compiler links object files into
10753 an executable output file. They are meaningless if the compiler is
10754 not doing a link step.
10755
10756 @table @gcctabopt
10757 @cindex file names
10758 @item @var{object-file-name}
10759 A file name that does not end in a special recognized suffix is
10760 considered to name an object file or library. (Object files are
10761 distinguished from libraries by the linker according to the file
10762 contents.) If linking is done, these object files are used as input
10763 to the linker.
10764
10765 @item -c
10766 @itemx -S
10767 @itemx -E
10768 @opindex c
10769 @opindex S
10770 @opindex E
10771 If any of these options is used, then the linker is not run, and
10772 object file names should not be used as arguments. @xref{Overall
10773 Options}.
10774
10775 @item -fuse-ld=bfd
10776 @opindex fuse-ld=bfd
10777 Use the @command{bfd} linker instead of the default linker.
10778
10779 @item -fuse-ld=gold
10780 @opindex fuse-ld=gold
10781 Use the @command{gold} linker instead of the default linker.
10782
10783 @cindex Libraries
10784 @item -l@var{library}
10785 @itemx -l @var{library}
10786 @opindex l
10787 Search the library named @var{library} when linking. (The second
10788 alternative with the library as a separate argument is only for
10789 POSIX compliance and is not recommended.)
10790
10791 It makes a difference where in the command you write this option; the
10792 linker searches and processes libraries and object files in the order they
10793 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
10794 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
10795 to functions in @samp{z}, those functions may not be loaded.
10796
10797 The linker searches a standard list of directories for the library,
10798 which is actually a file named @file{lib@var{library}.a}. The linker
10799 then uses this file as if it had been specified precisely by name.
10800
10801 The directories searched include several standard system directories
10802 plus any that you specify with @option{-L}.
10803
10804 Normally the files found this way are library files---archive files
10805 whose members are object files. The linker handles an archive file by
10806 scanning through it for members which define symbols that have so far
10807 been referenced but not defined. But if the file that is found is an
10808 ordinary object file, it is linked in the usual fashion. The only
10809 difference between using an @option{-l} option and specifying a file name
10810 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
10811 and searches several directories.
10812
10813 @item -lobjc
10814 @opindex lobjc
10815 You need this special case of the @option{-l} option in order to
10816 link an Objective-C or Objective-C++ program.
10817
10818 @item -nostartfiles
10819 @opindex nostartfiles
10820 Do not use the standard system startup files when linking.
10821 The standard system libraries are used normally, unless @option{-nostdlib}
10822 or @option{-nodefaultlibs} is used.
10823
10824 @item -nodefaultlibs
10825 @opindex nodefaultlibs
10826 Do not use the standard system libraries when linking.
10827 Only the libraries you specify are passed to the linker, and options
10828 specifying linkage of the system libraries, such as @option{-static-libgcc}
10829 or @option{-shared-libgcc}, are ignored.
10830 The standard startup files are used normally, unless @option{-nostartfiles}
10831 is used.
10832
10833 The compiler may generate calls to @code{memcmp},
10834 @code{memset}, @code{memcpy} and @code{memmove}.
10835 These entries are usually resolved by entries in
10836 libc. These entry points should be supplied through some other
10837 mechanism when this option is specified.
10838
10839 @item -nostdlib
10840 @opindex nostdlib
10841 Do not use the standard system startup files or libraries when linking.
10842 No startup files and only the libraries you specify are passed to
10843 the linker, and options specifying linkage of the system libraries, such as
10844 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
10845
10846 The compiler may generate calls to @code{memcmp}, @code{memset},
10847 @code{memcpy} and @code{memmove}.
10848 These entries are usually resolved by entries in
10849 libc. These entry points should be supplied through some other
10850 mechanism when this option is specified.
10851
10852 @cindex @option{-lgcc}, use with @option{-nostdlib}
10853 @cindex @option{-nostdlib} and unresolved references
10854 @cindex unresolved references and @option{-nostdlib}
10855 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
10856 @cindex @option{-nodefaultlibs} and unresolved references
10857 @cindex unresolved references and @option{-nodefaultlibs}
10858 One of the standard libraries bypassed by @option{-nostdlib} and
10859 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
10860 which GCC uses to overcome shortcomings of particular machines, or special
10861 needs for some languages.
10862 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
10863 Collection (GCC) Internals},
10864 for more discussion of @file{libgcc.a}.)
10865 In most cases, you need @file{libgcc.a} even when you want to avoid
10866 other standard libraries. In other words, when you specify @option{-nostdlib}
10867 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
10868 This ensures that you have no unresolved references to internal GCC
10869 library subroutines.
10870 (An example of such an internal subroutine is @code{__main}, used to ensure C++
10871 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
10872 GNU Compiler Collection (GCC) Internals}.)
10873
10874 @item -pie
10875 @opindex pie
10876 Produce a position independent executable on targets that support it.
10877 For predictable results, you must also specify the same set of options
10878 used for compilation (@option{-fpie}, @option{-fPIE},
10879 or model suboptions) when you specify this linker option.
10880
10881 @item -no-pie
10882 @opindex no-pie
10883 Don't produce a position independent executable.
10884
10885 @item -rdynamic
10886 @opindex rdynamic
10887 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
10888 that support it. This instructs the linker to add all symbols, not
10889 only used ones, to the dynamic symbol table. This option is needed
10890 for some uses of @code{dlopen} or to allow obtaining backtraces
10891 from within a program.
10892
10893 @item -s
10894 @opindex s
10895 Remove all symbol table and relocation information from the executable.
10896
10897 @item -static
10898 @opindex static
10899 On systems that support dynamic linking, this prevents linking with the shared
10900 libraries. On other systems, this option has no effect.
10901
10902 @item -shared
10903 @opindex shared
10904 Produce a shared object which can then be linked with other objects to
10905 form an executable. Not all systems support this option. For predictable
10906 results, you must also specify the same set of options used for compilation
10907 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
10908 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
10909 needs to build supplementary stub code for constructors to work. On
10910 multi-libbed systems, @samp{gcc -shared} must select the correct support
10911 libraries to link against. Failing to supply the correct flags may lead
10912 to subtle defects. Supplying them in cases where they are not necessary
10913 is innocuous.}
10914
10915 @item -shared-libgcc
10916 @itemx -static-libgcc
10917 @opindex shared-libgcc
10918 @opindex static-libgcc
10919 On systems that provide @file{libgcc} as a shared library, these options
10920 force the use of either the shared or static version, respectively.
10921 If no shared version of @file{libgcc} was built when the compiler was
10922 configured, these options have no effect.
10923
10924 There are several situations in which an application should use the
10925 shared @file{libgcc} instead of the static version. The most common
10926 of these is when the application wishes to throw and catch exceptions
10927 across different shared libraries. In that case, each of the libraries
10928 as well as the application itself should use the shared @file{libgcc}.
10929
10930 Therefore, the G++ and GCJ drivers automatically add
10931 @option{-shared-libgcc} whenever you build a shared library or a main
10932 executable, because C++ and Java programs typically use exceptions, so
10933 this is the right thing to do.
10934
10935 If, instead, you use the GCC driver to create shared libraries, you may
10936 find that they are not always linked with the shared @file{libgcc}.
10937 If GCC finds, at its configuration time, that you have a non-GNU linker
10938 or a GNU linker that does not support option @option{--eh-frame-hdr},
10939 it links the shared version of @file{libgcc} into shared libraries
10940 by default. Otherwise, it takes advantage of the linker and optimizes
10941 away the linking with the shared version of @file{libgcc}, linking with
10942 the static version of libgcc by default. This allows exceptions to
10943 propagate through such shared libraries, without incurring relocation
10944 costs at library load time.
10945
10946 However, if a library or main executable is supposed to throw or catch
10947 exceptions, you must link it using the G++ or GCJ driver, as appropriate
10948 for the languages used in the program, or using the option
10949 @option{-shared-libgcc}, such that it is linked with the shared
10950 @file{libgcc}.
10951
10952 @item -static-libasan
10953 @opindex static-libasan
10954 When the @option{-fsanitize=address} option is used to link a program,
10955 the GCC driver automatically links against @option{libasan}. If
10956 @file{libasan} is available as a shared library, and the @option{-static}
10957 option is not used, then this links against the shared version of
10958 @file{libasan}. The @option{-static-libasan} option directs the GCC
10959 driver to link @file{libasan} statically, without necessarily linking
10960 other libraries statically.
10961
10962 @item -static-libtsan
10963 @opindex static-libtsan
10964 When the @option{-fsanitize=thread} option is used to link a program,
10965 the GCC driver automatically links against @option{libtsan}. If
10966 @file{libtsan} is available as a shared library, and the @option{-static}
10967 option is not used, then this links against the shared version of
10968 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
10969 driver to link @file{libtsan} statically, without necessarily linking
10970 other libraries statically.
10971
10972 @item -static-liblsan
10973 @opindex static-liblsan
10974 When the @option{-fsanitize=leak} option is used to link a program,
10975 the GCC driver automatically links against @option{liblsan}. If
10976 @file{liblsan} is available as a shared library, and the @option{-static}
10977 option is not used, then this links against the shared version of
10978 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
10979 driver to link @file{liblsan} statically, without necessarily linking
10980 other libraries statically.
10981
10982 @item -static-libubsan
10983 @opindex static-libubsan
10984 When the @option{-fsanitize=undefined} option is used to link a program,
10985 the GCC driver automatically links against @option{libubsan}. If
10986 @file{libubsan} is available as a shared library, and the @option{-static}
10987 option is not used, then this links against the shared version of
10988 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
10989 driver to link @file{libubsan} statically, without necessarily linking
10990 other libraries statically.
10991
10992 @item -static-libmpx
10993 @opindex static-libmpx
10994 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
10995 used to link a program, the GCC driver automatically links against
10996 @file{libmpx}. If @file{libmpx} is available as a shared library,
10997 and the @option{-static} option is not used, then this links against
10998 the shared version of @file{libmpx}. The @option{-static-libmpx}
10999 option directs the GCC driver to link @file{libmpx} statically,
11000 without necessarily linking other libraries statically.
11001
11002 @item -static-libmpxwrappers
11003 @opindex static-libmpxwrappers
11004 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
11005 to link a program without also using @option{-fno-chkp-use-wrappers}, the
11006 GCC driver automatically links against @file{libmpxwrappers}. If
11007 @file{libmpxwrappers} is available as a shared library, and the
11008 @option{-static} option is not used, then this links against the shared
11009 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
11010 option directs the GCC driver to link @file{libmpxwrappers} statically,
11011 without necessarily linking other libraries statically.
11012
11013 @item -static-libstdc++
11014 @opindex static-libstdc++
11015 When the @command{g++} program is used to link a C++ program, it
11016 normally automatically links against @option{libstdc++}. If
11017 @file{libstdc++} is available as a shared library, and the
11018 @option{-static} option is not used, then this links against the
11019 shared version of @file{libstdc++}. That is normally fine. However, it
11020 is sometimes useful to freeze the version of @file{libstdc++} used by
11021 the program without going all the way to a fully static link. The
11022 @option{-static-libstdc++} option directs the @command{g++} driver to
11023 link @file{libstdc++} statically, without necessarily linking other
11024 libraries statically.
11025
11026 @item -symbolic
11027 @opindex symbolic
11028 Bind references to global symbols when building a shared object. Warn
11029 about any unresolved references (unless overridden by the link editor
11030 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
11031 this option.
11032
11033 @item -T @var{script}
11034 @opindex T
11035 @cindex linker script
11036 Use @var{script} as the linker script. This option is supported by most
11037 systems using the GNU linker. On some targets, such as bare-board
11038 targets without an operating system, the @option{-T} option may be required
11039 when linking to avoid references to undefined symbols.
11040
11041 @item -Xlinker @var{option}
11042 @opindex Xlinker
11043 Pass @var{option} as an option to the linker. You can use this to
11044 supply system-specific linker options that GCC does not recognize.
11045
11046 If you want to pass an option that takes a separate argument, you must use
11047 @option{-Xlinker} twice, once for the option and once for the argument.
11048 For example, to pass @option{-assert definitions}, you must write
11049 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
11050 @option{-Xlinker "-assert definitions"}, because this passes the entire
11051 string as a single argument, which is not what the linker expects.
11052
11053 When using the GNU linker, it is usually more convenient to pass
11054 arguments to linker options using the @option{@var{option}=@var{value}}
11055 syntax than as separate arguments. For example, you can specify
11056 @option{-Xlinker -Map=output.map} rather than
11057 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
11058 this syntax for command-line options.
11059
11060 @item -Wl,@var{option}
11061 @opindex Wl
11062 Pass @var{option} as an option to the linker. If @var{option} contains
11063 commas, it is split into multiple options at the commas. You can use this
11064 syntax to pass an argument to the option.
11065 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
11066 linker. When using the GNU linker, you can also get the same effect with
11067 @option{-Wl,-Map=output.map}.
11068
11069 @item -u @var{symbol}
11070 @opindex u
11071 Pretend the symbol @var{symbol} is undefined, to force linking of
11072 library modules to define it. You can use @option{-u} multiple times with
11073 different symbols to force loading of additional library modules.
11074
11075 @item -z @var{keyword}
11076 @opindex z
11077 @option{-z} is passed directly on to the linker along with the keyword
11078 @var{keyword}. See the section in the documentation of your linker for
11079 permitted values and their meanings.
11080 @end table
11081
11082 @node Directory Options
11083 @section Options for Directory Search
11084 @cindex directory options
11085 @cindex options, directory search
11086 @cindex search path
11087
11088 These options specify directories to search for header files, for
11089 libraries and for parts of the compiler:
11090
11091 @table @gcctabopt
11092 @item -I@var{dir}
11093 @opindex I
11094 Add the directory @var{dir} to the head of the list of directories to be
11095 searched for header files. This can be used to override a system header
11096 file, substituting your own version, since these directories are
11097 searched before the system header file directories. However, you should
11098 not use this option to add directories that contain vendor-supplied
11099 system header files (use @option{-isystem} for that). If you use more than
11100 one @option{-I} option, the directories are scanned in left-to-right
11101 order; the standard system directories come after.
11102
11103 If a standard system include directory, or a directory specified with
11104 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
11105 option is ignored. The directory is still searched but as a
11106 system directory at its normal position in the system include chain.
11107 This is to ensure that GCC's procedure to fix buggy system headers and
11108 the ordering for the @code{include_next} directive are not inadvertently changed.
11109 If you really need to change the search order for system directories,
11110 use the @option{-nostdinc} and/or @option{-isystem} options.
11111
11112 @item -iplugindir=@var{dir}
11113 @opindex iplugindir=
11114 Set the directory to search for plugins that are passed
11115 by @option{-fplugin=@var{name}} instead of
11116 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
11117 to be used by the user, but only passed by the driver.
11118
11119 @item -iquote@var{dir}
11120 @opindex iquote
11121 Add the directory @var{dir} to the head of the list of directories to
11122 be searched for header files only for the case of @code{#include
11123 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
11124 otherwise just like @option{-I}.
11125
11126 @item -L@var{dir}
11127 @opindex L
11128 Add directory @var{dir} to the list of directories to be searched
11129 for @option{-l}.
11130
11131 @item -B@var{prefix}
11132 @opindex B
11133 This option specifies where to find the executables, libraries,
11134 include files, and data files of the compiler itself.
11135
11136 The compiler driver program runs one or more of the subprograms
11137 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
11138 @var{prefix} as a prefix for each program it tries to run, both with and
11139 without @samp{@var{machine}/@var{version}/} for the corresponding target
11140 machine and compiler version.
11141
11142 For each subprogram to be run, the compiler driver first tries the
11143 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
11144 is not specified, the driver tries two standard prefixes,
11145 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
11146 those results in a file name that is found, the unmodified program
11147 name is searched for using the directories specified in your
11148 @env{PATH} environment variable.
11149
11150 The compiler checks to see if the path provided by @option{-B}
11151 refers to a directory, and if necessary it adds a directory
11152 separator character at the end of the path.
11153
11154 @option{-B} prefixes that effectively specify directory names also apply
11155 to libraries in the linker, because the compiler translates these
11156 options into @option{-L} options for the linker. They also apply to
11157 include files in the preprocessor, because the compiler translates these
11158 options into @option{-isystem} options for the preprocessor. In this case,
11159 the compiler appends @samp{include} to the prefix.
11160
11161 The runtime support file @file{libgcc.a} can also be searched for using
11162 the @option{-B} prefix, if needed. If it is not found there, the two
11163 standard prefixes above are tried, and that is all. The file is left
11164 out of the link if it is not found by those means.
11165
11166 Another way to specify a prefix much like the @option{-B} prefix is to use
11167 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
11168 Variables}.
11169
11170 As a special kludge, if the path provided by @option{-B} is
11171 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
11172 9, then it is replaced by @file{[dir/]include}. This is to help
11173 with boot-strapping the compiler.
11174
11175 @item -no-canonical-prefixes
11176 @opindex no-canonical-prefixes
11177 Do not expand any symbolic links, resolve references to @samp{/../}
11178 or @samp{/./}, or make the path absolute when generating a relative
11179 prefix.
11180
11181 @item --sysroot=@var{dir}
11182 @opindex sysroot
11183 Use @var{dir} as the logical root directory for headers and libraries.
11184 For example, if the compiler normally searches for headers in
11185 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
11186 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
11187
11188 If you use both this option and the @option{-isysroot} option, then
11189 the @option{--sysroot} option applies to libraries, but the
11190 @option{-isysroot} option applies to header files.
11191
11192 The GNU linker (beginning with version 2.16) has the necessary support
11193 for this option. If your linker does not support this option, the
11194 header file aspect of @option{--sysroot} still works, but the
11195 library aspect does not.
11196
11197 @item --no-sysroot-suffix
11198 @opindex no-sysroot-suffix
11199 For some targets, a suffix is added to the root directory specified
11200 with @option{--sysroot}, depending on the other options used, so that
11201 headers may for example be found in
11202 @file{@var{dir}/@var{suffix}/usr/include} instead of
11203 @file{@var{dir}/usr/include}. This option disables the addition of
11204 such a suffix.
11205
11206 @item -I-
11207 @opindex I-
11208 This option has been deprecated. Please use @option{-iquote} instead for
11209 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
11210 option.
11211 Any directories you specify with @option{-I} options before the @option{-I-}
11212 option are searched only for the case of @code{#include "@var{file}"};
11213 they are not searched for @code{#include <@var{file}>}.
11214
11215 If additional directories are specified with @option{-I} options after
11216 the @option{-I-} option, these directories are searched for all @code{#include}
11217 directives. (Ordinarily @emph{all} @option{-I} directories are used
11218 this way.)
11219
11220 In addition, the @option{-I-} option inhibits the use of the current
11221 directory (where the current input file came from) as the first search
11222 directory for @code{#include "@var{file}"}. There is no way to
11223 override this effect of @option{-I-}. With @option{-I.} you can specify
11224 searching the directory that is current when the compiler is
11225 invoked. That is not exactly the same as what the preprocessor does
11226 by default, but it is often satisfactory.
11227
11228 @option{-I-} does not inhibit the use of the standard system directories
11229 for header files. Thus, @option{-I-} and @option{-nostdinc} are
11230 independent.
11231 @end table
11232
11233 @node Code Gen Options
11234 @section Options for Code Generation Conventions
11235 @cindex code generation conventions
11236 @cindex options, code generation
11237 @cindex run-time options
11238
11239 These machine-independent options control the interface conventions
11240 used in code generation.
11241
11242 Most of them have both positive and negative forms; the negative form
11243 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
11244 one of the forms is listed---the one that is not the default. You
11245 can figure out the other form by either removing @samp{no-} or adding
11246 it.
11247
11248 @table @gcctabopt
11249 @item -fstack-reuse=@var{reuse-level}
11250 @opindex fstack_reuse
11251 This option controls stack space reuse for user declared local/auto variables
11252 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
11253 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
11254 local variables and temporaries, @samp{named_vars} enables the reuse only for
11255 user defined local variables with names, and @samp{none} disables stack reuse
11256 completely. The default value is @samp{all}. The option is needed when the
11257 program extends the lifetime of a scoped local variable or a compiler generated
11258 temporary beyond the end point defined by the language. When a lifetime of
11259 a variable ends, and if the variable lives in memory, the optimizing compiler
11260 has the freedom to reuse its stack space with other temporaries or scoped
11261 local variables whose live range does not overlap with it. Legacy code extending
11262 local lifetime is likely to break with the stack reuse optimization.
11263
11264 For example,
11265
11266 @smallexample
11267 int *p;
11268 @{
11269 int local1;
11270
11271 p = &local1;
11272 local1 = 10;
11273 ....
11274 @}
11275 @{
11276 int local2;
11277 local2 = 20;
11278 ...
11279 @}
11280
11281 if (*p == 10) // out of scope use of local1
11282 @{
11283
11284 @}
11285 @end smallexample
11286
11287 Another example:
11288 @smallexample
11289
11290 struct A
11291 @{
11292 A(int k) : i(k), j(k) @{ @}
11293 int i;
11294 int j;
11295 @};
11296
11297 A *ap;
11298
11299 void foo(const A& ar)
11300 @{
11301 ap = &ar;
11302 @}
11303
11304 void bar()
11305 @{
11306 foo(A(10)); // temp object's lifetime ends when foo returns
11307
11308 @{
11309 A a(20);
11310 ....
11311 @}
11312 ap->i+= 10; // ap references out of scope temp whose space
11313 // is reused with a. What is the value of ap->i?
11314 @}
11315
11316 @end smallexample
11317
11318 The lifetime of a compiler generated temporary is well defined by the C++
11319 standard. When a lifetime of a temporary ends, and if the temporary lives
11320 in memory, the optimizing compiler has the freedom to reuse its stack
11321 space with other temporaries or scoped local variables whose live range
11322 does not overlap with it. However some of the legacy code relies on
11323 the behavior of older compilers in which temporaries' stack space is
11324 not reused, the aggressive stack reuse can lead to runtime errors. This
11325 option is used to control the temporary stack reuse optimization.
11326
11327 @item -ftrapv
11328 @opindex ftrapv
11329 This option generates traps for signed overflow on addition, subtraction,
11330 multiplication operations.
11331 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11332 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11333 @option{-fwrapv} being effective. Note that only active options override, so
11334 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11335 results in @option{-ftrapv} being effective.
11336
11337 @item -fwrapv
11338 @opindex fwrapv
11339 This option instructs the compiler to assume that signed arithmetic
11340 overflow of addition, subtraction and multiplication wraps around
11341 using twos-complement representation. This flag enables some optimizations
11342 and disables others. This option is enabled by default for the Java
11343 front end, as required by the Java language specification.
11344 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11345 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11346 @option{-fwrapv} being effective. Note that only active options override, so
11347 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11348 results in @option{-ftrapv} being effective.
11349
11350 @item -fexceptions
11351 @opindex fexceptions
11352 Enable exception handling. Generates extra code needed to propagate
11353 exceptions. For some targets, this implies GCC generates frame
11354 unwind information for all functions, which can produce significant data
11355 size overhead, although it does not affect execution. If you do not
11356 specify this option, GCC enables it by default for languages like
11357 C++ that normally require exception handling, and disables it for
11358 languages like C that do not normally require it. However, you may need
11359 to enable this option when compiling C code that needs to interoperate
11360 properly with exception handlers written in C++. You may also wish to
11361 disable this option if you are compiling older C++ programs that don't
11362 use exception handling.
11363
11364 @item -fnon-call-exceptions
11365 @opindex fnon-call-exceptions
11366 Generate code that allows trapping instructions to throw exceptions.
11367 Note that this requires platform-specific runtime support that does
11368 not exist everywhere. Moreover, it only allows @emph{trapping}
11369 instructions to throw exceptions, i.e.@: memory references or floating-point
11370 instructions. It does not allow exceptions to be thrown from
11371 arbitrary signal handlers such as @code{SIGALRM}.
11372
11373 @item -fdelete-dead-exceptions
11374 @opindex fdelete-dead-exceptions
11375 Consider that instructions that may throw exceptions but don't otherwise
11376 contribute to the execution of the program can be optimized away.
11377 This option is enabled by default for the Ada front end, as permitted by
11378 the Ada language specification.
11379 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
11380
11381 @item -funwind-tables
11382 @opindex funwind-tables
11383 Similar to @option{-fexceptions}, except that it just generates any needed
11384 static data, but does not affect the generated code in any other way.
11385 You normally do not need to enable this option; instead, a language processor
11386 that needs this handling enables it on your behalf.
11387
11388 @item -fasynchronous-unwind-tables
11389 @opindex fasynchronous-unwind-tables
11390 Generate unwind table in DWARF format, if supported by target machine. The
11391 table is exact at each instruction boundary, so it can be used for stack
11392 unwinding from asynchronous events (such as debugger or garbage collector).
11393
11394 @item -fno-gnu-unique
11395 @opindex fno-gnu-unique
11396 On systems with recent GNU assembler and C library, the C++ compiler
11397 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
11398 of template static data members and static local variables in inline
11399 functions are unique even in the presence of @code{RTLD_LOCAL}; this
11400 is necessary to avoid problems with a library used by two different
11401 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
11402 therefore disagreeing with the other one about the binding of the
11403 symbol. But this causes @code{dlclose} to be ignored for affected
11404 DSOs; if your program relies on reinitialization of a DSO via
11405 @code{dlclose} and @code{dlopen}, you can use
11406 @option{-fno-gnu-unique}.
11407
11408 @item -fpcc-struct-return
11409 @opindex fpcc-struct-return
11410 Return ``short'' @code{struct} and @code{union} values in memory like
11411 longer ones, rather than in registers. This convention is less
11412 efficient, but it has the advantage of allowing intercallability between
11413 GCC-compiled files and files compiled with other compilers, particularly
11414 the Portable C Compiler (pcc).
11415
11416 The precise convention for returning structures in memory depends
11417 on the target configuration macros.
11418
11419 Short structures and unions are those whose size and alignment match
11420 that of some integer type.
11421
11422 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11423 switch is not binary compatible with code compiled with the
11424 @option{-freg-struct-return} switch.
11425 Use it to conform to a non-default application binary interface.
11426
11427 @item -freg-struct-return
11428 @opindex freg-struct-return
11429 Return @code{struct} and @code{union} values in registers when possible.
11430 This is more efficient for small structures than
11431 @option{-fpcc-struct-return}.
11432
11433 If you specify neither @option{-fpcc-struct-return} nor
11434 @option{-freg-struct-return}, GCC defaults to whichever convention is
11435 standard for the target. If there is no standard convention, GCC
11436 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11437 the principal compiler. In those cases, we can choose the standard, and
11438 we chose the more efficient register return alternative.
11439
11440 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11441 switch is not binary compatible with code compiled with the
11442 @option{-fpcc-struct-return} switch.
11443 Use it to conform to a non-default application binary interface.
11444
11445 @item -fshort-enums
11446 @opindex fshort-enums
11447 Allocate to an @code{enum} type only as many bytes as it needs for the
11448 declared range of possible values. Specifically, the @code{enum} type
11449 is equivalent to the smallest integer type that has enough room.
11450
11451 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11452 code that is not binary compatible with code generated without that switch.
11453 Use it to conform to a non-default application binary interface.
11454
11455 @item -fshort-wchar
11456 @opindex fshort-wchar
11457 Override the underlying type for @code{wchar_t} to be @code{short
11458 unsigned int} instead of the default for the target. This option is
11459 useful for building programs to run under WINE@.
11460
11461 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11462 code that is not binary compatible with code generated without that switch.
11463 Use it to conform to a non-default application binary interface.
11464
11465 @item -fno-common
11466 @opindex fno-common
11467 In C code, controls the placement of uninitialized global variables.
11468 Unix C compilers have traditionally permitted multiple definitions of
11469 such variables in different compilation units by placing the variables
11470 in a common block.
11471 This is the behavior specified by @option{-fcommon}, and is the default
11472 for GCC on most targets.
11473 On the other hand, this behavior is not required by ISO C, and on some
11474 targets may carry a speed or code size penalty on variable references.
11475 The @option{-fno-common} option specifies that the compiler should place
11476 uninitialized global variables in the data section of the object file,
11477 rather than generating them as common blocks.
11478 This has the effect that if the same variable is declared
11479 (without @code{extern}) in two different compilations,
11480 you get a multiple-definition error when you link them.
11481 In this case, you must compile with @option{-fcommon} instead.
11482 Compiling with @option{-fno-common} is useful on targets for which
11483 it provides better performance, or if you wish to verify that the
11484 program will work on other systems that always treat uninitialized
11485 variable declarations this way.
11486
11487 @item -fno-ident
11488 @opindex fno-ident
11489 Ignore the @code{#ident} directive.
11490
11491 @item -finhibit-size-directive
11492 @opindex finhibit-size-directive
11493 Don't output a @code{.size} assembler directive, or anything else that
11494 would cause trouble if the function is split in the middle, and the
11495 two halves are placed at locations far apart in memory. This option is
11496 used when compiling @file{crtstuff.c}; you should not need to use it
11497 for anything else.
11498
11499 @item -fverbose-asm
11500 @opindex fverbose-asm
11501 Put extra commentary information in the generated assembly code to
11502 make it more readable. This option is generally only of use to those
11503 who actually need to read the generated assembly code (perhaps while
11504 debugging the compiler itself).
11505
11506 @option{-fno-verbose-asm}, the default, causes the
11507 extra information to be omitted and is useful when comparing two assembler
11508 files.
11509
11510 The added comments include:
11511
11512 @itemize @bullet
11513
11514 @item
11515 information on the compiler version and command-line options,
11516
11517 @item
11518 the source code lines associated with the assembly instructions,
11519 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
11520
11521 @item
11522 hints on which high-level expressions correspond to
11523 the various assembly instruction operands.
11524
11525 @end itemize
11526
11527 For example, given this C source file:
11528
11529 @smallexample
11530 int test (int n)
11531 @{
11532 int i;
11533 int total = 0;
11534
11535 for (i = 0; i < n; i++)
11536 total += i * i;
11537
11538 return total;
11539 @}
11540 @end smallexample
11541
11542 compiling to (x86_64) assembly via @option{-S} and emitting the result
11543 direct to stdout via @option{-o} @option{-}
11544
11545 @smallexample
11546 gcc -S test.c -fverbose-asm -Os -o -
11547 @end smallexample
11548
11549 gives output similar to this:
11550
11551 @smallexample
11552 .file "test.c"
11553 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
11554 [...snip...]
11555 # options passed:
11556 [...snip...]
11557
11558 .text
11559 .globl test
11560 .type test, @@function
11561 test:
11562 .LFB0:
11563 .cfi_startproc
11564 # test.c:4: int total = 0;
11565 xorl %eax, %eax # <retval>
11566 # test.c:6: for (i = 0; i < n; i++)
11567 xorl %edx, %edx # i
11568 .L2:
11569 # test.c:6: for (i = 0; i < n; i++)
11570 cmpl %edi, %edx # n, i
11571 jge .L5 #,
11572 # test.c:7: total += i * i;
11573 movl %edx, %ecx # i, tmp92
11574 imull %edx, %ecx # i, tmp92
11575 # test.c:6: for (i = 0; i < n; i++)
11576 incl %edx # i
11577 # test.c:7: total += i * i;
11578 addl %ecx, %eax # tmp92, <retval>
11579 jmp .L2 #
11580 .L5:
11581 # test.c:10: @}
11582 ret
11583 .cfi_endproc
11584 .LFE0:
11585 .size test, .-test
11586 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
11587 .section .note.GNU-stack,"",@@progbits
11588 @end smallexample
11589
11590 The comments are intended for humans rather than machines and hence the
11591 precise format of the comments is subject to change.
11592
11593 @item -frecord-gcc-switches
11594 @opindex frecord-gcc-switches
11595 This switch causes the command line used to invoke the
11596 compiler to be recorded into the object file that is being created.
11597 This switch is only implemented on some targets and the exact format
11598 of the recording is target and binary file format dependent, but it
11599 usually takes the form of a section containing ASCII text. This
11600 switch is related to the @option{-fverbose-asm} switch, but that
11601 switch only records information in the assembler output file as
11602 comments, so it never reaches the object file.
11603 See also @option{-grecord-gcc-switches} for another
11604 way of storing compiler options into the object file.
11605
11606 @item -fpic
11607 @opindex fpic
11608 @cindex global offset table
11609 @cindex PIC
11610 Generate position-independent code (PIC) suitable for use in a shared
11611 library, if supported for the target machine. Such code accesses all
11612 constant addresses through a global offset table (GOT)@. The dynamic
11613 loader resolves the GOT entries when the program starts (the dynamic
11614 loader is not part of GCC; it is part of the operating system). If
11615 the GOT size for the linked executable exceeds a machine-specific
11616 maximum size, you get an error message from the linker indicating that
11617 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
11618 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
11619 on the m68k and RS/6000. The x86 has no such limit.)
11620
11621 Position-independent code requires special support, and therefore works
11622 only on certain machines. For the x86, GCC supports PIC for System V
11623 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
11624 position-independent.
11625
11626 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11627 are defined to 1.
11628
11629 @item -fPIC
11630 @opindex fPIC
11631 If supported for the target machine, emit position-independent code,
11632 suitable for dynamic linking and avoiding any limit on the size of the
11633 global offset table. This option makes a difference on AArch64, m68k,
11634 PowerPC and SPARC@.
11635
11636 Position-independent code requires special support, and therefore works
11637 only on certain machines.
11638
11639 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11640 are defined to 2.
11641
11642 @item -fpie
11643 @itemx -fPIE
11644 @opindex fpie
11645 @opindex fPIE
11646 These options are similar to @option{-fpic} and @option{-fPIC}, but
11647 generated position independent code can be only linked into executables.
11648 Usually these options are used when @option{-pie} GCC option is
11649 used during linking.
11650
11651 @option{-fpie} and @option{-fPIE} both define the macros
11652 @code{__pie__} and @code{__PIE__}. The macros have the value 1
11653 for @option{-fpie} and 2 for @option{-fPIE}.
11654
11655 @item -fno-plt
11656 @opindex fno-plt
11657 Do not use the PLT for external function calls in position-independent code.
11658 Instead, load the callee address at call sites from the GOT and branch to it.
11659 This leads to more efficient code by eliminating PLT stubs and exposing
11660 GOT loads to optimizations. On architectures such as 32-bit x86 where
11661 PLT stubs expect the GOT pointer in a specific register, this gives more
11662 register allocation freedom to the compiler.
11663 Lazy binding requires use of the PLT;
11664 with @option{-fno-plt} all external symbols are resolved at load time.
11665
11666 Alternatively, the function attribute @code{noplt} can be used to avoid calls
11667 through the PLT for specific external functions.
11668
11669 In position-dependent code, a few targets also convert calls to
11670 functions that are marked to not use the PLT to use the GOT instead.
11671
11672 @item -fno-jump-tables
11673 @opindex fno-jump-tables
11674 Do not use jump tables for switch statements even where it would be
11675 more efficient than other code generation strategies. This option is
11676 of use in conjunction with @option{-fpic} or @option{-fPIC} for
11677 building code that forms part of a dynamic linker and cannot
11678 reference the address of a jump table. On some targets, jump tables
11679 do not require a GOT and this option is not needed.
11680
11681 @item -ffixed-@var{reg}
11682 @opindex ffixed
11683 Treat the register named @var{reg} as a fixed register; generated code
11684 should never refer to it (except perhaps as a stack pointer, frame
11685 pointer or in some other fixed role).
11686
11687 @var{reg} must be the name of a register. The register names accepted
11688 are machine-specific and are defined in the @code{REGISTER_NAMES}
11689 macro in the machine description macro file.
11690
11691 This flag does not have a negative form, because it specifies a
11692 three-way choice.
11693
11694 @item -fcall-used-@var{reg}
11695 @opindex fcall-used
11696 Treat the register named @var{reg} as an allocable register that is
11697 clobbered by function calls. It may be allocated for temporaries or
11698 variables that do not live across a call. Functions compiled this way
11699 do not save and restore the register @var{reg}.
11700
11701 It is an error to use this flag with the frame pointer or stack pointer.
11702 Use of this flag for other registers that have fixed pervasive roles in
11703 the machine's execution model produces disastrous results.
11704
11705 This flag does not have a negative form, because it specifies a
11706 three-way choice.
11707
11708 @item -fcall-saved-@var{reg}
11709 @opindex fcall-saved
11710 Treat the register named @var{reg} as an allocable register saved by
11711 functions. It may be allocated even for temporaries or variables that
11712 live across a call. Functions compiled this way save and restore
11713 the register @var{reg} if they use it.
11714
11715 It is an error to use this flag with the frame pointer or stack pointer.
11716 Use of this flag for other registers that have fixed pervasive roles in
11717 the machine's execution model produces disastrous results.
11718
11719 A different sort of disaster results from the use of this flag for
11720 a register in which function values may be returned.
11721
11722 This flag does not have a negative form, because it specifies a
11723 three-way choice.
11724
11725 @item -fpack-struct[=@var{n}]
11726 @opindex fpack-struct
11727 Without a value specified, pack all structure members together without
11728 holes. When a value is specified (which must be a small power of two), pack
11729 structure members according to this value, representing the maximum
11730 alignment (that is, objects with default alignment requirements larger than
11731 this are output potentially unaligned at the next fitting location.
11732
11733 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11734 code that is not binary compatible with code generated without that switch.
11735 Additionally, it makes the code suboptimal.
11736 Use it to conform to a non-default application binary interface.
11737
11738 @item -fleading-underscore
11739 @opindex fleading-underscore
11740 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11741 change the way C symbols are represented in the object file. One use
11742 is to help link with legacy assembly code.
11743
11744 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11745 generate code that is not binary compatible with code generated without that
11746 switch. Use it to conform to a non-default application binary interface.
11747 Not all targets provide complete support for this switch.
11748
11749 @item -ftls-model=@var{model}
11750 @opindex ftls-model
11751 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11752 The @var{model} argument should be one of @samp{global-dynamic},
11753 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
11754 Note that the choice is subject to optimization: the compiler may use
11755 a more efficient model for symbols not visible outside of the translation
11756 unit, or if @option{-fpic} is not given on the command line.
11757
11758 The default without @option{-fpic} is @samp{initial-exec}; with
11759 @option{-fpic} the default is @samp{global-dynamic}.
11760
11761 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
11762 @opindex fvisibility
11763 Set the default ELF image symbol visibility to the specified option---all
11764 symbols are marked with this unless overridden within the code.
11765 Using this feature can very substantially improve linking and
11766 load times of shared object libraries, produce more optimized
11767 code, provide near-perfect API export and prevent symbol clashes.
11768 It is @strong{strongly} recommended that you use this in any shared objects
11769 you distribute.
11770
11771 Despite the nomenclature, @samp{default} always means public; i.e.,
11772 available to be linked against from outside the shared object.
11773 @samp{protected} and @samp{internal} are pretty useless in real-world
11774 usage so the only other commonly used option is @samp{hidden}.
11775 The default if @option{-fvisibility} isn't specified is
11776 @samp{default}, i.e., make every symbol public.
11777
11778 A good explanation of the benefits offered by ensuring ELF
11779 symbols have the correct visibility is given by ``How To Write
11780 Shared Libraries'' by Ulrich Drepper (which can be found at
11781 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
11782 solution made possible by this option to marking things hidden when
11783 the default is public is to make the default hidden and mark things
11784 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
11785 and @code{__attribute__ ((visibility("default")))} instead of
11786 @code{__declspec(dllexport)} you get almost identical semantics with
11787 identical syntax. This is a great boon to those working with
11788 cross-platform projects.
11789
11790 For those adding visibility support to existing code, you may find
11791 @code{#pragma GCC visibility} of use. This works by you enclosing
11792 the declarations you wish to set visibility for with (for example)
11793 @code{#pragma GCC visibility push(hidden)} and
11794 @code{#pragma GCC visibility pop}.
11795 Bear in mind that symbol visibility should be viewed @strong{as
11796 part of the API interface contract} and thus all new code should
11797 always specify visibility when it is not the default; i.e., declarations
11798 only for use within the local DSO should @strong{always} be marked explicitly
11799 as hidden as so to avoid PLT indirection overheads---making this
11800 abundantly clear also aids readability and self-documentation of the code.
11801 Note that due to ISO C++ specification requirements, @code{operator new} and
11802 @code{operator delete} must always be of default visibility.
11803
11804 Be aware that headers from outside your project, in particular system
11805 headers and headers from any other library you use, may not be
11806 expecting to be compiled with visibility other than the default. You
11807 may need to explicitly say @code{#pragma GCC visibility push(default)}
11808 before including any such headers.
11809
11810 @code{extern} declarations are not affected by @option{-fvisibility}, so
11811 a lot of code can be recompiled with @option{-fvisibility=hidden} with
11812 no modifications. However, this means that calls to @code{extern}
11813 functions with no explicit visibility use the PLT, so it is more
11814 effective to use @code{__attribute ((visibility))} and/or
11815 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
11816 declarations should be treated as hidden.
11817
11818 Note that @option{-fvisibility} does affect C++ vague linkage
11819 entities. This means that, for instance, an exception class that is
11820 be thrown between DSOs must be explicitly marked with default
11821 visibility so that the @samp{type_info} nodes are unified between
11822 the DSOs.
11823
11824 An overview of these techniques, their benefits and how to use them
11825 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
11826
11827 @item -fstrict-volatile-bitfields
11828 @opindex fstrict-volatile-bitfields
11829 This option should be used if accesses to volatile bit-fields (or other
11830 structure fields, although the compiler usually honors those types
11831 anyway) should use a single access of the width of the
11832 field's type, aligned to a natural alignment if possible. For
11833 example, targets with memory-mapped peripheral registers might require
11834 all such accesses to be 16 bits wide; with this flag you can
11835 declare all peripheral bit-fields as @code{unsigned short} (assuming short
11836 is 16 bits on these targets) to force GCC to use 16-bit accesses
11837 instead of, perhaps, a more efficient 32-bit access.
11838
11839 If this option is disabled, the compiler uses the most efficient
11840 instruction. In the previous example, that might be a 32-bit load
11841 instruction, even though that accesses bytes that do not contain
11842 any portion of the bit-field, or memory-mapped registers unrelated to
11843 the one being updated.
11844
11845 In some cases, such as when the @code{packed} attribute is applied to a
11846 structure field, it may not be possible to access the field with a single
11847 read or write that is correctly aligned for the target machine. In this
11848 case GCC falls back to generating multiple accesses rather than code that
11849 will fault or truncate the result at run time.
11850
11851 Note: Due to restrictions of the C/C++11 memory model, write accesses are
11852 not allowed to touch non bit-field members. It is therefore recommended
11853 to define all bits of the field's type as bit-field members.
11854
11855 The default value of this option is determined by the application binary
11856 interface for the target processor.
11857
11858 @item -fsync-libcalls
11859 @opindex fsync-libcalls
11860 This option controls whether any out-of-line instance of the @code{__sync}
11861 family of functions may be used to implement the C++11 @code{__atomic}
11862 family of functions.
11863
11864 The default value of this option is enabled, thus the only useful form
11865 of the option is @option{-fno-sync-libcalls}. This option is used in
11866 the implementation of the @file{libatomic} runtime library.
11867
11868 @end table
11869
11870 @node Developer Options
11871 @section GCC Developer Options
11872 @cindex developer options
11873 @cindex debugging GCC
11874 @cindex debug dump options
11875 @cindex dump options
11876 @cindex compilation statistics
11877
11878 This section describes command-line options that are primarily of
11879 interest to GCC developers, including options to support compiler
11880 testing and investigation of compiler bugs and compile-time
11881 performance problems. This includes options that produce debug dumps
11882 at various points in the compilation; that print statistics such as
11883 memory use and execution time; and that print information about GCC's
11884 configuration, such as where it searches for libraries. You should
11885 rarely need to use any of these options for ordinary compilation and
11886 linking tasks.
11887
11888 @table @gcctabopt
11889
11890 @item -d@var{letters}
11891 @itemx -fdump-rtl-@var{pass}
11892 @itemx -fdump-rtl-@var{pass}=@var{filename}
11893 @opindex d
11894 @opindex fdump-rtl-@var{pass}
11895 Says to make debugging dumps during compilation at times specified by
11896 @var{letters}. This is used for debugging the RTL-based passes of the
11897 compiler. The file names for most of the dumps are made by appending
11898 a pass number and a word to the @var{dumpname}, and the files are
11899 created in the directory of the output file. In case of
11900 @option{=@var{filename}} option, the dump is output on the given file
11901 instead of the pass numbered dump files. Note that the pass number is
11902 assigned as passes are registered into the pass manager. Most passes
11903 are registered in the order that they will execute and for these passes
11904 the number corresponds to the pass execution order. However, passes
11905 registered by plugins, passes specific to compilation targets, or
11906 passes that are otherwise registered after all the other passes are
11907 numbered higher than a pass named "final", even if they are executed
11908 earlier. @var{dumpname} is generated from the name of the output
11909 file if explicitly specified and not an executable, otherwise it is
11910 the basename of the source file. These switches may have different
11911 effects when @option{-E} is used for preprocessing.
11912
11913 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
11914 @option{-d} option @var{letters}. Here are the possible
11915 letters for use in @var{pass} and @var{letters}, and their meanings:
11916
11917 @table @gcctabopt
11918
11919 @item -fdump-rtl-alignments
11920 @opindex fdump-rtl-alignments
11921 Dump after branch alignments have been computed.
11922
11923 @item -fdump-rtl-asmcons
11924 @opindex fdump-rtl-asmcons
11925 Dump after fixing rtl statements that have unsatisfied in/out constraints.
11926
11927 @item -fdump-rtl-auto_inc_dec
11928 @opindex fdump-rtl-auto_inc_dec
11929 Dump after auto-inc-dec discovery. This pass is only run on
11930 architectures that have auto inc or auto dec instructions.
11931
11932 @item -fdump-rtl-barriers
11933 @opindex fdump-rtl-barriers
11934 Dump after cleaning up the barrier instructions.
11935
11936 @item -fdump-rtl-bbpart
11937 @opindex fdump-rtl-bbpart
11938 Dump after partitioning hot and cold basic blocks.
11939
11940 @item -fdump-rtl-bbro
11941 @opindex fdump-rtl-bbro
11942 Dump after block reordering.
11943
11944 @item -fdump-rtl-btl1
11945 @itemx -fdump-rtl-btl2
11946 @opindex fdump-rtl-btl2
11947 @opindex fdump-rtl-btl2
11948 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
11949 after the two branch
11950 target load optimization passes.
11951
11952 @item -fdump-rtl-bypass
11953 @opindex fdump-rtl-bypass
11954 Dump after jump bypassing and control flow optimizations.
11955
11956 @item -fdump-rtl-combine
11957 @opindex fdump-rtl-combine
11958 Dump after the RTL instruction combination pass.
11959
11960 @item -fdump-rtl-compgotos
11961 @opindex fdump-rtl-compgotos
11962 Dump after duplicating the computed gotos.
11963
11964 @item -fdump-rtl-ce1
11965 @itemx -fdump-rtl-ce2
11966 @itemx -fdump-rtl-ce3
11967 @opindex fdump-rtl-ce1
11968 @opindex fdump-rtl-ce2
11969 @opindex fdump-rtl-ce3
11970 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
11971 @option{-fdump-rtl-ce3} enable dumping after the three
11972 if conversion passes.
11973
11974 @item -fdump-rtl-cprop_hardreg
11975 @opindex fdump-rtl-cprop_hardreg
11976 Dump after hard register copy propagation.
11977
11978 @item -fdump-rtl-csa
11979 @opindex fdump-rtl-csa
11980 Dump after combining stack adjustments.
11981
11982 @item -fdump-rtl-cse1
11983 @itemx -fdump-rtl-cse2
11984 @opindex fdump-rtl-cse1
11985 @opindex fdump-rtl-cse2
11986 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
11987 the two common subexpression elimination passes.
11988
11989 @item -fdump-rtl-dce
11990 @opindex fdump-rtl-dce
11991 Dump after the standalone dead code elimination passes.
11992
11993 @item -fdump-rtl-dbr
11994 @opindex fdump-rtl-dbr
11995 Dump after delayed branch scheduling.
11996
11997 @item -fdump-rtl-dce1
11998 @itemx -fdump-rtl-dce2
11999 @opindex fdump-rtl-dce1
12000 @opindex fdump-rtl-dce2
12001 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
12002 the two dead store elimination passes.
12003
12004 @item -fdump-rtl-eh
12005 @opindex fdump-rtl-eh
12006 Dump after finalization of EH handling code.
12007
12008 @item -fdump-rtl-eh_ranges
12009 @opindex fdump-rtl-eh_ranges
12010 Dump after conversion of EH handling range regions.
12011
12012 @item -fdump-rtl-expand
12013 @opindex fdump-rtl-expand
12014 Dump after RTL generation.
12015
12016 @item -fdump-rtl-fwprop1
12017 @itemx -fdump-rtl-fwprop2
12018 @opindex fdump-rtl-fwprop1
12019 @opindex fdump-rtl-fwprop2
12020 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
12021 dumping after the two forward propagation passes.
12022
12023 @item -fdump-rtl-gcse1
12024 @itemx -fdump-rtl-gcse2
12025 @opindex fdump-rtl-gcse1
12026 @opindex fdump-rtl-gcse2
12027 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
12028 after global common subexpression elimination.
12029
12030 @item -fdump-rtl-init-regs
12031 @opindex fdump-rtl-init-regs
12032 Dump after the initialization of the registers.
12033
12034 @item -fdump-rtl-initvals
12035 @opindex fdump-rtl-initvals
12036 Dump after the computation of the initial value sets.
12037
12038 @item -fdump-rtl-into_cfglayout
12039 @opindex fdump-rtl-into_cfglayout
12040 Dump after converting to cfglayout mode.
12041
12042 @item -fdump-rtl-ira
12043 @opindex fdump-rtl-ira
12044 Dump after iterated register allocation.
12045
12046 @item -fdump-rtl-jump
12047 @opindex fdump-rtl-jump
12048 Dump after the second jump optimization.
12049
12050 @item -fdump-rtl-loop2
12051 @opindex fdump-rtl-loop2
12052 @option{-fdump-rtl-loop2} enables dumping after the rtl
12053 loop optimization passes.
12054
12055 @item -fdump-rtl-mach
12056 @opindex fdump-rtl-mach
12057 Dump after performing the machine dependent reorganization pass, if that
12058 pass exists.
12059
12060 @item -fdump-rtl-mode_sw
12061 @opindex fdump-rtl-mode_sw
12062 Dump after removing redundant mode switches.
12063
12064 @item -fdump-rtl-rnreg
12065 @opindex fdump-rtl-rnreg
12066 Dump after register renumbering.
12067
12068 @item -fdump-rtl-outof_cfglayout
12069 @opindex fdump-rtl-outof_cfglayout
12070 Dump after converting from cfglayout mode.
12071
12072 @item -fdump-rtl-peephole2
12073 @opindex fdump-rtl-peephole2
12074 Dump after the peephole pass.
12075
12076 @item -fdump-rtl-postreload
12077 @opindex fdump-rtl-postreload
12078 Dump after post-reload optimizations.
12079
12080 @item -fdump-rtl-pro_and_epilogue
12081 @opindex fdump-rtl-pro_and_epilogue
12082 Dump after generating the function prologues and epilogues.
12083
12084 @item -fdump-rtl-sched1
12085 @itemx -fdump-rtl-sched2
12086 @opindex fdump-rtl-sched1
12087 @opindex fdump-rtl-sched2
12088 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
12089 after the basic block scheduling passes.
12090
12091 @item -fdump-rtl-ree
12092 @opindex fdump-rtl-ree
12093 Dump after sign/zero extension elimination.
12094
12095 @item -fdump-rtl-seqabstr
12096 @opindex fdump-rtl-seqabstr
12097 Dump after common sequence discovery.
12098
12099 @item -fdump-rtl-shorten
12100 @opindex fdump-rtl-shorten
12101 Dump after shortening branches.
12102
12103 @item -fdump-rtl-sibling
12104 @opindex fdump-rtl-sibling
12105 Dump after sibling call optimizations.
12106
12107 @item -fdump-rtl-split1
12108 @itemx -fdump-rtl-split2
12109 @itemx -fdump-rtl-split3
12110 @itemx -fdump-rtl-split4
12111 @itemx -fdump-rtl-split5
12112 @opindex fdump-rtl-split1
12113 @opindex fdump-rtl-split2
12114 @opindex fdump-rtl-split3
12115 @opindex fdump-rtl-split4
12116 @opindex fdump-rtl-split5
12117 These options enable dumping after five rounds of
12118 instruction splitting.
12119
12120 @item -fdump-rtl-sms
12121 @opindex fdump-rtl-sms
12122 Dump after modulo scheduling. This pass is only run on some
12123 architectures.
12124
12125 @item -fdump-rtl-stack
12126 @opindex fdump-rtl-stack
12127 Dump after conversion from GCC's ``flat register file'' registers to the
12128 x87's stack-like registers. This pass is only run on x86 variants.
12129
12130 @item -fdump-rtl-subreg1
12131 @itemx -fdump-rtl-subreg2
12132 @opindex fdump-rtl-subreg1
12133 @opindex fdump-rtl-subreg2
12134 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
12135 the two subreg expansion passes.
12136
12137 @item -fdump-rtl-unshare
12138 @opindex fdump-rtl-unshare
12139 Dump after all rtl has been unshared.
12140
12141 @item -fdump-rtl-vartrack
12142 @opindex fdump-rtl-vartrack
12143 Dump after variable tracking.
12144
12145 @item -fdump-rtl-vregs
12146 @opindex fdump-rtl-vregs
12147 Dump after converting virtual registers to hard registers.
12148
12149 @item -fdump-rtl-web
12150 @opindex fdump-rtl-web
12151 Dump after live range splitting.
12152
12153 @item -fdump-rtl-regclass
12154 @itemx -fdump-rtl-subregs_of_mode_init
12155 @itemx -fdump-rtl-subregs_of_mode_finish
12156 @itemx -fdump-rtl-dfinit
12157 @itemx -fdump-rtl-dfinish
12158 @opindex fdump-rtl-regclass
12159 @opindex fdump-rtl-subregs_of_mode_init
12160 @opindex fdump-rtl-subregs_of_mode_finish
12161 @opindex fdump-rtl-dfinit
12162 @opindex fdump-rtl-dfinish
12163 These dumps are defined but always produce empty files.
12164
12165 @item -da
12166 @itemx -fdump-rtl-all
12167 @opindex da
12168 @opindex fdump-rtl-all
12169 Produce all the dumps listed above.
12170
12171 @item -dA
12172 @opindex dA
12173 Annotate the assembler output with miscellaneous debugging information.
12174
12175 @item -dD
12176 @opindex dD
12177 Dump all macro definitions, at the end of preprocessing, in addition to
12178 normal output.
12179
12180 @item -dH
12181 @opindex dH
12182 Produce a core dump whenever an error occurs.
12183
12184 @item -dp
12185 @opindex dp
12186 Annotate the assembler output with a comment indicating which
12187 pattern and alternative is used. The length of each instruction is
12188 also printed.
12189
12190 @item -dP
12191 @opindex dP
12192 Dump the RTL in the assembler output as a comment before each instruction.
12193 Also turns on @option{-dp} annotation.
12194
12195 @item -dx
12196 @opindex dx
12197 Just generate RTL for a function instead of compiling it. Usually used
12198 with @option{-fdump-rtl-expand}.
12199 @end table
12200
12201 @item -fdump-noaddr
12202 @opindex fdump-noaddr
12203 When doing debugging dumps, suppress address output. This makes it more
12204 feasible to use diff on debugging dumps for compiler invocations with
12205 different compiler binaries and/or different
12206 text / bss / data / heap / stack / dso start locations.
12207
12208 @item -freport-bug
12209 @opindex freport-bug
12210 Collect and dump debug information into a temporary file if an
12211 internal compiler error (ICE) occurs.
12212
12213 @item -fdump-unnumbered
12214 @opindex fdump-unnumbered
12215 When doing debugging dumps, suppress instruction numbers and address output.
12216 This makes it more feasible to use diff on debugging dumps for compiler
12217 invocations with different options, in particular with and without
12218 @option{-g}.
12219
12220 @item -fdump-unnumbered-links
12221 @opindex fdump-unnumbered-links
12222 When doing debugging dumps (see @option{-d} option above), suppress
12223 instruction numbers for the links to the previous and next instructions
12224 in a sequence.
12225
12226 @item -fdump-translation-unit @r{(C++ only)}
12227 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
12228 @opindex fdump-translation-unit
12229 Dump a representation of the tree structure for the entire translation
12230 unit to a file. The file name is made by appending @file{.tu} to the
12231 source file name, and the file is created in the same directory as the
12232 output file. If the @samp{-@var{options}} form is used, @var{options}
12233 controls the details of the dump as described for the
12234 @option{-fdump-tree} options.
12235
12236 @item -fdump-class-hierarchy @r{(C++ only)}
12237 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
12238 @opindex fdump-class-hierarchy
12239 Dump a representation of each class's hierarchy and virtual function
12240 table layout to a file. The file name is made by appending
12241 @file{.class} to the source file name, and the file is created in the
12242 same directory as the output file. If the @samp{-@var{options}} form
12243 is used, @var{options} controls the details of the dump as described
12244 for the @option{-fdump-tree} options.
12245
12246 @item -fdump-ipa-@var{switch}
12247 @opindex fdump-ipa
12248 Control the dumping at various stages of inter-procedural analysis
12249 language tree to a file. The file name is generated by appending a
12250 switch specific suffix to the source file name, and the file is created
12251 in the same directory as the output file. The following dumps are
12252 possible:
12253
12254 @table @samp
12255 @item all
12256 Enables all inter-procedural analysis dumps.
12257
12258 @item cgraph
12259 Dumps information about call-graph optimization, unused function removal,
12260 and inlining decisions.
12261
12262 @item inline
12263 Dump after function inlining.
12264
12265 @end table
12266
12267 @item -fdump-passes
12268 @opindex fdump-passes
12269 Dump the list of optimization passes that are turned on and off by
12270 the current command-line options.
12271
12272 @item -fdump-statistics-@var{option}
12273 @opindex fdump-statistics
12274 Enable and control dumping of pass statistics in a separate file. The
12275 file name is generated by appending a suffix ending in
12276 @samp{.statistics} to the source file name, and the file is created in
12277 the same directory as the output file. If the @samp{-@var{option}}
12278 form is used, @samp{-stats} causes counters to be summed over the
12279 whole compilation unit while @samp{-details} dumps every event as
12280 the passes generate them. The default with no option is to sum
12281 counters for each function compiled.
12282
12283 @item -fdump-tree-@var{switch}
12284 @itemx -fdump-tree-@var{switch}-@var{options}
12285 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
12286 @opindex fdump-tree
12287 Control the dumping at various stages of processing the intermediate
12288 language tree to a file. The file name is generated by appending a
12289 switch-specific suffix to the source file name, and the file is
12290 created in the same directory as the output file. In case of
12291 @option{=@var{filename}} option, the dump is output on the given file
12292 instead of the auto named dump files. If the @samp{-@var{options}}
12293 form is used, @var{options} is a list of @samp{-} separated options
12294 which control the details of the dump. Not all options are applicable
12295 to all dumps; those that are not meaningful are ignored. The
12296 following options are available
12297
12298 @table @samp
12299 @item address
12300 Print the address of each node. Usually this is not meaningful as it
12301 changes according to the environment and source file. Its primary use
12302 is for tying up a dump file with a debug environment.
12303 @item asmname
12304 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
12305 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
12306 use working backward from mangled names in the assembly file.
12307 @item slim
12308 When dumping front-end intermediate representations, inhibit dumping
12309 of members of a scope or body of a function merely because that scope
12310 has been reached. Only dump such items when they are directly reachable
12311 by some other path.
12312
12313 When dumping pretty-printed trees, this option inhibits dumping the
12314 bodies of control structures.
12315
12316 When dumping RTL, print the RTL in slim (condensed) form instead of
12317 the default LISP-like representation.
12318 @item raw
12319 Print a raw representation of the tree. By default, trees are
12320 pretty-printed into a C-like representation.
12321 @item details
12322 Enable more detailed dumps (not honored by every dump option). Also
12323 include information from the optimization passes.
12324 @item stats
12325 Enable dumping various statistics about the pass (not honored by every dump
12326 option).
12327 @item blocks
12328 Enable showing basic block boundaries (disabled in raw dumps).
12329 @item graph
12330 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
12331 dump a representation of the control flow graph suitable for viewing with
12332 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
12333 the file is pretty-printed as a subgraph, so that GraphViz can render them
12334 all in a single plot.
12335
12336 This option currently only works for RTL dumps, and the RTL is always
12337 dumped in slim form.
12338 @item vops
12339 Enable showing virtual operands for every statement.
12340 @item lineno
12341 Enable showing line numbers for statements.
12342 @item uid
12343 Enable showing the unique ID (@code{DECL_UID}) for each variable.
12344 @item verbose
12345 Enable showing the tree dump for each statement.
12346 @item eh
12347 Enable showing the EH region number holding each statement.
12348 @item scev
12349 Enable showing scalar evolution analysis details.
12350 @item optimized
12351 Enable showing optimization information (only available in certain
12352 passes).
12353 @item missed
12354 Enable showing missed optimization information (only available in certain
12355 passes).
12356 @item note
12357 Enable other detailed optimization information (only available in
12358 certain passes).
12359 @item =@var{filename}
12360 Instead of an auto named dump file, output into the given file
12361 name. The file names @file{stdout} and @file{stderr} are treated
12362 specially and are considered already open standard streams. For
12363 example,
12364
12365 @smallexample
12366 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
12367 -fdump-tree-pre=stderr file.c
12368 @end smallexample
12369
12370 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
12371 output on to @file{stderr}. If two conflicting dump filenames are
12372 given for the same pass, then the latter option overrides the earlier
12373 one.
12374
12375 @item split-paths
12376 @opindex fdump-tree-split-paths
12377 Dump each function after splitting paths to loop backedges. The file
12378 name is made by appending @file{.split-paths} to the source file name.
12379
12380 @item all
12381 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
12382 and @option{lineno}.
12383
12384 @item optall
12385 Turn on all optimization options, i.e., @option{optimized},
12386 @option{missed}, and @option{note}.
12387 @end table
12388
12389 The following tree dumps are possible:
12390 @table @samp
12391
12392 @item original
12393 @opindex fdump-tree-original
12394 Dump before any tree based optimization, to @file{@var{file}.original}.
12395
12396 @item optimized
12397 @opindex fdump-tree-optimized
12398 Dump after all tree based optimization, to @file{@var{file}.optimized}.
12399
12400 @item gimple
12401 @opindex fdump-tree-gimple
12402 Dump each function before and after the gimplification pass to a file. The
12403 file name is made by appending @file{.gimple} to the source file name.
12404
12405 @item cfg
12406 @opindex fdump-tree-cfg
12407 Dump the control flow graph of each function to a file. The file name is
12408 made by appending @file{.cfg} to the source file name.
12409
12410 @item ch
12411 @opindex fdump-tree-ch
12412 Dump each function after copying loop headers. The file name is made by
12413 appending @file{.ch} to the source file name.
12414
12415 @item ssa
12416 @opindex fdump-tree-ssa
12417 Dump SSA related information to a file. The file name is made by appending
12418 @file{.ssa} to the source file name.
12419
12420 @item alias
12421 @opindex fdump-tree-alias
12422 Dump aliasing information for each function. The file name is made by
12423 appending @file{.alias} to the source file name.
12424
12425 @item ccp
12426 @opindex fdump-tree-ccp
12427 Dump each function after CCP@. The file name is made by appending
12428 @file{.ccp} to the source file name.
12429
12430 @item storeccp
12431 @opindex fdump-tree-storeccp
12432 Dump each function after STORE-CCP@. The file name is made by appending
12433 @file{.storeccp} to the source file name.
12434
12435 @item pre
12436 @opindex fdump-tree-pre
12437 Dump trees after partial redundancy elimination and/or code hoisting.
12438 The file name is made by appending @file{.pre} to the source file name.
12439
12440 @item fre
12441 @opindex fdump-tree-fre
12442 Dump trees after full redundancy elimination. The file name is made
12443 by appending @file{.fre} to the source file name.
12444
12445 @item copyprop
12446 @opindex fdump-tree-copyprop
12447 Dump trees after copy propagation. The file name is made
12448 by appending @file{.copyprop} to the source file name.
12449
12450 @item store_copyprop
12451 @opindex fdump-tree-store_copyprop
12452 Dump trees after store copy-propagation. The file name is made
12453 by appending @file{.store_copyprop} to the source file name.
12454
12455 @item dce
12456 @opindex fdump-tree-dce
12457 Dump each function after dead code elimination. The file name is made by
12458 appending @file{.dce} to the source file name.
12459
12460 @item sra
12461 @opindex fdump-tree-sra
12462 Dump each function after performing scalar replacement of aggregates. The
12463 file name is made by appending @file{.sra} to the source file name.
12464
12465 @item sink
12466 @opindex fdump-tree-sink
12467 Dump each function after performing code sinking. The file name is made
12468 by appending @file{.sink} to the source file name.
12469
12470 @item dom
12471 @opindex fdump-tree-dom
12472 Dump each function after applying dominator tree optimizations. The file
12473 name is made by appending @file{.dom} to the source file name.
12474
12475 @item dse
12476 @opindex fdump-tree-dse
12477 Dump each function after applying dead store elimination. The file
12478 name is made by appending @file{.dse} to the source file name.
12479
12480 @item phiopt
12481 @opindex fdump-tree-phiopt
12482 Dump each function after optimizing PHI nodes into straightline code. The file
12483 name is made by appending @file{.phiopt} to the source file name.
12484
12485 @item backprop
12486 @opindex fdump-tree-backprop
12487 Dump each function after back-propagating use information up the definition
12488 chain. The file name is made by appending @file{.backprop} to the
12489 source file name.
12490
12491 @item forwprop
12492 @opindex fdump-tree-forwprop
12493 Dump each function after forward propagating single use variables. The file
12494 name is made by appending @file{.forwprop} to the source file name.
12495
12496 @item nrv
12497 @opindex fdump-tree-nrv
12498 Dump each function after applying the named return value optimization on
12499 generic trees. The file name is made by appending @file{.nrv} to the source
12500 file name.
12501
12502 @item vect
12503 @opindex fdump-tree-vect
12504 Dump each function after applying vectorization of loops. The file name is
12505 made by appending @file{.vect} to the source file name.
12506
12507 @item slp
12508 @opindex fdump-tree-slp
12509 Dump each function after applying vectorization of basic blocks. The file name
12510 is made by appending @file{.slp} to the source file name.
12511
12512 @item vrp
12513 @opindex fdump-tree-vrp
12514 Dump each function after Value Range Propagation (VRP). The file name
12515 is made by appending @file{.vrp} to the source file name.
12516
12517 @item oaccdevlow
12518 @opindex fdump-tree-oaccdevlow
12519 Dump each function after applying device-specific OpenACC transformations.
12520 The file name is made by appending @file{.oaccdevlow} to the source file name.
12521
12522 @item all
12523 @opindex fdump-tree-all
12524 Enable all the available tree dumps with the flags provided in this option.
12525 @end table
12526
12527 @item -fopt-info
12528 @itemx -fopt-info-@var{options}
12529 @itemx -fopt-info-@var{options}=@var{filename}
12530 @opindex fopt-info
12531 Controls optimization dumps from various optimization passes. If the
12532 @samp{-@var{options}} form is used, @var{options} is a list of
12533 @samp{-} separated option keywords to select the dump details and
12534 optimizations.
12535
12536 The @var{options} can be divided into two groups: options describing the
12537 verbosity of the dump, and options describing which optimizations
12538 should be included. The options from both the groups can be freely
12539 mixed as they are non-overlapping. However, in case of any conflicts,
12540 the later options override the earlier options on the command
12541 line.
12542
12543 The following options control the dump verbosity:
12544
12545 @table @samp
12546 @item optimized
12547 Print information when an optimization is successfully applied. It is
12548 up to a pass to decide which information is relevant. For example, the
12549 vectorizer passes print the source location of loops which are
12550 successfully vectorized.
12551 @item missed
12552 Print information about missed optimizations. Individual passes
12553 control which information to include in the output.
12554 @item note
12555 Print verbose information about optimizations, such as certain
12556 transformations, more detailed messages about decisions etc.
12557 @item all
12558 Print detailed optimization information. This includes
12559 @samp{optimized}, @samp{missed}, and @samp{note}.
12560 @end table
12561
12562 One or more of the following option keywords can be used to describe a
12563 group of optimizations:
12564
12565 @table @samp
12566 @item ipa
12567 Enable dumps from all interprocedural optimizations.
12568 @item loop
12569 Enable dumps from all loop optimizations.
12570 @item inline
12571 Enable dumps from all inlining optimizations.
12572 @item vec
12573 Enable dumps from all vectorization optimizations.
12574 @item optall
12575 Enable dumps from all optimizations. This is a superset of
12576 the optimization groups listed above.
12577 @end table
12578
12579 If @var{options} is
12580 omitted, it defaults to @samp{optimized-optall}, which means to dump all
12581 info about successful optimizations from all the passes.
12582
12583 If the @var{filename} is provided, then the dumps from all the
12584 applicable optimizations are concatenated into the @var{filename}.
12585 Otherwise the dump is output onto @file{stderr}. Though multiple
12586 @option{-fopt-info} options are accepted, only one of them can include
12587 a @var{filename}. If other filenames are provided then all but the
12588 first such option are ignored.
12589
12590 Note that the output @var{filename} is overwritten
12591 in case of multiple translation units. If a combined output from
12592 multiple translation units is desired, @file{stderr} should be used
12593 instead.
12594
12595 In the following example, the optimization info is output to
12596 @file{stderr}:
12597
12598 @smallexample
12599 gcc -O3 -fopt-info
12600 @end smallexample
12601
12602 This example:
12603 @smallexample
12604 gcc -O3 -fopt-info-missed=missed.all
12605 @end smallexample
12606
12607 @noindent
12608 outputs missed optimization report from all the passes into
12609 @file{missed.all}, and this one:
12610
12611 @smallexample
12612 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
12613 @end smallexample
12614
12615 @noindent
12616 prints information about missed optimization opportunities from
12617 vectorization passes on @file{stderr}.
12618 Note that @option{-fopt-info-vec-missed} is equivalent to
12619 @option{-fopt-info-missed-vec}.
12620
12621 As another example,
12622 @smallexample
12623 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
12624 @end smallexample
12625
12626 @noindent
12627 outputs information about missed optimizations as well as
12628 optimized locations from all the inlining passes into
12629 @file{inline.txt}.
12630
12631 Finally, consider:
12632
12633 @smallexample
12634 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
12635 @end smallexample
12636
12637 @noindent
12638 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
12639 in conflict since only one output file is allowed. In this case, only
12640 the first option takes effect and the subsequent options are
12641 ignored. Thus only @file{vec.miss} is produced which contains
12642 dumps from the vectorizer about missed opportunities.
12643
12644 @item -fsched-verbose=@var{n}
12645 @opindex fsched-verbose
12646 On targets that use instruction scheduling, this option controls the
12647 amount of debugging output the scheduler prints to the dump files.
12648
12649 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
12650 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
12651 For @var{n} greater than one, it also output basic block probabilities,
12652 detailed ready list information and unit/insn info. For @var{n} greater
12653 than two, it includes RTL at abort point, control-flow and regions info.
12654 And for @var{n} over four, @option{-fsched-verbose} also includes
12655 dependence info.
12656
12657
12658
12659 @item -fenable-@var{kind}-@var{pass}
12660 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
12661 @opindex fdisable-
12662 @opindex fenable-
12663
12664 This is a set of options that are used to explicitly disable/enable
12665 optimization passes. These options are intended for use for debugging GCC.
12666 Compiler users should use regular options for enabling/disabling
12667 passes instead.
12668
12669 @table @gcctabopt
12670
12671 @item -fdisable-ipa-@var{pass}
12672 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12673 statically invoked in the compiler multiple times, the pass name should be
12674 appended with a sequential number starting from 1.
12675
12676 @item -fdisable-rtl-@var{pass}
12677 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
12678 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
12679 statically invoked in the compiler multiple times, the pass name should be
12680 appended with a sequential number starting from 1. @var{range-list} is a
12681 comma-separated list of function ranges or assembler names. Each range is a number
12682 pair separated by a colon. The range is inclusive in both ends. If the range
12683 is trivial, the number pair can be simplified as a single number. If the
12684 function's call graph node's @var{uid} falls within one of the specified ranges,
12685 the @var{pass} is disabled for that function. The @var{uid} is shown in the
12686 function header of a dump file, and the pass names can be dumped by using
12687 option @option{-fdump-passes}.
12688
12689 @item -fdisable-tree-@var{pass}
12690 @itemx -fdisable-tree-@var{pass}=@var{range-list}
12691 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
12692 option arguments.
12693
12694 @item -fenable-ipa-@var{pass}
12695 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12696 statically invoked in the compiler multiple times, the pass name should be
12697 appended with a sequential number starting from 1.
12698
12699 @item -fenable-rtl-@var{pass}
12700 @itemx -fenable-rtl-@var{pass}=@var{range-list}
12701 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
12702 description and examples.
12703
12704 @item -fenable-tree-@var{pass}
12705 @itemx -fenable-tree-@var{pass}=@var{range-list}
12706 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
12707 of option arguments.
12708
12709 @end table
12710
12711 Here are some examples showing uses of these options.
12712
12713 @smallexample
12714
12715 # disable ccp1 for all functions
12716 -fdisable-tree-ccp1
12717 # disable complete unroll for function whose cgraph node uid is 1
12718 -fenable-tree-cunroll=1
12719 # disable gcse2 for functions at the following ranges [1,1],
12720 # [300,400], and [400,1000]
12721 # disable gcse2 for functions foo and foo2
12722 -fdisable-rtl-gcse2=foo,foo2
12723 # disable early inlining
12724 -fdisable-tree-einline
12725 # disable ipa inlining
12726 -fdisable-ipa-inline
12727 # enable tree full unroll
12728 -fenable-tree-unroll
12729
12730 @end smallexample
12731
12732 @item -fchecking
12733 @itemx -fchecking=@var{n}
12734 @opindex fchecking
12735 @opindex fno-checking
12736 Enable internal consistency checking. The default depends on
12737 the compiler configuration. @option{-fchecking=2} enables further
12738 internal consistency checking that might affect code generation.
12739
12740 @item -frandom-seed=@var{string}
12741 @opindex frandom-seed
12742 This option provides a seed that GCC uses in place of
12743 random numbers in generating certain symbol names
12744 that have to be different in every compiled file. It is also used to
12745 place unique stamps in coverage data files and the object files that
12746 produce them. You can use the @option{-frandom-seed} option to produce
12747 reproducibly identical object files.
12748
12749 The @var{string} can either be a number (decimal, octal or hex) or an
12750 arbitrary string (in which case it's converted to a number by
12751 computing CRC32).
12752
12753 The @var{string} should be different for every file you compile.
12754
12755 @item -save-temps
12756 @itemx -save-temps=cwd
12757 @opindex save-temps
12758 Store the usual ``temporary'' intermediate files permanently; place them
12759 in the current directory and name them based on the source file. Thus,
12760 compiling @file{foo.c} with @option{-c -save-temps} produces files
12761 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
12762 preprocessed @file{foo.i} output file even though the compiler now
12763 normally uses an integrated preprocessor.
12764
12765 When used in combination with the @option{-x} command-line option,
12766 @option{-save-temps} is sensible enough to avoid over writing an
12767 input source file with the same extension as an intermediate file.
12768 The corresponding intermediate file may be obtained by renaming the
12769 source file before using @option{-save-temps}.
12770
12771 If you invoke GCC in parallel, compiling several different source
12772 files that share a common base name in different subdirectories or the
12773 same source file compiled for multiple output destinations, it is
12774 likely that the different parallel compilers will interfere with each
12775 other, and overwrite the temporary files. For instance:
12776
12777 @smallexample
12778 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
12779 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
12780 @end smallexample
12781
12782 may result in @file{foo.i} and @file{foo.o} being written to
12783 simultaneously by both compilers.
12784
12785 @item -save-temps=obj
12786 @opindex save-temps=obj
12787 Store the usual ``temporary'' intermediate files permanently. If the
12788 @option{-o} option is used, the temporary files are based on the
12789 object file. If the @option{-o} option is not used, the
12790 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
12791
12792 For example:
12793
12794 @smallexample
12795 gcc -save-temps=obj -c foo.c
12796 gcc -save-temps=obj -c bar.c -o dir/xbar.o
12797 gcc -save-temps=obj foobar.c -o dir2/yfoobar
12798 @end smallexample
12799
12800 @noindent
12801 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
12802 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
12803 @file{dir2/yfoobar.o}.
12804
12805 @item -time@r{[}=@var{file}@r{]}
12806 @opindex time
12807 Report the CPU time taken by each subprocess in the compilation
12808 sequence. For C source files, this is the compiler proper and assembler
12809 (plus the linker if linking is done).
12810
12811 Without the specification of an output file, the output looks like this:
12812
12813 @smallexample
12814 # cc1 0.12 0.01
12815 # as 0.00 0.01
12816 @end smallexample
12817
12818 The first number on each line is the ``user time'', that is time spent
12819 executing the program itself. The second number is ``system time'',
12820 time spent executing operating system routines on behalf of the program.
12821 Both numbers are in seconds.
12822
12823 With the specification of an output file, the output is appended to the
12824 named file, and it looks like this:
12825
12826 @smallexample
12827 0.12 0.01 cc1 @var{options}
12828 0.00 0.01 as @var{options}
12829 @end smallexample
12830
12831 The ``user time'' and the ``system time'' are moved before the program
12832 name, and the options passed to the program are displayed, so that one
12833 can later tell what file was being compiled, and with which options.
12834
12835 @item -fdump-final-insns@r{[}=@var{file}@r{]}
12836 @opindex fdump-final-insns
12837 Dump the final internal representation (RTL) to @var{file}. If the
12838 optional argument is omitted (or if @var{file} is @code{.}), the name
12839 of the dump file is determined by appending @code{.gkd} to the
12840 compilation output file name.
12841
12842 @item -fcompare-debug@r{[}=@var{opts}@r{]}
12843 @opindex fcompare-debug
12844 @opindex fno-compare-debug
12845 If no error occurs during compilation, run the compiler a second time,
12846 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
12847 passed to the second compilation. Dump the final internal
12848 representation in both compilations, and print an error if they differ.
12849
12850 If the equal sign is omitted, the default @option{-gtoggle} is used.
12851
12852 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
12853 and nonzero, implicitly enables @option{-fcompare-debug}. If
12854 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
12855 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
12856 is used.
12857
12858 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
12859 is equivalent to @option{-fno-compare-debug}, which disables the dumping
12860 of the final representation and the second compilation, preventing even
12861 @env{GCC_COMPARE_DEBUG} from taking effect.
12862
12863 To verify full coverage during @option{-fcompare-debug} testing, set
12864 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
12865 which GCC rejects as an invalid option in any actual compilation
12866 (rather than preprocessing, assembly or linking). To get just a
12867 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
12868 not overridden} will do.
12869
12870 @item -fcompare-debug-second
12871 @opindex fcompare-debug-second
12872 This option is implicitly passed to the compiler for the second
12873 compilation requested by @option{-fcompare-debug}, along with options to
12874 silence warnings, and omitting other options that would cause
12875 side-effect compiler outputs to files or to the standard output. Dump
12876 files and preserved temporary files are renamed so as to contain the
12877 @code{.gk} additional extension during the second compilation, to avoid
12878 overwriting those generated by the first.
12879
12880 When this option is passed to the compiler driver, it causes the
12881 @emph{first} compilation to be skipped, which makes it useful for little
12882 other than debugging the compiler proper.
12883
12884 @item -gtoggle
12885 @opindex gtoggle
12886 Turn off generation of debug info, if leaving out this option
12887 generates it, or turn it on at level 2 otherwise. The position of this
12888 argument in the command line does not matter; it takes effect after all
12889 other options are processed, and it does so only once, no matter how
12890 many times it is given. This is mainly intended to be used with
12891 @option{-fcompare-debug}.
12892
12893 @item -fvar-tracking-assignments-toggle
12894 @opindex fvar-tracking-assignments-toggle
12895 @opindex fno-var-tracking-assignments-toggle
12896 Toggle @option{-fvar-tracking-assignments}, in the same way that
12897 @option{-gtoggle} toggles @option{-g}.
12898
12899 @item -Q
12900 @opindex Q
12901 Makes the compiler print out each function name as it is compiled, and
12902 print some statistics about each pass when it finishes.
12903
12904 @item -ftime-report
12905 @opindex ftime-report
12906 Makes the compiler print some statistics about the time consumed by each
12907 pass when it finishes.
12908
12909 @item -ftime-report-details
12910 @opindex ftime-report-details
12911 Record the time consumed by infrastructure parts separately for each pass.
12912
12913 @item -fira-verbose=@var{n}
12914 @opindex fira-verbose
12915 Control the verbosity of the dump file for the integrated register allocator.
12916 The default value is 5. If the value @var{n} is greater or equal to 10,
12917 the dump output is sent to stderr using the same format as @var{n} minus 10.
12918
12919 @item -flto-report
12920 @opindex flto-report
12921 Prints a report with internal details on the workings of the link-time
12922 optimizer. The contents of this report vary from version to version.
12923 It is meant to be useful to GCC developers when processing object
12924 files in LTO mode (via @option{-flto}).
12925
12926 Disabled by default.
12927
12928 @item -flto-report-wpa
12929 @opindex flto-report-wpa
12930 Like @option{-flto-report}, but only print for the WPA phase of Link
12931 Time Optimization.
12932
12933 @item -fmem-report
12934 @opindex fmem-report
12935 Makes the compiler print some statistics about permanent memory
12936 allocation when it finishes.
12937
12938 @item -fmem-report-wpa
12939 @opindex fmem-report-wpa
12940 Makes the compiler print some statistics about permanent memory
12941 allocation for the WPA phase only.
12942
12943 @item -fpre-ipa-mem-report
12944 @opindex fpre-ipa-mem-report
12945 @item -fpost-ipa-mem-report
12946 @opindex fpost-ipa-mem-report
12947 Makes the compiler print some statistics about permanent memory
12948 allocation before or after interprocedural optimization.
12949
12950 @item -fprofile-report
12951 @opindex fprofile-report
12952 Makes the compiler print some statistics about consistency of the
12953 (estimated) profile and effect of individual passes.
12954
12955 @item -fstack-usage
12956 @opindex fstack-usage
12957 Makes the compiler output stack usage information for the program, on a
12958 per-function basis. The filename for the dump is made by appending
12959 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
12960 the output file, if explicitly specified and it is not an executable,
12961 otherwise it is the basename of the source file. An entry is made up
12962 of three fields:
12963
12964 @itemize
12965 @item
12966 The name of the function.
12967 @item
12968 A number of bytes.
12969 @item
12970 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
12971 @end itemize
12972
12973 The qualifier @code{static} means that the function manipulates the stack
12974 statically: a fixed number of bytes are allocated for the frame on function
12975 entry and released on function exit; no stack adjustments are otherwise made
12976 in the function. The second field is this fixed number of bytes.
12977
12978 The qualifier @code{dynamic} means that the function manipulates the stack
12979 dynamically: in addition to the static allocation described above, stack
12980 adjustments are made in the body of the function, for example to push/pop
12981 arguments around function calls. If the qualifier @code{bounded} is also
12982 present, the amount of these adjustments is bounded at compile time and
12983 the second field is an upper bound of the total amount of stack used by
12984 the function. If it is not present, the amount of these adjustments is
12985 not bounded at compile time and the second field only represents the
12986 bounded part.
12987
12988 @item -fstats
12989 @opindex fstats
12990 Emit statistics about front-end processing at the end of the compilation.
12991 This option is supported only by the C++ front end, and
12992 the information is generally only useful to the G++ development team.
12993
12994 @item -fdbg-cnt-list
12995 @opindex fdbg-cnt-list
12996 Print the name and the counter upper bound for all debug counters.
12997
12998
12999 @item -fdbg-cnt=@var{counter-value-list}
13000 @opindex fdbg-cnt
13001 Set the internal debug counter upper bound. @var{counter-value-list}
13002 is a comma-separated list of @var{name}:@var{value} pairs
13003 which sets the upper bound of each debug counter @var{name} to @var{value}.
13004 All debug counters have the initial upper bound of @code{UINT_MAX};
13005 thus @code{dbg_cnt} returns true always unless the upper bound
13006 is set by this option.
13007 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
13008 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
13009
13010 @item -print-file-name=@var{library}
13011 @opindex print-file-name
13012 Print the full absolute name of the library file @var{library} that
13013 would be used when linking---and don't do anything else. With this
13014 option, GCC does not compile or link anything; it just prints the
13015 file name.
13016
13017 @item -print-multi-directory
13018 @opindex print-multi-directory
13019 Print the directory name corresponding to the multilib selected by any
13020 other switches present in the command line. This directory is supposed
13021 to exist in @env{GCC_EXEC_PREFIX}.
13022
13023 @item -print-multi-lib
13024 @opindex print-multi-lib
13025 Print the mapping from multilib directory names to compiler switches
13026 that enable them. The directory name is separated from the switches by
13027 @samp{;}, and each switch starts with an @samp{@@} instead of the
13028 @samp{-}, without spaces between multiple switches. This is supposed to
13029 ease shell processing.
13030
13031 @item -print-multi-os-directory
13032 @opindex print-multi-os-directory
13033 Print the path to OS libraries for the selected
13034 multilib, relative to some @file{lib} subdirectory. If OS libraries are
13035 present in the @file{lib} subdirectory and no multilibs are used, this is
13036 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
13037 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
13038 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
13039 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
13040
13041 @item -print-multiarch
13042 @opindex print-multiarch
13043 Print the path to OS libraries for the selected multiarch,
13044 relative to some @file{lib} subdirectory.
13045
13046 @item -print-prog-name=@var{program}
13047 @opindex print-prog-name
13048 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
13049
13050 @item -print-libgcc-file-name
13051 @opindex print-libgcc-file-name
13052 Same as @option{-print-file-name=libgcc.a}.
13053
13054 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
13055 but you do want to link with @file{libgcc.a}. You can do:
13056
13057 @smallexample
13058 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
13059 @end smallexample
13060
13061 @item -print-search-dirs
13062 @opindex print-search-dirs
13063 Print the name of the configured installation directory and a list of
13064 program and library directories @command{gcc} searches---and don't do anything else.
13065
13066 This is useful when @command{gcc} prints the error message
13067 @samp{installation problem, cannot exec cpp0: No such file or directory}.
13068 To resolve this you either need to put @file{cpp0} and the other compiler
13069 components where @command{gcc} expects to find them, or you can set the environment
13070 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
13071 Don't forget the trailing @samp{/}.
13072 @xref{Environment Variables}.
13073
13074 @item -print-sysroot
13075 @opindex print-sysroot
13076 Print the target sysroot directory that is used during
13077 compilation. This is the target sysroot specified either at configure
13078 time or using the @option{--sysroot} option, possibly with an extra
13079 suffix that depends on compilation options. If no target sysroot is
13080 specified, the option prints nothing.
13081
13082 @item -print-sysroot-headers-suffix
13083 @opindex print-sysroot-headers-suffix
13084 Print the suffix added to the target sysroot when searching for
13085 headers, or give an error if the compiler is not configured with such
13086 a suffix---and don't do anything else.
13087
13088 @item -dumpmachine
13089 @opindex dumpmachine
13090 Print the compiler's target machine (for example,
13091 @samp{i686-pc-linux-gnu})---and don't do anything else.
13092
13093 @item -dumpversion
13094 @opindex dumpversion
13095 Print the compiler version (for example, @code{3.0})---and don't do
13096 anything else.
13097
13098 @item -dumpspecs
13099 @opindex dumpspecs
13100 Print the compiler's built-in specs---and don't do anything else. (This
13101 is used when GCC itself is being built.) @xref{Spec Files}.
13102 @end table
13103
13104 @node Submodel Options
13105 @section Machine-Dependent Options
13106 @cindex submodel options
13107 @cindex specifying hardware config
13108 @cindex hardware models and configurations, specifying
13109 @cindex target-dependent options
13110 @cindex machine-dependent options
13111
13112 Each target machine supported by GCC can have its own options---for
13113 example, to allow you to compile for a particular processor variant or
13114 ABI, or to control optimizations specific to that machine. By
13115 convention, the names of machine-specific options start with
13116 @samp{-m}.
13117
13118 Some configurations of the compiler also support additional target-specific
13119 options, usually for compatibility with other compilers on the same
13120 platform.
13121
13122 @c This list is ordered alphanumerically by subsection name.
13123 @c It should be the same order and spelling as these options are listed
13124 @c in Machine Dependent Options
13125
13126 @menu
13127 * AArch64 Options::
13128 * Adapteva Epiphany Options::
13129 * ARC Options::
13130 * ARM Options::
13131 * AVR Options::
13132 * Blackfin Options::
13133 * C6X Options::
13134 * CRIS Options::
13135 * CR16 Options::
13136 * Darwin Options::
13137 * DEC Alpha Options::
13138 * FR30 Options::
13139 * FT32 Options::
13140 * FRV Options::
13141 * GNU/Linux Options::
13142 * H8/300 Options::
13143 * HPPA Options::
13144 * IA-64 Options::
13145 * LM32 Options::
13146 * M32C Options::
13147 * M32R/D Options::
13148 * M680x0 Options::
13149 * MCore Options::
13150 * MeP Options::
13151 * MicroBlaze Options::
13152 * MIPS Options::
13153 * MMIX Options::
13154 * MN10300 Options::
13155 * Moxie Options::
13156 * MSP430 Options::
13157 * NDS32 Options::
13158 * Nios II Options::
13159 * Nvidia PTX Options::
13160 * PDP-11 Options::
13161 * picoChip Options::
13162 * PowerPC Options::
13163 * RL78 Options::
13164 * RS/6000 and PowerPC Options::
13165 * RX Options::
13166 * S/390 and zSeries Options::
13167 * Score Options::
13168 * SH Options::
13169 * Solaris 2 Options::
13170 * SPARC Options::
13171 * SPU Options::
13172 * System V Options::
13173 * TILE-Gx Options::
13174 * TILEPro Options::
13175 * V850 Options::
13176 * VAX Options::
13177 * Visium Options::
13178 * VMS Options::
13179 * VxWorks Options::
13180 * x86 Options::
13181 * x86 Windows Options::
13182 * Xstormy16 Options::
13183 * Xtensa Options::
13184 * zSeries Options::
13185 @end menu
13186
13187 @node AArch64 Options
13188 @subsection AArch64 Options
13189 @cindex AArch64 Options
13190
13191 These options are defined for AArch64 implementations:
13192
13193 @table @gcctabopt
13194
13195 @item -mabi=@var{name}
13196 @opindex mabi
13197 Generate code for the specified data model. Permissible values
13198 are @samp{ilp32} for SysV-like data model where int, long int and pointers
13199 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
13200 but long int and pointers are 64 bits.
13201
13202 The default depends on the specific target configuration. Note that
13203 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
13204 entire program with the same ABI, and link with a compatible set of libraries.
13205
13206 @item -mbig-endian
13207 @opindex mbig-endian
13208 Generate big-endian code. This is the default when GCC is configured for an
13209 @samp{aarch64_be-*-*} target.
13210
13211 @item -mgeneral-regs-only
13212 @opindex mgeneral-regs-only
13213 Generate code which uses only the general-purpose registers. This will prevent
13214 the compiler from using floating-point and Advanced SIMD registers but will not
13215 impose any restrictions on the assembler.
13216
13217 @item -mlittle-endian
13218 @opindex mlittle-endian
13219 Generate little-endian code. This is the default when GCC is configured for an
13220 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
13221
13222 @item -mcmodel=tiny
13223 @opindex mcmodel=tiny
13224 Generate code for the tiny code model. The program and its statically defined
13225 symbols must be within 1MB of each other. Programs can be statically or
13226 dynamically linked.
13227
13228 @item -mcmodel=small
13229 @opindex mcmodel=small
13230 Generate code for the small code model. The program and its statically defined
13231 symbols must be within 4GB of each other. Programs can be statically or
13232 dynamically linked. This is the default code model.
13233
13234 @item -mcmodel=large
13235 @opindex mcmodel=large
13236 Generate code for the large code model. This makes no assumptions about
13237 addresses and sizes of sections. Programs can be statically linked only.
13238
13239 @item -mstrict-align
13240 @opindex mstrict-align
13241 Avoid generating memory accesses that may not be aligned on a natural object
13242 boundary as described in the architecture specification.
13243
13244 @item -momit-leaf-frame-pointer
13245 @itemx -mno-omit-leaf-frame-pointer
13246 @opindex momit-leaf-frame-pointer
13247 @opindex mno-omit-leaf-frame-pointer
13248 Omit or keep the frame pointer in leaf functions. The former behavior is the
13249 default.
13250
13251 @item -mtls-dialect=desc
13252 @opindex mtls-dialect=desc
13253 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
13254 of TLS variables. This is the default.
13255
13256 @item -mtls-dialect=traditional
13257 @opindex mtls-dialect=traditional
13258 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
13259 of TLS variables.
13260
13261 @item -mtls-size=@var{size}
13262 @opindex mtls-size
13263 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
13264 This option requires binutils 2.26 or newer.
13265
13266 @item -mfix-cortex-a53-835769
13267 @itemx -mno-fix-cortex-a53-835769
13268 @opindex mfix-cortex-a53-835769
13269 @opindex mno-fix-cortex-a53-835769
13270 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
13271 This involves inserting a NOP instruction between memory instructions and
13272 64-bit integer multiply-accumulate instructions.
13273
13274 @item -mfix-cortex-a53-843419
13275 @itemx -mno-fix-cortex-a53-843419
13276 @opindex mfix-cortex-a53-843419
13277 @opindex mno-fix-cortex-a53-843419
13278 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
13279 This erratum workaround is made at link time and this will only pass the
13280 corresponding flag to the linker.
13281
13282 @item -mlow-precision-recip-sqrt
13283 @item -mno-low-precision-recip-sqrt
13284 @opindex mlow-precision-recip-sqrt
13285 @opindex mno-low-precision-recip-sqrt
13286 Enable or disable the reciprocal square root approximation.
13287 This option only has an effect if @option{-ffast-math} or
13288 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13289 precision of reciprocal square root results to about 16 bits for
13290 single precision and to 32 bits for double precision.
13291
13292 @item -mlow-precision-sqrt
13293 @item -mno-low-precision-sqrt
13294 @opindex -mlow-precision-sqrt
13295 @opindex -mno-low-precision-sqrt
13296 Enable or disable the square root approximation.
13297 This option only has an effect if @option{-ffast-math} or
13298 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13299 precision of square root results to about 16 bits for
13300 single precision and to 32 bits for double precision.
13301 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
13302
13303 @item -mlow-precision-div
13304 @item -mno-low-precision-div
13305 @opindex -mlow-precision-div
13306 @opindex -mno-low-precision-div
13307 Enable or disable the division approximation.
13308 This option only has an effect if @option{-ffast-math} or
13309 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13310 precision of division results to about 16 bits for
13311 single precision and to 32 bits for double precision.
13312
13313 @item -march=@var{name}
13314 @opindex march
13315 Specify the name of the target architecture and, optionally, one or
13316 more feature modifiers. This option has the form
13317 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
13318
13319 The permissible values for @var{arch} are @samp{armv8-a},
13320 @samp{armv8.1-a}, @samp{armv8.2-a} or @var{native}.
13321
13322 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
13323 support for the ARMv8.2-A architecture extensions.
13324
13325 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
13326 support for the ARMv8.1-A architecture extension. In particular, it
13327 enables the @samp{+crc} and @samp{+lse} features.
13328
13329 The value @samp{native} is available on native AArch64 GNU/Linux and
13330 causes the compiler to pick the architecture of the host system. This
13331 option has no effect if the compiler is unable to recognize the
13332 architecture of the host system,
13333
13334 The permissible values for @var{feature} are listed in the sub-section
13335 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13336 Feature Modifiers}. Where conflicting feature modifiers are
13337 specified, the right-most feature is used.
13338
13339 GCC uses @var{name} to determine what kind of instructions it can emit
13340 when generating assembly code. If @option{-march} is specified
13341 without either of @option{-mtune} or @option{-mcpu} also being
13342 specified, the code is tuned to perform well across a range of target
13343 processors implementing the target architecture.
13344
13345 @item -mtune=@var{name}
13346 @opindex mtune
13347 Specify the name of the target processor for which GCC should tune the
13348 performance of the code. Permissible values for this option are:
13349 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
13350 @samp{cortex-a72}, @samp{cortex-a73}, @samp{exynos-m1}, @samp{qdf24xx},
13351 @samp{thunderx}, @samp{xgene1}, @samp{vulcan}, @samp{cortex-a57.cortex-a53},
13352 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
13353 @samp{cortex-a73.cortex-a53}, @samp{native}.
13354
13355 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
13356 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53}
13357 specify that GCC should tune for a big.LITTLE system.
13358
13359 Additionally on native AArch64 GNU/Linux systems the value
13360 @samp{native} tunes performance to the host system. This option has no effect
13361 if the compiler is unable to recognize the processor of the host system.
13362
13363 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
13364 are specified, the code is tuned to perform well across a range
13365 of target processors.
13366
13367 This option cannot be suffixed by feature modifiers.
13368
13369 @item -mcpu=@var{name}
13370 @opindex mcpu
13371 Specify the name of the target processor, optionally suffixed by one
13372 or more feature modifiers. This option has the form
13373 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
13374 the permissible values for @var{cpu} are the same as those available
13375 for @option{-mtune}. The permissible values for @var{feature} are
13376 documented in the sub-section on
13377 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13378 Feature Modifiers}. Where conflicting feature modifiers are
13379 specified, the right-most feature is used.
13380
13381 GCC uses @var{name} to determine what kind of instructions it can emit when
13382 generating assembly code (as if by @option{-march}) and to determine
13383 the target processor for which to tune for performance (as if
13384 by @option{-mtune}). Where this option is used in conjunction
13385 with @option{-march} or @option{-mtune}, those options take precedence
13386 over the appropriate part of this option.
13387
13388 @item -moverride=@var{string}
13389 @opindex moverride
13390 Override tuning decisions made by the back-end in response to a
13391 @option{-mtune=} switch. The syntax, semantics, and accepted values
13392 for @var{string} in this option are not guaranteed to be consistent
13393 across releases.
13394
13395 This option is only intended to be useful when developing GCC.
13396
13397 @item -mpc-relative-literal-loads
13398 @opindex mpc-relative-literal-loads
13399 Enable PC-relative literal loads. With this option literal pools are
13400 accessed using a single instruction and emitted after each function. This
13401 limits the maximum size of functions to 1MB. This is enabled by default for
13402 @option{-mcmodel=tiny}.
13403
13404 @end table
13405
13406 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
13407 @anchor{aarch64-feature-modifiers}
13408 @cindex @option{-march} feature modifiers
13409 @cindex @option{-mcpu} feature modifiers
13410 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
13411 the following and their inverses @option{no@var{feature}}:
13412
13413 @table @samp
13414 @item crc
13415 Enable CRC extension. This is on by default for
13416 @option{-march=armv8.1-a}.
13417 @item crypto
13418 Enable Crypto extension. This also enables Advanced SIMD and floating-point
13419 instructions.
13420 @item fp
13421 Enable floating-point instructions. This is on by default for all possible
13422 values for options @option{-march} and @option{-mcpu}.
13423 @item simd
13424 Enable Advanced SIMD instructions. This also enables floating-point
13425 instructions. This is on by default for all possible values for options
13426 @option{-march} and @option{-mcpu}.
13427 @item lse
13428 Enable Large System Extension instructions. This is on by default for
13429 @option{-march=armv8.1-a}.
13430 @item fp16
13431 Enable FP16 extension. This also enables floating-point instructions.
13432
13433 @end table
13434
13435 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
13436 Conversely, @option{nofp} implies @option{nosimd}, which implies
13437 @option{nocrypto}.
13438
13439 @node Adapteva Epiphany Options
13440 @subsection Adapteva Epiphany Options
13441
13442 These @samp{-m} options are defined for Adapteva Epiphany:
13443
13444 @table @gcctabopt
13445 @item -mhalf-reg-file
13446 @opindex mhalf-reg-file
13447 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
13448 That allows code to run on hardware variants that lack these registers.
13449
13450 @item -mprefer-short-insn-regs
13451 @opindex mprefer-short-insn-regs
13452 Preferentially allocate registers that allow short instruction generation.
13453 This can result in increased instruction count, so this may either reduce or
13454 increase overall code size.
13455
13456 @item -mbranch-cost=@var{num}
13457 @opindex mbranch-cost
13458 Set the cost of branches to roughly @var{num} ``simple'' instructions.
13459 This cost is only a heuristic and is not guaranteed to produce
13460 consistent results across releases.
13461
13462 @item -mcmove
13463 @opindex mcmove
13464 Enable the generation of conditional moves.
13465
13466 @item -mnops=@var{num}
13467 @opindex mnops
13468 Emit @var{num} NOPs before every other generated instruction.
13469
13470 @item -mno-soft-cmpsf
13471 @opindex mno-soft-cmpsf
13472 For single-precision floating-point comparisons, emit an @code{fsub} instruction
13473 and test the flags. This is faster than a software comparison, but can
13474 get incorrect results in the presence of NaNs, or when two different small
13475 numbers are compared such that their difference is calculated as zero.
13476 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
13477 software comparisons.
13478
13479 @item -mstack-offset=@var{num}
13480 @opindex mstack-offset
13481 Set the offset between the top of the stack and the stack pointer.
13482 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
13483 can be used by leaf functions without stack allocation.
13484 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
13485 Note also that this option changes the ABI; compiling a program with a
13486 different stack offset than the libraries have been compiled with
13487 generally does not work.
13488 This option can be useful if you want to evaluate if a different stack
13489 offset would give you better code, but to actually use a different stack
13490 offset to build working programs, it is recommended to configure the
13491 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
13492
13493 @item -mno-round-nearest
13494 @opindex mno-round-nearest
13495 Make the scheduler assume that the rounding mode has been set to
13496 truncating. The default is @option{-mround-nearest}.
13497
13498 @item -mlong-calls
13499 @opindex mlong-calls
13500 If not otherwise specified by an attribute, assume all calls might be beyond
13501 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
13502 function address into a register before performing a (otherwise direct) call.
13503 This is the default.
13504
13505 @item -mshort-calls
13506 @opindex short-calls
13507 If not otherwise specified by an attribute, assume all direct calls are
13508 in the range of the @code{b} / @code{bl} instructions, so use these instructions
13509 for direct calls. The default is @option{-mlong-calls}.
13510
13511 @item -msmall16
13512 @opindex msmall16
13513 Assume addresses can be loaded as 16-bit unsigned values. This does not
13514 apply to function addresses for which @option{-mlong-calls} semantics
13515 are in effect.
13516
13517 @item -mfp-mode=@var{mode}
13518 @opindex mfp-mode
13519 Set the prevailing mode of the floating-point unit.
13520 This determines the floating-point mode that is provided and expected
13521 at function call and return time. Making this mode match the mode you
13522 predominantly need at function start can make your programs smaller and
13523 faster by avoiding unnecessary mode switches.
13524
13525 @var{mode} can be set to one the following values:
13526
13527 @table @samp
13528 @item caller
13529 Any mode at function entry is valid, and retained or restored when
13530 the function returns, and when it calls other functions.
13531 This mode is useful for compiling libraries or other compilation units
13532 you might want to incorporate into different programs with different
13533 prevailing FPU modes, and the convenience of being able to use a single
13534 object file outweighs the size and speed overhead for any extra
13535 mode switching that might be needed, compared with what would be needed
13536 with a more specific choice of prevailing FPU mode.
13537
13538 @item truncate
13539 This is the mode used for floating-point calculations with
13540 truncating (i.e.@: round towards zero) rounding mode. That includes
13541 conversion from floating point to integer.
13542
13543 @item round-nearest
13544 This is the mode used for floating-point calculations with
13545 round-to-nearest-or-even rounding mode.
13546
13547 @item int
13548 This is the mode used to perform integer calculations in the FPU, e.g.@:
13549 integer multiply, or integer multiply-and-accumulate.
13550 @end table
13551
13552 The default is @option{-mfp-mode=caller}
13553
13554 @item -mnosplit-lohi
13555 @itemx -mno-postinc
13556 @itemx -mno-postmodify
13557 @opindex mnosplit-lohi
13558 @opindex mno-postinc
13559 @opindex mno-postmodify
13560 Code generation tweaks that disable, respectively, splitting of 32-bit
13561 loads, generation of post-increment addresses, and generation of
13562 post-modify addresses. The defaults are @option{msplit-lohi},
13563 @option{-mpost-inc}, and @option{-mpost-modify}.
13564
13565 @item -mnovect-double
13566 @opindex mno-vect-double
13567 Change the preferred SIMD mode to SImode. The default is
13568 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
13569
13570 @item -max-vect-align=@var{num}
13571 @opindex max-vect-align
13572 The maximum alignment for SIMD vector mode types.
13573 @var{num} may be 4 or 8. The default is 8.
13574 Note that this is an ABI change, even though many library function
13575 interfaces are unaffected if they don't use SIMD vector modes
13576 in places that affect size and/or alignment of relevant types.
13577
13578 @item -msplit-vecmove-early
13579 @opindex msplit-vecmove-early
13580 Split vector moves into single word moves before reload. In theory this
13581 can give better register allocation, but so far the reverse seems to be
13582 generally the case.
13583
13584 @item -m1reg-@var{reg}
13585 @opindex m1reg-
13586 Specify a register to hold the constant @minus{}1, which makes loading small negative
13587 constants and certain bitmasks faster.
13588 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
13589 which specify use of that register as a fixed register,
13590 and @samp{none}, which means that no register is used for this
13591 purpose. The default is @option{-m1reg-none}.
13592
13593 @end table
13594
13595 @node ARC Options
13596 @subsection ARC Options
13597 @cindex ARC options
13598
13599 The following options control the architecture variant for which code
13600 is being compiled:
13601
13602 @c architecture variants
13603 @table @gcctabopt
13604
13605 @item -mbarrel-shifter
13606 @opindex mbarrel-shifter
13607 Generate instructions supported by barrel shifter. This is the default
13608 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
13609
13610 @item -mcpu=@var{cpu}
13611 @opindex mcpu
13612 Set architecture type, register usage, and instruction scheduling
13613 parameters for @var{cpu}. There are also shortcut alias options
13614 available for backward compatibility and convenience. Supported
13615 values for @var{cpu} are
13616
13617 @table @samp
13618 @opindex mA6
13619 @opindex mARC600
13620 @item ARC600
13621 @item arc600
13622 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
13623
13624 @item ARC601
13625 @item arc601
13626 @opindex mARC601
13627 Compile for ARC601. Alias: @option{-mARC601}.
13628
13629 @item ARC700
13630 @item arc700
13631 @opindex mA7
13632 @opindex mARC700
13633 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
13634 This is the default when configured with @option{--with-cpu=arc700}@.
13635
13636 @item ARCEM
13637 @item arcem
13638 Compile for ARC EM.
13639
13640 @item ARCHS
13641 @item archs
13642 Compile for ARC HS.
13643 @end table
13644
13645 @item -mdpfp
13646 @opindex mdpfp
13647 @itemx -mdpfp-compact
13648 @opindex mdpfp-compact
13649 FPX: Generate Double Precision FPX instructions, tuned for the compact
13650 implementation.
13651
13652 @item -mdpfp-fast
13653 @opindex mdpfp-fast
13654 FPX: Generate Double Precision FPX instructions, tuned for the fast
13655 implementation.
13656
13657 @item -mno-dpfp-lrsr
13658 @opindex mno-dpfp-lrsr
13659 Disable LR and SR instructions from using FPX extension aux registers.
13660
13661 @item -mea
13662 @opindex mea
13663 Generate Extended arithmetic instructions. Currently only
13664 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
13665 supported. This is always enabled for @option{-mcpu=ARC700}.
13666
13667 @item -mno-mpy
13668 @opindex mno-mpy
13669 Do not generate mpy instructions for ARC700.
13670
13671 @item -mmul32x16
13672 @opindex mmul32x16
13673 Generate 32x16 bit multiply and mac instructions.
13674
13675 @item -mmul64
13676 @opindex mmul64
13677 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
13678
13679 @item -mnorm
13680 @opindex mnorm
13681 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
13682 is in effect.
13683
13684 @item -mspfp
13685 @opindex mspfp
13686 @itemx -mspfp-compact
13687 @opindex mspfp-compact
13688 FPX: Generate Single Precision FPX instructions, tuned for the compact
13689 implementation.
13690
13691 @item -mspfp-fast
13692 @opindex mspfp-fast
13693 FPX: Generate Single Precision FPX instructions, tuned for the fast
13694 implementation.
13695
13696 @item -msimd
13697 @opindex msimd
13698 Enable generation of ARC SIMD instructions via target-specific
13699 builtins. Only valid for @option{-mcpu=ARC700}.
13700
13701 @item -msoft-float
13702 @opindex msoft-float
13703 This option ignored; it is provided for compatibility purposes only.
13704 Software floating point code is emitted by default, and this default
13705 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
13706 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
13707 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
13708
13709 @item -mswap
13710 @opindex mswap
13711 Generate swap instructions.
13712
13713 @item -matomic
13714 @opindex matomic
13715 This enables Locked Load/Store Conditional extension to implement
13716 atomic memopry built-in functions. Not available for ARC 6xx or ARC
13717 EM cores.
13718
13719 @item -mdiv-rem
13720 @opindex mdiv-rem
13721 Enable DIV/REM instructions for ARCv2 cores.
13722
13723 @item -mcode-density
13724 @opindex mcode-density
13725 Enable code density instructions for ARC EM, default on for ARC HS.
13726
13727 @item -mll64
13728 @opindex mll64
13729 Enable double load/store operations for ARC HS cores.
13730
13731 @item -mtp-regno=@var{regno}
13732 @opindex mtp-regno
13733 Specify thread pointer register number.
13734
13735 @item -mmpy-option=@var{multo}
13736 @opindex mmpy-option
13737 Compile ARCv2 code with a multiplier design option. @samp{wlh1} is
13738 the default value. The recognized values for @var{multo} are:
13739
13740 @table @samp
13741 @item 0
13742 No multiplier available.
13743
13744 @item 1
13745 @opindex w
13746 The multiply option is set to w: 16x16 multiplier, fully pipelined.
13747 The following instructions are enabled: MPYW, and MPYUW.
13748
13749 @item 2
13750 @opindex wlh1
13751 The multiply option is set to wlh1: 32x32 multiplier, fully
13752 pipelined (1 stage). The following instructions are additionally
13753 enabled: MPY, MPYU, MPYM, MPYMU, and MPY_S.
13754
13755 @item 3
13756 @opindex wlh2
13757 The multiply option is set to wlh2: 32x32 multiplier, fully pipelined
13758 (2 stages). The following instructions are additionally enabled: MPY,
13759 MPYU, MPYM, MPYMU, and MPY_S.
13760
13761 @item 4
13762 @opindex wlh3
13763 The multiply option is set to wlh3: Two 16x16 multiplier, blocking,
13764 sequential. The following instructions are additionally enabled: MPY,
13765 MPYU, MPYM, MPYMU, and MPY_S.
13766
13767 @item 5
13768 @opindex wlh4
13769 The multiply option is set to wlh4: One 16x16 multiplier, blocking,
13770 sequential. The following instructions are additionally enabled: MPY,
13771 MPYU, MPYM, MPYMU, and MPY_S.
13772
13773 @item 6
13774 @opindex wlh5
13775 The multiply option is set to wlh5: One 32x4 multiplier, blocking,
13776 sequential. The following instructions are additionally enabled: MPY,
13777 MPYU, MPYM, MPYMU, and MPY_S.
13778
13779 @end table
13780
13781 This option is only available for ARCv2 cores@.
13782
13783 @item -mfpu=@var{fpu}
13784 @opindex mfpu
13785 Enables specific floating-point hardware extension for ARCv2
13786 core. Supported values for @var{fpu} are:
13787
13788 @table @samp
13789
13790 @item fpus
13791 @opindex fpus
13792 Enables support for single precision floating point hardware
13793 extensions@.
13794
13795 @item fpud
13796 @opindex fpud
13797 Enables support for double precision floating point hardware
13798 extensions. The single precision floating point extension is also
13799 enabled. Not available for ARC EM@.
13800
13801 @item fpuda
13802 @opindex fpuda
13803 Enables support for double precision floating point hardware
13804 extensions using double precision assist instructions. The single
13805 precision floating point extension is also enabled. This option is
13806 only available for ARC EM@.
13807
13808 @item fpuda_div
13809 @opindex fpuda_div
13810 Enables support for double precision floating point hardware
13811 extensions using double precision assist instructions, and simple
13812 precision square-root and divide hardware extensions. The single
13813 precision floating point extension is also enabled. This option is
13814 only available for ARC EM@.
13815
13816 @item fpuda_fma
13817 @opindex fpuda_fma
13818 Enables support for double precision floating point hardware
13819 extensions using double precision assist instructions, and simple
13820 precision fused multiple and add hardware extension. The single
13821 precision floating point extension is also enabled. This option is
13822 only available for ARC EM@.
13823
13824 @item fpuda_all
13825 @opindex fpuda_all
13826 Enables support for double precision floating point hardware
13827 extensions using double precision assist instructions, and all simple
13828 precision hardware extensions. The single precision floating point
13829 extension is also enabled. This option is only available for ARC EM@.
13830
13831 @item fpus_div
13832 @opindex fpus_div
13833 Enables support for single precision floating point, and single
13834 precision square-root and divide hardware extensions@.
13835
13836 @item fpud_div
13837 @opindex fpud_div
13838 Enables support for double precision floating point, and double
13839 precision square-root and divide hardware extensions. This option
13840 includes option @samp{fpus_div}. Not available for ARC EM@.
13841
13842 @item fpus_fma
13843 @opindex fpus_fma
13844 Enables support for single precision floating point, and single
13845 precision fused multiple and add hardware extensions@.
13846
13847 @item fpud_fma
13848 @opindex fpud_fma
13849 Enables support for double precision floating point, and double
13850 precision fused multiple and add hardware extensions. This option
13851 includes option @samp{fpus_fma}. Not available for ARC EM@.
13852
13853 @item fpus_all
13854 @opindex fpus_all
13855 Enables support for all single precision floating point hardware
13856 extensions@.
13857
13858 @item fpud_all
13859 @opindex fpud_all
13860 Enables support for all single and double precision floating point
13861 hardware extensions. Not available for ARC EM@.
13862
13863 @end table
13864
13865 @end table
13866
13867 The following options are passed through to the assembler, and also
13868 define preprocessor macro symbols.
13869
13870 @c Flags used by the assembler, but for which we define preprocessor
13871 @c macro symbols as well.
13872 @table @gcctabopt
13873 @item -mdsp-packa
13874 @opindex mdsp-packa
13875 Passed down to the assembler to enable the DSP Pack A extensions.
13876 Also sets the preprocessor symbol @code{__Xdsp_packa}.
13877
13878 @item -mdvbf
13879 @opindex mdvbf
13880 Passed down to the assembler to enable the dual viterbi butterfly
13881 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
13882
13883 @c ARC700 4.10 extension instruction
13884 @item -mlock
13885 @opindex mlock
13886 Passed down to the assembler to enable the Locked Load/Store
13887 Conditional extension. Also sets the preprocessor symbol
13888 @code{__Xlock}.
13889
13890 @item -mmac-d16
13891 @opindex mmac-d16
13892 Passed down to the assembler. Also sets the preprocessor symbol
13893 @code{__Xxmac_d16}.
13894
13895 @item -mmac-24
13896 @opindex mmac-24
13897 Passed down to the assembler. Also sets the preprocessor symbol
13898 @code{__Xxmac_24}.
13899
13900 @c ARC700 4.10 extension instruction
13901 @item -mrtsc
13902 @opindex mrtsc
13903 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
13904 extension instruction. Also sets the preprocessor symbol
13905 @code{__Xrtsc}.
13906
13907 @c ARC700 4.10 extension instruction
13908 @item -mswape
13909 @opindex mswape
13910 Passed down to the assembler to enable the swap byte ordering
13911 extension instruction. Also sets the preprocessor symbol
13912 @code{__Xswape}.
13913
13914 @item -mtelephony
13915 @opindex mtelephony
13916 Passed down to the assembler to enable dual and single operand
13917 instructions for telephony. Also sets the preprocessor symbol
13918 @code{__Xtelephony}.
13919
13920 @item -mxy
13921 @opindex mxy
13922 Passed down to the assembler to enable the XY Memory extension. Also
13923 sets the preprocessor symbol @code{__Xxy}.
13924
13925 @end table
13926
13927 The following options control how the assembly code is annotated:
13928
13929 @c Assembly annotation options
13930 @table @gcctabopt
13931 @item -misize
13932 @opindex misize
13933 Annotate assembler instructions with estimated addresses.
13934
13935 @item -mannotate-align
13936 @opindex mannotate-align
13937 Explain what alignment considerations lead to the decision to make an
13938 instruction short or long.
13939
13940 @end table
13941
13942 The following options are passed through to the linker:
13943
13944 @c options passed through to the linker
13945 @table @gcctabopt
13946 @item -marclinux
13947 @opindex marclinux
13948 Passed through to the linker, to specify use of the @code{arclinux} emulation.
13949 This option is enabled by default in tool chains built for
13950 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
13951 when profiling is not requested.
13952
13953 @item -marclinux_prof
13954 @opindex marclinux_prof
13955 Passed through to the linker, to specify use of the
13956 @code{arclinux_prof} emulation. This option is enabled by default in
13957 tool chains built for @w{@code{arc-linux-uclibc}} and
13958 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
13959
13960 @end table
13961
13962 The following options control the semantics of generated code:
13963
13964 @c semantically relevant code generation options
13965 @table @gcctabopt
13966 @item -mlong-calls
13967 @opindex mlong-calls
13968 Generate call insns as register indirect calls, thus providing access
13969 to the full 32-bit address range.
13970
13971 @item -mmedium-calls
13972 @opindex mmedium-calls
13973 Don't use less than 25 bit addressing range for calls, which is the
13974 offset available for an unconditional branch-and-link
13975 instruction. Conditional execution of function calls is suppressed, to
13976 allow use of the 25-bit range, rather than the 21-bit range with
13977 conditional branch-and-link. This is the default for tool chains built
13978 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
13979
13980 @item -mno-sdata
13981 @opindex mno-sdata
13982 Do not generate sdata references. This is the default for tool chains
13983 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
13984 targets.
13985
13986 @item -mucb-mcount
13987 @opindex mucb-mcount
13988 Instrument with mcount calls as used in UCB code. I.e. do the
13989 counting in the callee, not the caller. By default ARC instrumentation
13990 counts in the caller.
13991
13992 @item -mvolatile-cache
13993 @opindex mvolatile-cache
13994 Use ordinarily cached memory accesses for volatile references. This is the
13995 default.
13996
13997 @item -mno-volatile-cache
13998 @opindex mno-volatile-cache
13999 Enable cache bypass for volatile references.
14000
14001 @end table
14002
14003 The following options fine tune code generation:
14004 @c code generation tuning options
14005 @table @gcctabopt
14006 @item -malign-call
14007 @opindex malign-call
14008 Do alignment optimizations for call instructions.
14009
14010 @item -mauto-modify-reg
14011 @opindex mauto-modify-reg
14012 Enable the use of pre/post modify with register displacement.
14013
14014 @item -mbbit-peephole
14015 @opindex mbbit-peephole
14016 Enable bbit peephole2.
14017
14018 @item -mno-brcc
14019 @opindex mno-brcc
14020 This option disables a target-specific pass in @file{arc_reorg} to
14021 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
14022 generation driven by the combiner pass.
14023
14024 @item -mcase-vector-pcrel
14025 @opindex mcase-vector-pcrel
14026 Use pc-relative switch case tables - this enables case table shortening.
14027 This is the default for @option{-Os}.
14028
14029 @item -mcompact-casesi
14030 @opindex mcompact-casesi
14031 Enable compact casesi pattern.
14032 This is the default for @option{-Os}.
14033
14034 @item -mno-cond-exec
14035 @opindex mno-cond-exec
14036 Disable ARCompact specific pass to generate conditional execution instructions.
14037 Due to delay slot scheduling and interactions between operand numbers,
14038 literal sizes, instruction lengths, and the support for conditional execution,
14039 the target-independent pass to generate conditional execution is often lacking,
14040 so the ARC port has kept a special pass around that tries to find more
14041 conditional execution generating opportunities after register allocation,
14042 branch shortening, and delay slot scheduling have been done. This pass
14043 generally, but not always, improves performance and code size, at the cost of
14044 extra compilation time, which is why there is an option to switch it off.
14045 If you have a problem with call instructions exceeding their allowable
14046 offset range because they are conditionalized, you should consider using
14047 @option{-mmedium-calls} instead.
14048
14049 @item -mearly-cbranchsi
14050 @opindex mearly-cbranchsi
14051 Enable pre-reload use of the cbranchsi pattern.
14052
14053 @item -mexpand-adddi
14054 @opindex mexpand-adddi
14055 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
14056 @code{add.f}, @code{adc} etc.
14057
14058 @item -mindexed-loads
14059 @opindex mindexed-loads
14060 Enable the use of indexed loads. This can be problematic because some
14061 optimizers then assume that indexed stores exist, which is not
14062 the case.
14063
14064 @opindex mlra
14065 Enable Local Register Allocation. This is still experimental for ARC,
14066 so by default the compiler uses standard reload
14067 (i.e. @option{-mno-lra}).
14068
14069 @item -mlra-priority-none
14070 @opindex mlra-priority-none
14071 Don't indicate any priority for target registers.
14072
14073 @item -mlra-priority-compact
14074 @opindex mlra-priority-compact
14075 Indicate target register priority for r0..r3 / r12..r15.
14076
14077 @item -mlra-priority-noncompact
14078 @opindex mlra-priority-noncompact
14079 Reduce target register priority for r0..r3 / r12..r15.
14080
14081 @item -mno-millicode
14082 @opindex mno-millicode
14083 When optimizing for size (using @option{-Os}), prologues and epilogues
14084 that have to save or restore a large number of registers are often
14085 shortened by using call to a special function in libgcc; this is
14086 referred to as a @emph{millicode} call. As these calls can pose
14087 performance issues, and/or cause linking issues when linking in a
14088 nonstandard way, this option is provided to turn off millicode call
14089 generation.
14090
14091 @item -mmixed-code
14092 @opindex mmixed-code
14093 Tweak register allocation to help 16-bit instruction generation.
14094 This generally has the effect of decreasing the average instruction size
14095 while increasing the instruction count.
14096
14097 @item -mq-class
14098 @opindex mq-class
14099 Enable 'q' instruction alternatives.
14100 This is the default for @option{-Os}.
14101
14102 @item -mRcq
14103 @opindex mRcq
14104 Enable Rcq constraint handling - most short code generation depends on this.
14105 This is the default.
14106
14107 @item -mRcw
14108 @opindex mRcw
14109 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
14110 This is the default.
14111
14112 @item -msize-level=@var{level}
14113 @opindex msize-level
14114 Fine-tune size optimization with regards to instruction lengths and alignment.
14115 The recognized values for @var{level} are:
14116 @table @samp
14117 @item 0
14118 No size optimization. This level is deprecated and treated like @samp{1}.
14119
14120 @item 1
14121 Short instructions are used opportunistically.
14122
14123 @item 2
14124 In addition, alignment of loops and of code after barriers are dropped.
14125
14126 @item 3
14127 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
14128
14129 @end table
14130
14131 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
14132 the behavior when this is not set is equivalent to level @samp{1}.
14133
14134 @item -mtune=@var{cpu}
14135 @opindex mtune
14136 Set instruction scheduling parameters for @var{cpu}, overriding any implied
14137 by @option{-mcpu=}.
14138
14139 Supported values for @var{cpu} are
14140
14141 @table @samp
14142 @item ARC600
14143 Tune for ARC600 cpu.
14144
14145 @item ARC601
14146 Tune for ARC601 cpu.
14147
14148 @item ARC700
14149 Tune for ARC700 cpu with standard multiplier block.
14150
14151 @item ARC700-xmac
14152 Tune for ARC700 cpu with XMAC block.
14153
14154 @item ARC725D
14155 Tune for ARC725D cpu.
14156
14157 @item ARC750D
14158 Tune for ARC750D cpu.
14159
14160 @end table
14161
14162 @item -mmultcost=@var{num}
14163 @opindex mmultcost
14164 Cost to assume for a multiply instruction, with @samp{4} being equal to a
14165 normal instruction.
14166
14167 @item -munalign-prob-threshold=@var{probability}
14168 @opindex munalign-prob-threshold
14169 Set probability threshold for unaligning branches.
14170 When tuning for @samp{ARC700} and optimizing for speed, branches without
14171 filled delay slot are preferably emitted unaligned and long, unless
14172 profiling indicates that the probability for the branch to be taken
14173 is below @var{probability}. @xref{Cross-profiling}.
14174 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
14175
14176 @end table
14177
14178 The following options are maintained for backward compatibility, but
14179 are now deprecated and will be removed in a future release:
14180
14181 @c Deprecated options
14182 @table @gcctabopt
14183
14184 @item -margonaut
14185 @opindex margonaut
14186 Obsolete FPX.
14187
14188 @item -mbig-endian
14189 @opindex mbig-endian
14190 @itemx -EB
14191 @opindex EB
14192 Compile code for big endian targets. Use of these options is now
14193 deprecated. Users wanting big-endian code, should use the
14194 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
14195 building the tool chain, for which big-endian is the default.
14196
14197 @item -mlittle-endian
14198 @opindex mlittle-endian
14199 @itemx -EL
14200 @opindex EL
14201 Compile code for little endian targets. Use of these options is now
14202 deprecated. Users wanting little-endian code should use the
14203 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
14204 building the tool chain, for which little-endian is the default.
14205
14206 @item -mbarrel_shifter
14207 @opindex mbarrel_shifter
14208 Replaced by @option{-mbarrel-shifter}.
14209
14210 @item -mdpfp_compact
14211 @opindex mdpfp_compact
14212 Replaced by @option{-mdpfp-compact}.
14213
14214 @item -mdpfp_fast
14215 @opindex mdpfp_fast
14216 Replaced by @option{-mdpfp-fast}.
14217
14218 @item -mdsp_packa
14219 @opindex mdsp_packa
14220 Replaced by @option{-mdsp-packa}.
14221
14222 @item -mEA
14223 @opindex mEA
14224 Replaced by @option{-mea}.
14225
14226 @item -mmac_24
14227 @opindex mmac_24
14228 Replaced by @option{-mmac-24}.
14229
14230 @item -mmac_d16
14231 @opindex mmac_d16
14232 Replaced by @option{-mmac-d16}.
14233
14234 @item -mspfp_compact
14235 @opindex mspfp_compact
14236 Replaced by @option{-mspfp-compact}.
14237
14238 @item -mspfp_fast
14239 @opindex mspfp_fast
14240 Replaced by @option{-mspfp-fast}.
14241
14242 @item -mtune=@var{cpu}
14243 @opindex mtune
14244 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
14245 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
14246 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
14247
14248 @item -multcost=@var{num}
14249 @opindex multcost
14250 Replaced by @option{-mmultcost}.
14251
14252 @end table
14253
14254 @node ARM Options
14255 @subsection ARM Options
14256 @cindex ARM options
14257
14258 These @samp{-m} options are defined for the ARM port:
14259
14260 @table @gcctabopt
14261 @item -mabi=@var{name}
14262 @opindex mabi
14263 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
14264 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
14265
14266 @item -mapcs-frame
14267 @opindex mapcs-frame
14268 Generate a stack frame that is compliant with the ARM Procedure Call
14269 Standard for all functions, even if this is not strictly necessary for
14270 correct execution of the code. Specifying @option{-fomit-frame-pointer}
14271 with this option causes the stack frames not to be generated for
14272 leaf functions. The default is @option{-mno-apcs-frame}.
14273 This option is deprecated.
14274
14275 @item -mapcs
14276 @opindex mapcs
14277 This is a synonym for @option{-mapcs-frame} and is deprecated.
14278
14279 @ignore
14280 @c not currently implemented
14281 @item -mapcs-stack-check
14282 @opindex mapcs-stack-check
14283 Generate code to check the amount of stack space available upon entry to
14284 every function (that actually uses some stack space). If there is
14285 insufficient space available then either the function
14286 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
14287 called, depending upon the amount of stack space required. The runtime
14288 system is required to provide these functions. The default is
14289 @option{-mno-apcs-stack-check}, since this produces smaller code.
14290
14291 @c not currently implemented
14292 @item -mapcs-float
14293 @opindex mapcs-float
14294 Pass floating-point arguments using the floating-point registers. This is
14295 one of the variants of the APCS@. This option is recommended if the
14296 target hardware has a floating-point unit or if a lot of floating-point
14297 arithmetic is going to be performed by the code. The default is
14298 @option{-mno-apcs-float}, since the size of integer-only code is
14299 slightly increased if @option{-mapcs-float} is used.
14300
14301 @c not currently implemented
14302 @item -mapcs-reentrant
14303 @opindex mapcs-reentrant
14304 Generate reentrant, position-independent code. The default is
14305 @option{-mno-apcs-reentrant}.
14306 @end ignore
14307
14308 @item -mthumb-interwork
14309 @opindex mthumb-interwork
14310 Generate code that supports calling between the ARM and Thumb
14311 instruction sets. Without this option, on pre-v5 architectures, the
14312 two instruction sets cannot be reliably used inside one program. The
14313 default is @option{-mno-thumb-interwork}, since slightly larger code
14314 is generated when @option{-mthumb-interwork} is specified. In AAPCS
14315 configurations this option is meaningless.
14316
14317 @item -mno-sched-prolog
14318 @opindex mno-sched-prolog
14319 Prevent the reordering of instructions in the function prologue, or the
14320 merging of those instruction with the instructions in the function's
14321 body. This means that all functions start with a recognizable set
14322 of instructions (or in fact one of a choice from a small set of
14323 different function prologues), and this information can be used to
14324 locate the start of functions inside an executable piece of code. The
14325 default is @option{-msched-prolog}.
14326
14327 @item -mfloat-abi=@var{name}
14328 @opindex mfloat-abi
14329 Specifies which floating-point ABI to use. Permissible values
14330 are: @samp{soft}, @samp{softfp} and @samp{hard}.
14331
14332 Specifying @samp{soft} causes GCC to generate output containing
14333 library calls for floating-point operations.
14334 @samp{softfp} allows the generation of code using hardware floating-point
14335 instructions, but still uses the soft-float calling conventions.
14336 @samp{hard} allows generation of floating-point instructions
14337 and uses FPU-specific calling conventions.
14338
14339 The default depends on the specific target configuration. Note that
14340 the hard-float and soft-float ABIs are not link-compatible; you must
14341 compile your entire program with the same ABI, and link with a
14342 compatible set of libraries.
14343
14344 @item -mlittle-endian
14345 @opindex mlittle-endian
14346 Generate code for a processor running in little-endian mode. This is
14347 the default for all standard configurations.
14348
14349 @item -mbig-endian
14350 @opindex mbig-endian
14351 Generate code for a processor running in big-endian mode; the default is
14352 to compile code for a little-endian processor.
14353
14354 @item -march=@var{name}
14355 @opindex march
14356 This specifies the name of the target ARM architecture. GCC uses this
14357 name to determine what kind of instructions it can emit when generating
14358 assembly code. This option can be used in conjunction with or instead
14359 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
14360 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
14361 @samp{armv5}, @samp{armv5e}, @samp{armv5t}, @samp{armv5te},
14362 @samp{armv6}, @samp{armv6-m}, @samp{armv6j}, @samp{armv6k},
14363 @samp{armv6kz}, @samp{armv6s-m},
14364 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk},
14365 @samp{armv7}, @samp{armv7-a}, @samp{armv7-m}, @samp{armv7-r}, @samp{armv7e-m},
14366 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
14367 @samp{armv8.1-a+crc}, @samp{armv8-m.base}, @samp{armv8-m.main},
14368 @samp{armv8-m.main+dsp}, @samp{iwmmxt}, @samp{iwmmxt2}.
14369
14370 Architecture revisions older than @samp{armv4t} are deprecated.
14371
14372 @option{-march=armv6s-m} is the @samp{armv6-m} architecture with support for
14373 the (now mandatory) SVC instruction.
14374
14375 @option{-march=armv6zk} is an alias for @samp{armv6kz}, existing for backwards
14376 compatibility.
14377
14378 @option{-march=armv7ve} is the @samp{armv7-a} architecture with virtualization
14379 extensions.
14380
14381 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
14382 architecture together with the optional CRC32 extensions.
14383
14384 @option{-march=native} causes the compiler to auto-detect the architecture
14385 of the build computer. At present, this feature is only supported on
14386 GNU/Linux, and not all architectures are recognized. If the auto-detect
14387 is unsuccessful the option has no effect.
14388
14389 @item -mtune=@var{name}
14390 @opindex mtune
14391 This option specifies the name of the target ARM processor for
14392 which GCC should tune the performance of the code.
14393 For some ARM implementations better performance can be obtained by using
14394 this option.
14395 Permissible names are: @samp{arm2}, @samp{arm250},
14396 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
14397 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
14398 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
14399 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
14400 @samp{arm720},
14401 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
14402 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
14403 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
14404 @samp{strongarm1110},
14405 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
14406 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
14407 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
14408 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
14409 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
14410 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
14411 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
14412 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
14413 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
14414 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
14415 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-r4},
14416 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
14417 @samp{cortex-m7},
14418 @samp{cortex-m4},
14419 @samp{cortex-m3},
14420 @samp{cortex-m1},
14421 @samp{cortex-m0},
14422 @samp{cortex-m0plus},
14423 @samp{cortex-m1.small-multiply},
14424 @samp{cortex-m0.small-multiply},
14425 @samp{cortex-m0plus.small-multiply},
14426 @samp{exynos-m1},
14427 @samp{qdf24xx},
14428 @samp{marvell-pj4},
14429 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
14430 @samp{fa526}, @samp{fa626},
14431 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
14432 @samp{xgene1}.
14433
14434 Additionally, this option can specify that GCC should tune the performance
14435 of the code for a big.LITTLE system. Permissible names are:
14436 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
14437 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
14438 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53}.
14439
14440 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
14441 performance for a blend of processors within architecture @var{arch}.
14442 The aim is to generate code that run well on the current most popular
14443 processors, balancing between optimizations that benefit some CPUs in the
14444 range, and avoiding performance pitfalls of other CPUs. The effects of
14445 this option may change in future GCC versions as CPU models come and go.
14446
14447 @option{-mtune=native} causes the compiler to auto-detect the CPU
14448 of the build computer. At present, this feature is only supported on
14449 GNU/Linux, and not all architectures are recognized. If the auto-detect is
14450 unsuccessful the option has no effect.
14451
14452 @item -mcpu=@var{name}
14453 @opindex mcpu
14454 This specifies the name of the target ARM processor. GCC uses this name
14455 to derive the name of the target ARM architecture (as if specified
14456 by @option{-march}) and the ARM processor type for which to tune for
14457 performance (as if specified by @option{-mtune}). Where this option
14458 is used in conjunction with @option{-march} or @option{-mtune},
14459 those options take precedence over the appropriate part of this option.
14460
14461 Permissible names for this option are the same as those for
14462 @option{-mtune}.
14463
14464 @option{-mcpu=generic-@var{arch}} is also permissible, and is
14465 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
14466 See @option{-mtune} for more information.
14467
14468 @option{-mcpu=native} causes the compiler to auto-detect the CPU
14469 of the build computer. At present, this feature is only supported on
14470 GNU/Linux, and not all architectures are recognized. If the auto-detect
14471 is unsuccessful the option has no effect.
14472
14473 @item -mfpu=@var{name}
14474 @opindex mfpu
14475 This specifies what floating-point hardware (or hardware emulation) is
14476 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
14477 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
14478 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
14479 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
14480 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
14481 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
14482
14483 If @option{-msoft-float} is specified this specifies the format of
14484 floating-point values.
14485
14486 If the selected floating-point hardware includes the NEON extension
14487 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
14488 operations are not generated by GCC's auto-vectorization pass unless
14489 @option{-funsafe-math-optimizations} is also specified. This is
14490 because NEON hardware does not fully implement the IEEE 754 standard for
14491 floating-point arithmetic (in particular denormal values are treated as
14492 zero), so the use of NEON instructions may lead to a loss of precision.
14493
14494 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}).
14495
14496 @item -mfp16-format=@var{name}
14497 @opindex mfp16-format
14498 Specify the format of the @code{__fp16} half-precision floating-point type.
14499 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
14500 the default is @samp{none}, in which case the @code{__fp16} type is not
14501 defined. @xref{Half-Precision}, for more information.
14502
14503 @item -mstructure-size-boundary=@var{n}
14504 @opindex mstructure-size-boundary
14505 The sizes of all structures and unions are rounded up to a multiple
14506 of the number of bits set by this option. Permissible values are 8, 32
14507 and 64. The default value varies for different toolchains. For the COFF
14508 targeted toolchain the default value is 8. A value of 64 is only allowed
14509 if the underlying ABI supports it.
14510
14511 Specifying a larger number can produce faster, more efficient code, but
14512 can also increase the size of the program. Different values are potentially
14513 incompatible. Code compiled with one value cannot necessarily expect to
14514 work with code or libraries compiled with another value, if they exchange
14515 information using structures or unions.
14516
14517 @item -mabort-on-noreturn
14518 @opindex mabort-on-noreturn
14519 Generate a call to the function @code{abort} at the end of a
14520 @code{noreturn} function. It is executed if the function tries to
14521 return.
14522
14523 @item -mlong-calls
14524 @itemx -mno-long-calls
14525 @opindex mlong-calls
14526 @opindex mno-long-calls
14527 Tells the compiler to perform function calls by first loading the
14528 address of the function into a register and then performing a subroutine
14529 call on this register. This switch is needed if the target function
14530 lies outside of the 64-megabyte addressing range of the offset-based
14531 version of subroutine call instruction.
14532
14533 Even if this switch is enabled, not all function calls are turned
14534 into long calls. The heuristic is that static functions, functions
14535 that have the @code{short_call} attribute, functions that are inside
14536 the scope of a @code{#pragma no_long_calls} directive, and functions whose
14537 definitions have already been compiled within the current compilation
14538 unit are not turned into long calls. The exceptions to this rule are
14539 that weak function definitions, functions with the @code{long_call}
14540 attribute or the @code{section} attribute, and functions that are within
14541 the scope of a @code{#pragma long_calls} directive are always
14542 turned into long calls.
14543
14544 This feature is not enabled by default. Specifying
14545 @option{-mno-long-calls} restores the default behavior, as does
14546 placing the function calls within the scope of a @code{#pragma
14547 long_calls_off} directive. Note these switches have no effect on how
14548 the compiler generates code to handle function calls via function
14549 pointers.
14550
14551 @item -msingle-pic-base
14552 @opindex msingle-pic-base
14553 Treat the register used for PIC addressing as read-only, rather than
14554 loading it in the prologue for each function. The runtime system is
14555 responsible for initializing this register with an appropriate value
14556 before execution begins.
14557
14558 @item -mpic-register=@var{reg}
14559 @opindex mpic-register
14560 Specify the register to be used for PIC addressing.
14561 For standard PIC base case, the default is any suitable register
14562 determined by compiler. For single PIC base case, the default is
14563 @samp{R9} if target is EABI based or stack-checking is enabled,
14564 otherwise the default is @samp{R10}.
14565
14566 @item -mpic-data-is-text-relative
14567 @opindex mpic-data-is-text-relative
14568 Assume that the displacement between the text and data segments is fixed
14569 at static link time. This permits using PC-relative addressing
14570 operations to access data known to be in the data segment. For
14571 non-VxWorks RTP targets, this option is enabled by default. When
14572 disabled on such targets, it will enable @option{-msingle-pic-base} by
14573 default.
14574
14575 @item -mpoke-function-name
14576 @opindex mpoke-function-name
14577 Write the name of each function into the text section, directly
14578 preceding the function prologue. The generated code is similar to this:
14579
14580 @smallexample
14581 t0
14582 .ascii "arm_poke_function_name", 0
14583 .align
14584 t1
14585 .word 0xff000000 + (t1 - t0)
14586 arm_poke_function_name
14587 mov ip, sp
14588 stmfd sp!, @{fp, ip, lr, pc@}
14589 sub fp, ip, #4
14590 @end smallexample
14591
14592 When performing a stack backtrace, code can inspect the value of
14593 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
14594 location @code{pc - 12} and the top 8 bits are set, then we know that
14595 there is a function name embedded immediately preceding this location
14596 and has length @code{((pc[-3]) & 0xff000000)}.
14597
14598 @item -mthumb
14599 @itemx -marm
14600 @opindex marm
14601 @opindex mthumb
14602
14603 Select between generating code that executes in ARM and Thumb
14604 states. The default for most configurations is to generate code
14605 that executes in ARM state, but the default can be changed by
14606 configuring GCC with the @option{--with-mode=}@var{state}
14607 configure option.
14608
14609 You can also override the ARM and Thumb mode for each function
14610 by using the @code{target("thumb")} and @code{target("arm")} function attributes
14611 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
14612
14613 @item -mtpcs-frame
14614 @opindex mtpcs-frame
14615 Generate a stack frame that is compliant with the Thumb Procedure Call
14616 Standard for all non-leaf functions. (A leaf function is one that does
14617 not call any other functions.) The default is @option{-mno-tpcs-frame}.
14618
14619 @item -mtpcs-leaf-frame
14620 @opindex mtpcs-leaf-frame
14621 Generate a stack frame that is compliant with the Thumb Procedure Call
14622 Standard for all leaf functions. (A leaf function is one that does
14623 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
14624
14625 @item -mcallee-super-interworking
14626 @opindex mcallee-super-interworking
14627 Gives all externally visible functions in the file being compiled an ARM
14628 instruction set header which switches to Thumb mode before executing the
14629 rest of the function. This allows these functions to be called from
14630 non-interworking code. This option is not valid in AAPCS configurations
14631 because interworking is enabled by default.
14632
14633 @item -mcaller-super-interworking
14634 @opindex mcaller-super-interworking
14635 Allows calls via function pointers (including virtual functions) to
14636 execute correctly regardless of whether the target code has been
14637 compiled for interworking or not. There is a small overhead in the cost
14638 of executing a function pointer if this option is enabled. This option
14639 is not valid in AAPCS configurations because interworking is enabled
14640 by default.
14641
14642 @item -mtp=@var{name}
14643 @opindex mtp
14644 Specify the access model for the thread local storage pointer. The valid
14645 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
14646 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
14647 (supported in the arm6k architecture), and @samp{auto}, which uses the
14648 best available method for the selected processor. The default setting is
14649 @samp{auto}.
14650
14651 @item -mtls-dialect=@var{dialect}
14652 @opindex mtls-dialect
14653 Specify the dialect to use for accessing thread local storage. Two
14654 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
14655 @samp{gnu} dialect selects the original GNU scheme for supporting
14656 local and global dynamic TLS models. The @samp{gnu2} dialect
14657 selects the GNU descriptor scheme, which provides better performance
14658 for shared libraries. The GNU descriptor scheme is compatible with
14659 the original scheme, but does require new assembler, linker and
14660 library support. Initial and local exec TLS models are unaffected by
14661 this option and always use the original scheme.
14662
14663 @item -mword-relocations
14664 @opindex mword-relocations
14665 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
14666 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
14667 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
14668 is specified.
14669
14670 @item -mfix-cortex-m3-ldrd
14671 @opindex mfix-cortex-m3-ldrd
14672 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
14673 with overlapping destination and base registers are used. This option avoids
14674 generating these instructions. This option is enabled by default when
14675 @option{-mcpu=cortex-m3} is specified.
14676
14677 @item -munaligned-access
14678 @itemx -mno-unaligned-access
14679 @opindex munaligned-access
14680 @opindex mno-unaligned-access
14681 Enables (or disables) reading and writing of 16- and 32- bit values
14682 from addresses that are not 16- or 32- bit aligned. By default
14683 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
14684 ARMv8-M Baseline architectures, and enabled for all other
14685 architectures. If unaligned access is not enabled then words in packed
14686 data structures are accessed a byte at a time.
14687
14688 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
14689 generated object file to either true or false, depending upon the
14690 setting of this option. If unaligned access is enabled then the
14691 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
14692 defined.
14693
14694 @item -mneon-for-64bits
14695 @opindex mneon-for-64bits
14696 Enables using Neon to handle scalar 64-bits operations. This is
14697 disabled by default since the cost of moving data from core registers
14698 to Neon is high.
14699
14700 @item -mslow-flash-data
14701 @opindex mslow-flash-data
14702 Assume loading data from flash is slower than fetching instruction.
14703 Therefore literal load is minimized for better performance.
14704 This option is only supported when compiling for ARMv7 M-profile and
14705 off by default.
14706
14707 @item -masm-syntax-unified
14708 @opindex masm-syntax-unified
14709 Assume inline assembler is using unified asm syntax. The default is
14710 currently off which implies divided syntax. This option has no impact
14711 on Thumb2. However, this may change in future releases of GCC.
14712 Divided syntax should be considered deprecated.
14713
14714 @item -mrestrict-it
14715 @opindex mrestrict-it
14716 Restricts generation of IT blocks to conform to the rules of ARMv8.
14717 IT blocks can only contain a single 16-bit instruction from a select
14718 set of instructions. This option is on by default for ARMv8 Thumb mode.
14719
14720 @item -mprint-tune-info
14721 @opindex mprint-tune-info
14722 Print CPU tuning information as comment in assembler file. This is
14723 an option used only for regression testing of the compiler and not
14724 intended for ordinary use in compiling code. This option is disabled
14725 by default.
14726 @end table
14727
14728 @node AVR Options
14729 @subsection AVR Options
14730 @cindex AVR Options
14731
14732 These options are defined for AVR implementations:
14733
14734 @table @gcctabopt
14735 @item -mmcu=@var{mcu}
14736 @opindex mmcu
14737 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
14738
14739 The default for this option is@tie{}@samp{avr2}.
14740
14741 GCC supports the following AVR devices and ISAs:
14742
14743 @include avr-mmcu.texi
14744
14745 @item -maccumulate-args
14746 @opindex maccumulate-args
14747 Accumulate outgoing function arguments and acquire/release the needed
14748 stack space for outgoing function arguments once in function
14749 prologue/epilogue. Without this option, outgoing arguments are pushed
14750 before calling a function and popped afterwards.
14751
14752 Popping the arguments after the function call can be expensive on
14753 AVR so that accumulating the stack space might lead to smaller
14754 executables because arguments need not to be removed from the
14755 stack after such a function call.
14756
14757 This option can lead to reduced code size for functions that perform
14758 several calls to functions that get their arguments on the stack like
14759 calls to printf-like functions.
14760
14761 @item -mbranch-cost=@var{cost}
14762 @opindex mbranch-cost
14763 Set the branch costs for conditional branch instructions to
14764 @var{cost}. Reasonable values for @var{cost} are small, non-negative
14765 integers. The default branch cost is 0.
14766
14767 @item -mcall-prologues
14768 @opindex mcall-prologues
14769 Functions prologues/epilogues are expanded as calls to appropriate
14770 subroutines. Code size is smaller.
14771
14772 @item -mint8
14773 @opindex mint8
14774 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
14775 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
14776 and @code{long long} is 4 bytes. Please note that this option does not
14777 conform to the C standards, but it results in smaller code
14778 size.
14779
14780 @item -mn-flash=@var{num}
14781 @opindex mn-flash
14782 Assume that the flash memory has a size of
14783 @var{num} times 64@tie{}KiB.
14784
14785 @item -mno-interrupts
14786 @opindex mno-interrupts
14787 Generated code is not compatible with hardware interrupts.
14788 Code size is smaller.
14789
14790 @item -mrelax
14791 @opindex mrelax
14792 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
14793 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
14794 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
14795 the assembler's command line and the @option{--relax} option to the
14796 linker's command line.
14797
14798 Jump relaxing is performed by the linker because jump offsets are not
14799 known before code is located. Therefore, the assembler code generated by the
14800 compiler is the same, but the instructions in the executable may
14801 differ from instructions in the assembler code.
14802
14803 Relaxing must be turned on if linker stubs are needed, see the
14804 section on @code{EIND} and linker stubs below.
14805
14806 @item -mrmw
14807 @opindex mrmw
14808 Assume that the device supports the Read-Modify-Write
14809 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
14810
14811 @item -msp8
14812 @opindex msp8
14813 Treat the stack pointer register as an 8-bit register,
14814 i.e.@: assume the high byte of the stack pointer is zero.
14815 In general, you don't need to set this option by hand.
14816
14817 This option is used internally by the compiler to select and
14818 build multilibs for architectures @code{avr2} and @code{avr25}.
14819 These architectures mix devices with and without @code{SPH}.
14820 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
14821 the compiler driver adds or removes this option from the compiler
14822 proper's command line, because the compiler then knows if the device
14823 or architecture has an 8-bit stack pointer and thus no @code{SPH}
14824 register or not.
14825
14826 @item -mstrict-X
14827 @opindex mstrict-X
14828 Use address register @code{X} in a way proposed by the hardware. This means
14829 that @code{X} is only used in indirect, post-increment or
14830 pre-decrement addressing.
14831
14832 Without this option, the @code{X} register may be used in the same way
14833 as @code{Y} or @code{Z} which then is emulated by additional
14834 instructions.
14835 For example, loading a value with @code{X+const} addressing with a
14836 small non-negative @code{const < 64} to a register @var{Rn} is
14837 performed as
14838
14839 @example
14840 adiw r26, const ; X += const
14841 ld @var{Rn}, X ; @var{Rn} = *X
14842 sbiw r26, const ; X -= const
14843 @end example
14844
14845 @item -mtiny-stack
14846 @opindex mtiny-stack
14847 Only change the lower 8@tie{}bits of the stack pointer.
14848
14849 @item -mfract-convert-truncate
14850 @opindex mfract-convert-truncate
14851 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
14852
14853 @item -nodevicelib
14854 @opindex nodevicelib
14855 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
14856
14857 @item -Waddr-space-convert
14858 @opindex Waddr-space-convert
14859 Warn about conversions between address spaces in the case where the
14860 resulting address space is not contained in the incoming address space.
14861
14862 @item -Wmisspelled-isr
14863 @opindex Wmisspelled-isr
14864 Warn if the ISR is misspelled, i.e. without __vector prefix.
14865 Enabled by default.
14866 @end table
14867
14868 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
14869 @cindex @code{EIND}
14870 Pointers in the implementation are 16@tie{}bits wide.
14871 The address of a function or label is represented as word address so
14872 that indirect jumps and calls can target any code address in the
14873 range of 64@tie{}Ki words.
14874
14875 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
14876 bytes of program memory space, there is a special function register called
14877 @code{EIND} that serves as most significant part of the target address
14878 when @code{EICALL} or @code{EIJMP} instructions are used.
14879
14880 Indirect jumps and calls on these devices are handled as follows by
14881 the compiler and are subject to some limitations:
14882
14883 @itemize @bullet
14884
14885 @item
14886 The compiler never sets @code{EIND}.
14887
14888 @item
14889 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
14890 instructions or might read @code{EIND} directly in order to emulate an
14891 indirect call/jump by means of a @code{RET} instruction.
14892
14893 @item
14894 The compiler assumes that @code{EIND} never changes during the startup
14895 code or during the application. In particular, @code{EIND} is not
14896 saved/restored in function or interrupt service routine
14897 prologue/epilogue.
14898
14899 @item
14900 For indirect calls to functions and computed goto, the linker
14901 generates @emph{stubs}. Stubs are jump pads sometimes also called
14902 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
14903 The stub contains a direct jump to the desired address.
14904
14905 @item
14906 Linker relaxation must be turned on so that the linker generates
14907 the stubs correctly in all situations. See the compiler option
14908 @option{-mrelax} and the linker option @option{--relax}.
14909 There are corner cases where the linker is supposed to generate stubs
14910 but aborts without relaxation and without a helpful error message.
14911
14912 @item
14913 The default linker script is arranged for code with @code{EIND = 0}.
14914 If code is supposed to work for a setup with @code{EIND != 0}, a custom
14915 linker script has to be used in order to place the sections whose
14916 name start with @code{.trampolines} into the segment where @code{EIND}
14917 points to.
14918
14919 @item
14920 The startup code from libgcc never sets @code{EIND}.
14921 Notice that startup code is a blend of code from libgcc and AVR-LibC.
14922 For the impact of AVR-LibC on @code{EIND}, see the
14923 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
14924
14925 @item
14926 It is legitimate for user-specific startup code to set up @code{EIND}
14927 early, for example by means of initialization code located in
14928 section @code{.init3}. Such code runs prior to general startup code
14929 that initializes RAM and calls constructors, but after the bit
14930 of startup code from AVR-LibC that sets @code{EIND} to the segment
14931 where the vector table is located.
14932 @example
14933 #include <avr/io.h>
14934
14935 static void
14936 __attribute__((section(".init3"),naked,used,no_instrument_function))
14937 init3_set_eind (void)
14938 @{
14939 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
14940 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
14941 @}
14942 @end example
14943
14944 @noindent
14945 The @code{__trampolines_start} symbol is defined in the linker script.
14946
14947 @item
14948 Stubs are generated automatically by the linker if
14949 the following two conditions are met:
14950 @itemize @minus
14951
14952 @item The address of a label is taken by means of the @code{gs} modifier
14953 (short for @emph{generate stubs}) like so:
14954 @example
14955 LDI r24, lo8(gs(@var{func}))
14956 LDI r25, hi8(gs(@var{func}))
14957 @end example
14958 @item The final location of that label is in a code segment
14959 @emph{outside} the segment where the stubs are located.
14960 @end itemize
14961
14962 @item
14963 The compiler emits such @code{gs} modifiers for code labels in the
14964 following situations:
14965 @itemize @minus
14966 @item Taking address of a function or code label.
14967 @item Computed goto.
14968 @item If prologue-save function is used, see @option{-mcall-prologues}
14969 command-line option.
14970 @item Switch/case dispatch tables. If you do not want such dispatch
14971 tables you can specify the @option{-fno-jump-tables} command-line option.
14972 @item C and C++ constructors/destructors called during startup/shutdown.
14973 @item If the tools hit a @code{gs()} modifier explained above.
14974 @end itemize
14975
14976 @item
14977 Jumping to non-symbolic addresses like so is @emph{not} supported:
14978
14979 @example
14980 int main (void)
14981 @{
14982 /* Call function at word address 0x2 */
14983 return ((int(*)(void)) 0x2)();
14984 @}
14985 @end example
14986
14987 Instead, a stub has to be set up, i.e.@: the function has to be called
14988 through a symbol (@code{func_4} in the example):
14989
14990 @example
14991 int main (void)
14992 @{
14993 extern int func_4 (void);
14994
14995 /* Call function at byte address 0x4 */
14996 return func_4();
14997 @}
14998 @end example
14999
15000 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
15001 Alternatively, @code{func_4} can be defined in the linker script.
15002 @end itemize
15003
15004 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
15005 @cindex @code{RAMPD}
15006 @cindex @code{RAMPX}
15007 @cindex @code{RAMPY}
15008 @cindex @code{RAMPZ}
15009 Some AVR devices support memories larger than the 64@tie{}KiB range
15010 that can be accessed with 16-bit pointers. To access memory locations
15011 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
15012 register is used as high part of the address:
15013 The @code{X}, @code{Y}, @code{Z} address register is concatenated
15014 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
15015 register, respectively, to get a wide address. Similarly,
15016 @code{RAMPD} is used together with direct addressing.
15017
15018 @itemize
15019 @item
15020 The startup code initializes the @code{RAMP} special function
15021 registers with zero.
15022
15023 @item
15024 If a @ref{AVR Named Address Spaces,named address space} other than
15025 generic or @code{__flash} is used, then @code{RAMPZ} is set
15026 as needed before the operation.
15027
15028 @item
15029 If the device supports RAM larger than 64@tie{}KiB and the compiler
15030 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
15031 is reset to zero after the operation.
15032
15033 @item
15034 If the device comes with a specific @code{RAMP} register, the ISR
15035 prologue/epilogue saves/restores that SFR and initializes it with
15036 zero in case the ISR code might (implicitly) use it.
15037
15038 @item
15039 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
15040 If you use inline assembler to read from locations outside the
15041 16-bit address range and change one of the @code{RAMP} registers,
15042 you must reset it to zero after the access.
15043
15044 @end itemize
15045
15046 @subsubsection AVR Built-in Macros
15047
15048 GCC defines several built-in macros so that the user code can test
15049 for the presence or absence of features. Almost any of the following
15050 built-in macros are deduced from device capabilities and thus
15051 triggered by the @option{-mmcu=} command-line option.
15052
15053 For even more AVR-specific built-in macros see
15054 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
15055
15056 @table @code
15057
15058 @item __AVR_ARCH__
15059 Build-in macro that resolves to a decimal number that identifies the
15060 architecture and depends on the @option{-mmcu=@var{mcu}} option.
15061 Possible values are:
15062
15063 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
15064 @code{4}, @code{5}, @code{51}, @code{6}
15065
15066 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
15067 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
15068
15069 respectively and
15070
15071 @code{100}, @code{102}, @code{104},
15072 @code{105}, @code{106}, @code{107}
15073
15074 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
15075 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
15076 If @var{mcu} specifies a device, this built-in macro is set
15077 accordingly. For example, with @option{-mmcu=atmega8} the macro is
15078 defined to @code{4}.
15079
15080 @item __AVR_@var{Device}__
15081 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
15082 the device's name. For example, @option{-mmcu=atmega8} defines the
15083 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
15084 @code{__AVR_ATtiny261A__}, etc.
15085
15086 The built-in macros' names follow
15087 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
15088 the device name as from the AVR user manual. The difference between
15089 @var{Device} in the built-in macro and @var{device} in
15090 @option{-mmcu=@var{device}} is that the latter is always lowercase.
15091
15092 If @var{device} is not a device but only a core architecture like
15093 @samp{avr51}, this macro is not defined.
15094
15095 @item __AVR_DEVICE_NAME__
15096 Setting @option{-mmcu=@var{device}} defines this built-in macro to
15097 the device's name. For example, with @option{-mmcu=atmega8} the macro
15098 is defined to @code{atmega8}.
15099
15100 If @var{device} is not a device but only a core architecture like
15101 @samp{avr51}, this macro is not defined.
15102
15103 @item __AVR_XMEGA__
15104 The device / architecture belongs to the XMEGA family of devices.
15105
15106 @item __AVR_HAVE_ELPM__
15107 The device has the @code{ELPM} instruction.
15108
15109 @item __AVR_HAVE_ELPMX__
15110 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
15111 R@var{n},Z+} instructions.
15112
15113 @item __AVR_HAVE_MOVW__
15114 The device has the @code{MOVW} instruction to perform 16-bit
15115 register-register moves.
15116
15117 @item __AVR_HAVE_LPMX__
15118 The device has the @code{LPM R@var{n},Z} and
15119 @code{LPM R@var{n},Z+} instructions.
15120
15121 @item __AVR_HAVE_MUL__
15122 The device has a hardware multiplier.
15123
15124 @item __AVR_HAVE_JMP_CALL__
15125 The device has the @code{JMP} and @code{CALL} instructions.
15126 This is the case for devices with at least 16@tie{}KiB of program
15127 memory.
15128
15129 @item __AVR_HAVE_EIJMP_EICALL__
15130 @itemx __AVR_3_BYTE_PC__
15131 The device has the @code{EIJMP} and @code{EICALL} instructions.
15132 This is the case for devices with more than 128@tie{}KiB of program memory.
15133 This also means that the program counter
15134 (PC) is 3@tie{}bytes wide.
15135
15136 @item __AVR_2_BYTE_PC__
15137 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
15138 with up to 128@tie{}KiB of program memory.
15139
15140 @item __AVR_HAVE_8BIT_SP__
15141 @itemx __AVR_HAVE_16BIT_SP__
15142 The stack pointer (SP) register is treated as 8-bit respectively
15143 16-bit register by the compiler.
15144 The definition of these macros is affected by @option{-mtiny-stack}.
15145
15146 @item __AVR_HAVE_SPH__
15147 @itemx __AVR_SP8__
15148 The device has the SPH (high part of stack pointer) special function
15149 register or has an 8-bit stack pointer, respectively.
15150 The definition of these macros is affected by @option{-mmcu=} and
15151 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
15152 by @option{-msp8}.
15153
15154 @item __AVR_HAVE_RAMPD__
15155 @itemx __AVR_HAVE_RAMPX__
15156 @itemx __AVR_HAVE_RAMPY__
15157 @itemx __AVR_HAVE_RAMPZ__
15158 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
15159 @code{RAMPZ} special function register, respectively.
15160
15161 @item __NO_INTERRUPTS__
15162 This macro reflects the @option{-mno-interrupts} command-line option.
15163
15164 @item __AVR_ERRATA_SKIP__
15165 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
15166 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
15167 instructions because of a hardware erratum. Skip instructions are
15168 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
15169 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
15170 set.
15171
15172 @item __AVR_ISA_RMW__
15173 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
15174
15175 @item __AVR_SFR_OFFSET__=@var{offset}
15176 Instructions that can address I/O special function registers directly
15177 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
15178 address as if addressed by an instruction to access RAM like @code{LD}
15179 or @code{STS}. This offset depends on the device architecture and has
15180 to be subtracted from the RAM address in order to get the
15181 respective I/O@tie{}address.
15182
15183 @item __WITH_AVRLIBC__
15184 The compiler is configured to be used together with AVR-Libc.
15185 See the @option{--with-avrlibc} configure option.
15186
15187 @end table
15188
15189 @node Blackfin Options
15190 @subsection Blackfin Options
15191 @cindex Blackfin Options
15192
15193 @table @gcctabopt
15194 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
15195 @opindex mcpu=
15196 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
15197 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
15198 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
15199 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
15200 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
15201 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
15202 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
15203 @samp{bf561}, @samp{bf592}.
15204
15205 The optional @var{sirevision} specifies the silicon revision of the target
15206 Blackfin processor. Any workarounds available for the targeted silicon revision
15207 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
15208 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
15209 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
15210 hexadecimal digits representing the major and minor numbers in the silicon
15211 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
15212 is not defined. If @var{sirevision} is @samp{any}, the
15213 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
15214 If this optional @var{sirevision} is not used, GCC assumes the latest known
15215 silicon revision of the targeted Blackfin processor.
15216
15217 GCC defines a preprocessor macro for the specified @var{cpu}.
15218 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
15219 provided by libgloss to be linked in if @option{-msim} is not given.
15220
15221 Without this option, @samp{bf532} is used as the processor by default.
15222
15223 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
15224 only the preprocessor macro is defined.
15225
15226 @item -msim
15227 @opindex msim
15228 Specifies that the program will be run on the simulator. This causes
15229 the simulator BSP provided by libgloss to be linked in. This option
15230 has effect only for @samp{bfin-elf} toolchain.
15231 Certain other options, such as @option{-mid-shared-library} and
15232 @option{-mfdpic}, imply @option{-msim}.
15233
15234 @item -momit-leaf-frame-pointer
15235 @opindex momit-leaf-frame-pointer
15236 Don't keep the frame pointer in a register for leaf functions. This
15237 avoids the instructions to save, set up and restore frame pointers and
15238 makes an extra register available in leaf functions. The option
15239 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
15240 which might make debugging harder.
15241
15242 @item -mspecld-anomaly
15243 @opindex mspecld-anomaly
15244 When enabled, the compiler ensures that the generated code does not
15245 contain speculative loads after jump instructions. If this option is used,
15246 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
15247
15248 @item -mno-specld-anomaly
15249 @opindex mno-specld-anomaly
15250 Don't generate extra code to prevent speculative loads from occurring.
15251
15252 @item -mcsync-anomaly
15253 @opindex mcsync-anomaly
15254 When enabled, the compiler ensures that the generated code does not
15255 contain CSYNC or SSYNC instructions too soon after conditional branches.
15256 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
15257
15258 @item -mno-csync-anomaly
15259 @opindex mno-csync-anomaly
15260 Don't generate extra code to prevent CSYNC or SSYNC instructions from
15261 occurring too soon after a conditional branch.
15262
15263 @item -mlow-64k
15264 @opindex mlow-64k
15265 When enabled, the compiler is free to take advantage of the knowledge that
15266 the entire program fits into the low 64k of memory.
15267
15268 @item -mno-low-64k
15269 @opindex mno-low-64k
15270 Assume that the program is arbitrarily large. This is the default.
15271
15272 @item -mstack-check-l1
15273 @opindex mstack-check-l1
15274 Do stack checking using information placed into L1 scratchpad memory by the
15275 uClinux kernel.
15276
15277 @item -mid-shared-library
15278 @opindex mid-shared-library
15279 Generate code that supports shared libraries via the library ID method.
15280 This allows for execute in place and shared libraries in an environment
15281 without virtual memory management. This option implies @option{-fPIC}.
15282 With a @samp{bfin-elf} target, this option implies @option{-msim}.
15283
15284 @item -mno-id-shared-library
15285 @opindex mno-id-shared-library
15286 Generate code that doesn't assume ID-based shared libraries are being used.
15287 This is the default.
15288
15289 @item -mleaf-id-shared-library
15290 @opindex mleaf-id-shared-library
15291 Generate code that supports shared libraries via the library ID method,
15292 but assumes that this library or executable won't link against any other
15293 ID shared libraries. That allows the compiler to use faster code for jumps
15294 and calls.
15295
15296 @item -mno-leaf-id-shared-library
15297 @opindex mno-leaf-id-shared-library
15298 Do not assume that the code being compiled won't link against any ID shared
15299 libraries. Slower code is generated for jump and call insns.
15300
15301 @item -mshared-library-id=n
15302 @opindex mshared-library-id
15303 Specifies the identification number of the ID-based shared library being
15304 compiled. Specifying a value of 0 generates more compact code; specifying
15305 other values forces the allocation of that number to the current
15306 library but is no more space- or time-efficient than omitting this option.
15307
15308 @item -msep-data
15309 @opindex msep-data
15310 Generate code that allows the data segment to be located in a different
15311 area of memory from the text segment. This allows for execute in place in
15312 an environment without virtual memory management by eliminating relocations
15313 against the text section.
15314
15315 @item -mno-sep-data
15316 @opindex mno-sep-data
15317 Generate code that assumes that the data segment follows the text segment.
15318 This is the default.
15319
15320 @item -mlong-calls
15321 @itemx -mno-long-calls
15322 @opindex mlong-calls
15323 @opindex mno-long-calls
15324 Tells the compiler to perform function calls by first loading the
15325 address of the function into a register and then performing a subroutine
15326 call on this register. This switch is needed if the target function
15327 lies outside of the 24-bit addressing range of the offset-based
15328 version of subroutine call instruction.
15329
15330 This feature is not enabled by default. Specifying
15331 @option{-mno-long-calls} restores the default behavior. Note these
15332 switches have no effect on how the compiler generates code to handle
15333 function calls via function pointers.
15334
15335 @item -mfast-fp
15336 @opindex mfast-fp
15337 Link with the fast floating-point library. This library relaxes some of
15338 the IEEE floating-point standard's rules for checking inputs against
15339 Not-a-Number (NAN), in the interest of performance.
15340
15341 @item -minline-plt
15342 @opindex minline-plt
15343 Enable inlining of PLT entries in function calls to functions that are
15344 not known to bind locally. It has no effect without @option{-mfdpic}.
15345
15346 @item -mmulticore
15347 @opindex mmulticore
15348 Build a standalone application for multicore Blackfin processors.
15349 This option causes proper start files and link scripts supporting
15350 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
15351 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
15352
15353 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
15354 selects the one-application-per-core programming model. Without
15355 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
15356 programming model is used. In this model, the main function of Core B
15357 should be named as @code{coreb_main}.
15358
15359 If this option is not used, the single-core application programming
15360 model is used.
15361
15362 @item -mcorea
15363 @opindex mcorea
15364 Build a standalone application for Core A of BF561 when using
15365 the one-application-per-core programming model. Proper start files
15366 and link scripts are used to support Core A, and the macro
15367 @code{__BFIN_COREA} is defined.
15368 This option can only be used in conjunction with @option{-mmulticore}.
15369
15370 @item -mcoreb
15371 @opindex mcoreb
15372 Build a standalone application for Core B of BF561 when using
15373 the one-application-per-core programming model. Proper start files
15374 and link scripts are used to support Core B, and the macro
15375 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
15376 should be used instead of @code{main}.
15377 This option can only be used in conjunction with @option{-mmulticore}.
15378
15379 @item -msdram
15380 @opindex msdram
15381 Build a standalone application for SDRAM. Proper start files and
15382 link scripts are used to put the application into SDRAM, and the macro
15383 @code{__BFIN_SDRAM} is defined.
15384 The loader should initialize SDRAM before loading the application.
15385
15386 @item -micplb
15387 @opindex micplb
15388 Assume that ICPLBs are enabled at run time. This has an effect on certain
15389 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
15390 are enabled; for standalone applications the default is off.
15391 @end table
15392
15393 @node C6X Options
15394 @subsection C6X Options
15395 @cindex C6X Options
15396
15397 @table @gcctabopt
15398 @item -march=@var{name}
15399 @opindex march
15400 This specifies the name of the target architecture. GCC uses this
15401 name to determine what kind of instructions it can emit when generating
15402 assembly code. Permissible names are: @samp{c62x},
15403 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
15404
15405 @item -mbig-endian
15406 @opindex mbig-endian
15407 Generate code for a big-endian target.
15408
15409 @item -mlittle-endian
15410 @opindex mlittle-endian
15411 Generate code for a little-endian target. This is the default.
15412
15413 @item -msim
15414 @opindex msim
15415 Choose startup files and linker script suitable for the simulator.
15416
15417 @item -msdata=default
15418 @opindex msdata=default
15419 Put small global and static data in the @code{.neardata} section,
15420 which is pointed to by register @code{B14}. Put small uninitialized
15421 global and static data in the @code{.bss} section, which is adjacent
15422 to the @code{.neardata} section. Put small read-only data into the
15423 @code{.rodata} section. The corresponding sections used for large
15424 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
15425
15426 @item -msdata=all
15427 @opindex msdata=all
15428 Put all data, not just small objects, into the sections reserved for
15429 small data, and use addressing relative to the @code{B14} register to
15430 access them.
15431
15432 @item -msdata=none
15433 @opindex msdata=none
15434 Make no use of the sections reserved for small data, and use absolute
15435 addresses to access all data. Put all initialized global and static
15436 data in the @code{.fardata} section, and all uninitialized data in the
15437 @code{.far} section. Put all constant data into the @code{.const}
15438 section.
15439 @end table
15440
15441 @node CRIS Options
15442 @subsection CRIS Options
15443 @cindex CRIS Options
15444
15445 These options are defined specifically for the CRIS ports.
15446
15447 @table @gcctabopt
15448 @item -march=@var{architecture-type}
15449 @itemx -mcpu=@var{architecture-type}
15450 @opindex march
15451 @opindex mcpu
15452 Generate code for the specified architecture. The choices for
15453 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
15454 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
15455 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
15456 @samp{v10}.
15457
15458 @item -mtune=@var{architecture-type}
15459 @opindex mtune
15460 Tune to @var{architecture-type} everything applicable about the generated
15461 code, except for the ABI and the set of available instructions. The
15462 choices for @var{architecture-type} are the same as for
15463 @option{-march=@var{architecture-type}}.
15464
15465 @item -mmax-stack-frame=@var{n}
15466 @opindex mmax-stack-frame
15467 Warn when the stack frame of a function exceeds @var{n} bytes.
15468
15469 @item -metrax4
15470 @itemx -metrax100
15471 @opindex metrax4
15472 @opindex metrax100
15473 The options @option{-metrax4} and @option{-metrax100} are synonyms for
15474 @option{-march=v3} and @option{-march=v8} respectively.
15475
15476 @item -mmul-bug-workaround
15477 @itemx -mno-mul-bug-workaround
15478 @opindex mmul-bug-workaround
15479 @opindex mno-mul-bug-workaround
15480 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
15481 models where it applies. This option is active by default.
15482
15483 @item -mpdebug
15484 @opindex mpdebug
15485 Enable CRIS-specific verbose debug-related information in the assembly
15486 code. This option also has the effect of turning off the @samp{#NO_APP}
15487 formatted-code indicator to the assembler at the beginning of the
15488 assembly file.
15489
15490 @item -mcc-init
15491 @opindex mcc-init
15492 Do not use condition-code results from previous instruction; always emit
15493 compare and test instructions before use of condition codes.
15494
15495 @item -mno-side-effects
15496 @opindex mno-side-effects
15497 Do not emit instructions with side effects in addressing modes other than
15498 post-increment.
15499
15500 @item -mstack-align
15501 @itemx -mno-stack-align
15502 @itemx -mdata-align
15503 @itemx -mno-data-align
15504 @itemx -mconst-align
15505 @itemx -mno-const-align
15506 @opindex mstack-align
15507 @opindex mno-stack-align
15508 @opindex mdata-align
15509 @opindex mno-data-align
15510 @opindex mconst-align
15511 @opindex mno-const-align
15512 These options (@samp{no-} options) arrange (eliminate arrangements) for the
15513 stack frame, individual data and constants to be aligned for the maximum
15514 single data access size for the chosen CPU model. The default is to
15515 arrange for 32-bit alignment. ABI details such as structure layout are
15516 not affected by these options.
15517
15518 @item -m32-bit
15519 @itemx -m16-bit
15520 @itemx -m8-bit
15521 @opindex m32-bit
15522 @opindex m16-bit
15523 @opindex m8-bit
15524 Similar to the stack- data- and const-align options above, these options
15525 arrange for stack frame, writable data and constants to all be 32-bit,
15526 16-bit or 8-bit aligned. The default is 32-bit alignment.
15527
15528 @item -mno-prologue-epilogue
15529 @itemx -mprologue-epilogue
15530 @opindex mno-prologue-epilogue
15531 @opindex mprologue-epilogue
15532 With @option{-mno-prologue-epilogue}, the normal function prologue and
15533 epilogue which set up the stack frame are omitted and no return
15534 instructions or return sequences are generated in the code. Use this
15535 option only together with visual inspection of the compiled code: no
15536 warnings or errors are generated when call-saved registers must be saved,
15537 or storage for local variables needs to be allocated.
15538
15539 @item -mno-gotplt
15540 @itemx -mgotplt
15541 @opindex mno-gotplt
15542 @opindex mgotplt
15543 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
15544 instruction sequences that load addresses for functions from the PLT part
15545 of the GOT rather than (traditional on other architectures) calls to the
15546 PLT@. The default is @option{-mgotplt}.
15547
15548 @item -melf
15549 @opindex melf
15550 Legacy no-op option only recognized with the cris-axis-elf and
15551 cris-axis-linux-gnu targets.
15552
15553 @item -mlinux
15554 @opindex mlinux
15555 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
15556
15557 @item -sim
15558 @opindex sim
15559 This option, recognized for the cris-axis-elf, arranges
15560 to link with input-output functions from a simulator library. Code,
15561 initialized data and zero-initialized data are allocated consecutively.
15562
15563 @item -sim2
15564 @opindex sim2
15565 Like @option{-sim}, but pass linker options to locate initialized data at
15566 0x40000000 and zero-initialized data at 0x80000000.
15567 @end table
15568
15569 @node CR16 Options
15570 @subsection CR16 Options
15571 @cindex CR16 Options
15572
15573 These options are defined specifically for the CR16 ports.
15574
15575 @table @gcctabopt
15576
15577 @item -mmac
15578 @opindex mmac
15579 Enable the use of multiply-accumulate instructions. Disabled by default.
15580
15581 @item -mcr16cplus
15582 @itemx -mcr16c
15583 @opindex mcr16cplus
15584 @opindex mcr16c
15585 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
15586 is default.
15587
15588 @item -msim
15589 @opindex msim
15590 Links the library libsim.a which is in compatible with simulator. Applicable
15591 to ELF compiler only.
15592
15593 @item -mint32
15594 @opindex mint32
15595 Choose integer type as 32-bit wide.
15596
15597 @item -mbit-ops
15598 @opindex mbit-ops
15599 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
15600
15601 @item -mdata-model=@var{model}
15602 @opindex mdata-model
15603 Choose a data model. The choices for @var{model} are @samp{near},
15604 @samp{far} or @samp{medium}. @samp{medium} is default.
15605 However, @samp{far} is not valid with @option{-mcr16c}, as the
15606 CR16C architecture does not support the far data model.
15607 @end table
15608
15609 @node Darwin Options
15610 @subsection Darwin Options
15611 @cindex Darwin options
15612
15613 These options are defined for all architectures running the Darwin operating
15614 system.
15615
15616 FSF GCC on Darwin does not create ``fat'' object files; it creates
15617 an object file for the single architecture that GCC was built to
15618 target. Apple's GCC on Darwin does create ``fat'' files if multiple
15619 @option{-arch} options are used; it does so by running the compiler or
15620 linker multiple times and joining the results together with
15621 @file{lipo}.
15622
15623 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
15624 @samp{i686}) is determined by the flags that specify the ISA
15625 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
15626 @option{-force_cpusubtype_ALL} option can be used to override this.
15627
15628 The Darwin tools vary in their behavior when presented with an ISA
15629 mismatch. The assembler, @file{as}, only permits instructions to
15630 be used that are valid for the subtype of the file it is generating,
15631 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
15632 The linker for shared libraries, @file{/usr/bin/libtool}, fails
15633 and prints an error if asked to create a shared library with a less
15634 restrictive subtype than its input files (for instance, trying to put
15635 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
15636 for executables, @command{ld}, quietly gives the executable the most
15637 restrictive subtype of any of its input files.
15638
15639 @table @gcctabopt
15640 @item -F@var{dir}
15641 @opindex F
15642 Add the framework directory @var{dir} to the head of the list of
15643 directories to be searched for header files. These directories are
15644 interleaved with those specified by @option{-I} options and are
15645 scanned in a left-to-right order.
15646
15647 A framework directory is a directory with frameworks in it. A
15648 framework is a directory with a @file{Headers} and/or
15649 @file{PrivateHeaders} directory contained directly in it that ends
15650 in @file{.framework}. The name of a framework is the name of this
15651 directory excluding the @file{.framework}. Headers associated with
15652 the framework are found in one of those two directories, with
15653 @file{Headers} being searched first. A subframework is a framework
15654 directory that is in a framework's @file{Frameworks} directory.
15655 Includes of subframework headers can only appear in a header of a
15656 framework that contains the subframework, or in a sibling subframework
15657 header. Two subframeworks are siblings if they occur in the same
15658 framework. A subframework should not have the same name as a
15659 framework; a warning is issued if this is violated. Currently a
15660 subframework cannot have subframeworks; in the future, the mechanism
15661 may be extended to support this. The standard frameworks can be found
15662 in @file{/System/Library/Frameworks} and
15663 @file{/Library/Frameworks}. An example include looks like
15664 @code{#include <Framework/header.h>}, where @file{Framework} denotes
15665 the name of the framework and @file{header.h} is found in the
15666 @file{PrivateHeaders} or @file{Headers} directory.
15667
15668 @item -iframework@var{dir}
15669 @opindex iframework
15670 Like @option{-F} except the directory is a treated as a system
15671 directory. The main difference between this @option{-iframework} and
15672 @option{-F} is that with @option{-iframework} the compiler does not
15673 warn about constructs contained within header files found via
15674 @var{dir}. This option is valid only for the C family of languages.
15675
15676 @item -gused
15677 @opindex gused
15678 Emit debugging information for symbols that are used. For stabs
15679 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
15680 This is by default ON@.
15681
15682 @item -gfull
15683 @opindex gfull
15684 Emit debugging information for all symbols and types.
15685
15686 @item -mmacosx-version-min=@var{version}
15687 The earliest version of MacOS X that this executable will run on
15688 is @var{version}. Typical values of @var{version} include @code{10.1},
15689 @code{10.2}, and @code{10.3.9}.
15690
15691 If the compiler was built to use the system's headers by default,
15692 then the default for this option is the system version on which the
15693 compiler is running, otherwise the default is to make choices that
15694 are compatible with as many systems and code bases as possible.
15695
15696 @item -mkernel
15697 @opindex mkernel
15698 Enable kernel development mode. The @option{-mkernel} option sets
15699 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
15700 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
15701 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
15702 applicable. This mode also sets @option{-mno-altivec},
15703 @option{-msoft-float}, @option{-fno-builtin} and
15704 @option{-mlong-branch} for PowerPC targets.
15705
15706 @item -mone-byte-bool
15707 @opindex mone-byte-bool
15708 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
15709 By default @code{sizeof(bool)} is @code{4} when compiling for
15710 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
15711 option has no effect on x86.
15712
15713 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
15714 to generate code that is not binary compatible with code generated
15715 without that switch. Using this switch may require recompiling all
15716 other modules in a program, including system libraries. Use this
15717 switch to conform to a non-default data model.
15718
15719 @item -mfix-and-continue
15720 @itemx -ffix-and-continue
15721 @itemx -findirect-data
15722 @opindex mfix-and-continue
15723 @opindex ffix-and-continue
15724 @opindex findirect-data
15725 Generate code suitable for fast turnaround development, such as to
15726 allow GDB to dynamically load @file{.o} files into already-running
15727 programs. @option{-findirect-data} and @option{-ffix-and-continue}
15728 are provided for backwards compatibility.
15729
15730 @item -all_load
15731 @opindex all_load
15732 Loads all members of static archive libraries.
15733 See man ld(1) for more information.
15734
15735 @item -arch_errors_fatal
15736 @opindex arch_errors_fatal
15737 Cause the errors having to do with files that have the wrong architecture
15738 to be fatal.
15739
15740 @item -bind_at_load
15741 @opindex bind_at_load
15742 Causes the output file to be marked such that the dynamic linker will
15743 bind all undefined references when the file is loaded or launched.
15744
15745 @item -bundle
15746 @opindex bundle
15747 Produce a Mach-o bundle format file.
15748 See man ld(1) for more information.
15749
15750 @item -bundle_loader @var{executable}
15751 @opindex bundle_loader
15752 This option specifies the @var{executable} that will load the build
15753 output file being linked. See man ld(1) for more information.
15754
15755 @item -dynamiclib
15756 @opindex dynamiclib
15757 When passed this option, GCC produces a dynamic library instead of
15758 an executable when linking, using the Darwin @file{libtool} command.
15759
15760 @item -force_cpusubtype_ALL
15761 @opindex force_cpusubtype_ALL
15762 This causes GCC's output file to have the @samp{ALL} subtype, instead of
15763 one controlled by the @option{-mcpu} or @option{-march} option.
15764
15765 @item -allowable_client @var{client_name}
15766 @itemx -client_name
15767 @itemx -compatibility_version
15768 @itemx -current_version
15769 @itemx -dead_strip
15770 @itemx -dependency-file
15771 @itemx -dylib_file
15772 @itemx -dylinker_install_name
15773 @itemx -dynamic
15774 @itemx -exported_symbols_list
15775 @itemx -filelist
15776 @need 800
15777 @itemx -flat_namespace
15778 @itemx -force_flat_namespace
15779 @itemx -headerpad_max_install_names
15780 @itemx -image_base
15781 @itemx -init
15782 @itemx -install_name
15783 @itemx -keep_private_externs
15784 @itemx -multi_module
15785 @itemx -multiply_defined
15786 @itemx -multiply_defined_unused
15787 @need 800
15788 @itemx -noall_load
15789 @itemx -no_dead_strip_inits_and_terms
15790 @itemx -nofixprebinding
15791 @itemx -nomultidefs
15792 @itemx -noprebind
15793 @itemx -noseglinkedit
15794 @itemx -pagezero_size
15795 @itemx -prebind
15796 @itemx -prebind_all_twolevel_modules
15797 @itemx -private_bundle
15798 @need 800
15799 @itemx -read_only_relocs
15800 @itemx -sectalign
15801 @itemx -sectobjectsymbols
15802 @itemx -whyload
15803 @itemx -seg1addr
15804 @itemx -sectcreate
15805 @itemx -sectobjectsymbols
15806 @itemx -sectorder
15807 @itemx -segaddr
15808 @itemx -segs_read_only_addr
15809 @need 800
15810 @itemx -segs_read_write_addr
15811 @itemx -seg_addr_table
15812 @itemx -seg_addr_table_filename
15813 @itemx -seglinkedit
15814 @itemx -segprot
15815 @itemx -segs_read_only_addr
15816 @itemx -segs_read_write_addr
15817 @itemx -single_module
15818 @itemx -static
15819 @itemx -sub_library
15820 @need 800
15821 @itemx -sub_umbrella
15822 @itemx -twolevel_namespace
15823 @itemx -umbrella
15824 @itemx -undefined
15825 @itemx -unexported_symbols_list
15826 @itemx -weak_reference_mismatches
15827 @itemx -whatsloaded
15828 @opindex allowable_client
15829 @opindex client_name
15830 @opindex compatibility_version
15831 @opindex current_version
15832 @opindex dead_strip
15833 @opindex dependency-file
15834 @opindex dylib_file
15835 @opindex dylinker_install_name
15836 @opindex dynamic
15837 @opindex exported_symbols_list
15838 @opindex filelist
15839 @opindex flat_namespace
15840 @opindex force_flat_namespace
15841 @opindex headerpad_max_install_names
15842 @opindex image_base
15843 @opindex init
15844 @opindex install_name
15845 @opindex keep_private_externs
15846 @opindex multi_module
15847 @opindex multiply_defined
15848 @opindex multiply_defined_unused
15849 @opindex noall_load
15850 @opindex no_dead_strip_inits_and_terms
15851 @opindex nofixprebinding
15852 @opindex nomultidefs
15853 @opindex noprebind
15854 @opindex noseglinkedit
15855 @opindex pagezero_size
15856 @opindex prebind
15857 @opindex prebind_all_twolevel_modules
15858 @opindex private_bundle
15859 @opindex read_only_relocs
15860 @opindex sectalign
15861 @opindex sectobjectsymbols
15862 @opindex whyload
15863 @opindex seg1addr
15864 @opindex sectcreate
15865 @opindex sectobjectsymbols
15866 @opindex sectorder
15867 @opindex segaddr
15868 @opindex segs_read_only_addr
15869 @opindex segs_read_write_addr
15870 @opindex seg_addr_table
15871 @opindex seg_addr_table_filename
15872 @opindex seglinkedit
15873 @opindex segprot
15874 @opindex segs_read_only_addr
15875 @opindex segs_read_write_addr
15876 @opindex single_module
15877 @opindex static
15878 @opindex sub_library
15879 @opindex sub_umbrella
15880 @opindex twolevel_namespace
15881 @opindex umbrella
15882 @opindex undefined
15883 @opindex unexported_symbols_list
15884 @opindex weak_reference_mismatches
15885 @opindex whatsloaded
15886 These options are passed to the Darwin linker. The Darwin linker man page
15887 describes them in detail.
15888 @end table
15889
15890 @node DEC Alpha Options
15891 @subsection DEC Alpha Options
15892
15893 These @samp{-m} options are defined for the DEC Alpha implementations:
15894
15895 @table @gcctabopt
15896 @item -mno-soft-float
15897 @itemx -msoft-float
15898 @opindex mno-soft-float
15899 @opindex msoft-float
15900 Use (do not use) the hardware floating-point instructions for
15901 floating-point operations. When @option{-msoft-float} is specified,
15902 functions in @file{libgcc.a} are used to perform floating-point
15903 operations. Unless they are replaced by routines that emulate the
15904 floating-point operations, or compiled in such a way as to call such
15905 emulations routines, these routines issue floating-point
15906 operations. If you are compiling for an Alpha without floating-point
15907 operations, you must ensure that the library is built so as not to call
15908 them.
15909
15910 Note that Alpha implementations without floating-point operations are
15911 required to have floating-point registers.
15912
15913 @item -mfp-reg
15914 @itemx -mno-fp-regs
15915 @opindex mfp-reg
15916 @opindex mno-fp-regs
15917 Generate code that uses (does not use) the floating-point register set.
15918 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
15919 register set is not used, floating-point operands are passed in integer
15920 registers as if they were integers and floating-point results are passed
15921 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
15922 so any function with a floating-point argument or return value called by code
15923 compiled with @option{-mno-fp-regs} must also be compiled with that
15924 option.
15925
15926 A typical use of this option is building a kernel that does not use,
15927 and hence need not save and restore, any floating-point registers.
15928
15929 @item -mieee
15930 @opindex mieee
15931 The Alpha architecture implements floating-point hardware optimized for
15932 maximum performance. It is mostly compliant with the IEEE floating-point
15933 standard. However, for full compliance, software assistance is
15934 required. This option generates code fully IEEE-compliant code
15935 @emph{except} that the @var{inexact-flag} is not maintained (see below).
15936 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
15937 defined during compilation. The resulting code is less efficient but is
15938 able to correctly support denormalized numbers and exceptional IEEE
15939 values such as not-a-number and plus/minus infinity. Other Alpha
15940 compilers call this option @option{-ieee_with_no_inexact}.
15941
15942 @item -mieee-with-inexact
15943 @opindex mieee-with-inexact
15944 This is like @option{-mieee} except the generated code also maintains
15945 the IEEE @var{inexact-flag}. Turning on this option causes the
15946 generated code to implement fully-compliant IEEE math. In addition to
15947 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
15948 macro. On some Alpha implementations the resulting code may execute
15949 significantly slower than the code generated by default. Since there is
15950 very little code that depends on the @var{inexact-flag}, you should
15951 normally not specify this option. Other Alpha compilers call this
15952 option @option{-ieee_with_inexact}.
15953
15954 @item -mfp-trap-mode=@var{trap-mode}
15955 @opindex mfp-trap-mode
15956 This option controls what floating-point related traps are enabled.
15957 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
15958 The trap mode can be set to one of four values:
15959
15960 @table @samp
15961 @item n
15962 This is the default (normal) setting. The only traps that are enabled
15963 are the ones that cannot be disabled in software (e.g., division by zero
15964 trap).
15965
15966 @item u
15967 In addition to the traps enabled by @samp{n}, underflow traps are enabled
15968 as well.
15969
15970 @item su
15971 Like @samp{u}, but the instructions are marked to be safe for software
15972 completion (see Alpha architecture manual for details).
15973
15974 @item sui
15975 Like @samp{su}, but inexact traps are enabled as well.
15976 @end table
15977
15978 @item -mfp-rounding-mode=@var{rounding-mode}
15979 @opindex mfp-rounding-mode
15980 Selects the IEEE rounding mode. Other Alpha compilers call this option
15981 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
15982 of:
15983
15984 @table @samp
15985 @item n
15986 Normal IEEE rounding mode. Floating-point numbers are rounded towards
15987 the nearest machine number or towards the even machine number in case
15988 of a tie.
15989
15990 @item m
15991 Round towards minus infinity.
15992
15993 @item c
15994 Chopped rounding mode. Floating-point numbers are rounded towards zero.
15995
15996 @item d
15997 Dynamic rounding mode. A field in the floating-point control register
15998 (@var{fpcr}, see Alpha architecture reference manual) controls the
15999 rounding mode in effect. The C library initializes this register for
16000 rounding towards plus infinity. Thus, unless your program modifies the
16001 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
16002 @end table
16003
16004 @item -mtrap-precision=@var{trap-precision}
16005 @opindex mtrap-precision
16006 In the Alpha architecture, floating-point traps are imprecise. This
16007 means without software assistance it is impossible to recover from a
16008 floating trap and program execution normally needs to be terminated.
16009 GCC can generate code that can assist operating system trap handlers
16010 in determining the exact location that caused a floating-point trap.
16011 Depending on the requirements of an application, different levels of
16012 precisions can be selected:
16013
16014 @table @samp
16015 @item p
16016 Program precision. This option is the default and means a trap handler
16017 can only identify which program caused a floating-point exception.
16018
16019 @item f
16020 Function precision. The trap handler can determine the function that
16021 caused a floating-point exception.
16022
16023 @item i
16024 Instruction precision. The trap handler can determine the exact
16025 instruction that caused a floating-point exception.
16026 @end table
16027
16028 Other Alpha compilers provide the equivalent options called
16029 @option{-scope_safe} and @option{-resumption_safe}.
16030
16031 @item -mieee-conformant
16032 @opindex mieee-conformant
16033 This option marks the generated code as IEEE conformant. You must not
16034 use this option unless you also specify @option{-mtrap-precision=i} and either
16035 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
16036 is to emit the line @samp{.eflag 48} in the function prologue of the
16037 generated assembly file.
16038
16039 @item -mbuild-constants
16040 @opindex mbuild-constants
16041 Normally GCC examines a 32- or 64-bit integer constant to
16042 see if it can construct it from smaller constants in two or three
16043 instructions. If it cannot, it outputs the constant as a literal and
16044 generates code to load it from the data segment at run time.
16045
16046 Use this option to require GCC to construct @emph{all} integer constants
16047 using code, even if it takes more instructions (the maximum is six).
16048
16049 You typically use this option to build a shared library dynamic
16050 loader. Itself a shared library, it must relocate itself in memory
16051 before it can find the variables and constants in its own data segment.
16052
16053 @item -mbwx
16054 @itemx -mno-bwx
16055 @itemx -mcix
16056 @itemx -mno-cix
16057 @itemx -mfix
16058 @itemx -mno-fix
16059 @itemx -mmax
16060 @itemx -mno-max
16061 @opindex mbwx
16062 @opindex mno-bwx
16063 @opindex mcix
16064 @opindex mno-cix
16065 @opindex mfix
16066 @opindex mno-fix
16067 @opindex mmax
16068 @opindex mno-max
16069 Indicate whether GCC should generate code to use the optional BWX,
16070 CIX, FIX and MAX instruction sets. The default is to use the instruction
16071 sets supported by the CPU type specified via @option{-mcpu=} option or that
16072 of the CPU on which GCC was built if none is specified.
16073
16074 @item -mfloat-vax
16075 @itemx -mfloat-ieee
16076 @opindex mfloat-vax
16077 @opindex mfloat-ieee
16078 Generate code that uses (does not use) VAX F and G floating-point
16079 arithmetic instead of IEEE single and double precision.
16080
16081 @item -mexplicit-relocs
16082 @itemx -mno-explicit-relocs
16083 @opindex mexplicit-relocs
16084 @opindex mno-explicit-relocs
16085 Older Alpha assemblers provided no way to generate symbol relocations
16086 except via assembler macros. Use of these macros does not allow
16087 optimal instruction scheduling. GNU binutils as of version 2.12
16088 supports a new syntax that allows the compiler to explicitly mark
16089 which relocations should apply to which instructions. This option
16090 is mostly useful for debugging, as GCC detects the capabilities of
16091 the assembler when it is built and sets the default accordingly.
16092
16093 @item -msmall-data
16094 @itemx -mlarge-data
16095 @opindex msmall-data
16096 @opindex mlarge-data
16097 When @option{-mexplicit-relocs} is in effect, static data is
16098 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
16099 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
16100 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
16101 16-bit relocations off of the @code{$gp} register. This limits the
16102 size of the small data area to 64KB, but allows the variables to be
16103 directly accessed via a single instruction.
16104
16105 The default is @option{-mlarge-data}. With this option the data area
16106 is limited to just below 2GB@. Programs that require more than 2GB of
16107 data must use @code{malloc} or @code{mmap} to allocate the data in the
16108 heap instead of in the program's data segment.
16109
16110 When generating code for shared libraries, @option{-fpic} implies
16111 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
16112
16113 @item -msmall-text
16114 @itemx -mlarge-text
16115 @opindex msmall-text
16116 @opindex mlarge-text
16117 When @option{-msmall-text} is used, the compiler assumes that the
16118 code of the entire program (or shared library) fits in 4MB, and is
16119 thus reachable with a branch instruction. When @option{-msmall-data}
16120 is used, the compiler can assume that all local symbols share the
16121 same @code{$gp} value, and thus reduce the number of instructions
16122 required for a function call from 4 to 1.
16123
16124 The default is @option{-mlarge-text}.
16125
16126 @item -mcpu=@var{cpu_type}
16127 @opindex mcpu
16128 Set the instruction set and instruction scheduling parameters for
16129 machine type @var{cpu_type}. You can specify either the @samp{EV}
16130 style name or the corresponding chip number. GCC supports scheduling
16131 parameters for the EV4, EV5 and EV6 family of processors and
16132 chooses the default values for the instruction set from the processor
16133 you specify. If you do not specify a processor type, GCC defaults
16134 to the processor on which the compiler was built.
16135
16136 Supported values for @var{cpu_type} are
16137
16138 @table @samp
16139 @item ev4
16140 @itemx ev45
16141 @itemx 21064
16142 Schedules as an EV4 and has no instruction set extensions.
16143
16144 @item ev5
16145 @itemx 21164
16146 Schedules as an EV5 and has no instruction set extensions.
16147
16148 @item ev56
16149 @itemx 21164a
16150 Schedules as an EV5 and supports the BWX extension.
16151
16152 @item pca56
16153 @itemx 21164pc
16154 @itemx 21164PC
16155 Schedules as an EV5 and supports the BWX and MAX extensions.
16156
16157 @item ev6
16158 @itemx 21264
16159 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
16160
16161 @item ev67
16162 @itemx 21264a
16163 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
16164 @end table
16165
16166 Native toolchains also support the value @samp{native},
16167 which selects the best architecture option for the host processor.
16168 @option{-mcpu=native} has no effect if GCC does not recognize
16169 the processor.
16170
16171 @item -mtune=@var{cpu_type}
16172 @opindex mtune
16173 Set only the instruction scheduling parameters for machine type
16174 @var{cpu_type}. The instruction set is not changed.
16175
16176 Native toolchains also support the value @samp{native},
16177 which selects the best architecture option for the host processor.
16178 @option{-mtune=native} has no effect if GCC does not recognize
16179 the processor.
16180
16181 @item -mmemory-latency=@var{time}
16182 @opindex mmemory-latency
16183 Sets the latency the scheduler should assume for typical memory
16184 references as seen by the application. This number is highly
16185 dependent on the memory access patterns used by the application
16186 and the size of the external cache on the machine.
16187
16188 Valid options for @var{time} are
16189
16190 @table @samp
16191 @item @var{number}
16192 A decimal number representing clock cycles.
16193
16194 @item L1
16195 @itemx L2
16196 @itemx L3
16197 @itemx main
16198 The compiler contains estimates of the number of clock cycles for
16199 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
16200 (also called Dcache, Scache, and Bcache), as well as to main memory.
16201 Note that L3 is only valid for EV5.
16202
16203 @end table
16204 @end table
16205
16206 @node FR30 Options
16207 @subsection FR30 Options
16208 @cindex FR30 Options
16209
16210 These options are defined specifically for the FR30 port.
16211
16212 @table @gcctabopt
16213
16214 @item -msmall-model
16215 @opindex msmall-model
16216 Use the small address space model. This can produce smaller code, but
16217 it does assume that all symbolic values and addresses fit into a
16218 20-bit range.
16219
16220 @item -mno-lsim
16221 @opindex mno-lsim
16222 Assume that runtime support has been provided and so there is no need
16223 to include the simulator library (@file{libsim.a}) on the linker
16224 command line.
16225
16226 @end table
16227
16228 @node FT32 Options
16229 @subsection FT32 Options
16230 @cindex FT32 Options
16231
16232 These options are defined specifically for the FT32 port.
16233
16234 @table @gcctabopt
16235
16236 @item -msim
16237 @opindex msim
16238 Specifies that the program will be run on the simulator. This causes
16239 an alternate runtime startup and library to be linked.
16240 You must not use this option when generating programs that will run on
16241 real hardware; you must provide your own runtime library for whatever
16242 I/O functions are needed.
16243
16244 @item -mlra
16245 @opindex mlra
16246 Enable Local Register Allocation. This is still experimental for FT32,
16247 so by default the compiler uses standard reload.
16248
16249 @item -mnodiv
16250 @opindex mnodiv
16251 Do not use div and mod instructions.
16252
16253 @end table
16254
16255 @node FRV Options
16256 @subsection FRV Options
16257 @cindex FRV Options
16258
16259 @table @gcctabopt
16260 @item -mgpr-32
16261 @opindex mgpr-32
16262
16263 Only use the first 32 general-purpose registers.
16264
16265 @item -mgpr-64
16266 @opindex mgpr-64
16267
16268 Use all 64 general-purpose registers.
16269
16270 @item -mfpr-32
16271 @opindex mfpr-32
16272
16273 Use only the first 32 floating-point registers.
16274
16275 @item -mfpr-64
16276 @opindex mfpr-64
16277
16278 Use all 64 floating-point registers.
16279
16280 @item -mhard-float
16281 @opindex mhard-float
16282
16283 Use hardware instructions for floating-point operations.
16284
16285 @item -msoft-float
16286 @opindex msoft-float
16287
16288 Use library routines for floating-point operations.
16289
16290 @item -malloc-cc
16291 @opindex malloc-cc
16292
16293 Dynamically allocate condition code registers.
16294
16295 @item -mfixed-cc
16296 @opindex mfixed-cc
16297
16298 Do not try to dynamically allocate condition code registers, only
16299 use @code{icc0} and @code{fcc0}.
16300
16301 @item -mdword
16302 @opindex mdword
16303
16304 Change ABI to use double word insns.
16305
16306 @item -mno-dword
16307 @opindex mno-dword
16308
16309 Do not use double word instructions.
16310
16311 @item -mdouble
16312 @opindex mdouble
16313
16314 Use floating-point double instructions.
16315
16316 @item -mno-double
16317 @opindex mno-double
16318
16319 Do not use floating-point double instructions.
16320
16321 @item -mmedia
16322 @opindex mmedia
16323
16324 Use media instructions.
16325
16326 @item -mno-media
16327 @opindex mno-media
16328
16329 Do not use media instructions.
16330
16331 @item -mmuladd
16332 @opindex mmuladd
16333
16334 Use multiply and add/subtract instructions.
16335
16336 @item -mno-muladd
16337 @opindex mno-muladd
16338
16339 Do not use multiply and add/subtract instructions.
16340
16341 @item -mfdpic
16342 @opindex mfdpic
16343
16344 Select the FDPIC ABI, which uses function descriptors to represent
16345 pointers to functions. Without any PIC/PIE-related options, it
16346 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
16347 assumes GOT entries and small data are within a 12-bit range from the
16348 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
16349 are computed with 32 bits.
16350 With a @samp{bfin-elf} target, this option implies @option{-msim}.
16351
16352 @item -minline-plt
16353 @opindex minline-plt
16354
16355 Enable inlining of PLT entries in function calls to functions that are
16356 not known to bind locally. It has no effect without @option{-mfdpic}.
16357 It's enabled by default if optimizing for speed and compiling for
16358 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
16359 optimization option such as @option{-O3} or above is present in the
16360 command line.
16361
16362 @item -mTLS
16363 @opindex mTLS
16364
16365 Assume a large TLS segment when generating thread-local code.
16366
16367 @item -mtls
16368 @opindex mtls
16369
16370 Do not assume a large TLS segment when generating thread-local code.
16371
16372 @item -mgprel-ro
16373 @opindex mgprel-ro
16374
16375 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
16376 that is known to be in read-only sections. It's enabled by default,
16377 except for @option{-fpic} or @option{-fpie}: even though it may help
16378 make the global offset table smaller, it trades 1 instruction for 4.
16379 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
16380 one of which may be shared by multiple symbols, and it avoids the need
16381 for a GOT entry for the referenced symbol, so it's more likely to be a
16382 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
16383
16384 @item -multilib-library-pic
16385 @opindex multilib-library-pic
16386
16387 Link with the (library, not FD) pic libraries. It's implied by
16388 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
16389 @option{-fpic} without @option{-mfdpic}. You should never have to use
16390 it explicitly.
16391
16392 @item -mlinked-fp
16393 @opindex mlinked-fp
16394
16395 Follow the EABI requirement of always creating a frame pointer whenever
16396 a stack frame is allocated. This option is enabled by default and can
16397 be disabled with @option{-mno-linked-fp}.
16398
16399 @item -mlong-calls
16400 @opindex mlong-calls
16401
16402 Use indirect addressing to call functions outside the current
16403 compilation unit. This allows the functions to be placed anywhere
16404 within the 32-bit address space.
16405
16406 @item -malign-labels
16407 @opindex malign-labels
16408
16409 Try to align labels to an 8-byte boundary by inserting NOPs into the
16410 previous packet. This option only has an effect when VLIW packing
16411 is enabled. It doesn't create new packets; it merely adds NOPs to
16412 existing ones.
16413
16414 @item -mlibrary-pic
16415 @opindex mlibrary-pic
16416
16417 Generate position-independent EABI code.
16418
16419 @item -macc-4
16420 @opindex macc-4
16421
16422 Use only the first four media accumulator registers.
16423
16424 @item -macc-8
16425 @opindex macc-8
16426
16427 Use all eight media accumulator registers.
16428
16429 @item -mpack
16430 @opindex mpack
16431
16432 Pack VLIW instructions.
16433
16434 @item -mno-pack
16435 @opindex mno-pack
16436
16437 Do not pack VLIW instructions.
16438
16439 @item -mno-eflags
16440 @opindex mno-eflags
16441
16442 Do not mark ABI switches in e_flags.
16443
16444 @item -mcond-move
16445 @opindex mcond-move
16446
16447 Enable the use of conditional-move instructions (default).
16448
16449 This switch is mainly for debugging the compiler and will likely be removed
16450 in a future version.
16451
16452 @item -mno-cond-move
16453 @opindex mno-cond-move
16454
16455 Disable the use of conditional-move instructions.
16456
16457 This switch is mainly for debugging the compiler and will likely be removed
16458 in a future version.
16459
16460 @item -mscc
16461 @opindex mscc
16462
16463 Enable the use of conditional set instructions (default).
16464
16465 This switch is mainly for debugging the compiler and will likely be removed
16466 in a future version.
16467
16468 @item -mno-scc
16469 @opindex mno-scc
16470
16471 Disable the use of conditional set instructions.
16472
16473 This switch is mainly for debugging the compiler and will likely be removed
16474 in a future version.
16475
16476 @item -mcond-exec
16477 @opindex mcond-exec
16478
16479 Enable the use of conditional execution (default).
16480
16481 This switch is mainly for debugging the compiler and will likely be removed
16482 in a future version.
16483
16484 @item -mno-cond-exec
16485 @opindex mno-cond-exec
16486
16487 Disable the use of conditional execution.
16488
16489 This switch is mainly for debugging the compiler and will likely be removed
16490 in a future version.
16491
16492 @item -mvliw-branch
16493 @opindex mvliw-branch
16494
16495 Run a pass to pack branches into VLIW instructions (default).
16496
16497 This switch is mainly for debugging the compiler and will likely be removed
16498 in a future version.
16499
16500 @item -mno-vliw-branch
16501 @opindex mno-vliw-branch
16502
16503 Do not run a pass to pack branches into VLIW instructions.
16504
16505 This switch is mainly for debugging the compiler and will likely be removed
16506 in a future version.
16507
16508 @item -mmulti-cond-exec
16509 @opindex mmulti-cond-exec
16510
16511 Enable optimization of @code{&&} and @code{||} in conditional execution
16512 (default).
16513
16514 This switch is mainly for debugging the compiler and will likely be removed
16515 in a future version.
16516
16517 @item -mno-multi-cond-exec
16518 @opindex mno-multi-cond-exec
16519
16520 Disable optimization of @code{&&} and @code{||} in conditional execution.
16521
16522 This switch is mainly for debugging the compiler and will likely be removed
16523 in a future version.
16524
16525 @item -mnested-cond-exec
16526 @opindex mnested-cond-exec
16527
16528 Enable nested conditional execution optimizations (default).
16529
16530 This switch is mainly for debugging the compiler and will likely be removed
16531 in a future version.
16532
16533 @item -mno-nested-cond-exec
16534 @opindex mno-nested-cond-exec
16535
16536 Disable nested conditional execution optimizations.
16537
16538 This switch is mainly for debugging the compiler and will likely be removed
16539 in a future version.
16540
16541 @item -moptimize-membar
16542 @opindex moptimize-membar
16543
16544 This switch removes redundant @code{membar} instructions from the
16545 compiler-generated code. It is enabled by default.
16546
16547 @item -mno-optimize-membar
16548 @opindex mno-optimize-membar
16549
16550 This switch disables the automatic removal of redundant @code{membar}
16551 instructions from the generated code.
16552
16553 @item -mtomcat-stats
16554 @opindex mtomcat-stats
16555
16556 Cause gas to print out tomcat statistics.
16557
16558 @item -mcpu=@var{cpu}
16559 @opindex mcpu
16560
16561 Select the processor type for which to generate code. Possible values are
16562 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
16563 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
16564
16565 @end table
16566
16567 @node GNU/Linux Options
16568 @subsection GNU/Linux Options
16569
16570 These @samp{-m} options are defined for GNU/Linux targets:
16571
16572 @table @gcctabopt
16573 @item -mglibc
16574 @opindex mglibc
16575 Use the GNU C library. This is the default except
16576 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
16577 @samp{*-*-linux-*android*} targets.
16578
16579 @item -muclibc
16580 @opindex muclibc
16581 Use uClibc C library. This is the default on
16582 @samp{*-*-linux-*uclibc*} targets.
16583
16584 @item -mmusl
16585 @opindex mmusl
16586 Use the musl C library. This is the default on
16587 @samp{*-*-linux-*musl*} targets.
16588
16589 @item -mbionic
16590 @opindex mbionic
16591 Use Bionic C library. This is the default on
16592 @samp{*-*-linux-*android*} targets.
16593
16594 @item -mandroid
16595 @opindex mandroid
16596 Compile code compatible with Android platform. This is the default on
16597 @samp{*-*-linux-*android*} targets.
16598
16599 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
16600 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
16601 this option makes the GCC driver pass Android-specific options to the linker.
16602 Finally, this option causes the preprocessor macro @code{__ANDROID__}
16603 to be defined.
16604
16605 @item -tno-android-cc
16606 @opindex tno-android-cc
16607 Disable compilation effects of @option{-mandroid}, i.e., do not enable
16608 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
16609 @option{-fno-rtti} by default.
16610
16611 @item -tno-android-ld
16612 @opindex tno-android-ld
16613 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
16614 linking options to the linker.
16615
16616 @end table
16617
16618 @node H8/300 Options
16619 @subsection H8/300 Options
16620
16621 These @samp{-m} options are defined for the H8/300 implementations:
16622
16623 @table @gcctabopt
16624 @item -mrelax
16625 @opindex mrelax
16626 Shorten some address references at link time, when possible; uses the
16627 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
16628 ld, Using ld}, for a fuller description.
16629
16630 @item -mh
16631 @opindex mh
16632 Generate code for the H8/300H@.
16633
16634 @item -ms
16635 @opindex ms
16636 Generate code for the H8S@.
16637
16638 @item -mn
16639 @opindex mn
16640 Generate code for the H8S and H8/300H in the normal mode. This switch
16641 must be used either with @option{-mh} or @option{-ms}.
16642
16643 @item -ms2600
16644 @opindex ms2600
16645 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
16646
16647 @item -mexr
16648 @opindex mexr
16649 Extended registers are stored on stack before execution of function
16650 with monitor attribute. Default option is @option{-mexr}.
16651 This option is valid only for H8S targets.
16652
16653 @item -mno-exr
16654 @opindex mno-exr
16655 Extended registers are not stored on stack before execution of function
16656 with monitor attribute. Default option is @option{-mno-exr}.
16657 This option is valid only for H8S targets.
16658
16659 @item -mint32
16660 @opindex mint32
16661 Make @code{int} data 32 bits by default.
16662
16663 @item -malign-300
16664 @opindex malign-300
16665 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
16666 The default for the H8/300H and H8S is to align longs and floats on
16667 4-byte boundaries.
16668 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
16669 This option has no effect on the H8/300.
16670 @end table
16671
16672 @node HPPA Options
16673 @subsection HPPA Options
16674 @cindex HPPA Options
16675
16676 These @samp{-m} options are defined for the HPPA family of computers:
16677
16678 @table @gcctabopt
16679 @item -march=@var{architecture-type}
16680 @opindex march
16681 Generate code for the specified architecture. The choices for
16682 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
16683 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
16684 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
16685 architecture option for your machine. Code compiled for lower numbered
16686 architectures runs on higher numbered architectures, but not the
16687 other way around.
16688
16689 @item -mpa-risc-1-0
16690 @itemx -mpa-risc-1-1
16691 @itemx -mpa-risc-2-0
16692 @opindex mpa-risc-1-0
16693 @opindex mpa-risc-1-1
16694 @opindex mpa-risc-2-0
16695 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
16696
16697 @item -mjump-in-delay
16698 @opindex mjump-in-delay
16699 This option is ignored and provided for compatibility purposes only.
16700
16701 @item -mdisable-fpregs
16702 @opindex mdisable-fpregs
16703 Prevent floating-point registers from being used in any manner. This is
16704 necessary for compiling kernels that perform lazy context switching of
16705 floating-point registers. If you use this option and attempt to perform
16706 floating-point operations, the compiler aborts.
16707
16708 @item -mdisable-indexing
16709 @opindex mdisable-indexing
16710 Prevent the compiler from using indexing address modes. This avoids some
16711 rather obscure problems when compiling MIG generated code under MACH@.
16712
16713 @item -mno-space-regs
16714 @opindex mno-space-regs
16715 Generate code that assumes the target has no space registers. This allows
16716 GCC to generate faster indirect calls and use unscaled index address modes.
16717
16718 Such code is suitable for level 0 PA systems and kernels.
16719
16720 @item -mfast-indirect-calls
16721 @opindex mfast-indirect-calls
16722 Generate code that assumes calls never cross space boundaries. This
16723 allows GCC to emit code that performs faster indirect calls.
16724
16725 This option does not work in the presence of shared libraries or nested
16726 functions.
16727
16728 @item -mfixed-range=@var{register-range}
16729 @opindex mfixed-range
16730 Generate code treating the given register range as fixed registers.
16731 A fixed register is one that the register allocator cannot use. This is
16732 useful when compiling kernel code. A register range is specified as
16733 two registers separated by a dash. Multiple register ranges can be
16734 specified separated by a comma.
16735
16736 @item -mlong-load-store
16737 @opindex mlong-load-store
16738 Generate 3-instruction load and store sequences as sometimes required by
16739 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
16740 the HP compilers.
16741
16742 @item -mportable-runtime
16743 @opindex mportable-runtime
16744 Use the portable calling conventions proposed by HP for ELF systems.
16745
16746 @item -mgas
16747 @opindex mgas
16748 Enable the use of assembler directives only GAS understands.
16749
16750 @item -mschedule=@var{cpu-type}
16751 @opindex mschedule
16752 Schedule code according to the constraints for the machine type
16753 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
16754 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
16755 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
16756 proper scheduling option for your machine. The default scheduling is
16757 @samp{8000}.
16758
16759 @item -mlinker-opt
16760 @opindex mlinker-opt
16761 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
16762 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
16763 linkers in which they give bogus error messages when linking some programs.
16764
16765 @item -msoft-float
16766 @opindex msoft-float
16767 Generate output containing library calls for floating point.
16768 @strong{Warning:} the requisite libraries are not available for all HPPA
16769 targets. Normally the facilities of the machine's usual C compiler are
16770 used, but this cannot be done directly in cross-compilation. You must make
16771 your own arrangements to provide suitable library functions for
16772 cross-compilation.
16773
16774 @option{-msoft-float} changes the calling convention in the output file;
16775 therefore, it is only useful if you compile @emph{all} of a program with
16776 this option. In particular, you need to compile @file{libgcc.a}, the
16777 library that comes with GCC, with @option{-msoft-float} in order for
16778 this to work.
16779
16780 @item -msio
16781 @opindex msio
16782 Generate the predefine, @code{_SIO}, for server IO@. The default is
16783 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
16784 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
16785 options are available under HP-UX and HI-UX@.
16786
16787 @item -mgnu-ld
16788 @opindex mgnu-ld
16789 Use options specific to GNU @command{ld}.
16790 This passes @option{-shared} to @command{ld} when
16791 building a shared library. It is the default when GCC is configured,
16792 explicitly or implicitly, with the GNU linker. This option does not
16793 affect which @command{ld} is called; it only changes what parameters
16794 are passed to that @command{ld}.
16795 The @command{ld} that is called is determined by the
16796 @option{--with-ld} configure option, GCC's program search path, and
16797 finally by the user's @env{PATH}. The linker used by GCC can be printed
16798 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
16799 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16800
16801 @item -mhp-ld
16802 @opindex mhp-ld
16803 Use options specific to HP @command{ld}.
16804 This passes @option{-b} to @command{ld} when building
16805 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
16806 links. It is the default when GCC is configured, explicitly or
16807 implicitly, with the HP linker. This option does not affect
16808 which @command{ld} is called; it only changes what parameters are passed to that
16809 @command{ld}.
16810 The @command{ld} that is called is determined by the @option{--with-ld}
16811 configure option, GCC's program search path, and finally by the user's
16812 @env{PATH}. The linker used by GCC can be printed using @samp{which
16813 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
16814 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16815
16816 @item -mlong-calls
16817 @opindex mno-long-calls
16818 Generate code that uses long call sequences. This ensures that a call
16819 is always able to reach linker generated stubs. The default is to generate
16820 long calls only when the distance from the call site to the beginning
16821 of the function or translation unit, as the case may be, exceeds a
16822 predefined limit set by the branch type being used. The limits for
16823 normal calls are 7,600,000 and 240,000 bytes, respectively for the
16824 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
16825 240,000 bytes.
16826
16827 Distances are measured from the beginning of functions when using the
16828 @option{-ffunction-sections} option, or when using the @option{-mgas}
16829 and @option{-mno-portable-runtime} options together under HP-UX with
16830 the SOM linker.
16831
16832 It is normally not desirable to use this option as it degrades
16833 performance. However, it may be useful in large applications,
16834 particularly when partial linking is used to build the application.
16835
16836 The types of long calls used depends on the capabilities of the
16837 assembler and linker, and the type of code being generated. The
16838 impact on systems that support long absolute calls, and long pic
16839 symbol-difference or pc-relative calls should be relatively small.
16840 However, an indirect call is used on 32-bit ELF systems in pic code
16841 and it is quite long.
16842
16843 @item -munix=@var{unix-std}
16844 @opindex march
16845 Generate compiler predefines and select a startfile for the specified
16846 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
16847 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
16848 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
16849 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
16850 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
16851 and later.
16852
16853 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
16854 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
16855 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
16856 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
16857 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
16858 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
16859
16860 It is @emph{important} to note that this option changes the interfaces
16861 for various library routines. It also affects the operational behavior
16862 of the C library. Thus, @emph{extreme} care is needed in using this
16863 option.
16864
16865 Library code that is intended to operate with more than one UNIX
16866 standard must test, set and restore the variable @code{__xpg4_extended_mask}
16867 as appropriate. Most GNU software doesn't provide this capability.
16868
16869 @item -nolibdld
16870 @opindex nolibdld
16871 Suppress the generation of link options to search libdld.sl when the
16872 @option{-static} option is specified on HP-UX 10 and later.
16873
16874 @item -static
16875 @opindex static
16876 The HP-UX implementation of setlocale in libc has a dependency on
16877 libdld.sl. There isn't an archive version of libdld.sl. Thus,
16878 when the @option{-static} option is specified, special link options
16879 are needed to resolve this dependency.
16880
16881 On HP-UX 10 and later, the GCC driver adds the necessary options to
16882 link with libdld.sl when the @option{-static} option is specified.
16883 This causes the resulting binary to be dynamic. On the 64-bit port,
16884 the linkers generate dynamic binaries by default in any case. The
16885 @option{-nolibdld} option can be used to prevent the GCC driver from
16886 adding these link options.
16887
16888 @item -threads
16889 @opindex threads
16890 Add support for multithreading with the @dfn{dce thread} library
16891 under HP-UX@. This option sets flags for both the preprocessor and
16892 linker.
16893 @end table
16894
16895 @node IA-64 Options
16896 @subsection IA-64 Options
16897 @cindex IA-64 Options
16898
16899 These are the @samp{-m} options defined for the Intel IA-64 architecture.
16900
16901 @table @gcctabopt
16902 @item -mbig-endian
16903 @opindex mbig-endian
16904 Generate code for a big-endian target. This is the default for HP-UX@.
16905
16906 @item -mlittle-endian
16907 @opindex mlittle-endian
16908 Generate code for a little-endian target. This is the default for AIX5
16909 and GNU/Linux.
16910
16911 @item -mgnu-as
16912 @itemx -mno-gnu-as
16913 @opindex mgnu-as
16914 @opindex mno-gnu-as
16915 Generate (or don't) code for the GNU assembler. This is the default.
16916 @c Also, this is the default if the configure option @option{--with-gnu-as}
16917 @c is used.
16918
16919 @item -mgnu-ld
16920 @itemx -mno-gnu-ld
16921 @opindex mgnu-ld
16922 @opindex mno-gnu-ld
16923 Generate (or don't) code for the GNU linker. This is the default.
16924 @c Also, this is the default if the configure option @option{--with-gnu-ld}
16925 @c is used.
16926
16927 @item -mno-pic
16928 @opindex mno-pic
16929 Generate code that does not use a global pointer register. The result
16930 is not position independent code, and violates the IA-64 ABI@.
16931
16932 @item -mvolatile-asm-stop
16933 @itemx -mno-volatile-asm-stop
16934 @opindex mvolatile-asm-stop
16935 @opindex mno-volatile-asm-stop
16936 Generate (or don't) a stop bit immediately before and after volatile asm
16937 statements.
16938
16939 @item -mregister-names
16940 @itemx -mno-register-names
16941 @opindex mregister-names
16942 @opindex mno-register-names
16943 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
16944 the stacked registers. This may make assembler output more readable.
16945
16946 @item -mno-sdata
16947 @itemx -msdata
16948 @opindex mno-sdata
16949 @opindex msdata
16950 Disable (or enable) optimizations that use the small data section. This may
16951 be useful for working around optimizer bugs.
16952
16953 @item -mconstant-gp
16954 @opindex mconstant-gp
16955 Generate code that uses a single constant global pointer value. This is
16956 useful when compiling kernel code.
16957
16958 @item -mauto-pic
16959 @opindex mauto-pic
16960 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
16961 This is useful when compiling firmware code.
16962
16963 @item -minline-float-divide-min-latency
16964 @opindex minline-float-divide-min-latency
16965 Generate code for inline divides of floating-point values
16966 using the minimum latency algorithm.
16967
16968 @item -minline-float-divide-max-throughput
16969 @opindex minline-float-divide-max-throughput
16970 Generate code for inline divides of floating-point values
16971 using the maximum throughput algorithm.
16972
16973 @item -mno-inline-float-divide
16974 @opindex mno-inline-float-divide
16975 Do not generate inline code for divides of floating-point values.
16976
16977 @item -minline-int-divide-min-latency
16978 @opindex minline-int-divide-min-latency
16979 Generate code for inline divides of integer values
16980 using the minimum latency algorithm.
16981
16982 @item -minline-int-divide-max-throughput
16983 @opindex minline-int-divide-max-throughput
16984 Generate code for inline divides of integer values
16985 using the maximum throughput algorithm.
16986
16987 @item -mno-inline-int-divide
16988 @opindex mno-inline-int-divide
16989 Do not generate inline code for divides of integer values.
16990
16991 @item -minline-sqrt-min-latency
16992 @opindex minline-sqrt-min-latency
16993 Generate code for inline square roots
16994 using the minimum latency algorithm.
16995
16996 @item -minline-sqrt-max-throughput
16997 @opindex minline-sqrt-max-throughput
16998 Generate code for inline square roots
16999 using the maximum throughput algorithm.
17000
17001 @item -mno-inline-sqrt
17002 @opindex mno-inline-sqrt
17003 Do not generate inline code for @code{sqrt}.
17004
17005 @item -mfused-madd
17006 @itemx -mno-fused-madd
17007 @opindex mfused-madd
17008 @opindex mno-fused-madd
17009 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
17010 instructions. The default is to use these instructions.
17011
17012 @item -mno-dwarf2-asm
17013 @itemx -mdwarf2-asm
17014 @opindex mno-dwarf2-asm
17015 @opindex mdwarf2-asm
17016 Don't (or do) generate assembler code for the DWARF line number debugging
17017 info. This may be useful when not using the GNU assembler.
17018
17019 @item -mearly-stop-bits
17020 @itemx -mno-early-stop-bits
17021 @opindex mearly-stop-bits
17022 @opindex mno-early-stop-bits
17023 Allow stop bits to be placed earlier than immediately preceding the
17024 instruction that triggered the stop bit. This can improve instruction
17025 scheduling, but does not always do so.
17026
17027 @item -mfixed-range=@var{register-range}
17028 @opindex mfixed-range
17029 Generate code treating the given register range as fixed registers.
17030 A fixed register is one that the register allocator cannot use. This is
17031 useful when compiling kernel code. A register range is specified as
17032 two registers separated by a dash. Multiple register ranges can be
17033 specified separated by a comma.
17034
17035 @item -mtls-size=@var{tls-size}
17036 @opindex mtls-size
17037 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
17038 64.
17039
17040 @item -mtune=@var{cpu-type}
17041 @opindex mtune
17042 Tune the instruction scheduling for a particular CPU, Valid values are
17043 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
17044 and @samp{mckinley}.
17045
17046 @item -milp32
17047 @itemx -mlp64
17048 @opindex milp32
17049 @opindex mlp64
17050 Generate code for a 32-bit or 64-bit environment.
17051 The 32-bit environment sets int, long and pointer to 32 bits.
17052 The 64-bit environment sets int to 32 bits and long and pointer
17053 to 64 bits. These are HP-UX specific flags.
17054
17055 @item -mno-sched-br-data-spec
17056 @itemx -msched-br-data-spec
17057 @opindex mno-sched-br-data-spec
17058 @opindex msched-br-data-spec
17059 (Dis/En)able data speculative scheduling before reload.
17060 This results in generation of @code{ld.a} instructions and
17061 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17062 The default setting is disabled.
17063
17064 @item -msched-ar-data-spec
17065 @itemx -mno-sched-ar-data-spec
17066 @opindex msched-ar-data-spec
17067 @opindex mno-sched-ar-data-spec
17068 (En/Dis)able data speculative scheduling after reload.
17069 This results in generation of @code{ld.a} instructions and
17070 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
17071 The default setting is enabled.
17072
17073 @item -mno-sched-control-spec
17074 @itemx -msched-control-spec
17075 @opindex mno-sched-control-spec
17076 @opindex msched-control-spec
17077 (Dis/En)able control speculative scheduling. This feature is
17078 available only during region scheduling (i.e.@: before reload).
17079 This results in generation of the @code{ld.s} instructions and
17080 the corresponding check instructions @code{chk.s}.
17081 The default setting is disabled.
17082
17083 @item -msched-br-in-data-spec
17084 @itemx -mno-sched-br-in-data-spec
17085 @opindex msched-br-in-data-spec
17086 @opindex mno-sched-br-in-data-spec
17087 (En/Dis)able speculative scheduling of the instructions that
17088 are dependent on the data speculative loads before reload.
17089 This is effective only with @option{-msched-br-data-spec} enabled.
17090 The default setting is enabled.
17091
17092 @item -msched-ar-in-data-spec
17093 @itemx -mno-sched-ar-in-data-spec
17094 @opindex msched-ar-in-data-spec
17095 @opindex mno-sched-ar-in-data-spec
17096 (En/Dis)able speculative scheduling of the instructions that
17097 are dependent on the data speculative loads after reload.
17098 This is effective only with @option{-msched-ar-data-spec} enabled.
17099 The default setting is enabled.
17100
17101 @item -msched-in-control-spec
17102 @itemx -mno-sched-in-control-spec
17103 @opindex msched-in-control-spec
17104 @opindex mno-sched-in-control-spec
17105 (En/Dis)able speculative scheduling of the instructions that
17106 are dependent on the control speculative loads.
17107 This is effective only with @option{-msched-control-spec} enabled.
17108 The default setting is enabled.
17109
17110 @item -mno-sched-prefer-non-data-spec-insns
17111 @itemx -msched-prefer-non-data-spec-insns
17112 @opindex mno-sched-prefer-non-data-spec-insns
17113 @opindex msched-prefer-non-data-spec-insns
17114 If enabled, data-speculative instructions are chosen for schedule
17115 only if there are no other choices at the moment. This makes
17116 the use of the data speculation much more conservative.
17117 The default setting is disabled.
17118
17119 @item -mno-sched-prefer-non-control-spec-insns
17120 @itemx -msched-prefer-non-control-spec-insns
17121 @opindex mno-sched-prefer-non-control-spec-insns
17122 @opindex msched-prefer-non-control-spec-insns
17123 If enabled, control-speculative instructions are chosen for schedule
17124 only if there are no other choices at the moment. This makes
17125 the use of the control speculation much more conservative.
17126 The default setting is disabled.
17127
17128 @item -mno-sched-count-spec-in-critical-path
17129 @itemx -msched-count-spec-in-critical-path
17130 @opindex mno-sched-count-spec-in-critical-path
17131 @opindex msched-count-spec-in-critical-path
17132 If enabled, speculative dependencies are considered during
17133 computation of the instructions priorities. This makes the use of the
17134 speculation a bit more conservative.
17135 The default setting is disabled.
17136
17137 @item -msched-spec-ldc
17138 @opindex msched-spec-ldc
17139 Use a simple data speculation check. This option is on by default.
17140
17141 @item -msched-control-spec-ldc
17142 @opindex msched-spec-ldc
17143 Use a simple check for control speculation. This option is on by default.
17144
17145 @item -msched-stop-bits-after-every-cycle
17146 @opindex msched-stop-bits-after-every-cycle
17147 Place a stop bit after every cycle when scheduling. This option is on
17148 by default.
17149
17150 @item -msched-fp-mem-deps-zero-cost
17151 @opindex msched-fp-mem-deps-zero-cost
17152 Assume that floating-point stores and loads are not likely to cause a conflict
17153 when placed into the same instruction group. This option is disabled by
17154 default.
17155
17156 @item -msel-sched-dont-check-control-spec
17157 @opindex msel-sched-dont-check-control-spec
17158 Generate checks for control speculation in selective scheduling.
17159 This flag is disabled by default.
17160
17161 @item -msched-max-memory-insns=@var{max-insns}
17162 @opindex msched-max-memory-insns
17163 Limit on the number of memory insns per instruction group, giving lower
17164 priority to subsequent memory insns attempting to schedule in the same
17165 instruction group. Frequently useful to prevent cache bank conflicts.
17166 The default value is 1.
17167
17168 @item -msched-max-memory-insns-hard-limit
17169 @opindex msched-max-memory-insns-hard-limit
17170 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
17171 disallowing more than that number in an instruction group.
17172 Otherwise, the limit is ``soft'', meaning that non-memory operations
17173 are preferred when the limit is reached, but memory operations may still
17174 be scheduled.
17175
17176 @end table
17177
17178 @node LM32 Options
17179 @subsection LM32 Options
17180 @cindex LM32 options
17181
17182 These @option{-m} options are defined for the LatticeMico32 architecture:
17183
17184 @table @gcctabopt
17185 @item -mbarrel-shift-enabled
17186 @opindex mbarrel-shift-enabled
17187 Enable barrel-shift instructions.
17188
17189 @item -mdivide-enabled
17190 @opindex mdivide-enabled
17191 Enable divide and modulus instructions.
17192
17193 @item -mmultiply-enabled
17194 @opindex multiply-enabled
17195 Enable multiply instructions.
17196
17197 @item -msign-extend-enabled
17198 @opindex msign-extend-enabled
17199 Enable sign extend instructions.
17200
17201 @item -muser-enabled
17202 @opindex muser-enabled
17203 Enable user-defined instructions.
17204
17205 @end table
17206
17207 @node M32C Options
17208 @subsection M32C Options
17209 @cindex M32C options
17210
17211 @table @gcctabopt
17212 @item -mcpu=@var{name}
17213 @opindex mcpu=
17214 Select the CPU for which code is generated. @var{name} may be one of
17215 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
17216 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
17217 the M32C/80 series.
17218
17219 @item -msim
17220 @opindex msim
17221 Specifies that the program will be run on the simulator. This causes
17222 an alternate runtime library to be linked in which supports, for
17223 example, file I/O@. You must not use this option when generating
17224 programs that will run on real hardware; you must provide your own
17225 runtime library for whatever I/O functions are needed.
17226
17227 @item -memregs=@var{number}
17228 @opindex memregs=
17229 Specifies the number of memory-based pseudo-registers GCC uses
17230 during code generation. These pseudo-registers are used like real
17231 registers, so there is a tradeoff between GCC's ability to fit the
17232 code into available registers, and the performance penalty of using
17233 memory instead of registers. Note that all modules in a program must
17234 be compiled with the same value for this option. Because of that, you
17235 must not use this option with GCC's default runtime libraries.
17236
17237 @end table
17238
17239 @node M32R/D Options
17240 @subsection M32R/D Options
17241 @cindex M32R/D options
17242
17243 These @option{-m} options are defined for Renesas M32R/D architectures:
17244
17245 @table @gcctabopt
17246 @item -m32r2
17247 @opindex m32r2
17248 Generate code for the M32R/2@.
17249
17250 @item -m32rx
17251 @opindex m32rx
17252 Generate code for the M32R/X@.
17253
17254 @item -m32r
17255 @opindex m32r
17256 Generate code for the M32R@. This is the default.
17257
17258 @item -mmodel=small
17259 @opindex mmodel=small
17260 Assume all objects live in the lower 16MB of memory (so that their addresses
17261 can be loaded with the @code{ld24} instruction), and assume all subroutines
17262 are reachable with the @code{bl} instruction.
17263 This is the default.
17264
17265 The addressability of a particular object can be set with the
17266 @code{model} attribute.
17267
17268 @item -mmodel=medium
17269 @opindex mmodel=medium
17270 Assume objects may be anywhere in the 32-bit address space (the compiler
17271 generates @code{seth/add3} instructions to load their addresses), and
17272 assume all subroutines are reachable with the @code{bl} instruction.
17273
17274 @item -mmodel=large
17275 @opindex mmodel=large
17276 Assume objects may be anywhere in the 32-bit address space (the compiler
17277 generates @code{seth/add3} instructions to load their addresses), and
17278 assume subroutines may not be reachable with the @code{bl} instruction
17279 (the compiler generates the much slower @code{seth/add3/jl}
17280 instruction sequence).
17281
17282 @item -msdata=none
17283 @opindex msdata=none
17284 Disable use of the small data area. Variables are put into
17285 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
17286 @code{section} attribute has been specified).
17287 This is the default.
17288
17289 The small data area consists of sections @code{.sdata} and @code{.sbss}.
17290 Objects may be explicitly put in the small data area with the
17291 @code{section} attribute using one of these sections.
17292
17293 @item -msdata=sdata
17294 @opindex msdata=sdata
17295 Put small global and static data in the small data area, but do not
17296 generate special code to reference them.
17297
17298 @item -msdata=use
17299 @opindex msdata=use
17300 Put small global and static data in the small data area, and generate
17301 special instructions to reference them.
17302
17303 @item -G @var{num}
17304 @opindex G
17305 @cindex smaller data references
17306 Put global and static objects less than or equal to @var{num} bytes
17307 into the small data or BSS sections instead of the normal data or BSS
17308 sections. The default value of @var{num} is 8.
17309 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
17310 for this option to have any effect.
17311
17312 All modules should be compiled with the same @option{-G @var{num}} value.
17313 Compiling with different values of @var{num} may or may not work; if it
17314 doesn't the linker gives an error message---incorrect code is not
17315 generated.
17316
17317 @item -mdebug
17318 @opindex mdebug
17319 Makes the M32R-specific code in the compiler display some statistics
17320 that might help in debugging programs.
17321
17322 @item -malign-loops
17323 @opindex malign-loops
17324 Align all loops to a 32-byte boundary.
17325
17326 @item -mno-align-loops
17327 @opindex mno-align-loops
17328 Do not enforce a 32-byte alignment for loops. This is the default.
17329
17330 @item -missue-rate=@var{number}
17331 @opindex missue-rate=@var{number}
17332 Issue @var{number} instructions per cycle. @var{number} can only be 1
17333 or 2.
17334
17335 @item -mbranch-cost=@var{number}
17336 @opindex mbranch-cost=@var{number}
17337 @var{number} can only be 1 or 2. If it is 1 then branches are
17338 preferred over conditional code, if it is 2, then the opposite applies.
17339
17340 @item -mflush-trap=@var{number}
17341 @opindex mflush-trap=@var{number}
17342 Specifies the trap number to use to flush the cache. The default is
17343 12. Valid numbers are between 0 and 15 inclusive.
17344
17345 @item -mno-flush-trap
17346 @opindex mno-flush-trap
17347 Specifies that the cache cannot be flushed by using a trap.
17348
17349 @item -mflush-func=@var{name}
17350 @opindex mflush-func=@var{name}
17351 Specifies the name of the operating system function to call to flush
17352 the cache. The default is @samp{_flush_cache}, but a function call
17353 is only used if a trap is not available.
17354
17355 @item -mno-flush-func
17356 @opindex mno-flush-func
17357 Indicates that there is no OS function for flushing the cache.
17358
17359 @end table
17360
17361 @node M680x0 Options
17362 @subsection M680x0 Options
17363 @cindex M680x0 options
17364
17365 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
17366 The default settings depend on which architecture was selected when
17367 the compiler was configured; the defaults for the most common choices
17368 are given below.
17369
17370 @table @gcctabopt
17371 @item -march=@var{arch}
17372 @opindex march
17373 Generate code for a specific M680x0 or ColdFire instruction set
17374 architecture. Permissible values of @var{arch} for M680x0
17375 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
17376 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
17377 architectures are selected according to Freescale's ISA classification
17378 and the permissible values are: @samp{isaa}, @samp{isaaplus},
17379 @samp{isab} and @samp{isac}.
17380
17381 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
17382 code for a ColdFire target. The @var{arch} in this macro is one of the
17383 @option{-march} arguments given above.
17384
17385 When used together, @option{-march} and @option{-mtune} select code
17386 that runs on a family of similar processors but that is optimized
17387 for a particular microarchitecture.
17388
17389 @item -mcpu=@var{cpu}
17390 @opindex mcpu
17391 Generate code for a specific M680x0 or ColdFire processor.
17392 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
17393 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
17394 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
17395 below, which also classifies the CPUs into families:
17396
17397 @multitable @columnfractions 0.20 0.80
17398 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
17399 @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}
17400 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
17401 @item @samp{5206e} @tab @samp{5206e}
17402 @item @samp{5208} @tab @samp{5207} @samp{5208}
17403 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
17404 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
17405 @item @samp{5216} @tab @samp{5214} @samp{5216}
17406 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
17407 @item @samp{5225} @tab @samp{5224} @samp{5225}
17408 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
17409 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
17410 @item @samp{5249} @tab @samp{5249}
17411 @item @samp{5250} @tab @samp{5250}
17412 @item @samp{5271} @tab @samp{5270} @samp{5271}
17413 @item @samp{5272} @tab @samp{5272}
17414 @item @samp{5275} @tab @samp{5274} @samp{5275}
17415 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
17416 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
17417 @item @samp{5307} @tab @samp{5307}
17418 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
17419 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
17420 @item @samp{5407} @tab @samp{5407}
17421 @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}
17422 @end multitable
17423
17424 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
17425 @var{arch} is compatible with @var{cpu}. Other combinations of
17426 @option{-mcpu} and @option{-march} are rejected.
17427
17428 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
17429 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
17430 where the value of @var{family} is given by the table above.
17431
17432 @item -mtune=@var{tune}
17433 @opindex mtune
17434 Tune the code for a particular microarchitecture within the
17435 constraints set by @option{-march} and @option{-mcpu}.
17436 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
17437 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
17438 and @samp{cpu32}. The ColdFire microarchitectures
17439 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
17440
17441 You can also use @option{-mtune=68020-40} for code that needs
17442 to run relatively well on 68020, 68030 and 68040 targets.
17443 @option{-mtune=68020-60} is similar but includes 68060 targets
17444 as well. These two options select the same tuning decisions as
17445 @option{-m68020-40} and @option{-m68020-60} respectively.
17446
17447 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
17448 when tuning for 680x0 architecture @var{arch}. It also defines
17449 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
17450 option is used. If GCC is tuning for a range of architectures,
17451 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
17452 it defines the macros for every architecture in the range.
17453
17454 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
17455 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
17456 of the arguments given above.
17457
17458 @item -m68000
17459 @itemx -mc68000
17460 @opindex m68000
17461 @opindex mc68000
17462 Generate output for a 68000. This is the default
17463 when the compiler is configured for 68000-based systems.
17464 It is equivalent to @option{-march=68000}.
17465
17466 Use this option for microcontrollers with a 68000 or EC000 core,
17467 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
17468
17469 @item -m68010
17470 @opindex m68010
17471 Generate output for a 68010. This is the default
17472 when the compiler is configured for 68010-based systems.
17473 It is equivalent to @option{-march=68010}.
17474
17475 @item -m68020
17476 @itemx -mc68020
17477 @opindex m68020
17478 @opindex mc68020
17479 Generate output for a 68020. This is the default
17480 when the compiler is configured for 68020-based systems.
17481 It is equivalent to @option{-march=68020}.
17482
17483 @item -m68030
17484 @opindex m68030
17485 Generate output for a 68030. This is the default when the compiler is
17486 configured for 68030-based systems. It is equivalent to
17487 @option{-march=68030}.
17488
17489 @item -m68040
17490 @opindex m68040
17491 Generate output for a 68040. This is the default when the compiler is
17492 configured for 68040-based systems. It is equivalent to
17493 @option{-march=68040}.
17494
17495 This option inhibits the use of 68881/68882 instructions that have to be
17496 emulated by software on the 68040. Use this option if your 68040 does not
17497 have code to emulate those instructions.
17498
17499 @item -m68060
17500 @opindex m68060
17501 Generate output for a 68060. This is the default when the compiler is
17502 configured for 68060-based systems. It is equivalent to
17503 @option{-march=68060}.
17504
17505 This option inhibits the use of 68020 and 68881/68882 instructions that
17506 have to be emulated by software on the 68060. Use this option if your 68060
17507 does not have code to emulate those instructions.
17508
17509 @item -mcpu32
17510 @opindex mcpu32
17511 Generate output for a CPU32. This is the default
17512 when the compiler is configured for CPU32-based systems.
17513 It is equivalent to @option{-march=cpu32}.
17514
17515 Use this option for microcontrollers with a
17516 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
17517 68336, 68340, 68341, 68349 and 68360.
17518
17519 @item -m5200
17520 @opindex m5200
17521 Generate output for a 520X ColdFire CPU@. This is the default
17522 when the compiler is configured for 520X-based systems.
17523 It is equivalent to @option{-mcpu=5206}, and is now deprecated
17524 in favor of that option.
17525
17526 Use this option for microcontroller with a 5200 core, including
17527 the MCF5202, MCF5203, MCF5204 and MCF5206.
17528
17529 @item -m5206e
17530 @opindex m5206e
17531 Generate output for a 5206e ColdFire CPU@. The option is now
17532 deprecated in favor of the equivalent @option{-mcpu=5206e}.
17533
17534 @item -m528x
17535 @opindex m528x
17536 Generate output for a member of the ColdFire 528X family.
17537 The option is now deprecated in favor of the equivalent
17538 @option{-mcpu=528x}.
17539
17540 @item -m5307
17541 @opindex m5307
17542 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
17543 in favor of the equivalent @option{-mcpu=5307}.
17544
17545 @item -m5407
17546 @opindex m5407
17547 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
17548 in favor of the equivalent @option{-mcpu=5407}.
17549
17550 @item -mcfv4e
17551 @opindex mcfv4e
17552 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
17553 This includes use of hardware floating-point instructions.
17554 The option is equivalent to @option{-mcpu=547x}, and is now
17555 deprecated in favor of that option.
17556
17557 @item -m68020-40
17558 @opindex m68020-40
17559 Generate output for a 68040, without using any of the new instructions.
17560 This results in code that can run relatively efficiently on either a
17561 68020/68881 or a 68030 or a 68040. The generated code does use the
17562 68881 instructions that are emulated on the 68040.
17563
17564 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
17565
17566 @item -m68020-60
17567 @opindex m68020-60
17568 Generate output for a 68060, without using any of the new instructions.
17569 This results in code that can run relatively efficiently on either a
17570 68020/68881 or a 68030 or a 68040. The generated code does use the
17571 68881 instructions that are emulated on the 68060.
17572
17573 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
17574
17575 @item -mhard-float
17576 @itemx -m68881
17577 @opindex mhard-float
17578 @opindex m68881
17579 Generate floating-point instructions. This is the default for 68020
17580 and above, and for ColdFire devices that have an FPU@. It defines the
17581 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
17582 on ColdFire targets.
17583
17584 @item -msoft-float
17585 @opindex msoft-float
17586 Do not generate floating-point instructions; use library calls instead.
17587 This is the default for 68000, 68010, and 68832 targets. It is also
17588 the default for ColdFire devices that have no FPU.
17589
17590 @item -mdiv
17591 @itemx -mno-div
17592 @opindex mdiv
17593 @opindex mno-div
17594 Generate (do not generate) ColdFire hardware divide and remainder
17595 instructions. If @option{-march} is used without @option{-mcpu},
17596 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
17597 architectures. Otherwise, the default is taken from the target CPU
17598 (either the default CPU, or the one specified by @option{-mcpu}). For
17599 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
17600 @option{-mcpu=5206e}.
17601
17602 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
17603
17604 @item -mshort
17605 @opindex mshort
17606 Consider type @code{int} to be 16 bits wide, like @code{short int}.
17607 Additionally, parameters passed on the stack are also aligned to a
17608 16-bit boundary even on targets whose API mandates promotion to 32-bit.
17609
17610 @item -mno-short
17611 @opindex mno-short
17612 Do not consider type @code{int} to be 16 bits wide. This is the default.
17613
17614 @item -mnobitfield
17615 @itemx -mno-bitfield
17616 @opindex mnobitfield
17617 @opindex mno-bitfield
17618 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
17619 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
17620
17621 @item -mbitfield
17622 @opindex mbitfield
17623 Do use the bit-field instructions. The @option{-m68020} option implies
17624 @option{-mbitfield}. This is the default if you use a configuration
17625 designed for a 68020.
17626
17627 @item -mrtd
17628 @opindex mrtd
17629 Use a different function-calling convention, in which functions
17630 that take a fixed number of arguments return with the @code{rtd}
17631 instruction, which pops their arguments while returning. This
17632 saves one instruction in the caller since there is no need to pop
17633 the arguments there.
17634
17635 This calling convention is incompatible with the one normally
17636 used on Unix, so you cannot use it if you need to call libraries
17637 compiled with the Unix compiler.
17638
17639 Also, you must provide function prototypes for all functions that
17640 take variable numbers of arguments (including @code{printf});
17641 otherwise incorrect code is generated for calls to those
17642 functions.
17643
17644 In addition, seriously incorrect code results if you call a
17645 function with too many arguments. (Normally, extra arguments are
17646 harmlessly ignored.)
17647
17648 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
17649 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
17650
17651 @item -mno-rtd
17652 @opindex mno-rtd
17653 Do not use the calling conventions selected by @option{-mrtd}.
17654 This is the default.
17655
17656 @item -malign-int
17657 @itemx -mno-align-int
17658 @opindex malign-int
17659 @opindex mno-align-int
17660 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
17661 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
17662 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
17663 Aligning variables on 32-bit boundaries produces code that runs somewhat
17664 faster on processors with 32-bit busses at the expense of more memory.
17665
17666 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
17667 aligns structures containing the above types differently than
17668 most published application binary interface specifications for the m68k.
17669
17670 @item -mpcrel
17671 @opindex mpcrel
17672 Use the pc-relative addressing mode of the 68000 directly, instead of
17673 using a global offset table. At present, this option implies @option{-fpic},
17674 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
17675 not presently supported with @option{-mpcrel}, though this could be supported for
17676 68020 and higher processors.
17677
17678 @item -mno-strict-align
17679 @itemx -mstrict-align
17680 @opindex mno-strict-align
17681 @opindex mstrict-align
17682 Do not (do) assume that unaligned memory references are handled by
17683 the system.
17684
17685 @item -msep-data
17686 Generate code that allows the data segment to be located in a different
17687 area of memory from the text segment. This allows for execute-in-place in
17688 an environment without virtual memory management. This option implies
17689 @option{-fPIC}.
17690
17691 @item -mno-sep-data
17692 Generate code that assumes that the data segment follows the text segment.
17693 This is the default.
17694
17695 @item -mid-shared-library
17696 Generate code that supports shared libraries via the library ID method.
17697 This allows for execute-in-place and shared libraries in an environment
17698 without virtual memory management. This option implies @option{-fPIC}.
17699
17700 @item -mno-id-shared-library
17701 Generate code that doesn't assume ID-based shared libraries are being used.
17702 This is the default.
17703
17704 @item -mshared-library-id=n
17705 Specifies the identification number of the ID-based shared library being
17706 compiled. Specifying a value of 0 generates more compact code; specifying
17707 other values forces the allocation of that number to the current
17708 library, but is no more space- or time-efficient than omitting this option.
17709
17710 @item -mxgot
17711 @itemx -mno-xgot
17712 @opindex mxgot
17713 @opindex mno-xgot
17714 When generating position-independent code for ColdFire, generate code
17715 that works if the GOT has more than 8192 entries. This code is
17716 larger and slower than code generated without this option. On M680x0
17717 processors, this option is not needed; @option{-fPIC} suffices.
17718
17719 GCC normally uses a single instruction to load values from the GOT@.
17720 While this is relatively efficient, it only works if the GOT
17721 is smaller than about 64k. Anything larger causes the linker
17722 to report an error such as:
17723
17724 @cindex relocation truncated to fit (ColdFire)
17725 @smallexample
17726 relocation truncated to fit: R_68K_GOT16O foobar
17727 @end smallexample
17728
17729 If this happens, you should recompile your code with @option{-mxgot}.
17730 It should then work with very large GOTs. However, code generated with
17731 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
17732 the value of a global symbol.
17733
17734 Note that some linkers, including newer versions of the GNU linker,
17735 can create multiple GOTs and sort GOT entries. If you have such a linker,
17736 you should only need to use @option{-mxgot} when compiling a single
17737 object file that accesses more than 8192 GOT entries. Very few do.
17738
17739 These options have no effect unless GCC is generating
17740 position-independent code.
17741
17742 @end table
17743
17744 @node MCore Options
17745 @subsection MCore Options
17746 @cindex MCore options
17747
17748 These are the @samp{-m} options defined for the Motorola M*Core
17749 processors.
17750
17751 @table @gcctabopt
17752
17753 @item -mhardlit
17754 @itemx -mno-hardlit
17755 @opindex mhardlit
17756 @opindex mno-hardlit
17757 Inline constants into the code stream if it can be done in two
17758 instructions or less.
17759
17760 @item -mdiv
17761 @itemx -mno-div
17762 @opindex mdiv
17763 @opindex mno-div
17764 Use the divide instruction. (Enabled by default).
17765
17766 @item -mrelax-immediate
17767 @itemx -mno-relax-immediate
17768 @opindex mrelax-immediate
17769 @opindex mno-relax-immediate
17770 Allow arbitrary-sized immediates in bit operations.
17771
17772 @item -mwide-bitfields
17773 @itemx -mno-wide-bitfields
17774 @opindex mwide-bitfields
17775 @opindex mno-wide-bitfields
17776 Always treat bit-fields as @code{int}-sized.
17777
17778 @item -m4byte-functions
17779 @itemx -mno-4byte-functions
17780 @opindex m4byte-functions
17781 @opindex mno-4byte-functions
17782 Force all functions to be aligned to a 4-byte boundary.
17783
17784 @item -mcallgraph-data
17785 @itemx -mno-callgraph-data
17786 @opindex mcallgraph-data
17787 @opindex mno-callgraph-data
17788 Emit callgraph information.
17789
17790 @item -mslow-bytes
17791 @itemx -mno-slow-bytes
17792 @opindex mslow-bytes
17793 @opindex mno-slow-bytes
17794 Prefer word access when reading byte quantities.
17795
17796 @item -mlittle-endian
17797 @itemx -mbig-endian
17798 @opindex mlittle-endian
17799 @opindex mbig-endian
17800 Generate code for a little-endian target.
17801
17802 @item -m210
17803 @itemx -m340
17804 @opindex m210
17805 @opindex m340
17806 Generate code for the 210 processor.
17807
17808 @item -mno-lsim
17809 @opindex mno-lsim
17810 Assume that runtime support has been provided and so omit the
17811 simulator library (@file{libsim.a)} from the linker command line.
17812
17813 @item -mstack-increment=@var{size}
17814 @opindex mstack-increment
17815 Set the maximum amount for a single stack increment operation. Large
17816 values can increase the speed of programs that contain functions
17817 that need a large amount of stack space, but they can also trigger a
17818 segmentation fault if the stack is extended too much. The default
17819 value is 0x1000.
17820
17821 @end table
17822
17823 @node MeP Options
17824 @subsection MeP Options
17825 @cindex MeP options
17826
17827 @table @gcctabopt
17828
17829 @item -mabsdiff
17830 @opindex mabsdiff
17831 Enables the @code{abs} instruction, which is the absolute difference
17832 between two registers.
17833
17834 @item -mall-opts
17835 @opindex mall-opts
17836 Enables all the optional instructions---average, multiply, divide, bit
17837 operations, leading zero, absolute difference, min/max, clip, and
17838 saturation.
17839
17840
17841 @item -maverage
17842 @opindex maverage
17843 Enables the @code{ave} instruction, which computes the average of two
17844 registers.
17845
17846 @item -mbased=@var{n}
17847 @opindex mbased=
17848 Variables of size @var{n} bytes or smaller are placed in the
17849 @code{.based} section by default. Based variables use the @code{$tp}
17850 register as a base register, and there is a 128-byte limit to the
17851 @code{.based} section.
17852
17853 @item -mbitops
17854 @opindex mbitops
17855 Enables the bit operation instructions---bit test (@code{btstm}), set
17856 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
17857 test-and-set (@code{tas}).
17858
17859 @item -mc=@var{name}
17860 @opindex mc=
17861 Selects which section constant data is placed in. @var{name} may
17862 be @samp{tiny}, @samp{near}, or @samp{far}.
17863
17864 @item -mclip
17865 @opindex mclip
17866 Enables the @code{clip} instruction. Note that @option{-mclip} is not
17867 useful unless you also provide @option{-mminmax}.
17868
17869 @item -mconfig=@var{name}
17870 @opindex mconfig=
17871 Selects one of the built-in core configurations. Each MeP chip has
17872 one or more modules in it; each module has a core CPU and a variety of
17873 coprocessors, optional instructions, and peripherals. The
17874 @code{MeP-Integrator} tool, not part of GCC, provides these
17875 configurations through this option; using this option is the same as
17876 using all the corresponding command-line options. The default
17877 configuration is @samp{default}.
17878
17879 @item -mcop
17880 @opindex mcop
17881 Enables the coprocessor instructions. By default, this is a 32-bit
17882 coprocessor. Note that the coprocessor is normally enabled via the
17883 @option{-mconfig=} option.
17884
17885 @item -mcop32
17886 @opindex mcop32
17887 Enables the 32-bit coprocessor's instructions.
17888
17889 @item -mcop64
17890 @opindex mcop64
17891 Enables the 64-bit coprocessor's instructions.
17892
17893 @item -mivc2
17894 @opindex mivc2
17895 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
17896
17897 @item -mdc
17898 @opindex mdc
17899 Causes constant variables to be placed in the @code{.near} section.
17900
17901 @item -mdiv
17902 @opindex mdiv
17903 Enables the @code{div} and @code{divu} instructions.
17904
17905 @item -meb
17906 @opindex meb
17907 Generate big-endian code.
17908
17909 @item -mel
17910 @opindex mel
17911 Generate little-endian code.
17912
17913 @item -mio-volatile
17914 @opindex mio-volatile
17915 Tells the compiler that any variable marked with the @code{io}
17916 attribute is to be considered volatile.
17917
17918 @item -ml
17919 @opindex ml
17920 Causes variables to be assigned to the @code{.far} section by default.
17921
17922 @item -mleadz
17923 @opindex mleadz
17924 Enables the @code{leadz} (leading zero) instruction.
17925
17926 @item -mm
17927 @opindex mm
17928 Causes variables to be assigned to the @code{.near} section by default.
17929
17930 @item -mminmax
17931 @opindex mminmax
17932 Enables the @code{min} and @code{max} instructions.
17933
17934 @item -mmult
17935 @opindex mmult
17936 Enables the multiplication and multiply-accumulate instructions.
17937
17938 @item -mno-opts
17939 @opindex mno-opts
17940 Disables all the optional instructions enabled by @option{-mall-opts}.
17941
17942 @item -mrepeat
17943 @opindex mrepeat
17944 Enables the @code{repeat} and @code{erepeat} instructions, used for
17945 low-overhead looping.
17946
17947 @item -ms
17948 @opindex ms
17949 Causes all variables to default to the @code{.tiny} section. Note
17950 that there is a 65536-byte limit to this section. Accesses to these
17951 variables use the @code{%gp} base register.
17952
17953 @item -msatur
17954 @opindex msatur
17955 Enables the saturation instructions. Note that the compiler does not
17956 currently generate these itself, but this option is included for
17957 compatibility with other tools, like @code{as}.
17958
17959 @item -msdram
17960 @opindex msdram
17961 Link the SDRAM-based runtime instead of the default ROM-based runtime.
17962
17963 @item -msim
17964 @opindex msim
17965 Link the simulator run-time libraries.
17966
17967 @item -msimnovec
17968 @opindex msimnovec
17969 Link the simulator runtime libraries, excluding built-in support
17970 for reset and exception vectors and tables.
17971
17972 @item -mtf
17973 @opindex mtf
17974 Causes all functions to default to the @code{.far} section. Without
17975 this option, functions default to the @code{.near} section.
17976
17977 @item -mtiny=@var{n}
17978 @opindex mtiny=
17979 Variables that are @var{n} bytes or smaller are allocated to the
17980 @code{.tiny} section. These variables use the @code{$gp} base
17981 register. The default for this option is 4, but note that there's a
17982 65536-byte limit to the @code{.tiny} section.
17983
17984 @end table
17985
17986 @node MicroBlaze Options
17987 @subsection MicroBlaze Options
17988 @cindex MicroBlaze Options
17989
17990 @table @gcctabopt
17991
17992 @item -msoft-float
17993 @opindex msoft-float
17994 Use software emulation for floating point (default).
17995
17996 @item -mhard-float
17997 @opindex mhard-float
17998 Use hardware floating-point instructions.
17999
18000 @item -mmemcpy
18001 @opindex mmemcpy
18002 Do not optimize block moves, use @code{memcpy}.
18003
18004 @item -mno-clearbss
18005 @opindex mno-clearbss
18006 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
18007
18008 @item -mcpu=@var{cpu-type}
18009 @opindex mcpu=
18010 Use features of, and schedule code for, the given CPU.
18011 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
18012 where @var{X} is a major version, @var{YY} is the minor version, and
18013 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
18014 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
18015
18016 @item -mxl-soft-mul
18017 @opindex mxl-soft-mul
18018 Use software multiply emulation (default).
18019
18020 @item -mxl-soft-div
18021 @opindex mxl-soft-div
18022 Use software emulation for divides (default).
18023
18024 @item -mxl-barrel-shift
18025 @opindex mxl-barrel-shift
18026 Use the hardware barrel shifter.
18027
18028 @item -mxl-pattern-compare
18029 @opindex mxl-pattern-compare
18030 Use pattern compare instructions.
18031
18032 @item -msmall-divides
18033 @opindex msmall-divides
18034 Use table lookup optimization for small signed integer divisions.
18035
18036 @item -mxl-stack-check
18037 @opindex mxl-stack-check
18038 This option is deprecated. Use @option{-fstack-check} instead.
18039
18040 @item -mxl-gp-opt
18041 @opindex mxl-gp-opt
18042 Use GP-relative @code{.sdata}/@code{.sbss} sections.
18043
18044 @item -mxl-multiply-high
18045 @opindex mxl-multiply-high
18046 Use multiply high instructions for high part of 32x32 multiply.
18047
18048 @item -mxl-float-convert
18049 @opindex mxl-float-convert
18050 Use hardware floating-point conversion instructions.
18051
18052 @item -mxl-float-sqrt
18053 @opindex mxl-float-sqrt
18054 Use hardware floating-point square root instruction.
18055
18056 @item -mbig-endian
18057 @opindex mbig-endian
18058 Generate code for a big-endian target.
18059
18060 @item -mlittle-endian
18061 @opindex mlittle-endian
18062 Generate code for a little-endian target.
18063
18064 @item -mxl-reorder
18065 @opindex mxl-reorder
18066 Use reorder instructions (swap and byte reversed load/store).
18067
18068 @item -mxl-mode-@var{app-model}
18069 Select application model @var{app-model}. Valid models are
18070 @table @samp
18071 @item executable
18072 normal executable (default), uses startup code @file{crt0.o}.
18073
18074 @item xmdstub
18075 for use with Xilinx Microprocessor Debugger (XMD) based
18076 software intrusive debug agent called xmdstub. This uses startup file
18077 @file{crt1.o} and sets the start address of the program to 0x800.
18078
18079 @item bootstrap
18080 for applications that are loaded using a bootloader.
18081 This model uses startup file @file{crt2.o} which does not contain a processor
18082 reset vector handler. This is suitable for transferring control on a
18083 processor reset to the bootloader rather than the application.
18084
18085 @item novectors
18086 for applications that do not require any of the
18087 MicroBlaze vectors. This option may be useful for applications running
18088 within a monitoring application. This model uses @file{crt3.o} as a startup file.
18089 @end table
18090
18091 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
18092 @option{-mxl-mode-@var{app-model}}.
18093
18094 @end table
18095
18096 @node MIPS Options
18097 @subsection MIPS Options
18098 @cindex MIPS options
18099
18100 @table @gcctabopt
18101
18102 @item -EB
18103 @opindex EB
18104 Generate big-endian code.
18105
18106 @item -EL
18107 @opindex EL
18108 Generate little-endian code. This is the default for @samp{mips*el-*-*}
18109 configurations.
18110
18111 @item -march=@var{arch}
18112 @opindex march
18113 Generate code that runs on @var{arch}, which can be the name of a
18114 generic MIPS ISA, or the name of a particular processor.
18115 The ISA names are:
18116 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
18117 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
18118 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
18119 @samp{mips64r5} and @samp{mips64r6}.
18120 The processor names are:
18121 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
18122 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
18123 @samp{5kc}, @samp{5kf},
18124 @samp{20kc},
18125 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
18126 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
18127 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
18128 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
18129 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
18130 @samp{i6400},
18131 @samp{interaptiv},
18132 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
18133 @samp{m4k},
18134 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
18135 @samp{m5100}, @samp{m5101},
18136 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
18137 @samp{orion},
18138 @samp{p5600},
18139 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
18140 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
18141 @samp{rm7000}, @samp{rm9000},
18142 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
18143 @samp{sb1},
18144 @samp{sr71000},
18145 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
18146 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
18147 @samp{xlr} and @samp{xlp}.
18148 The special value @samp{from-abi} selects the
18149 most compatible architecture for the selected ABI (that is,
18150 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
18151
18152 The native Linux/GNU toolchain also supports the value @samp{native},
18153 which selects the best architecture option for the host processor.
18154 @option{-march=native} has no effect if GCC does not recognize
18155 the processor.
18156
18157 In processor names, a final @samp{000} can be abbreviated as @samp{k}
18158 (for example, @option{-march=r2k}). Prefixes are optional, and
18159 @samp{vr} may be written @samp{r}.
18160
18161 Names of the form @samp{@var{n}f2_1} refer to processors with
18162 FPUs clocked at half the rate of the core, names of the form
18163 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
18164 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
18165 processors with FPUs clocked a ratio of 3:2 with respect to the core.
18166 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
18167 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
18168 accepted as synonyms for @samp{@var{n}f1_1}.
18169
18170 GCC defines two macros based on the value of this option. The first
18171 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
18172 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
18173 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
18174 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
18175 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
18176
18177 Note that the @code{_MIPS_ARCH} macro uses the processor names given
18178 above. In other words, it has the full prefix and does not
18179 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
18180 the macro names the resolved architecture (either @code{"mips1"} or
18181 @code{"mips3"}). It names the default architecture when no
18182 @option{-march} option is given.
18183
18184 @item -mtune=@var{arch}
18185 @opindex mtune
18186 Optimize for @var{arch}. Among other things, this option controls
18187 the way instructions are scheduled, and the perceived cost of arithmetic
18188 operations. The list of @var{arch} values is the same as for
18189 @option{-march}.
18190
18191 When this option is not used, GCC optimizes for the processor
18192 specified by @option{-march}. By using @option{-march} and
18193 @option{-mtune} together, it is possible to generate code that
18194 runs on a family of processors, but optimize the code for one
18195 particular member of that family.
18196
18197 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
18198 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
18199 @option{-march} ones described above.
18200
18201 @item -mips1
18202 @opindex mips1
18203 Equivalent to @option{-march=mips1}.
18204
18205 @item -mips2
18206 @opindex mips2
18207 Equivalent to @option{-march=mips2}.
18208
18209 @item -mips3
18210 @opindex mips3
18211 Equivalent to @option{-march=mips3}.
18212
18213 @item -mips4
18214 @opindex mips4
18215 Equivalent to @option{-march=mips4}.
18216
18217 @item -mips32
18218 @opindex mips32
18219 Equivalent to @option{-march=mips32}.
18220
18221 @item -mips32r3
18222 @opindex mips32r3
18223 Equivalent to @option{-march=mips32r3}.
18224
18225 @item -mips32r5
18226 @opindex mips32r5
18227 Equivalent to @option{-march=mips32r5}.
18228
18229 @item -mips32r6
18230 @opindex mips32r6
18231 Equivalent to @option{-march=mips32r6}.
18232
18233 @item -mips64
18234 @opindex mips64
18235 Equivalent to @option{-march=mips64}.
18236
18237 @item -mips64r2
18238 @opindex mips64r2
18239 Equivalent to @option{-march=mips64r2}.
18240
18241 @item -mips64r3
18242 @opindex mips64r3
18243 Equivalent to @option{-march=mips64r3}.
18244
18245 @item -mips64r5
18246 @opindex mips64r5
18247 Equivalent to @option{-march=mips64r5}.
18248
18249 @item -mips64r6
18250 @opindex mips64r6
18251 Equivalent to @option{-march=mips64r6}.
18252
18253 @item -mips16
18254 @itemx -mno-mips16
18255 @opindex mips16
18256 @opindex mno-mips16
18257 Generate (do not generate) MIPS16 code. If GCC is targeting a
18258 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
18259
18260 MIPS16 code generation can also be controlled on a per-function basis
18261 by means of @code{mips16} and @code{nomips16} attributes.
18262 @xref{Function Attributes}, for more information.
18263
18264 @item -mflip-mips16
18265 @opindex mflip-mips16
18266 Generate MIPS16 code on alternating functions. This option is provided
18267 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
18268 not intended for ordinary use in compiling user code.
18269
18270 @item -minterlink-compressed
18271 @item -mno-interlink-compressed
18272 @opindex minterlink-compressed
18273 @opindex mno-interlink-compressed
18274 Require (do not require) that code using the standard (uncompressed) MIPS ISA
18275 be link-compatible with MIPS16 and microMIPS code, and vice versa.
18276
18277 For example, code using the standard ISA encoding cannot jump directly
18278 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
18279 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
18280 knows that the target of the jump is not compressed.
18281
18282 @item -minterlink-mips16
18283 @itemx -mno-interlink-mips16
18284 @opindex minterlink-mips16
18285 @opindex mno-interlink-mips16
18286 Aliases of @option{-minterlink-compressed} and
18287 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
18288 and are retained for backwards compatibility.
18289
18290 @item -mabi=32
18291 @itemx -mabi=o64
18292 @itemx -mabi=n32
18293 @itemx -mabi=64
18294 @itemx -mabi=eabi
18295 @opindex mabi=32
18296 @opindex mabi=o64
18297 @opindex mabi=n32
18298 @opindex mabi=64
18299 @opindex mabi=eabi
18300 Generate code for the given ABI@.
18301
18302 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
18303 generates 64-bit code when you select a 64-bit architecture, but you
18304 can use @option{-mgp32} to get 32-bit code instead.
18305
18306 For information about the O64 ABI, see
18307 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
18308
18309 GCC supports a variant of the o32 ABI in which floating-point registers
18310 are 64 rather than 32 bits wide. You can select this combination with
18311 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
18312 and @code{mfhc1} instructions and is therefore only supported for
18313 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
18314
18315 The register assignments for arguments and return values remain the
18316 same, but each scalar value is passed in a single 64-bit register
18317 rather than a pair of 32-bit registers. For example, scalar
18318 floating-point values are returned in @samp{$f0} only, not a
18319 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
18320 remains the same in that the even-numbered double-precision registers
18321 are saved.
18322
18323 Two additional variants of the o32 ABI are supported to enable
18324 a transition from 32-bit to 64-bit registers. These are FPXX
18325 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
18326 The FPXX extension mandates that all code must execute correctly
18327 when run using 32-bit or 64-bit registers. The code can be interlinked
18328 with either FP32 or FP64, but not both.
18329 The FP64A extension is similar to the FP64 extension but forbids the
18330 use of odd-numbered single-precision registers. This can be used
18331 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
18332 processors and allows both FP32 and FP64A code to interlink and
18333 run in the same process without changing FPU modes.
18334
18335 @item -mabicalls
18336 @itemx -mno-abicalls
18337 @opindex mabicalls
18338 @opindex mno-abicalls
18339 Generate (do not generate) code that is suitable for SVR4-style
18340 dynamic objects. @option{-mabicalls} is the default for SVR4-based
18341 systems.
18342
18343 @item -mshared
18344 @itemx -mno-shared
18345 Generate (do not generate) code that is fully position-independent,
18346 and that can therefore be linked into shared libraries. This option
18347 only affects @option{-mabicalls}.
18348
18349 All @option{-mabicalls} code has traditionally been position-independent,
18350 regardless of options like @option{-fPIC} and @option{-fpic}. However,
18351 as an extension, the GNU toolchain allows executables to use absolute
18352 accesses for locally-binding symbols. It can also use shorter GP
18353 initialization sequences and generate direct calls to locally-defined
18354 functions. This mode is selected by @option{-mno-shared}.
18355
18356 @option{-mno-shared} depends on binutils 2.16 or higher and generates
18357 objects that can only be linked by the GNU linker. However, the option
18358 does not affect the ABI of the final executable; it only affects the ABI
18359 of relocatable objects. Using @option{-mno-shared} generally makes
18360 executables both smaller and quicker.
18361
18362 @option{-mshared} is the default.
18363
18364 @item -mplt
18365 @itemx -mno-plt
18366 @opindex mplt
18367 @opindex mno-plt
18368 Assume (do not assume) that the static and dynamic linkers
18369 support PLTs and copy relocations. This option only affects
18370 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
18371 has no effect without @option{-msym32}.
18372
18373 You can make @option{-mplt} the default by configuring
18374 GCC with @option{--with-mips-plt}. The default is
18375 @option{-mno-plt} otherwise.
18376
18377 @item -mxgot
18378 @itemx -mno-xgot
18379 @opindex mxgot
18380 @opindex mno-xgot
18381 Lift (do not lift) the usual restrictions on the size of the global
18382 offset table.
18383
18384 GCC normally uses a single instruction to load values from the GOT@.
18385 While this is relatively efficient, it only works if the GOT
18386 is smaller than about 64k. Anything larger causes the linker
18387 to report an error such as:
18388
18389 @cindex relocation truncated to fit (MIPS)
18390 @smallexample
18391 relocation truncated to fit: R_MIPS_GOT16 foobar
18392 @end smallexample
18393
18394 If this happens, you should recompile your code with @option{-mxgot}.
18395 This works with very large GOTs, although the code is also
18396 less efficient, since it takes three instructions to fetch the
18397 value of a global symbol.
18398
18399 Note that some linkers can create multiple GOTs. If you have such a
18400 linker, you should only need to use @option{-mxgot} when a single object
18401 file accesses more than 64k's worth of GOT entries. Very few do.
18402
18403 These options have no effect unless GCC is generating position
18404 independent code.
18405
18406 @item -mgp32
18407 @opindex mgp32
18408 Assume that general-purpose registers are 32 bits wide.
18409
18410 @item -mgp64
18411 @opindex mgp64
18412 Assume that general-purpose registers are 64 bits wide.
18413
18414 @item -mfp32
18415 @opindex mfp32
18416 Assume that floating-point registers are 32 bits wide.
18417
18418 @item -mfp64
18419 @opindex mfp64
18420 Assume that floating-point registers are 64 bits wide.
18421
18422 @item -mfpxx
18423 @opindex mfpxx
18424 Do not assume the width of floating-point registers.
18425
18426 @item -mhard-float
18427 @opindex mhard-float
18428 Use floating-point coprocessor instructions.
18429
18430 @item -msoft-float
18431 @opindex msoft-float
18432 Do not use floating-point coprocessor instructions. Implement
18433 floating-point calculations using library calls instead.
18434
18435 @item -mno-float
18436 @opindex mno-float
18437 Equivalent to @option{-msoft-float}, but additionally asserts that the
18438 program being compiled does not perform any floating-point operations.
18439 This option is presently supported only by some bare-metal MIPS
18440 configurations, where it may select a special set of libraries
18441 that lack all floating-point support (including, for example, the
18442 floating-point @code{printf} formats).
18443 If code compiled with @option{-mno-float} accidentally contains
18444 floating-point operations, it is likely to suffer a link-time
18445 or run-time failure.
18446
18447 @item -msingle-float
18448 @opindex msingle-float
18449 Assume that the floating-point coprocessor only supports single-precision
18450 operations.
18451
18452 @item -mdouble-float
18453 @opindex mdouble-float
18454 Assume that the floating-point coprocessor supports double-precision
18455 operations. This is the default.
18456
18457 @item -modd-spreg
18458 @itemx -mno-odd-spreg
18459 @opindex modd-spreg
18460 @opindex mno-odd-spreg
18461 Enable the use of odd-numbered single-precision floating-point registers
18462 for the o32 ABI. This is the default for processors that are known to
18463 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
18464 is set by default.
18465
18466 @item -mabs=2008
18467 @itemx -mabs=legacy
18468 @opindex mabs=2008
18469 @opindex mabs=legacy
18470 These options control the treatment of the special not-a-number (NaN)
18471 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
18472 @code{neg.@i{fmt}} machine instructions.
18473
18474 By default or when @option{-mabs=legacy} is used the legacy
18475 treatment is selected. In this case these instructions are considered
18476 arithmetic and avoided where correct operation is required and the
18477 input operand might be a NaN. A longer sequence of instructions that
18478 manipulate the sign bit of floating-point datum manually is used
18479 instead unless the @option{-ffinite-math-only} option has also been
18480 specified.
18481
18482 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
18483 this case these instructions are considered non-arithmetic and therefore
18484 operating correctly in all cases, including in particular where the
18485 input operand is a NaN. These instructions are therefore always used
18486 for the respective operations.
18487
18488 @item -mnan=2008
18489 @itemx -mnan=legacy
18490 @opindex mnan=2008
18491 @opindex mnan=legacy
18492 These options control the encoding of the special not-a-number (NaN)
18493 IEEE 754 floating-point data.
18494
18495 The @option{-mnan=legacy} option selects the legacy encoding. In this
18496 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
18497 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
18498 by the first bit of their trailing significand field being 1.
18499
18500 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
18501 this case qNaNs are denoted by the first bit of their trailing
18502 significand field being 1, whereas sNaNs are denoted by the first bit of
18503 their trailing significand field being 0.
18504
18505 The default is @option{-mnan=legacy} unless GCC has been configured with
18506 @option{--with-nan=2008}.
18507
18508 @item -mllsc
18509 @itemx -mno-llsc
18510 @opindex mllsc
18511 @opindex mno-llsc
18512 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
18513 implement atomic memory built-in functions. When neither option is
18514 specified, GCC uses the instructions if the target architecture
18515 supports them.
18516
18517 @option{-mllsc} is useful if the runtime environment can emulate the
18518 instructions and @option{-mno-llsc} can be useful when compiling for
18519 nonstandard ISAs. You can make either option the default by
18520 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
18521 respectively. @option{--with-llsc} is the default for some
18522 configurations; see the installation documentation for details.
18523
18524 @item -mdsp
18525 @itemx -mno-dsp
18526 @opindex mdsp
18527 @opindex mno-dsp
18528 Use (do not use) revision 1 of the MIPS DSP ASE@.
18529 @xref{MIPS DSP Built-in Functions}. This option defines the
18530 preprocessor macro @code{__mips_dsp}. It also defines
18531 @code{__mips_dsp_rev} to 1.
18532
18533 @item -mdspr2
18534 @itemx -mno-dspr2
18535 @opindex mdspr2
18536 @opindex mno-dspr2
18537 Use (do not use) revision 2 of the MIPS DSP ASE@.
18538 @xref{MIPS DSP Built-in Functions}. This option defines the
18539 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
18540 It also defines @code{__mips_dsp_rev} to 2.
18541
18542 @item -msmartmips
18543 @itemx -mno-smartmips
18544 @opindex msmartmips
18545 @opindex mno-smartmips
18546 Use (do not use) the MIPS SmartMIPS ASE.
18547
18548 @item -mpaired-single
18549 @itemx -mno-paired-single
18550 @opindex mpaired-single
18551 @opindex mno-paired-single
18552 Use (do not use) paired-single floating-point instructions.
18553 @xref{MIPS Paired-Single Support}. This option requires
18554 hardware floating-point support to be enabled.
18555
18556 @item -mdmx
18557 @itemx -mno-mdmx
18558 @opindex mdmx
18559 @opindex mno-mdmx
18560 Use (do not use) MIPS Digital Media Extension instructions.
18561 This option can only be used when generating 64-bit code and requires
18562 hardware floating-point support to be enabled.
18563
18564 @item -mips3d
18565 @itemx -mno-mips3d
18566 @opindex mips3d
18567 @opindex mno-mips3d
18568 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
18569 The option @option{-mips3d} implies @option{-mpaired-single}.
18570
18571 @item -mmicromips
18572 @itemx -mno-micromips
18573 @opindex mmicromips
18574 @opindex mno-mmicromips
18575 Generate (do not generate) microMIPS code.
18576
18577 MicroMIPS code generation can also be controlled on a per-function basis
18578 by means of @code{micromips} and @code{nomicromips} attributes.
18579 @xref{Function Attributes}, for more information.
18580
18581 @item -mmt
18582 @itemx -mno-mt
18583 @opindex mmt
18584 @opindex mno-mt
18585 Use (do not use) MT Multithreading instructions.
18586
18587 @item -mmcu
18588 @itemx -mno-mcu
18589 @opindex mmcu
18590 @opindex mno-mcu
18591 Use (do not use) the MIPS MCU ASE instructions.
18592
18593 @item -meva
18594 @itemx -mno-eva
18595 @opindex meva
18596 @opindex mno-eva
18597 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
18598
18599 @item -mvirt
18600 @itemx -mno-virt
18601 @opindex mvirt
18602 @opindex mno-virt
18603 Use (do not use) the MIPS Virtualization Application Specific instructions.
18604
18605 @item -mxpa
18606 @itemx -mno-xpa
18607 @opindex mxpa
18608 @opindex mno-xpa
18609 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
18610
18611 @item -mlong64
18612 @opindex mlong64
18613 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
18614 an explanation of the default and the way that the pointer size is
18615 determined.
18616
18617 @item -mlong32
18618 @opindex mlong32
18619 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
18620
18621 The default size of @code{int}s, @code{long}s and pointers depends on
18622 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
18623 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
18624 32-bit @code{long}s. Pointers are the same size as @code{long}s,
18625 or the same size as integer registers, whichever is smaller.
18626
18627 @item -msym32
18628 @itemx -mno-sym32
18629 @opindex msym32
18630 @opindex mno-sym32
18631 Assume (do not assume) that all symbols have 32-bit values, regardless
18632 of the selected ABI@. This option is useful in combination with
18633 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
18634 to generate shorter and faster references to symbolic addresses.
18635
18636 @item -G @var{num}
18637 @opindex G
18638 Put definitions of externally-visible data in a small data section
18639 if that data is no bigger than @var{num} bytes. GCC can then generate
18640 more efficient accesses to the data; see @option{-mgpopt} for details.
18641
18642 The default @option{-G} option depends on the configuration.
18643
18644 @item -mlocal-sdata
18645 @itemx -mno-local-sdata
18646 @opindex mlocal-sdata
18647 @opindex mno-local-sdata
18648 Extend (do not extend) the @option{-G} behavior to local data too,
18649 such as to static variables in C@. @option{-mlocal-sdata} is the
18650 default for all configurations.
18651
18652 If the linker complains that an application is using too much small data,
18653 you might want to try rebuilding the less performance-critical parts with
18654 @option{-mno-local-sdata}. You might also want to build large
18655 libraries with @option{-mno-local-sdata}, so that the libraries leave
18656 more room for the main program.
18657
18658 @item -mextern-sdata
18659 @itemx -mno-extern-sdata
18660 @opindex mextern-sdata
18661 @opindex mno-extern-sdata
18662 Assume (do not assume) that externally-defined data is in
18663 a small data section if the size of that data is within the @option{-G} limit.
18664 @option{-mextern-sdata} is the default for all configurations.
18665
18666 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
18667 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
18668 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
18669 is placed in a small data section. If @var{Var} is defined by another
18670 module, you must either compile that module with a high-enough
18671 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
18672 definition. If @var{Var} is common, you must link the application
18673 with a high-enough @option{-G} setting.
18674
18675 The easiest way of satisfying these restrictions is to compile
18676 and link every module with the same @option{-G} option. However,
18677 you may wish to build a library that supports several different
18678 small data limits. You can do this by compiling the library with
18679 the highest supported @option{-G} setting and additionally using
18680 @option{-mno-extern-sdata} to stop the library from making assumptions
18681 about externally-defined data.
18682
18683 @item -mgpopt
18684 @itemx -mno-gpopt
18685 @opindex mgpopt
18686 @opindex mno-gpopt
18687 Use (do not use) GP-relative accesses for symbols that are known to be
18688 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
18689 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
18690 configurations.
18691
18692 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
18693 might not hold the value of @code{_gp}. For example, if the code is
18694 part of a library that might be used in a boot monitor, programs that
18695 call boot monitor routines pass an unknown value in @code{$gp}.
18696 (In such situations, the boot monitor itself is usually compiled
18697 with @option{-G0}.)
18698
18699 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
18700 @option{-mno-extern-sdata}.
18701
18702 @item -membedded-data
18703 @itemx -mno-embedded-data
18704 @opindex membedded-data
18705 @opindex mno-embedded-data
18706 Allocate variables to the read-only data section first if possible, then
18707 next in the small data section if possible, otherwise in data. This gives
18708 slightly slower code than the default, but reduces the amount of RAM required
18709 when executing, and thus may be preferred for some embedded systems.
18710
18711 @item -muninit-const-in-rodata
18712 @itemx -mno-uninit-const-in-rodata
18713 @opindex muninit-const-in-rodata
18714 @opindex mno-uninit-const-in-rodata
18715 Put uninitialized @code{const} variables in the read-only data section.
18716 This option is only meaningful in conjunction with @option{-membedded-data}.
18717
18718 @item -mcode-readable=@var{setting}
18719 @opindex mcode-readable
18720 Specify whether GCC may generate code that reads from executable sections.
18721 There are three possible settings:
18722
18723 @table @gcctabopt
18724 @item -mcode-readable=yes
18725 Instructions may freely access executable sections. This is the
18726 default setting.
18727
18728 @item -mcode-readable=pcrel
18729 MIPS16 PC-relative load instructions can access executable sections,
18730 but other instructions must not do so. This option is useful on 4KSc
18731 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
18732 It is also useful on processors that can be configured to have a dual
18733 instruction/data SRAM interface and that, like the M4K, automatically
18734 redirect PC-relative loads to the instruction RAM.
18735
18736 @item -mcode-readable=no
18737 Instructions must not access executable sections. This option can be
18738 useful on targets that are configured to have a dual instruction/data
18739 SRAM interface but that (unlike the M4K) do not automatically redirect
18740 PC-relative loads to the instruction RAM.
18741 @end table
18742
18743 @item -msplit-addresses
18744 @itemx -mno-split-addresses
18745 @opindex msplit-addresses
18746 @opindex mno-split-addresses
18747 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
18748 relocation operators. This option has been superseded by
18749 @option{-mexplicit-relocs} but is retained for backwards compatibility.
18750
18751 @item -mexplicit-relocs
18752 @itemx -mno-explicit-relocs
18753 @opindex mexplicit-relocs
18754 @opindex mno-explicit-relocs
18755 Use (do not use) assembler relocation operators when dealing with symbolic
18756 addresses. The alternative, selected by @option{-mno-explicit-relocs},
18757 is to use assembler macros instead.
18758
18759 @option{-mexplicit-relocs} is the default if GCC was configured
18760 to use an assembler that supports relocation operators.
18761
18762 @item -mcheck-zero-division
18763 @itemx -mno-check-zero-division
18764 @opindex mcheck-zero-division
18765 @opindex mno-check-zero-division
18766 Trap (do not trap) on integer division by zero.
18767
18768 The default is @option{-mcheck-zero-division}.
18769
18770 @item -mdivide-traps
18771 @itemx -mdivide-breaks
18772 @opindex mdivide-traps
18773 @opindex mdivide-breaks
18774 MIPS systems check for division by zero by generating either a
18775 conditional trap or a break instruction. Using traps results in
18776 smaller code, but is only supported on MIPS II and later. Also, some
18777 versions of the Linux kernel have a bug that prevents trap from
18778 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
18779 allow conditional traps on architectures that support them and
18780 @option{-mdivide-breaks} to force the use of breaks.
18781
18782 The default is usually @option{-mdivide-traps}, but this can be
18783 overridden at configure time using @option{--with-divide=breaks}.
18784 Divide-by-zero checks can be completely disabled using
18785 @option{-mno-check-zero-division}.
18786
18787 @item -mmemcpy
18788 @itemx -mno-memcpy
18789 @opindex mmemcpy
18790 @opindex mno-memcpy
18791 Force (do not force) the use of @code{memcpy} for non-trivial block
18792 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
18793 most constant-sized copies.
18794
18795 @item -mlong-calls
18796 @itemx -mno-long-calls
18797 @opindex mlong-calls
18798 @opindex mno-long-calls
18799 Disable (do not disable) use of the @code{jal} instruction. Calling
18800 functions using @code{jal} is more efficient but requires the caller
18801 and callee to be in the same 256 megabyte segment.
18802
18803 This option has no effect on abicalls code. The default is
18804 @option{-mno-long-calls}.
18805
18806 @item -mmad
18807 @itemx -mno-mad
18808 @opindex mmad
18809 @opindex mno-mad
18810 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
18811 instructions, as provided by the R4650 ISA@.
18812
18813 @item -mimadd
18814 @itemx -mno-imadd
18815 @opindex mimadd
18816 @opindex mno-imadd
18817 Enable (disable) use of the @code{madd} and @code{msub} integer
18818 instructions. The default is @option{-mimadd} on architectures
18819 that support @code{madd} and @code{msub} except for the 74k
18820 architecture where it was found to generate slower code.
18821
18822 @item -mfused-madd
18823 @itemx -mno-fused-madd
18824 @opindex mfused-madd
18825 @opindex mno-fused-madd
18826 Enable (disable) use of the floating-point multiply-accumulate
18827 instructions, when they are available. The default is
18828 @option{-mfused-madd}.
18829
18830 On the R8000 CPU when multiply-accumulate instructions are used,
18831 the intermediate product is calculated to infinite precision
18832 and is not subject to the FCSR Flush to Zero bit. This may be
18833 undesirable in some circumstances. On other processors the result
18834 is numerically identical to the equivalent computation using
18835 separate multiply, add, subtract and negate instructions.
18836
18837 @item -nocpp
18838 @opindex nocpp
18839 Tell the MIPS assembler to not run its preprocessor over user
18840 assembler files (with a @samp{.s} suffix) when assembling them.
18841
18842 @item -mfix-24k
18843 @item -mno-fix-24k
18844 @opindex mfix-24k
18845 @opindex mno-fix-24k
18846 Work around the 24K E48 (lost data on stores during refill) errata.
18847 The workarounds are implemented by the assembler rather than by GCC@.
18848
18849 @item -mfix-r4000
18850 @itemx -mno-fix-r4000
18851 @opindex mfix-r4000
18852 @opindex mno-fix-r4000
18853 Work around certain R4000 CPU errata:
18854 @itemize @minus
18855 @item
18856 A double-word or a variable shift may give an incorrect result if executed
18857 immediately after starting an integer division.
18858 @item
18859 A double-word or a variable shift may give an incorrect result if executed
18860 while an integer multiplication is in progress.
18861 @item
18862 An integer division may give an incorrect result if started in a delay slot
18863 of a taken branch or a jump.
18864 @end itemize
18865
18866 @item -mfix-r4400
18867 @itemx -mno-fix-r4400
18868 @opindex mfix-r4400
18869 @opindex mno-fix-r4400
18870 Work around certain R4400 CPU errata:
18871 @itemize @minus
18872 @item
18873 A double-word or a variable shift may give an incorrect result if executed
18874 immediately after starting an integer division.
18875 @end itemize
18876
18877 @item -mfix-r10000
18878 @itemx -mno-fix-r10000
18879 @opindex mfix-r10000
18880 @opindex mno-fix-r10000
18881 Work around certain R10000 errata:
18882 @itemize @minus
18883 @item
18884 @code{ll}/@code{sc} sequences may not behave atomically on revisions
18885 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
18886 @end itemize
18887
18888 This option can only be used if the target architecture supports
18889 branch-likely instructions. @option{-mfix-r10000} is the default when
18890 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
18891 otherwise.
18892
18893 @item -mfix-rm7000
18894 @itemx -mno-fix-rm7000
18895 @opindex mfix-rm7000
18896 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
18897 workarounds are implemented by the assembler rather than by GCC@.
18898
18899 @item -mfix-vr4120
18900 @itemx -mno-fix-vr4120
18901 @opindex mfix-vr4120
18902 Work around certain VR4120 errata:
18903 @itemize @minus
18904 @item
18905 @code{dmultu} does not always produce the correct result.
18906 @item
18907 @code{div} and @code{ddiv} do not always produce the correct result if one
18908 of the operands is negative.
18909 @end itemize
18910 The workarounds for the division errata rely on special functions in
18911 @file{libgcc.a}. At present, these functions are only provided by
18912 the @code{mips64vr*-elf} configurations.
18913
18914 Other VR4120 errata require a NOP to be inserted between certain pairs of
18915 instructions. These errata are handled by the assembler, not by GCC itself.
18916
18917 @item -mfix-vr4130
18918 @opindex mfix-vr4130
18919 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
18920 workarounds are implemented by the assembler rather than by GCC,
18921 although GCC avoids using @code{mflo} and @code{mfhi} if the
18922 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
18923 instructions are available instead.
18924
18925 @item -mfix-sb1
18926 @itemx -mno-fix-sb1
18927 @opindex mfix-sb1
18928 Work around certain SB-1 CPU core errata.
18929 (This flag currently works around the SB-1 revision 2
18930 ``F1'' and ``F2'' floating-point errata.)
18931
18932 @item -mr10k-cache-barrier=@var{setting}
18933 @opindex mr10k-cache-barrier
18934 Specify whether GCC should insert cache barriers to avoid the
18935 side-effects of speculation on R10K processors.
18936
18937 In common with many processors, the R10K tries to predict the outcome
18938 of a conditional branch and speculatively executes instructions from
18939 the ``taken'' branch. It later aborts these instructions if the
18940 predicted outcome is wrong. However, on the R10K, even aborted
18941 instructions can have side effects.
18942
18943 This problem only affects kernel stores and, depending on the system,
18944 kernel loads. As an example, a speculatively-executed store may load
18945 the target memory into cache and mark the cache line as dirty, even if
18946 the store itself is later aborted. If a DMA operation writes to the
18947 same area of memory before the ``dirty'' line is flushed, the cached
18948 data overwrites the DMA-ed data. See the R10K processor manual
18949 for a full description, including other potential problems.
18950
18951 One workaround is to insert cache barrier instructions before every memory
18952 access that might be speculatively executed and that might have side
18953 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
18954 controls GCC's implementation of this workaround. It assumes that
18955 aborted accesses to any byte in the following regions does not have
18956 side effects:
18957
18958 @enumerate
18959 @item
18960 the memory occupied by the current function's stack frame;
18961
18962 @item
18963 the memory occupied by an incoming stack argument;
18964
18965 @item
18966 the memory occupied by an object with a link-time-constant address.
18967 @end enumerate
18968
18969 It is the kernel's responsibility to ensure that speculative
18970 accesses to these regions are indeed safe.
18971
18972 If the input program contains a function declaration such as:
18973
18974 @smallexample
18975 void foo (void);
18976 @end smallexample
18977
18978 then the implementation of @code{foo} must allow @code{j foo} and
18979 @code{jal foo} to be executed speculatively. GCC honors this
18980 restriction for functions it compiles itself. It expects non-GCC
18981 functions (such as hand-written assembly code) to do the same.
18982
18983 The option has three forms:
18984
18985 @table @gcctabopt
18986 @item -mr10k-cache-barrier=load-store
18987 Insert a cache barrier before a load or store that might be
18988 speculatively executed and that might have side effects even
18989 if aborted.
18990
18991 @item -mr10k-cache-barrier=store
18992 Insert a cache barrier before a store that might be speculatively
18993 executed and that might have side effects even if aborted.
18994
18995 @item -mr10k-cache-barrier=none
18996 Disable the insertion of cache barriers. This is the default setting.
18997 @end table
18998
18999 @item -mflush-func=@var{func}
19000 @itemx -mno-flush-func
19001 @opindex mflush-func
19002 Specifies the function to call to flush the I and D caches, or to not
19003 call any such function. If called, the function must take the same
19004 arguments as the common @code{_flush_func}, that is, the address of the
19005 memory range for which the cache is being flushed, the size of the
19006 memory range, and the number 3 (to flush both caches). The default
19007 depends on the target GCC was configured for, but commonly is either
19008 @code{_flush_func} or @code{__cpu_flush}.
19009
19010 @item mbranch-cost=@var{num}
19011 @opindex mbranch-cost
19012 Set the cost of branches to roughly @var{num} ``simple'' instructions.
19013 This cost is only a heuristic and is not guaranteed to produce
19014 consistent results across releases. A zero cost redundantly selects
19015 the default, which is based on the @option{-mtune} setting.
19016
19017 @item -mbranch-likely
19018 @itemx -mno-branch-likely
19019 @opindex mbranch-likely
19020 @opindex mno-branch-likely
19021 Enable or disable use of Branch Likely instructions, regardless of the
19022 default for the selected architecture. By default, Branch Likely
19023 instructions may be generated if they are supported by the selected
19024 architecture. An exception is for the MIPS32 and MIPS64 architectures
19025 and processors that implement those architectures; for those, Branch
19026 Likely instructions are not be generated by default because the MIPS32
19027 and MIPS64 architectures specifically deprecate their use.
19028
19029 @item -mcompact-branches=never
19030 @itemx -mcompact-branches=optimal
19031 @itemx -mcompact-branches=always
19032 @opindex mcompact-branches=never
19033 @opindex mcompact-branches=optimal
19034 @opindex mcompact-branches=always
19035 These options control which form of branches will be generated. The
19036 default is @option{-mcompact-branches=optimal}.
19037
19038 The @option{-mcompact-branches=never} option ensures that compact branch
19039 instructions will never be generated.
19040
19041 The @option{-mcompact-branches=always} option ensures that a compact
19042 branch instruction will be generated if available. If a compact branch
19043 instruction is not available, a delay slot form of the branch will be
19044 used instead.
19045
19046 This option is supported from MIPS Release 6 onwards.
19047
19048 The @option{-mcompact-branches=optimal} option will cause a delay slot
19049 branch to be used if one is available in the current ISA and the delay
19050 slot is successfully filled. If the delay slot is not filled, a compact
19051 branch will be chosen if one is available.
19052
19053 @item -mfp-exceptions
19054 @itemx -mno-fp-exceptions
19055 @opindex mfp-exceptions
19056 Specifies whether FP exceptions are enabled. This affects how
19057 FP instructions are scheduled for some processors.
19058 The default is that FP exceptions are
19059 enabled.
19060
19061 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
19062 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
19063 FP pipe.
19064
19065 @item -mvr4130-align
19066 @itemx -mno-vr4130-align
19067 @opindex mvr4130-align
19068 The VR4130 pipeline is two-way superscalar, but can only issue two
19069 instructions together if the first one is 8-byte aligned. When this
19070 option is enabled, GCC aligns pairs of instructions that it
19071 thinks should execute in parallel.
19072
19073 This option only has an effect when optimizing for the VR4130.
19074 It normally makes code faster, but at the expense of making it bigger.
19075 It is enabled by default at optimization level @option{-O3}.
19076
19077 @item -msynci
19078 @itemx -mno-synci
19079 @opindex msynci
19080 Enable (disable) generation of @code{synci} instructions on
19081 architectures that support it. The @code{synci} instructions (if
19082 enabled) are generated when @code{__builtin___clear_cache} is
19083 compiled.
19084
19085 This option defaults to @option{-mno-synci}, but the default can be
19086 overridden by configuring GCC with @option{--with-synci}.
19087
19088 When compiling code for single processor systems, it is generally safe
19089 to use @code{synci}. However, on many multi-core (SMP) systems, it
19090 does not invalidate the instruction caches on all cores and may lead
19091 to undefined behavior.
19092
19093 @item -mrelax-pic-calls
19094 @itemx -mno-relax-pic-calls
19095 @opindex mrelax-pic-calls
19096 Try to turn PIC calls that are normally dispatched via register
19097 @code{$25} into direct calls. This is only possible if the linker can
19098 resolve the destination at link time and if the destination is within
19099 range for a direct call.
19100
19101 @option{-mrelax-pic-calls} is the default if GCC was configured to use
19102 an assembler and a linker that support the @code{.reloc} assembly
19103 directive and @option{-mexplicit-relocs} is in effect. With
19104 @option{-mno-explicit-relocs}, this optimization can be performed by the
19105 assembler and the linker alone without help from the compiler.
19106
19107 @item -mmcount-ra-address
19108 @itemx -mno-mcount-ra-address
19109 @opindex mmcount-ra-address
19110 @opindex mno-mcount-ra-address
19111 Emit (do not emit) code that allows @code{_mcount} to modify the
19112 calling function's return address. When enabled, this option extends
19113 the usual @code{_mcount} interface with a new @var{ra-address}
19114 parameter, which has type @code{intptr_t *} and is passed in register
19115 @code{$12}. @code{_mcount} can then modify the return address by
19116 doing both of the following:
19117 @itemize
19118 @item
19119 Returning the new address in register @code{$31}.
19120 @item
19121 Storing the new address in @code{*@var{ra-address}},
19122 if @var{ra-address} is nonnull.
19123 @end itemize
19124
19125 The default is @option{-mno-mcount-ra-address}.
19126
19127 @item -mframe-header-opt
19128 @itemx -mno-frame-header-opt
19129 @opindex mframe-header-opt
19130 Enable (disable) frame header optimization in the o32 ABI. When using the
19131 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
19132 function to write out register arguments. When enabled, this optimization
19133 will suppress the allocation of the frame header if it can be determined that
19134 it is unused.
19135
19136 This optimization is off by default at all optimization levels.
19137
19138 @end table
19139
19140 @node MMIX Options
19141 @subsection MMIX Options
19142 @cindex MMIX Options
19143
19144 These options are defined for the MMIX:
19145
19146 @table @gcctabopt
19147 @item -mlibfuncs
19148 @itemx -mno-libfuncs
19149 @opindex mlibfuncs
19150 @opindex mno-libfuncs
19151 Specify that intrinsic library functions are being compiled, passing all
19152 values in registers, no matter the size.
19153
19154 @item -mepsilon
19155 @itemx -mno-epsilon
19156 @opindex mepsilon
19157 @opindex mno-epsilon
19158 Generate floating-point comparison instructions that compare with respect
19159 to the @code{rE} epsilon register.
19160
19161 @item -mabi=mmixware
19162 @itemx -mabi=gnu
19163 @opindex mabi=mmixware
19164 @opindex mabi=gnu
19165 Generate code that passes function parameters and return values that (in
19166 the called function) are seen as registers @code{$0} and up, as opposed to
19167 the GNU ABI which uses global registers @code{$231} and up.
19168
19169 @item -mzero-extend
19170 @itemx -mno-zero-extend
19171 @opindex mzero-extend
19172 @opindex mno-zero-extend
19173 When reading data from memory in sizes shorter than 64 bits, use (do not
19174 use) zero-extending load instructions by default, rather than
19175 sign-extending ones.
19176
19177 @item -mknuthdiv
19178 @itemx -mno-knuthdiv
19179 @opindex mknuthdiv
19180 @opindex mno-knuthdiv
19181 Make the result of a division yielding a remainder have the same sign as
19182 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
19183 remainder follows the sign of the dividend. Both methods are
19184 arithmetically valid, the latter being almost exclusively used.
19185
19186 @item -mtoplevel-symbols
19187 @itemx -mno-toplevel-symbols
19188 @opindex mtoplevel-symbols
19189 @opindex mno-toplevel-symbols
19190 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
19191 code can be used with the @code{PREFIX} assembly directive.
19192
19193 @item -melf
19194 @opindex melf
19195 Generate an executable in the ELF format, rather than the default
19196 @samp{mmo} format used by the @command{mmix} simulator.
19197
19198 @item -mbranch-predict
19199 @itemx -mno-branch-predict
19200 @opindex mbranch-predict
19201 @opindex mno-branch-predict
19202 Use (do not use) the probable-branch instructions, when static branch
19203 prediction indicates a probable branch.
19204
19205 @item -mbase-addresses
19206 @itemx -mno-base-addresses
19207 @opindex mbase-addresses
19208 @opindex mno-base-addresses
19209 Generate (do not generate) code that uses @emph{base addresses}. Using a
19210 base address automatically generates a request (handled by the assembler
19211 and the linker) for a constant to be set up in a global register. The
19212 register is used for one or more base address requests within the range 0
19213 to 255 from the value held in the register. The generally leads to short
19214 and fast code, but the number of different data items that can be
19215 addressed is limited. This means that a program that uses lots of static
19216 data may require @option{-mno-base-addresses}.
19217
19218 @item -msingle-exit
19219 @itemx -mno-single-exit
19220 @opindex msingle-exit
19221 @opindex mno-single-exit
19222 Force (do not force) generated code to have a single exit point in each
19223 function.
19224 @end table
19225
19226 @node MN10300 Options
19227 @subsection MN10300 Options
19228 @cindex MN10300 options
19229
19230 These @option{-m} options are defined for Matsushita MN10300 architectures:
19231
19232 @table @gcctabopt
19233 @item -mmult-bug
19234 @opindex mmult-bug
19235 Generate code to avoid bugs in the multiply instructions for the MN10300
19236 processors. This is the default.
19237
19238 @item -mno-mult-bug
19239 @opindex mno-mult-bug
19240 Do not generate code to avoid bugs in the multiply instructions for the
19241 MN10300 processors.
19242
19243 @item -mam33
19244 @opindex mam33
19245 Generate code using features specific to the AM33 processor.
19246
19247 @item -mno-am33
19248 @opindex mno-am33
19249 Do not generate code using features specific to the AM33 processor. This
19250 is the default.
19251
19252 @item -mam33-2
19253 @opindex mam33-2
19254 Generate code using features specific to the AM33/2.0 processor.
19255
19256 @item -mam34
19257 @opindex mam34
19258 Generate code using features specific to the AM34 processor.
19259
19260 @item -mtune=@var{cpu-type}
19261 @opindex mtune
19262 Use the timing characteristics of the indicated CPU type when
19263 scheduling instructions. This does not change the targeted processor
19264 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
19265 @samp{am33-2} or @samp{am34}.
19266
19267 @item -mreturn-pointer-on-d0
19268 @opindex mreturn-pointer-on-d0
19269 When generating a function that returns a pointer, return the pointer
19270 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
19271 only in @code{a0}, and attempts to call such functions without a prototype
19272 result in errors. Note that this option is on by default; use
19273 @option{-mno-return-pointer-on-d0} to disable it.
19274
19275 @item -mno-crt0
19276 @opindex mno-crt0
19277 Do not link in the C run-time initialization object file.
19278
19279 @item -mrelax
19280 @opindex mrelax
19281 Indicate to the linker that it should perform a relaxation optimization pass
19282 to shorten branches, calls and absolute memory addresses. This option only
19283 has an effect when used on the command line for the final link step.
19284
19285 This option makes symbolic debugging impossible.
19286
19287 @item -mliw
19288 @opindex mliw
19289 Allow the compiler to generate @emph{Long Instruction Word}
19290 instructions if the target is the @samp{AM33} or later. This is the
19291 default. This option defines the preprocessor macro @code{__LIW__}.
19292
19293 @item -mnoliw
19294 @opindex mnoliw
19295 Do not allow the compiler to generate @emph{Long Instruction Word}
19296 instructions. This option defines the preprocessor macro
19297 @code{__NO_LIW__}.
19298
19299 @item -msetlb
19300 @opindex msetlb
19301 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
19302 instructions if the target is the @samp{AM33} or later. This is the
19303 default. This option defines the preprocessor macro @code{__SETLB__}.
19304
19305 @item -mnosetlb
19306 @opindex mnosetlb
19307 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
19308 instructions. This option defines the preprocessor macro
19309 @code{__NO_SETLB__}.
19310
19311 @end table
19312
19313 @node Moxie Options
19314 @subsection Moxie Options
19315 @cindex Moxie Options
19316
19317 @table @gcctabopt
19318
19319 @item -meb
19320 @opindex meb
19321 Generate big-endian code. This is the default for @samp{moxie-*-*}
19322 configurations.
19323
19324 @item -mel
19325 @opindex mel
19326 Generate little-endian code.
19327
19328 @item -mmul.x
19329 @opindex mmul.x
19330 Generate mul.x and umul.x instructions. This is the default for
19331 @samp{moxiebox-*-*} configurations.
19332
19333 @item -mno-crt0
19334 @opindex mno-crt0
19335 Do not link in the C run-time initialization object file.
19336
19337 @end table
19338
19339 @node MSP430 Options
19340 @subsection MSP430 Options
19341 @cindex MSP430 Options
19342
19343 These options are defined for the MSP430:
19344
19345 @table @gcctabopt
19346
19347 @item -masm-hex
19348 @opindex masm-hex
19349 Force assembly output to always use hex constants. Normally such
19350 constants are signed decimals, but this option is available for
19351 testsuite and/or aesthetic purposes.
19352
19353 @item -mmcu=
19354 @opindex mmcu=
19355 Select the MCU to target. This is used to create a C preprocessor
19356 symbol based upon the MCU name, converted to upper case and pre- and
19357 post-fixed with @samp{__}. This in turn is used by the
19358 @file{msp430.h} header file to select an MCU-specific supplementary
19359 header file.
19360
19361 The option also sets the ISA to use. If the MCU name is one that is
19362 known to only support the 430 ISA then that is selected, otherwise the
19363 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
19364 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
19365 name selects the 430X ISA.
19366
19367 In addition an MCU-specific linker script is added to the linker
19368 command line. The script's name is the name of the MCU with
19369 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
19370 command line defines the C preprocessor symbol @code{__XXX__} and
19371 cause the linker to search for a script called @file{xxx.ld}.
19372
19373 This option is also passed on to the assembler.
19374
19375 @item -mwarn-mcu
19376 @itemx -mno-warn-mcu
19377 @opindex mwarn-mcu
19378 @opindex mno-warn-mcu
19379 This option enables or disables warnings about conflicts between the
19380 MCU name specified by the @option{-mmcu} option and the ISA set by the
19381 @option{-mcpu} option and/or the hardware multiply support set by the
19382 @option{-mhwmult} option. It also toggles warnings about unrecognized
19383 MCU names. This option is on by default.
19384
19385 @item -mcpu=
19386 @opindex mcpu=
19387 Specifies the ISA to use. Accepted values are @samp{msp430},
19388 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
19389 @option{-mmcu=} option should be used to select the ISA.
19390
19391 @item -msim
19392 @opindex msim
19393 Link to the simulator runtime libraries and linker script. Overrides
19394 any scripts that would be selected by the @option{-mmcu=} option.
19395
19396 @item -mlarge
19397 @opindex mlarge
19398 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
19399
19400 @item -msmall
19401 @opindex msmall
19402 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
19403
19404 @item -mrelax
19405 @opindex mrelax
19406 This option is passed to the assembler and linker, and allows the
19407 linker to perform certain optimizations that cannot be done until
19408 the final link.
19409
19410 @item mhwmult=
19411 @opindex mhwmult=
19412 Describes the type of hardware multiply supported by the target.
19413 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
19414 for the original 16-bit-only multiply supported by early MCUs.
19415 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
19416 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
19417 A value of @samp{auto} can also be given. This tells GCC to deduce
19418 the hardware multiply support based upon the MCU name provided by the
19419 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
19420 the MCU name is not recognized then no hardware multiply support is
19421 assumed. @code{auto} is the default setting.
19422
19423 Hardware multiplies are normally performed by calling a library
19424 routine. This saves space in the generated code. When compiling at
19425 @option{-O3} or higher however the hardware multiplier is invoked
19426 inline. This makes for bigger, but faster code.
19427
19428 The hardware multiply routines disable interrupts whilst running and
19429 restore the previous interrupt state when they finish. This makes
19430 them safe to use inside interrupt handlers as well as in normal code.
19431
19432 @item -minrt
19433 @opindex minrt
19434 Enable the use of a minimum runtime environment - no static
19435 initializers or constructors. This is intended for memory-constrained
19436 devices. The compiler includes special symbols in some objects
19437 that tell the linker and runtime which code fragments are required.
19438
19439 @item -mcode-region=
19440 @itemx -mdata-region=
19441 @opindex mcode-region
19442 @opindex mdata-region
19443 These options tell the compiler where to place functions and data that
19444 do not have one of the @code{lower}, @code{upper}, @code{either} or
19445 @code{section} attributes. Possible values are @code{lower},
19446 @code{upper}, @code{either} or @code{any}. The first three behave
19447 like the corresponding attribute. The fourth possible value -
19448 @code{any} - is the default. It leaves placement entirely up to the
19449 linker script and how it assigns the standard sections
19450 (@code{.text}, @code{.data}, etc) to the memory regions.
19451
19452 @item -msilicon-errata=
19453 @opindex msilicon-errata
19454 This option passes on a request to assembler to enable the fixes for
19455 the named silicon errata.
19456
19457 @item -msilicon-errata-warn=
19458 @opindex msilicon-errata-warn
19459 This option passes on a request to the assembler to enable warning
19460 messages when a silicon errata might need to be applied.
19461
19462 @end table
19463
19464 @node NDS32 Options
19465 @subsection NDS32 Options
19466 @cindex NDS32 Options
19467
19468 These options are defined for NDS32 implementations:
19469
19470 @table @gcctabopt
19471
19472 @item -mbig-endian
19473 @opindex mbig-endian
19474 Generate code in big-endian mode.
19475
19476 @item -mlittle-endian
19477 @opindex mlittle-endian
19478 Generate code in little-endian mode.
19479
19480 @item -mreduced-regs
19481 @opindex mreduced-regs
19482 Use reduced-set registers for register allocation.
19483
19484 @item -mfull-regs
19485 @opindex mfull-regs
19486 Use full-set registers for register allocation.
19487
19488 @item -mcmov
19489 @opindex mcmov
19490 Generate conditional move instructions.
19491
19492 @item -mno-cmov
19493 @opindex mno-cmov
19494 Do not generate conditional move instructions.
19495
19496 @item -mperf-ext
19497 @opindex mperf-ext
19498 Generate performance extension instructions.
19499
19500 @item -mno-perf-ext
19501 @opindex mno-perf-ext
19502 Do not generate performance extension instructions.
19503
19504 @item -mv3push
19505 @opindex mv3push
19506 Generate v3 push25/pop25 instructions.
19507
19508 @item -mno-v3push
19509 @opindex mno-v3push
19510 Do not generate v3 push25/pop25 instructions.
19511
19512 @item -m16-bit
19513 @opindex m16-bit
19514 Generate 16-bit instructions.
19515
19516 @item -mno-16-bit
19517 @opindex mno-16-bit
19518 Do not generate 16-bit instructions.
19519
19520 @item -misr-vector-size=@var{num}
19521 @opindex misr-vector-size
19522 Specify the size of each interrupt vector, which must be 4 or 16.
19523
19524 @item -mcache-block-size=@var{num}
19525 @opindex mcache-block-size
19526 Specify the size of each cache block,
19527 which must be a power of 2 between 4 and 512.
19528
19529 @item -march=@var{arch}
19530 @opindex march
19531 Specify the name of the target architecture.
19532
19533 @item -mcmodel=@var{code-model}
19534 @opindex mcmodel
19535 Set the code model to one of
19536 @table @asis
19537 @item @samp{small}
19538 All the data and read-only data segments must be within 512KB addressing space.
19539 The text segment must be within 16MB addressing space.
19540 @item @samp{medium}
19541 The data segment must be within 512KB while the read-only data segment can be
19542 within 4GB addressing space. The text segment should be still within 16MB
19543 addressing space.
19544 @item @samp{large}
19545 All the text and data segments can be within 4GB addressing space.
19546 @end table
19547
19548 @item -mctor-dtor
19549 @opindex mctor-dtor
19550 Enable constructor/destructor feature.
19551
19552 @item -mrelax
19553 @opindex mrelax
19554 Guide linker to relax instructions.
19555
19556 @end table
19557
19558 @node Nios II Options
19559 @subsection Nios II Options
19560 @cindex Nios II options
19561 @cindex Altera Nios II options
19562
19563 These are the options defined for the Altera Nios II processor.
19564
19565 @table @gcctabopt
19566
19567 @item -G @var{num}
19568 @opindex G
19569 @cindex smaller data references
19570 Put global and static objects less than or equal to @var{num} bytes
19571 into the small data or BSS sections instead of the normal data or BSS
19572 sections. The default value of @var{num} is 8.
19573
19574 @item -mgpopt=@var{option}
19575 @item -mgpopt
19576 @itemx -mno-gpopt
19577 @opindex mgpopt
19578 @opindex mno-gpopt
19579 Generate (do not generate) GP-relative accesses. The following
19580 @var{option} names are recognized:
19581
19582 @table @samp
19583
19584 @item none
19585 Do not generate GP-relative accesses.
19586
19587 @item local
19588 Generate GP-relative accesses for small data objects that are not
19589 external, weak, or uninitialized common symbols.
19590 Also use GP-relative addressing for objects that
19591 have been explicitly placed in a small data section via a @code{section}
19592 attribute.
19593
19594 @item global
19595 As for @samp{local}, but also generate GP-relative accesses for
19596 small data objects that are external, weak, or common. If you use this option,
19597 you must ensure that all parts of your program (including libraries) are
19598 compiled with the same @option{-G} setting.
19599
19600 @item data
19601 Generate GP-relative accesses for all data objects in the program. If you
19602 use this option, the entire data and BSS segments
19603 of your program must fit in 64K of memory and you must use an appropriate
19604 linker script to allocate them within the addressable range of the
19605 global pointer.
19606
19607 @item all
19608 Generate GP-relative addresses for function pointers as well as data
19609 pointers. If you use this option, the entire text, data, and BSS segments
19610 of your program must fit in 64K of memory and you must use an appropriate
19611 linker script to allocate them within the addressable range of the
19612 global pointer.
19613
19614 @end table
19615
19616 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
19617 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
19618
19619 The default is @option{-mgpopt} except when @option{-fpic} or
19620 @option{-fPIC} is specified to generate position-independent code.
19621 Note that the Nios II ABI does not permit GP-relative accesses from
19622 shared libraries.
19623
19624 You may need to specify @option{-mno-gpopt} explicitly when building
19625 programs that include large amounts of small data, including large
19626 GOT data sections. In this case, the 16-bit offset for GP-relative
19627 addressing may not be large enough to allow access to the entire
19628 small data section.
19629
19630 @item -mel
19631 @itemx -meb
19632 @opindex mel
19633 @opindex meb
19634 Generate little-endian (default) or big-endian (experimental) code,
19635 respectively.
19636
19637 @item -march=@var{arch}
19638 @opindex march
19639 This specifies the name of the target Nios II architecture. GCC uses this
19640 name to determine what kind of instructions it can emit when generating
19641 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
19642
19643 The preprocessor macro @code{__nios2_arch__} is available to programs,
19644 with value 1 or 2, indicating the targeted ISA level.
19645
19646 @item -mbypass-cache
19647 @itemx -mno-bypass-cache
19648 @opindex mno-bypass-cache
19649 @opindex mbypass-cache
19650 Force all load and store instructions to always bypass cache by
19651 using I/O variants of the instructions. The default is not to
19652 bypass the cache.
19653
19654 @item -mno-cache-volatile
19655 @itemx -mcache-volatile
19656 @opindex mcache-volatile
19657 @opindex mno-cache-volatile
19658 Volatile memory access bypass the cache using the I/O variants of
19659 the load and store instructions. The default is not to bypass the cache.
19660
19661 @item -mno-fast-sw-div
19662 @itemx -mfast-sw-div
19663 @opindex mno-fast-sw-div
19664 @opindex mfast-sw-div
19665 Do not use table-based fast divide for small numbers. The default
19666 is to use the fast divide at @option{-O3} and above.
19667
19668 @item -mno-hw-mul
19669 @itemx -mhw-mul
19670 @itemx -mno-hw-mulx
19671 @itemx -mhw-mulx
19672 @itemx -mno-hw-div
19673 @itemx -mhw-div
19674 @opindex mno-hw-mul
19675 @opindex mhw-mul
19676 @opindex mno-hw-mulx
19677 @opindex mhw-mulx
19678 @opindex mno-hw-div
19679 @opindex mhw-div
19680 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
19681 instructions by the compiler. The default is to emit @code{mul}
19682 and not emit @code{div} and @code{mulx}.
19683
19684 @item -mbmx
19685 @itemx -mno-bmx
19686 @itemx -mcdx
19687 @itemx -mno-cdx
19688 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
19689 CDX (code density) instructions. Enabling these instructions also
19690 requires @option{-march=r2}. Since these instructions are optional
19691 extensions to the R2 architecture, the default is not to emit them.
19692
19693 @item -mcustom-@var{insn}=@var{N}
19694 @itemx -mno-custom-@var{insn}
19695 @opindex mcustom-@var{insn}
19696 @opindex mno-custom-@var{insn}
19697 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
19698 custom instruction with encoding @var{N} when generating code that uses
19699 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
19700 instruction 253 for single-precision floating-point add operations instead
19701 of the default behavior of using a library call.
19702
19703 The following values of @var{insn} are supported. Except as otherwise
19704 noted, floating-point operations are expected to be implemented with
19705 normal IEEE 754 semantics and correspond directly to the C operators or the
19706 equivalent GCC built-in functions (@pxref{Other Builtins}).
19707
19708 Single-precision floating point:
19709 @table @asis
19710
19711 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
19712 Binary arithmetic operations.
19713
19714 @item @samp{fnegs}
19715 Unary negation.
19716
19717 @item @samp{fabss}
19718 Unary absolute value.
19719
19720 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
19721 Comparison operations.
19722
19723 @item @samp{fmins}, @samp{fmaxs}
19724 Floating-point minimum and maximum. These instructions are only
19725 generated if @option{-ffinite-math-only} is specified.
19726
19727 @item @samp{fsqrts}
19728 Unary square root operation.
19729
19730 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
19731 Floating-point trigonometric and exponential functions. These instructions
19732 are only generated if @option{-funsafe-math-optimizations} is also specified.
19733
19734 @end table
19735
19736 Double-precision floating point:
19737 @table @asis
19738
19739 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
19740 Binary arithmetic operations.
19741
19742 @item @samp{fnegd}
19743 Unary negation.
19744
19745 @item @samp{fabsd}
19746 Unary absolute value.
19747
19748 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
19749 Comparison operations.
19750
19751 @item @samp{fmind}, @samp{fmaxd}
19752 Double-precision minimum and maximum. These instructions are only
19753 generated if @option{-ffinite-math-only} is specified.
19754
19755 @item @samp{fsqrtd}
19756 Unary square root operation.
19757
19758 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
19759 Double-precision trigonometric and exponential functions. These instructions
19760 are only generated if @option{-funsafe-math-optimizations} is also specified.
19761
19762 @end table
19763
19764 Conversions:
19765 @table @asis
19766 @item @samp{fextsd}
19767 Conversion from single precision to double precision.
19768
19769 @item @samp{ftruncds}
19770 Conversion from double precision to single precision.
19771
19772 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
19773 Conversion from floating point to signed or unsigned integer types, with
19774 truncation towards zero.
19775
19776 @item @samp{round}
19777 Conversion from single-precision floating point to signed integer,
19778 rounding to the nearest integer and ties away from zero.
19779 This corresponds to the @code{__builtin_lroundf} function when
19780 @option{-fno-math-errno} is used.
19781
19782 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
19783 Conversion from signed or unsigned integer types to floating-point types.
19784
19785 @end table
19786
19787 In addition, all of the following transfer instructions for internal
19788 registers X and Y must be provided to use any of the double-precision
19789 floating-point instructions. Custom instructions taking two
19790 double-precision source operands expect the first operand in the
19791 64-bit register X. The other operand (or only operand of a unary
19792 operation) is given to the custom arithmetic instruction with the
19793 least significant half in source register @var{src1} and the most
19794 significant half in @var{src2}. A custom instruction that returns a
19795 double-precision result returns the most significant 32 bits in the
19796 destination register and the other half in 32-bit register Y.
19797 GCC automatically generates the necessary code sequences to write
19798 register X and/or read register Y when double-precision floating-point
19799 instructions are used.
19800
19801 @table @asis
19802
19803 @item @samp{fwrx}
19804 Write @var{src1} into the least significant half of X and @var{src2} into
19805 the most significant half of X.
19806
19807 @item @samp{fwry}
19808 Write @var{src1} into Y.
19809
19810 @item @samp{frdxhi}, @samp{frdxlo}
19811 Read the most or least (respectively) significant half of X and store it in
19812 @var{dest}.
19813
19814 @item @samp{frdy}
19815 Read the value of Y and store it into @var{dest}.
19816 @end table
19817
19818 Note that you can gain more local control over generation of Nios II custom
19819 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
19820 and @code{target("no-custom-@var{insn}")} function attributes
19821 (@pxref{Function Attributes})
19822 or pragmas (@pxref{Function Specific Option Pragmas}).
19823
19824 @item -mcustom-fpu-cfg=@var{name}
19825 @opindex mcustom-fpu-cfg
19826
19827 This option enables a predefined, named set of custom instruction encodings
19828 (see @option{-mcustom-@var{insn}} above).
19829 Currently, the following sets are defined:
19830
19831 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
19832 @gccoptlist{-mcustom-fmuls=252 @gol
19833 -mcustom-fadds=253 @gol
19834 -mcustom-fsubs=254 @gol
19835 -fsingle-precision-constant}
19836
19837 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
19838 @gccoptlist{-mcustom-fmuls=252 @gol
19839 -mcustom-fadds=253 @gol
19840 -mcustom-fsubs=254 @gol
19841 -mcustom-fdivs=255 @gol
19842 -fsingle-precision-constant}
19843
19844 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
19845 @gccoptlist{-mcustom-floatus=243 @gol
19846 -mcustom-fixsi=244 @gol
19847 -mcustom-floatis=245 @gol
19848 -mcustom-fcmpgts=246 @gol
19849 -mcustom-fcmples=249 @gol
19850 -mcustom-fcmpeqs=250 @gol
19851 -mcustom-fcmpnes=251 @gol
19852 -mcustom-fmuls=252 @gol
19853 -mcustom-fadds=253 @gol
19854 -mcustom-fsubs=254 @gol
19855 -mcustom-fdivs=255 @gol
19856 -fsingle-precision-constant}
19857
19858 Custom instruction assignments given by individual
19859 @option{-mcustom-@var{insn}=} options override those given by
19860 @option{-mcustom-fpu-cfg=}, regardless of the
19861 order of the options on the command line.
19862
19863 Note that you can gain more local control over selection of a FPU
19864 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
19865 function attribute (@pxref{Function Attributes})
19866 or pragma (@pxref{Function Specific Option Pragmas}).
19867
19868 @end table
19869
19870 These additional @samp{-m} options are available for the Altera Nios II
19871 ELF (bare-metal) target:
19872
19873 @table @gcctabopt
19874
19875 @item -mhal
19876 @opindex mhal
19877 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
19878 startup and termination code, and is typically used in conjunction with
19879 @option{-msys-crt0=} to specify the location of the alternate startup code
19880 provided by the HAL BSP.
19881
19882 @item -msmallc
19883 @opindex msmallc
19884 Link with a limited version of the C library, @option{-lsmallc}, rather than
19885 Newlib.
19886
19887 @item -msys-crt0=@var{startfile}
19888 @opindex msys-crt0
19889 @var{startfile} is the file name of the startfile (crt0) to use
19890 when linking. This option is only useful in conjunction with @option{-mhal}.
19891
19892 @item -msys-lib=@var{systemlib}
19893 @opindex msys-lib
19894 @var{systemlib} is the library name of the library that provides
19895 low-level system calls required by the C library,
19896 e.g. @code{read} and @code{write}.
19897 This option is typically used to link with a library provided by a HAL BSP.
19898
19899 @end table
19900
19901 @node Nvidia PTX Options
19902 @subsection Nvidia PTX Options
19903 @cindex Nvidia PTX options
19904 @cindex nvptx options
19905
19906 These options are defined for Nvidia PTX:
19907
19908 @table @gcctabopt
19909
19910 @item -m32
19911 @itemx -m64
19912 @opindex m32
19913 @opindex m64
19914 Generate code for 32-bit or 64-bit ABI.
19915
19916 @item -mmainkernel
19917 @opindex mmainkernel
19918 Link in code for a __main kernel. This is for stand-alone instead of
19919 offloading execution.
19920
19921 @item -moptimize
19922 @opindex moptimize
19923 Apply partitioned execution optimizations. This is the default when any
19924 level of optimization is selected.
19925
19926 @end table
19927
19928 @node PDP-11 Options
19929 @subsection PDP-11 Options
19930 @cindex PDP-11 Options
19931
19932 These options are defined for the PDP-11:
19933
19934 @table @gcctabopt
19935 @item -mfpu
19936 @opindex mfpu
19937 Use hardware FPP floating point. This is the default. (FIS floating
19938 point on the PDP-11/40 is not supported.)
19939
19940 @item -msoft-float
19941 @opindex msoft-float
19942 Do not use hardware floating point.
19943
19944 @item -mac0
19945 @opindex mac0
19946 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
19947
19948 @item -mno-ac0
19949 @opindex mno-ac0
19950 Return floating-point results in memory. This is the default.
19951
19952 @item -m40
19953 @opindex m40
19954 Generate code for a PDP-11/40.
19955
19956 @item -m45
19957 @opindex m45
19958 Generate code for a PDP-11/45. This is the default.
19959
19960 @item -m10
19961 @opindex m10
19962 Generate code for a PDP-11/10.
19963
19964 @item -mbcopy-builtin
19965 @opindex mbcopy-builtin
19966 Use inline @code{movmemhi} patterns for copying memory. This is the
19967 default.
19968
19969 @item -mbcopy
19970 @opindex mbcopy
19971 Do not use inline @code{movmemhi} patterns for copying memory.
19972
19973 @item -mint16
19974 @itemx -mno-int32
19975 @opindex mint16
19976 @opindex mno-int32
19977 Use 16-bit @code{int}. This is the default.
19978
19979 @item -mint32
19980 @itemx -mno-int16
19981 @opindex mint32
19982 @opindex mno-int16
19983 Use 32-bit @code{int}.
19984
19985 @item -mfloat64
19986 @itemx -mno-float32
19987 @opindex mfloat64
19988 @opindex mno-float32
19989 Use 64-bit @code{float}. This is the default.
19990
19991 @item -mfloat32
19992 @itemx -mno-float64
19993 @opindex mfloat32
19994 @opindex mno-float64
19995 Use 32-bit @code{float}.
19996
19997 @item -mabshi
19998 @opindex mabshi
19999 Use @code{abshi2} pattern. This is the default.
20000
20001 @item -mno-abshi
20002 @opindex mno-abshi
20003 Do not use @code{abshi2} pattern.
20004
20005 @item -mbranch-expensive
20006 @opindex mbranch-expensive
20007 Pretend that branches are expensive. This is for experimenting with
20008 code generation only.
20009
20010 @item -mbranch-cheap
20011 @opindex mbranch-cheap
20012 Do not pretend that branches are expensive. This is the default.
20013
20014 @item -munix-asm
20015 @opindex munix-asm
20016 Use Unix assembler syntax. This is the default when configured for
20017 @samp{pdp11-*-bsd}.
20018
20019 @item -mdec-asm
20020 @opindex mdec-asm
20021 Use DEC assembler syntax. This is the default when configured for any
20022 PDP-11 target other than @samp{pdp11-*-bsd}.
20023 @end table
20024
20025 @node picoChip Options
20026 @subsection picoChip Options
20027 @cindex picoChip options
20028
20029 These @samp{-m} options are defined for picoChip implementations:
20030
20031 @table @gcctabopt
20032
20033 @item -mae=@var{ae_type}
20034 @opindex mcpu
20035 Set the instruction set, register set, and instruction scheduling
20036 parameters for array element type @var{ae_type}. Supported values
20037 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
20038
20039 @option{-mae=ANY} selects a completely generic AE type. Code
20040 generated with this option runs on any of the other AE types. The
20041 code is not as efficient as it would be if compiled for a specific
20042 AE type, and some types of operation (e.g., multiplication) do not
20043 work properly on all types of AE.
20044
20045 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
20046 for compiled code, and is the default.
20047
20048 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
20049 option may suffer from poor performance of byte (char) manipulation,
20050 since the DSP AE does not provide hardware support for byte load/stores.
20051
20052 @item -msymbol-as-address
20053 Enable the compiler to directly use a symbol name as an address in a
20054 load/store instruction, without first loading it into a
20055 register. Typically, the use of this option generates larger
20056 programs, which run faster than when the option isn't used. However, the
20057 results vary from program to program, so it is left as a user option,
20058 rather than being permanently enabled.
20059
20060 @item -mno-inefficient-warnings
20061 Disables warnings about the generation of inefficient code. These
20062 warnings can be generated, for example, when compiling code that
20063 performs byte-level memory operations on the MAC AE type. The MAC AE has
20064 no hardware support for byte-level memory operations, so all byte
20065 load/stores must be synthesized from word load/store operations. This is
20066 inefficient and a warning is generated to indicate
20067 that you should rewrite the code to avoid byte operations, or to target
20068 an AE type that has the necessary hardware support. This option disables
20069 these warnings.
20070
20071 @end table
20072
20073 @node PowerPC Options
20074 @subsection PowerPC Options
20075 @cindex PowerPC options
20076
20077 These are listed under @xref{RS/6000 and PowerPC Options}.
20078
20079 @node RL78 Options
20080 @subsection RL78 Options
20081 @cindex RL78 Options
20082
20083 @table @gcctabopt
20084
20085 @item -msim
20086 @opindex msim
20087 Links in additional target libraries to support operation within a
20088 simulator.
20089
20090 @item -mmul=none
20091 @itemx -mmul=g10
20092 @itemx -mmul=g13
20093 @itemx -mmul=g14
20094 @itemx -mmul=rl78
20095 @opindex mmul
20096 Specifies the type of hardware multiplication and division support to
20097 be used. The simplest is @code{none}, which uses software for both
20098 multiplication and division. This is the default. The @code{g13}
20099 value is for the hardware multiply/divide peripheral found on the
20100 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
20101 the multiplication and division instructions supported by the RL78/G14
20102 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
20103 the value @code{mg10} is an alias for @code{none}.
20104
20105 In addition a C preprocessor macro is defined, based upon the setting
20106 of this option. Possible values are: @code{__RL78_MUL_NONE__},
20107 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
20108
20109 @item -mcpu=g10
20110 @itemx -mcpu=g13
20111 @itemx -mcpu=g14
20112 @itemx -mcpu=rl78
20113 @opindex mcpu
20114 Specifies the RL78 core to target. The default is the G14 core, also
20115 known as an S3 core or just RL78. The G13 or S2 core does not have
20116 multiply or divide instructions, instead it uses a hardware peripheral
20117 for these operations. The G10 or S1 core does not have register
20118 banks, so it uses a different calling convention.
20119
20120 If this option is set it also selects the type of hardware multiply
20121 support to use, unless this is overridden by an explicit
20122 @option{-mmul=none} option on the command line. Thus specifying
20123 @option{-mcpu=g13} enables the use of the G13 hardware multiply
20124 peripheral and specifying @option{-mcpu=g10} disables the use of
20125 hardware multiplications altogether.
20126
20127 Note, although the RL78/G14 core is the default target, specifying
20128 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
20129 change the behavior of the toolchain since it also enables G14
20130 hardware multiply support. If these options are not specified on the
20131 command line then software multiplication routines will be used even
20132 though the code targets the RL78 core. This is for backwards
20133 compatibility with older toolchains which did not have hardware
20134 multiply and divide support.
20135
20136 In addition a C preprocessor macro is defined, based upon the setting
20137 of this option. Possible values are: @code{__RL78_G10__},
20138 @code{__RL78_G13__} or @code{__RL78_G14__}.
20139
20140 @item -mg10
20141 @itemx -mg13
20142 @itemx -mg14
20143 @itemx -mrl78
20144 @opindex mg10
20145 @opindex mg13
20146 @opindex mg14
20147 @opindex mrl78
20148 These are aliases for the corresponding @option{-mcpu=} option. They
20149 are provided for backwards compatibility.
20150
20151 @item -mallregs
20152 @opindex mallregs
20153 Allow the compiler to use all of the available registers. By default
20154 registers @code{r24..r31} are reserved for use in interrupt handlers.
20155 With this option enabled these registers can be used in ordinary
20156 functions as well.
20157
20158 @item -m64bit-doubles
20159 @itemx -m32bit-doubles
20160 @opindex m64bit-doubles
20161 @opindex m32bit-doubles
20162 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
20163 or 32 bits (@option{-m32bit-doubles}) in size. The default is
20164 @option{-m32bit-doubles}.
20165
20166 @item -msave-mduc-in-interrupts
20167 @item -mno-save-mduc-in-interrupts
20168 @opindex msave-mduc-in-interrupts
20169 @opindex mno-save-mduc-in-interrupts
20170 Specifies that interrupt handler functions should preserve the
20171 MDUC registers. This is only necessary if normal code might use
20172 the MDUC registers, for example because it performs multiplication
20173 and division operations. The default is to ignore the MDUC registers
20174 as this makes the interrupt handlers faster. The target option -mg13
20175 needs to be passed for this to work as this feature is only available
20176 on the G13 target (S2 core). The MDUC registers will only be saved
20177 if the interrupt handler performs a multiplication or division
20178 operation or it calls another function.
20179
20180 @end table
20181
20182 @node RS/6000 and PowerPC Options
20183 @subsection IBM RS/6000 and PowerPC Options
20184 @cindex RS/6000 and PowerPC Options
20185 @cindex IBM RS/6000 and PowerPC Options
20186
20187 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
20188 @table @gcctabopt
20189 @item -mpowerpc-gpopt
20190 @itemx -mno-powerpc-gpopt
20191 @itemx -mpowerpc-gfxopt
20192 @itemx -mno-powerpc-gfxopt
20193 @need 800
20194 @itemx -mpowerpc64
20195 @itemx -mno-powerpc64
20196 @itemx -mmfcrf
20197 @itemx -mno-mfcrf
20198 @itemx -mpopcntb
20199 @itemx -mno-popcntb
20200 @itemx -mpopcntd
20201 @itemx -mno-popcntd
20202 @itemx -mfprnd
20203 @itemx -mno-fprnd
20204 @need 800
20205 @itemx -mcmpb
20206 @itemx -mno-cmpb
20207 @itemx -mmfpgpr
20208 @itemx -mno-mfpgpr
20209 @itemx -mhard-dfp
20210 @itemx -mno-hard-dfp
20211 @opindex mpowerpc-gpopt
20212 @opindex mno-powerpc-gpopt
20213 @opindex mpowerpc-gfxopt
20214 @opindex mno-powerpc-gfxopt
20215 @opindex mpowerpc64
20216 @opindex mno-powerpc64
20217 @opindex mmfcrf
20218 @opindex mno-mfcrf
20219 @opindex mpopcntb
20220 @opindex mno-popcntb
20221 @opindex mpopcntd
20222 @opindex mno-popcntd
20223 @opindex mfprnd
20224 @opindex mno-fprnd
20225 @opindex mcmpb
20226 @opindex mno-cmpb
20227 @opindex mmfpgpr
20228 @opindex mno-mfpgpr
20229 @opindex mhard-dfp
20230 @opindex mno-hard-dfp
20231 You use these options to specify which instructions are available on the
20232 processor you are using. The default value of these options is
20233 determined when configuring GCC@. Specifying the
20234 @option{-mcpu=@var{cpu_type}} overrides the specification of these
20235 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
20236 rather than the options listed above.
20237
20238 Specifying @option{-mpowerpc-gpopt} allows
20239 GCC to use the optional PowerPC architecture instructions in the
20240 General Purpose group, including floating-point square root. Specifying
20241 @option{-mpowerpc-gfxopt} allows GCC to
20242 use the optional PowerPC architecture instructions in the Graphics
20243 group, including floating-point select.
20244
20245 The @option{-mmfcrf} option allows GCC to generate the move from
20246 condition register field instruction implemented on the POWER4
20247 processor and other processors that support the PowerPC V2.01
20248 architecture.
20249 The @option{-mpopcntb} option allows GCC to generate the popcount and
20250 double-precision FP reciprocal estimate instruction implemented on the
20251 POWER5 processor and other processors that support the PowerPC V2.02
20252 architecture.
20253 The @option{-mpopcntd} option allows GCC to generate the popcount
20254 instruction implemented on the POWER7 processor and other processors
20255 that support the PowerPC V2.06 architecture.
20256 The @option{-mfprnd} option allows GCC to generate the FP round to
20257 integer instructions implemented on the POWER5+ processor and other
20258 processors that support the PowerPC V2.03 architecture.
20259 The @option{-mcmpb} option allows GCC to generate the compare bytes
20260 instruction implemented on the POWER6 processor and other processors
20261 that support the PowerPC V2.05 architecture.
20262 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
20263 general-purpose register instructions implemented on the POWER6X
20264 processor and other processors that support the extended PowerPC V2.05
20265 architecture.
20266 The @option{-mhard-dfp} option allows GCC to generate the decimal
20267 floating-point instructions implemented on some POWER processors.
20268
20269 The @option{-mpowerpc64} option allows GCC to generate the additional
20270 64-bit instructions that are found in the full PowerPC64 architecture
20271 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
20272 @option{-mno-powerpc64}.
20273
20274 @item -mcpu=@var{cpu_type}
20275 @opindex mcpu
20276 Set architecture type, register usage, and
20277 instruction scheduling parameters for machine type @var{cpu_type}.
20278 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
20279 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
20280 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
20281 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
20282 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
20283 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
20284 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
20285 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
20286 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
20287 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
20288 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
20289 and @samp{rs64}.
20290
20291 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
20292 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
20293 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
20294 architecture machine types, with an appropriate, generic processor
20295 model assumed for scheduling purposes.
20296
20297 The other options specify a specific processor. Code generated under
20298 those options runs best on that processor, and may not run at all on
20299 others.
20300
20301 The @option{-mcpu} options automatically enable or disable the
20302 following options:
20303
20304 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
20305 -mpopcntb -mpopcntd -mpowerpc64 @gol
20306 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
20307 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
20308 -mcrypto -mdirect-move -mhtm -mpower8-fusion -mpower8-vector @gol
20309 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
20310
20311 The particular options set for any particular CPU varies between
20312 compiler versions, depending on what setting seems to produce optimal
20313 code for that CPU; it doesn't necessarily reflect the actual hardware's
20314 capabilities. If you wish to set an individual option to a particular
20315 value, you may specify it after the @option{-mcpu} option, like
20316 @option{-mcpu=970 -mno-altivec}.
20317
20318 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
20319 not enabled or disabled by the @option{-mcpu} option at present because
20320 AIX does not have full support for these options. You may still
20321 enable or disable them individually if you're sure it'll work in your
20322 environment.
20323
20324 @item -mtune=@var{cpu_type}
20325 @opindex mtune
20326 Set the instruction scheduling parameters for machine type
20327 @var{cpu_type}, but do not set the architecture type or register usage,
20328 as @option{-mcpu=@var{cpu_type}} does. The same
20329 values for @var{cpu_type} are used for @option{-mtune} as for
20330 @option{-mcpu}. If both are specified, the code generated uses the
20331 architecture and registers set by @option{-mcpu}, but the
20332 scheduling parameters set by @option{-mtune}.
20333
20334 @item -mcmodel=small
20335 @opindex mcmodel=small
20336 Generate PowerPC64 code for the small model: The TOC is limited to
20337 64k.
20338
20339 @item -mcmodel=medium
20340 @opindex mcmodel=medium
20341 Generate PowerPC64 code for the medium model: The TOC and other static
20342 data may be up to a total of 4G in size.
20343
20344 @item -mcmodel=large
20345 @opindex mcmodel=large
20346 Generate PowerPC64 code for the large model: The TOC may be up to 4G
20347 in size. Other data and code is only limited by the 64-bit address
20348 space.
20349
20350 @item -maltivec
20351 @itemx -mno-altivec
20352 @opindex maltivec
20353 @opindex mno-altivec
20354 Generate code that uses (does not use) AltiVec instructions, and also
20355 enable the use of built-in functions that allow more direct access to
20356 the AltiVec instruction set. You may also need to set
20357 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
20358 enhancements.
20359
20360 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
20361 @option{-maltivec=be}, the element order for AltiVec intrinsics such
20362 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
20363 match array element order corresponding to the endianness of the
20364 target. That is, element zero identifies the leftmost element in a
20365 vector register when targeting a big-endian platform, and identifies
20366 the rightmost element in a vector register when targeting a
20367 little-endian platform.
20368
20369 @item -maltivec=be
20370 @opindex maltivec=be
20371 Generate AltiVec instructions using big-endian element order,
20372 regardless of whether the target is big- or little-endian. This is
20373 the default when targeting a big-endian platform.
20374
20375 The element order is used to interpret element numbers in AltiVec
20376 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20377 @code{vec_insert}. By default, these match array element order
20378 corresponding to the endianness for the target.
20379
20380 @item -maltivec=le
20381 @opindex maltivec=le
20382 Generate AltiVec instructions using little-endian element order,
20383 regardless of whether the target is big- or little-endian. This is
20384 the default when targeting a little-endian platform. This option is
20385 currently ignored when targeting a big-endian platform.
20386
20387 The element order is used to interpret element numbers in AltiVec
20388 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20389 @code{vec_insert}. By default, these match array element order
20390 corresponding to the endianness for the target.
20391
20392 @item -mvrsave
20393 @itemx -mno-vrsave
20394 @opindex mvrsave
20395 @opindex mno-vrsave
20396 Generate VRSAVE instructions when generating AltiVec code.
20397
20398 @item -mgen-cell-microcode
20399 @opindex mgen-cell-microcode
20400 Generate Cell microcode instructions.
20401
20402 @item -mwarn-cell-microcode
20403 @opindex mwarn-cell-microcode
20404 Warn when a Cell microcode instruction is emitted. An example
20405 of a Cell microcode instruction is a variable shift.
20406
20407 @item -msecure-plt
20408 @opindex msecure-plt
20409 Generate code that allows @command{ld} and @command{ld.so}
20410 to build executables and shared
20411 libraries with non-executable @code{.plt} and @code{.got} sections.
20412 This is a PowerPC
20413 32-bit SYSV ABI option.
20414
20415 @item -mbss-plt
20416 @opindex mbss-plt
20417 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
20418 fills in, and
20419 requires @code{.plt} and @code{.got}
20420 sections that are both writable and executable.
20421 This is a PowerPC 32-bit SYSV ABI option.
20422
20423 @item -misel
20424 @itemx -mno-isel
20425 @opindex misel
20426 @opindex mno-isel
20427 This switch enables or disables the generation of ISEL instructions.
20428
20429 @item -misel=@var{yes/no}
20430 This switch has been deprecated. Use @option{-misel} and
20431 @option{-mno-isel} instead.
20432
20433 @item -mlra
20434 @opindex mlra
20435 Enable Local Register Allocation. This is still experimental for PowerPC,
20436 so by default the compiler uses standard reload
20437 (i.e. @option{-mno-lra}).
20438
20439 @item -mspe
20440 @itemx -mno-spe
20441 @opindex mspe
20442 @opindex mno-spe
20443 This switch enables or disables the generation of SPE simd
20444 instructions.
20445
20446 @item -mpaired
20447 @itemx -mno-paired
20448 @opindex mpaired
20449 @opindex mno-paired
20450 This switch enables or disables the generation of PAIRED simd
20451 instructions.
20452
20453 @item -mspe=@var{yes/no}
20454 This option has been deprecated. Use @option{-mspe} and
20455 @option{-mno-spe} instead.
20456
20457 @item -mvsx
20458 @itemx -mno-vsx
20459 @opindex mvsx
20460 @opindex mno-vsx
20461 Generate code that uses (does not use) vector/scalar (VSX)
20462 instructions, and also enable the use of built-in functions that allow
20463 more direct access to the VSX instruction set.
20464
20465 @item -mcrypto
20466 @itemx -mno-crypto
20467 @opindex mcrypto
20468 @opindex mno-crypto
20469 Enable the use (disable) of the built-in functions that allow direct
20470 access to the cryptographic instructions that were added in version
20471 2.07 of the PowerPC ISA.
20472
20473 @item -mdirect-move
20474 @itemx -mno-direct-move
20475 @opindex mdirect-move
20476 @opindex mno-direct-move
20477 Generate code that uses (does not use) the instructions to move data
20478 between the general purpose registers and the vector/scalar (VSX)
20479 registers that were added in version 2.07 of the PowerPC ISA.
20480
20481 @item -mhtm
20482 @itemx -mno-htm
20483 @opindex mhtm
20484 @opindex mno-htm
20485 Enable (disable) the use of the built-in functions that allow direct
20486 access to the Hardware Transactional Memory (HTM) instructions that
20487 were added in version 2.07 of the PowerPC ISA.
20488
20489 @item -mpower8-fusion
20490 @itemx -mno-power8-fusion
20491 @opindex mpower8-fusion
20492 @opindex mno-power8-fusion
20493 Generate code that keeps (does not keeps) some integer operations
20494 adjacent so that the instructions can be fused together on power8 and
20495 later processors.
20496
20497 @item -mpower8-vector
20498 @itemx -mno-power8-vector
20499 @opindex mpower8-vector
20500 @opindex mno-power8-vector
20501 Generate code that uses (does not use) the vector and scalar
20502 instructions that were added in version 2.07 of the PowerPC ISA. Also
20503 enable the use of built-in functions that allow more direct access to
20504 the vector instructions.
20505
20506 @item -mquad-memory
20507 @itemx -mno-quad-memory
20508 @opindex mquad-memory
20509 @opindex mno-quad-memory
20510 Generate code that uses (does not use) the non-atomic quad word memory
20511 instructions. The @option{-mquad-memory} option requires use of
20512 64-bit mode.
20513
20514 @item -mquad-memory-atomic
20515 @itemx -mno-quad-memory-atomic
20516 @opindex mquad-memory-atomic
20517 @opindex mno-quad-memory-atomic
20518 Generate code that uses (does not use) the atomic quad word memory
20519 instructions. The @option{-mquad-memory-atomic} option requires use of
20520 64-bit mode.
20521
20522 @item -mupper-regs-di
20523 @itemx -mno-upper-regs-di
20524 @opindex mupper-regs-di
20525 @opindex mno-upper-regs-di
20526 Generate code that uses (does not use) the scalar instructions that
20527 target all 64 registers in the vector/scalar floating point register
20528 set that were added in version 2.06 of the PowerPC ISA when processing
20529 integers. @option{-mupper-regs-di} is turned on by default if you use
20530 any of the @option{-mcpu=power7}, @option{-mcpu=power8},
20531 @option{-mcpu=power9}, or @option{-mvsx} options.
20532
20533 @item -mupper-regs-df
20534 @itemx -mno-upper-regs-df
20535 @opindex mupper-regs-df
20536 @opindex mno-upper-regs-df
20537 Generate code that uses (does not use) the scalar double precision
20538 instructions that target all 64 registers in the vector/scalar
20539 floating point register set that were added in version 2.06 of the
20540 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
20541 use any of the @option{-mcpu=power7}, @option{-mcpu=power8},
20542 @option{-mcpu=power9}, or @option{-mvsx} options.
20543
20544 @item -mupper-regs-sf
20545 @itemx -mno-upper-regs-sf
20546 @opindex mupper-regs-sf
20547 @opindex mno-upper-regs-sf
20548 Generate code that uses (does not use) the scalar single precision
20549 instructions that target all 64 registers in the vector/scalar
20550 floating point register set that were added in version 2.07 of the
20551 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
20552 use either of the @option{-mcpu=power8}, @option{-mpower8-vector}, or
20553 @option{-mcpu=power9} options.
20554
20555 @item -mupper-regs
20556 @itemx -mno-upper-regs
20557 @opindex mupper-regs
20558 @opindex mno-upper-regs
20559 Generate code that uses (does not use) the scalar
20560 instructions that target all 64 registers in the vector/scalar
20561 floating point register set, depending on the model of the machine.
20562
20563 If the @option{-mno-upper-regs} option is used, it turns off both
20564 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
20565
20566 @item -mfloat128
20567 @itemx -mno-float128
20568 @opindex mfloat128
20569 @opindex mno-float128
20570 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
20571 and use either software emulation for IEEE 128-bit floating point or
20572 hardware instructions.
20573
20574 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
20575 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
20576 option. The @option{-mfloat128} option only works on PowerPC 64-bit
20577 Linux systems.
20578
20579 If you use the ISA 3.0 instruction set (@option{-mcpu=power9}), the
20580 @option{-mfloat128} option will also enable the generation of ISA 3.0
20581 IEEE 128-bit floating point instructions. Otherwise, IEEE 128-bit
20582 floating point will be done with software emulation.
20583
20584 @item -mfloat128-hardware
20585 @itemx -mno-float128-hardware
20586 @opindex mfloat128-hardware
20587 @opindex mno-float128-hardware
20588 Enable/disable using ISA 3.0 hardware instructions to support the
20589 @var{__float128} data type.
20590
20591 If you use @option{-mfloat128-hardware}, it will enable the option
20592 @option{-mfloat128} as well.
20593
20594 If you select ISA 3.0 instructions with @option{-mcpu=power9}, but do
20595 not use either @option{-mfloat128} or @option{-mfloat128-hardware},
20596 the IEEE 128-bit floating point support will not be enabled.
20597
20598 @item -mfloat-gprs=@var{yes/single/double/no}
20599 @itemx -mfloat-gprs
20600 @opindex mfloat-gprs
20601 This switch enables or disables the generation of floating-point
20602 operations on the general-purpose registers for architectures that
20603 support it.
20604
20605 The argument @samp{yes} or @samp{single} enables the use of
20606 single-precision floating-point operations.
20607
20608 The argument @samp{double} enables the use of single and
20609 double-precision floating-point operations.
20610
20611 The argument @samp{no} disables floating-point operations on the
20612 general-purpose registers.
20613
20614 This option is currently only available on the MPC854x.
20615
20616 @item -m32
20617 @itemx -m64
20618 @opindex m32
20619 @opindex m64
20620 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
20621 targets (including GNU/Linux). The 32-bit environment sets int, long
20622 and pointer to 32 bits and generates code that runs on any PowerPC
20623 variant. The 64-bit environment sets int to 32 bits and long and
20624 pointer to 64 bits, and generates code for PowerPC64, as for
20625 @option{-mpowerpc64}.
20626
20627 @item -mfull-toc
20628 @itemx -mno-fp-in-toc
20629 @itemx -mno-sum-in-toc
20630 @itemx -mminimal-toc
20631 @opindex mfull-toc
20632 @opindex mno-fp-in-toc
20633 @opindex mno-sum-in-toc
20634 @opindex mminimal-toc
20635 Modify generation of the TOC (Table Of Contents), which is created for
20636 every executable file. The @option{-mfull-toc} option is selected by
20637 default. In that case, GCC allocates at least one TOC entry for
20638 each unique non-automatic variable reference in your program. GCC
20639 also places floating-point constants in the TOC@. However, only
20640 16,384 entries are available in the TOC@.
20641
20642 If you receive a linker error message that saying you have overflowed
20643 the available TOC space, you can reduce the amount of TOC space used
20644 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
20645 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
20646 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
20647 generate code to calculate the sum of an address and a constant at
20648 run time instead of putting that sum into the TOC@. You may specify one
20649 or both of these options. Each causes GCC to produce very slightly
20650 slower and larger code at the expense of conserving TOC space.
20651
20652 If you still run out of space in the TOC even when you specify both of
20653 these options, specify @option{-mminimal-toc} instead. This option causes
20654 GCC to make only one TOC entry for every file. When you specify this
20655 option, GCC produces code that is slower and larger but which
20656 uses extremely little TOC space. You may wish to use this option
20657 only on files that contain less frequently-executed code.
20658
20659 @item -maix64
20660 @itemx -maix32
20661 @opindex maix64
20662 @opindex maix32
20663 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
20664 @code{long} type, and the infrastructure needed to support them.
20665 Specifying @option{-maix64} implies @option{-mpowerpc64},
20666 while @option{-maix32} disables the 64-bit ABI and
20667 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
20668
20669 @item -mxl-compat
20670 @itemx -mno-xl-compat
20671 @opindex mxl-compat
20672 @opindex mno-xl-compat
20673 Produce code that conforms more closely to IBM XL compiler semantics
20674 when using AIX-compatible ABI@. Pass floating-point arguments to
20675 prototyped functions beyond the register save area (RSA) on the stack
20676 in addition to argument FPRs. Do not assume that most significant
20677 double in 128-bit long double value is properly rounded when comparing
20678 values and converting to double. Use XL symbol names for long double
20679 support routines.
20680
20681 The AIX calling convention was extended but not initially documented to
20682 handle an obscure K&R C case of calling a function that takes the
20683 address of its arguments with fewer arguments than declared. IBM XL
20684 compilers access floating-point arguments that do not fit in the
20685 RSA from the stack when a subroutine is compiled without
20686 optimization. Because always storing floating-point arguments on the
20687 stack is inefficient and rarely needed, this option is not enabled by
20688 default and only is necessary when calling subroutines compiled by IBM
20689 XL compilers without optimization.
20690
20691 @item -mpe
20692 @opindex mpe
20693 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
20694 application written to use message passing with special startup code to
20695 enable the application to run. The system must have PE installed in the
20696 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
20697 must be overridden with the @option{-specs=} option to specify the
20698 appropriate directory location. The Parallel Environment does not
20699 support threads, so the @option{-mpe} option and the @option{-pthread}
20700 option are incompatible.
20701
20702 @item -malign-natural
20703 @itemx -malign-power
20704 @opindex malign-natural
20705 @opindex malign-power
20706 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
20707 @option{-malign-natural} overrides the ABI-defined alignment of larger
20708 types, such as floating-point doubles, on their natural size-based boundary.
20709 The option @option{-malign-power} instructs GCC to follow the ABI-specified
20710 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
20711
20712 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
20713 is not supported.
20714
20715 @item -msoft-float
20716 @itemx -mhard-float
20717 @opindex msoft-float
20718 @opindex mhard-float
20719 Generate code that does not use (uses) the floating-point register set.
20720 Software floating-point emulation is provided if you use the
20721 @option{-msoft-float} option, and pass the option to GCC when linking.
20722
20723 @item -msingle-float
20724 @itemx -mdouble-float
20725 @opindex msingle-float
20726 @opindex mdouble-float
20727 Generate code for single- or double-precision floating-point operations.
20728 @option{-mdouble-float} implies @option{-msingle-float}.
20729
20730 @item -msimple-fpu
20731 @opindex msimple-fpu
20732 Do not generate @code{sqrt} and @code{div} instructions for hardware
20733 floating-point unit.
20734
20735 @item -mfpu=@var{name}
20736 @opindex mfpu
20737 Specify type of floating-point unit. Valid values for @var{name} are
20738 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
20739 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
20740 @samp{sp_full} (equivalent to @option{-msingle-float}),
20741 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
20742
20743 @item -mxilinx-fpu
20744 @opindex mxilinx-fpu
20745 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
20746
20747 @item -mmultiple
20748 @itemx -mno-multiple
20749 @opindex mmultiple
20750 @opindex mno-multiple
20751 Generate code that uses (does not use) the load multiple word
20752 instructions and the store multiple word instructions. These
20753 instructions are generated by default on POWER systems, and not
20754 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
20755 PowerPC systems, since those instructions do not work when the
20756 processor is in little-endian mode. The exceptions are PPC740 and
20757 PPC750 which permit these instructions in little-endian mode.
20758
20759 @item -mstring
20760 @itemx -mno-string
20761 @opindex mstring
20762 @opindex mno-string
20763 Generate code that uses (does not use) the load string instructions
20764 and the store string word instructions to save multiple registers and
20765 do small block moves. These instructions are generated by default on
20766 POWER systems, and not generated on PowerPC systems. Do not use
20767 @option{-mstring} on little-endian PowerPC systems, since those
20768 instructions do not work when the processor is in little-endian mode.
20769 The exceptions are PPC740 and PPC750 which permit these instructions
20770 in little-endian mode.
20771
20772 @item -mupdate
20773 @itemx -mno-update
20774 @opindex mupdate
20775 @opindex mno-update
20776 Generate code that uses (does not use) the load or store instructions
20777 that update the base register to the address of the calculated memory
20778 location. These instructions are generated by default. If you use
20779 @option{-mno-update}, there is a small window between the time that the
20780 stack pointer is updated and the address of the previous frame is
20781 stored, which means code that walks the stack frame across interrupts or
20782 signals may get corrupted data.
20783
20784 @item -mavoid-indexed-addresses
20785 @itemx -mno-avoid-indexed-addresses
20786 @opindex mavoid-indexed-addresses
20787 @opindex mno-avoid-indexed-addresses
20788 Generate code that tries to avoid (not avoid) the use of indexed load
20789 or store instructions. These instructions can incur a performance
20790 penalty on Power6 processors in certain situations, such as when
20791 stepping through large arrays that cross a 16M boundary. This option
20792 is enabled by default when targeting Power6 and disabled otherwise.
20793
20794 @item -mfused-madd
20795 @itemx -mno-fused-madd
20796 @opindex mfused-madd
20797 @opindex mno-fused-madd
20798 Generate code that uses (does not use) the floating-point multiply and
20799 accumulate instructions. These instructions are generated by default
20800 if hardware floating point is used. The machine-dependent
20801 @option{-mfused-madd} option is now mapped to the machine-independent
20802 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
20803 mapped to @option{-ffp-contract=off}.
20804
20805 @item -mmulhw
20806 @itemx -mno-mulhw
20807 @opindex mmulhw
20808 @opindex mno-mulhw
20809 Generate code that uses (does not use) the half-word multiply and
20810 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
20811 These instructions are generated by default when targeting those
20812 processors.
20813
20814 @item -mdlmzb
20815 @itemx -mno-dlmzb
20816 @opindex mdlmzb
20817 @opindex mno-dlmzb
20818 Generate code that uses (does not use) the string-search @samp{dlmzb}
20819 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
20820 generated by default when targeting those processors.
20821
20822 @item -mno-bit-align
20823 @itemx -mbit-align
20824 @opindex mno-bit-align
20825 @opindex mbit-align
20826 On System V.4 and embedded PowerPC systems do not (do) force structures
20827 and unions that contain bit-fields to be aligned to the base type of the
20828 bit-field.
20829
20830 For example, by default a structure containing nothing but 8
20831 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
20832 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
20833 the structure is aligned to a 1-byte boundary and is 1 byte in
20834 size.
20835
20836 @item -mno-strict-align
20837 @itemx -mstrict-align
20838 @opindex mno-strict-align
20839 @opindex mstrict-align
20840 On System V.4 and embedded PowerPC systems do not (do) assume that
20841 unaligned memory references are handled by the system.
20842
20843 @item -mrelocatable
20844 @itemx -mno-relocatable
20845 @opindex mrelocatable
20846 @opindex mno-relocatable
20847 Generate code that allows (does not allow) a static executable to be
20848 relocated to a different address at run time. A simple embedded
20849 PowerPC system loader should relocate the entire contents of
20850 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
20851 a table of 32-bit addresses generated by this option. For this to
20852 work, all objects linked together must be compiled with
20853 @option{-mrelocatable} or @option{-mrelocatable-lib}.
20854 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
20855
20856 @item -mrelocatable-lib
20857 @itemx -mno-relocatable-lib
20858 @opindex mrelocatable-lib
20859 @opindex mno-relocatable-lib
20860 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
20861 @code{.fixup} section to allow static executables to be relocated at
20862 run time, but @option{-mrelocatable-lib} does not use the smaller stack
20863 alignment of @option{-mrelocatable}. Objects compiled with
20864 @option{-mrelocatable-lib} may be linked with objects compiled with
20865 any combination of the @option{-mrelocatable} options.
20866
20867 @item -mno-toc
20868 @itemx -mtoc
20869 @opindex mno-toc
20870 @opindex mtoc
20871 On System V.4 and embedded PowerPC systems do not (do) assume that
20872 register 2 contains a pointer to a global area pointing to the addresses
20873 used in the program.
20874
20875 @item -mlittle
20876 @itemx -mlittle-endian
20877 @opindex mlittle
20878 @opindex mlittle-endian
20879 On System V.4 and embedded PowerPC systems compile code for the
20880 processor in little-endian mode. The @option{-mlittle-endian} option is
20881 the same as @option{-mlittle}.
20882
20883 @item -mbig
20884 @itemx -mbig-endian
20885 @opindex mbig
20886 @opindex mbig-endian
20887 On System V.4 and embedded PowerPC systems compile code for the
20888 processor in big-endian mode. The @option{-mbig-endian} option is
20889 the same as @option{-mbig}.
20890
20891 @item -mdynamic-no-pic
20892 @opindex mdynamic-no-pic
20893 On Darwin and Mac OS X systems, compile code so that it is not
20894 relocatable, but that its external references are relocatable. The
20895 resulting code is suitable for applications, but not shared
20896 libraries.
20897
20898 @item -msingle-pic-base
20899 @opindex msingle-pic-base
20900 Treat the register used for PIC addressing as read-only, rather than
20901 loading it in the prologue for each function. The runtime system is
20902 responsible for initializing this register with an appropriate value
20903 before execution begins.
20904
20905 @item -mprioritize-restricted-insns=@var{priority}
20906 @opindex mprioritize-restricted-insns
20907 This option controls the priority that is assigned to
20908 dispatch-slot restricted instructions during the second scheduling
20909 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
20910 or @samp{2} to assign no, highest, or second-highest (respectively)
20911 priority to dispatch-slot restricted
20912 instructions.
20913
20914 @item -msched-costly-dep=@var{dependence_type}
20915 @opindex msched-costly-dep
20916 This option controls which dependences are considered costly
20917 by the target during instruction scheduling. The argument
20918 @var{dependence_type} takes one of the following values:
20919
20920 @table @asis
20921 @item @samp{no}
20922 No dependence is costly.
20923
20924 @item @samp{all}
20925 All dependences are costly.
20926
20927 @item @samp{true_store_to_load}
20928 A true dependence from store to load is costly.
20929
20930 @item @samp{store_to_load}
20931 Any dependence from store to load is costly.
20932
20933 @item @var{number}
20934 Any dependence for which the latency is greater than or equal to
20935 @var{number} is costly.
20936 @end table
20937
20938 @item -minsert-sched-nops=@var{scheme}
20939 @opindex minsert-sched-nops
20940 This option controls which NOP insertion scheme is used during
20941 the second scheduling pass. The argument @var{scheme} takes one of the
20942 following values:
20943
20944 @table @asis
20945 @item @samp{no}
20946 Don't insert NOPs.
20947
20948 @item @samp{pad}
20949 Pad with NOPs any dispatch group that has vacant issue slots,
20950 according to the scheduler's grouping.
20951
20952 @item @samp{regroup_exact}
20953 Insert NOPs to force costly dependent insns into
20954 separate groups. Insert exactly as many NOPs as needed to force an insn
20955 to a new group, according to the estimated processor grouping.
20956
20957 @item @var{number}
20958 Insert NOPs to force costly dependent insns into
20959 separate groups. Insert @var{number} NOPs to force an insn to a new group.
20960 @end table
20961
20962 @item -mcall-sysv
20963 @opindex mcall-sysv
20964 On System V.4 and embedded PowerPC systems compile code using calling
20965 conventions that adhere to the March 1995 draft of the System V
20966 Application Binary Interface, PowerPC processor supplement. This is the
20967 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
20968
20969 @item -mcall-sysv-eabi
20970 @itemx -mcall-eabi
20971 @opindex mcall-sysv-eabi
20972 @opindex mcall-eabi
20973 Specify both @option{-mcall-sysv} and @option{-meabi} options.
20974
20975 @item -mcall-sysv-noeabi
20976 @opindex mcall-sysv-noeabi
20977 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
20978
20979 @item -mcall-aixdesc
20980 @opindex m
20981 On System V.4 and embedded PowerPC systems compile code for the AIX
20982 operating system.
20983
20984 @item -mcall-linux
20985 @opindex mcall-linux
20986 On System V.4 and embedded PowerPC systems compile code for the
20987 Linux-based GNU system.
20988
20989 @item -mcall-freebsd
20990 @opindex mcall-freebsd
20991 On System V.4 and embedded PowerPC systems compile code for the
20992 FreeBSD operating system.
20993
20994 @item -mcall-netbsd
20995 @opindex mcall-netbsd
20996 On System V.4 and embedded PowerPC systems compile code for the
20997 NetBSD operating system.
20998
20999 @item -mcall-openbsd
21000 @opindex mcall-netbsd
21001 On System V.4 and embedded PowerPC systems compile code for the
21002 OpenBSD operating system.
21003
21004 @item -maix-struct-return
21005 @opindex maix-struct-return
21006 Return all structures in memory (as specified by the AIX ABI)@.
21007
21008 @item -msvr4-struct-return
21009 @opindex msvr4-struct-return
21010 Return structures smaller than 8 bytes in registers (as specified by the
21011 SVR4 ABI)@.
21012
21013 @item -mabi=@var{abi-type}
21014 @opindex mabi
21015 Extend the current ABI with a particular extension, or remove such extension.
21016 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
21017 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
21018 @samp{elfv1}, @samp{elfv2}@.
21019
21020 @item -mabi=spe
21021 @opindex mabi=spe
21022 Extend the current ABI with SPE ABI extensions. This does not change
21023 the default ABI, instead it adds the SPE ABI extensions to the current
21024 ABI@.
21025
21026 @item -mabi=no-spe
21027 @opindex mabi=no-spe
21028 Disable Book-E SPE ABI extensions for the current ABI@.
21029
21030 @item -mabi=ibmlongdouble
21031 @opindex mabi=ibmlongdouble
21032 Change the current ABI to use IBM extended-precision long double.
21033 This is a PowerPC 32-bit SYSV ABI option.
21034
21035 @item -mabi=ieeelongdouble
21036 @opindex mabi=ieeelongdouble
21037 Change the current ABI to use IEEE extended-precision long double.
21038 This is a PowerPC 32-bit Linux ABI option.
21039
21040 @item -mabi=elfv1
21041 @opindex mabi=elfv1
21042 Change the current ABI to use the ELFv1 ABI.
21043 This is the default ABI for big-endian PowerPC 64-bit Linux.
21044 Overriding the default ABI requires special system support and is
21045 likely to fail in spectacular ways.
21046
21047 @item -mabi=elfv2
21048 @opindex mabi=elfv2
21049 Change the current ABI to use the ELFv2 ABI.
21050 This is the default ABI for little-endian PowerPC 64-bit Linux.
21051 Overriding the default ABI requires special system support and is
21052 likely to fail in spectacular ways.
21053
21054 @item -mprototype
21055 @itemx -mno-prototype
21056 @opindex mprototype
21057 @opindex mno-prototype
21058 On System V.4 and embedded PowerPC systems assume that all calls to
21059 variable argument functions are properly prototyped. Otherwise, the
21060 compiler must insert an instruction before every non-prototyped call to
21061 set or clear bit 6 of the condition code register (@code{CR}) to
21062 indicate whether floating-point values are passed in the floating-point
21063 registers in case the function takes variable arguments. With
21064 @option{-mprototype}, only calls to prototyped variable argument functions
21065 set or clear the bit.
21066
21067 @item -msim
21068 @opindex msim
21069 On embedded PowerPC systems, assume that the startup module is called
21070 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
21071 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
21072 configurations.
21073
21074 @item -mmvme
21075 @opindex mmvme
21076 On embedded PowerPC systems, assume that the startup module is called
21077 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
21078 @file{libc.a}.
21079
21080 @item -mads
21081 @opindex mads
21082 On embedded PowerPC systems, assume that the startup module is called
21083 @file{crt0.o} and the standard C libraries are @file{libads.a} and
21084 @file{libc.a}.
21085
21086 @item -myellowknife
21087 @opindex myellowknife
21088 On embedded PowerPC systems, assume that the startup module is called
21089 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
21090 @file{libc.a}.
21091
21092 @item -mvxworks
21093 @opindex mvxworks
21094 On System V.4 and embedded PowerPC systems, specify that you are
21095 compiling for a VxWorks system.
21096
21097 @item -memb
21098 @opindex memb
21099 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
21100 header to indicate that @samp{eabi} extended relocations are used.
21101
21102 @item -meabi
21103 @itemx -mno-eabi
21104 @opindex meabi
21105 @opindex mno-eabi
21106 On System V.4 and embedded PowerPC systems do (do not) adhere to the
21107 Embedded Applications Binary Interface (EABI), which is a set of
21108 modifications to the System V.4 specifications. Selecting @option{-meabi}
21109 means that the stack is aligned to an 8-byte boundary, a function
21110 @code{__eabi} is called from @code{main} to set up the EABI
21111 environment, and the @option{-msdata} option can use both @code{r2} and
21112 @code{r13} to point to two separate small data areas. Selecting
21113 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
21114 no EABI initialization function is called from @code{main}, and the
21115 @option{-msdata} option only uses @code{r13} to point to a single
21116 small data area. The @option{-meabi} option is on by default if you
21117 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
21118
21119 @item -msdata=eabi
21120 @opindex msdata=eabi
21121 On System V.4 and embedded PowerPC systems, put small initialized
21122 @code{const} global and static data in the @code{.sdata2} section, which
21123 is pointed to by register @code{r2}. Put small initialized
21124 non-@code{const} global and static data in the @code{.sdata} section,
21125 which is pointed to by register @code{r13}. Put small uninitialized
21126 global and static data in the @code{.sbss} section, which is adjacent to
21127 the @code{.sdata} section. The @option{-msdata=eabi} option is
21128 incompatible with the @option{-mrelocatable} option. The
21129 @option{-msdata=eabi} option also sets the @option{-memb} option.
21130
21131 @item -msdata=sysv
21132 @opindex msdata=sysv
21133 On System V.4 and embedded PowerPC systems, put small global and static
21134 data in the @code{.sdata} section, which is pointed to by register
21135 @code{r13}. Put small uninitialized global and static data in the
21136 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
21137 The @option{-msdata=sysv} option is incompatible with the
21138 @option{-mrelocatable} option.
21139
21140 @item -msdata=default
21141 @itemx -msdata
21142 @opindex msdata=default
21143 @opindex msdata
21144 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
21145 compile code the same as @option{-msdata=eabi}, otherwise compile code the
21146 same as @option{-msdata=sysv}.
21147
21148 @item -msdata=data
21149 @opindex msdata=data
21150 On System V.4 and embedded PowerPC systems, put small global
21151 data in the @code{.sdata} section. Put small uninitialized global
21152 data in the @code{.sbss} section. Do not use register @code{r13}
21153 to address small data however. This is the default behavior unless
21154 other @option{-msdata} options are used.
21155
21156 @item -msdata=none
21157 @itemx -mno-sdata
21158 @opindex msdata=none
21159 @opindex mno-sdata
21160 On embedded PowerPC systems, put all initialized global and static data
21161 in the @code{.data} section, and all uninitialized data in the
21162 @code{.bss} section.
21163
21164 @item -mblock-move-inline-limit=@var{num}
21165 @opindex mblock-move-inline-limit
21166 Inline all block moves (such as calls to @code{memcpy} or structure
21167 copies) less than or equal to @var{num} bytes. The minimum value for
21168 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
21169 targets. The default value is target-specific.
21170
21171 @item -G @var{num}
21172 @opindex G
21173 @cindex smaller data references (PowerPC)
21174 @cindex .sdata/.sdata2 references (PowerPC)
21175 On embedded PowerPC systems, put global and static items less than or
21176 equal to @var{num} bytes into the small data or BSS sections instead of
21177 the normal data or BSS section. By default, @var{num} is 8. The
21178 @option{-G @var{num}} switch is also passed to the linker.
21179 All modules should be compiled with the same @option{-G @var{num}} value.
21180
21181 @item -mregnames
21182 @itemx -mno-regnames
21183 @opindex mregnames
21184 @opindex mno-regnames
21185 On System V.4 and embedded PowerPC systems do (do not) emit register
21186 names in the assembly language output using symbolic forms.
21187
21188 @item -mlongcall
21189 @itemx -mno-longcall
21190 @opindex mlongcall
21191 @opindex mno-longcall
21192 By default assume that all calls are far away so that a longer and more
21193 expensive calling sequence is required. This is required for calls
21194 farther than 32 megabytes (33,554,432 bytes) from the current location.
21195 A short call is generated if the compiler knows
21196 the call cannot be that far away. This setting can be overridden by
21197 the @code{shortcall} function attribute, or by @code{#pragma
21198 longcall(0)}.
21199
21200 Some linkers are capable of detecting out-of-range calls and generating
21201 glue code on the fly. On these systems, long calls are unnecessary and
21202 generate slower code. As of this writing, the AIX linker can do this,
21203 as can the GNU linker for PowerPC/64. It is planned to add this feature
21204 to the GNU linker for 32-bit PowerPC systems as well.
21205
21206 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
21207 callee, L42}, plus a @dfn{branch island} (glue code). The two target
21208 addresses represent the callee and the branch island. The
21209 Darwin/PPC linker prefers the first address and generates a @code{bl
21210 callee} if the PPC @code{bl} instruction reaches the callee directly;
21211 otherwise, the linker generates @code{bl L42} to call the branch
21212 island. The branch island is appended to the body of the
21213 calling function; it computes the full 32-bit address of the callee
21214 and jumps to it.
21215
21216 On Mach-O (Darwin) systems, this option directs the compiler emit to
21217 the glue for every direct call, and the Darwin linker decides whether
21218 to use or discard it.
21219
21220 In the future, GCC may ignore all longcall specifications
21221 when the linker is known to generate glue.
21222
21223 @item -mtls-markers
21224 @itemx -mno-tls-markers
21225 @opindex mtls-markers
21226 @opindex mno-tls-markers
21227 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
21228 specifying the function argument. The relocation allows the linker to
21229 reliably associate function call with argument setup instructions for
21230 TLS optimization, which in turn allows GCC to better schedule the
21231 sequence.
21232
21233 @item -pthread
21234 @opindex pthread
21235 Adds support for multithreading with the @dfn{pthreads} library.
21236 This option sets flags for both the preprocessor and linker.
21237
21238 @item -mrecip
21239 @itemx -mno-recip
21240 @opindex mrecip
21241 This option enables use of the reciprocal estimate and
21242 reciprocal square root estimate instructions with additional
21243 Newton-Raphson steps to increase precision instead of doing a divide or
21244 square root and divide for floating-point arguments. You should use
21245 the @option{-ffast-math} option when using @option{-mrecip} (or at
21246 least @option{-funsafe-math-optimizations},
21247 @option{-ffinite-math-only}, @option{-freciprocal-math} and
21248 @option{-fno-trapping-math}). Note that while the throughput of the
21249 sequence is generally higher than the throughput of the non-reciprocal
21250 instruction, the precision of the sequence can be decreased by up to 2
21251 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
21252 roots.
21253
21254 @item -mrecip=@var{opt}
21255 @opindex mrecip=opt
21256 This option controls which reciprocal estimate instructions
21257 may be used. @var{opt} is a comma-separated list of options, which may
21258 be preceded by a @code{!} to invert the option:
21259
21260 @table @samp
21261
21262 @item all
21263 Enable all estimate instructions.
21264
21265 @item default
21266 Enable the default instructions, equivalent to @option{-mrecip}.
21267
21268 @item none
21269 Disable all estimate instructions, equivalent to @option{-mno-recip}.
21270
21271 @item div
21272 Enable the reciprocal approximation instructions for both
21273 single and double precision.
21274
21275 @item divf
21276 Enable the single-precision reciprocal approximation instructions.
21277
21278 @item divd
21279 Enable the double-precision reciprocal approximation instructions.
21280
21281 @item rsqrt
21282 Enable the reciprocal square root approximation instructions for both
21283 single and double precision.
21284
21285 @item rsqrtf
21286 Enable the single-precision reciprocal square root approximation instructions.
21287
21288 @item rsqrtd
21289 Enable the double-precision reciprocal square root approximation instructions.
21290
21291 @end table
21292
21293 So, for example, @option{-mrecip=all,!rsqrtd} enables
21294 all of the reciprocal estimate instructions, except for the
21295 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
21296 which handle the double-precision reciprocal square root calculations.
21297
21298 @item -mrecip-precision
21299 @itemx -mno-recip-precision
21300 @opindex mrecip-precision
21301 Assume (do not assume) that the reciprocal estimate instructions
21302 provide higher-precision estimates than is mandated by the PowerPC
21303 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
21304 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
21305 The double-precision square root estimate instructions are not generated by
21306 default on low-precision machines, since they do not provide an
21307 estimate that converges after three steps.
21308
21309 @item -mveclibabi=@var{type}
21310 @opindex mveclibabi
21311 Specifies the ABI type to use for vectorizing intrinsics using an
21312 external library. The only type supported at present is @samp{mass},
21313 which specifies to use IBM's Mathematical Acceleration Subsystem
21314 (MASS) libraries for vectorizing intrinsics using external libraries.
21315 GCC currently emits calls to @code{acosd2}, @code{acosf4},
21316 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
21317 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
21318 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
21319 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
21320 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
21321 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
21322 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
21323 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
21324 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
21325 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
21326 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
21327 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
21328 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
21329 for power7. Both @option{-ftree-vectorize} and
21330 @option{-funsafe-math-optimizations} must also be enabled. The MASS
21331 libraries must be specified at link time.
21332
21333 @item -mfriz
21334 @itemx -mno-friz
21335 @opindex mfriz
21336 Generate (do not generate) the @code{friz} instruction when the
21337 @option{-funsafe-math-optimizations} option is used to optimize
21338 rounding of floating-point values to 64-bit integer and back to floating
21339 point. The @code{friz} instruction does not return the same value if
21340 the floating-point number is too large to fit in an integer.
21341
21342 @item -mpointers-to-nested-functions
21343 @itemx -mno-pointers-to-nested-functions
21344 @opindex mpointers-to-nested-functions
21345 Generate (do not generate) code to load up the static chain register
21346 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
21347 systems where a function pointer points to a 3-word descriptor giving
21348 the function address, TOC value to be loaded in register @code{r2}, and
21349 static chain value to be loaded in register @code{r11}. The
21350 @option{-mpointers-to-nested-functions} is on by default. You cannot
21351 call through pointers to nested functions or pointers
21352 to functions compiled in other languages that use the static chain if
21353 you use @option{-mno-pointers-to-nested-functions}.
21354
21355 @item -msave-toc-indirect
21356 @itemx -mno-save-toc-indirect
21357 @opindex msave-toc-indirect
21358 Generate (do not generate) code to save the TOC value in the reserved
21359 stack location in the function prologue if the function calls through
21360 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
21361 saved in the prologue, it is saved just before the call through the
21362 pointer. The @option{-mno-save-toc-indirect} option is the default.
21363
21364 @item -mcompat-align-parm
21365 @itemx -mno-compat-align-parm
21366 @opindex mcompat-align-parm
21367 Generate (do not generate) code to pass structure parameters with a
21368 maximum alignment of 64 bits, for compatibility with older versions
21369 of GCC.
21370
21371 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
21372 structure parameter on a 128-bit boundary when that structure contained
21373 a member requiring 128-bit alignment. This is corrected in more
21374 recent versions of GCC. This option may be used to generate code
21375 that is compatible with functions compiled with older versions of
21376 GCC.
21377
21378 The @option{-mno-compat-align-parm} option is the default.
21379 @end table
21380
21381 @node RX Options
21382 @subsection RX Options
21383 @cindex RX Options
21384
21385 These command-line options are defined for RX targets:
21386
21387 @table @gcctabopt
21388 @item -m64bit-doubles
21389 @itemx -m32bit-doubles
21390 @opindex m64bit-doubles
21391 @opindex m32bit-doubles
21392 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
21393 or 32 bits (@option{-m32bit-doubles}) in size. The default is
21394 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
21395 works on 32-bit values, which is why the default is
21396 @option{-m32bit-doubles}.
21397
21398 @item -fpu
21399 @itemx -nofpu
21400 @opindex fpu
21401 @opindex nofpu
21402 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
21403 floating-point hardware. The default is enabled for the RX600
21404 series and disabled for the RX200 series.
21405
21406 Floating-point instructions are only generated for 32-bit floating-point
21407 values, however, so the FPU hardware is not used for doubles if the
21408 @option{-m64bit-doubles} option is used.
21409
21410 @emph{Note} If the @option{-fpu} option is enabled then
21411 @option{-funsafe-math-optimizations} is also enabled automatically.
21412 This is because the RX FPU instructions are themselves unsafe.
21413
21414 @item -mcpu=@var{name}
21415 @opindex mcpu
21416 Selects the type of RX CPU to be targeted. Currently three types are
21417 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
21418 the specific @samp{RX610} CPU. The default is @samp{RX600}.
21419
21420 The only difference between @samp{RX600} and @samp{RX610} is that the
21421 @samp{RX610} does not support the @code{MVTIPL} instruction.
21422
21423 The @samp{RX200} series does not have a hardware floating-point unit
21424 and so @option{-nofpu} is enabled by default when this type is
21425 selected.
21426
21427 @item -mbig-endian-data
21428 @itemx -mlittle-endian-data
21429 @opindex mbig-endian-data
21430 @opindex mlittle-endian-data
21431 Store data (but not code) in the big-endian format. The default is
21432 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
21433 format.
21434
21435 @item -msmall-data-limit=@var{N}
21436 @opindex msmall-data-limit
21437 Specifies the maximum size in bytes of global and static variables
21438 which can be placed into the small data area. Using the small data
21439 area can lead to smaller and faster code, but the size of area is
21440 limited and it is up to the programmer to ensure that the area does
21441 not overflow. Also when the small data area is used one of the RX's
21442 registers (usually @code{r13}) is reserved for use pointing to this
21443 area, so it is no longer available for use by the compiler. This
21444 could result in slower and/or larger code if variables are pushed onto
21445 the stack instead of being held in this register.
21446
21447 Note, common variables (variables that have not been initialized) and
21448 constants are not placed into the small data area as they are assigned
21449 to other sections in the output executable.
21450
21451 The default value is zero, which disables this feature. Note, this
21452 feature is not enabled by default with higher optimization levels
21453 (@option{-O2} etc) because of the potentially detrimental effects of
21454 reserving a register. It is up to the programmer to experiment and
21455 discover whether this feature is of benefit to their program. See the
21456 description of the @option{-mpid} option for a description of how the
21457 actual register to hold the small data area pointer is chosen.
21458
21459 @item -msim
21460 @itemx -mno-sim
21461 @opindex msim
21462 @opindex mno-sim
21463 Use the simulator runtime. The default is to use the libgloss
21464 board-specific runtime.
21465
21466 @item -mas100-syntax
21467 @itemx -mno-as100-syntax
21468 @opindex mas100-syntax
21469 @opindex mno-as100-syntax
21470 When generating assembler output use a syntax that is compatible with
21471 Renesas's AS100 assembler. This syntax can also be handled by the GAS
21472 assembler, but it has some restrictions so it is not generated by default.
21473
21474 @item -mmax-constant-size=@var{N}
21475 @opindex mmax-constant-size
21476 Specifies the maximum size, in bytes, of a constant that can be used as
21477 an operand in a RX instruction. Although the RX instruction set does
21478 allow constants of up to 4 bytes in length to be used in instructions,
21479 a longer value equates to a longer instruction. Thus in some
21480 circumstances it can be beneficial to restrict the size of constants
21481 that are used in instructions. Constants that are too big are instead
21482 placed into a constant pool and referenced via register indirection.
21483
21484 The value @var{N} can be between 0 and 4. A value of 0 (the default)
21485 or 4 means that constants of any size are allowed.
21486
21487 @item -mrelax
21488 @opindex mrelax
21489 Enable linker relaxation. Linker relaxation is a process whereby the
21490 linker attempts to reduce the size of a program by finding shorter
21491 versions of various instructions. Disabled by default.
21492
21493 @item -mint-register=@var{N}
21494 @opindex mint-register
21495 Specify the number of registers to reserve for fast interrupt handler
21496 functions. The value @var{N} can be between 0 and 4. A value of 1
21497 means that register @code{r13} is reserved for the exclusive use
21498 of fast interrupt handlers. A value of 2 reserves @code{r13} and
21499 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
21500 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
21501 A value of 0, the default, does not reserve any registers.
21502
21503 @item -msave-acc-in-interrupts
21504 @opindex msave-acc-in-interrupts
21505 Specifies that interrupt handler functions should preserve the
21506 accumulator register. This is only necessary if normal code might use
21507 the accumulator register, for example because it performs 64-bit
21508 multiplications. The default is to ignore the accumulator as this
21509 makes the interrupt handlers faster.
21510
21511 @item -mpid
21512 @itemx -mno-pid
21513 @opindex mpid
21514 @opindex mno-pid
21515 Enables the generation of position independent data. When enabled any
21516 access to constant data is done via an offset from a base address
21517 held in a register. This allows the location of constant data to be
21518 determined at run time without requiring the executable to be
21519 relocated, which is a benefit to embedded applications with tight
21520 memory constraints. Data that can be modified is not affected by this
21521 option.
21522
21523 Note, using this feature reserves a register, usually @code{r13}, for
21524 the constant data base address. This can result in slower and/or
21525 larger code, especially in complicated functions.
21526
21527 The actual register chosen to hold the constant data base address
21528 depends upon whether the @option{-msmall-data-limit} and/or the
21529 @option{-mint-register} command-line options are enabled. Starting
21530 with register @code{r13} and proceeding downwards, registers are
21531 allocated first to satisfy the requirements of @option{-mint-register},
21532 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
21533 is possible for the small data area register to be @code{r8} if both
21534 @option{-mint-register=4} and @option{-mpid} are specified on the
21535 command line.
21536
21537 By default this feature is not enabled. The default can be restored
21538 via the @option{-mno-pid} command-line option.
21539
21540 @item -mno-warn-multiple-fast-interrupts
21541 @itemx -mwarn-multiple-fast-interrupts
21542 @opindex mno-warn-multiple-fast-interrupts
21543 @opindex mwarn-multiple-fast-interrupts
21544 Prevents GCC from issuing a warning message if it finds more than one
21545 fast interrupt handler when it is compiling a file. The default is to
21546 issue a warning for each extra fast interrupt handler found, as the RX
21547 only supports one such interrupt.
21548
21549 @item -mallow-string-insns
21550 @itemx -mno-allow-string-insns
21551 @opindex mallow-string-insns
21552 @opindex mno-allow-string-insns
21553 Enables or disables the use of the string manipulation instructions
21554 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
21555 @code{SWHILE} and also the @code{RMPA} instruction. These
21556 instructions may prefetch data, which is not safe to do if accessing
21557 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
21558 for more information).
21559
21560 The default is to allow these instructions, but it is not possible for
21561 GCC to reliably detect all circumstances where a string instruction
21562 might be used to access an I/O register, so their use cannot be
21563 disabled automatically. Instead it is reliant upon the programmer to
21564 use the @option{-mno-allow-string-insns} option if their program
21565 accesses I/O space.
21566
21567 When the instructions are enabled GCC defines the C preprocessor
21568 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
21569 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
21570
21571 @item -mjsr
21572 @itemx -mno-jsr
21573 @opindex mjsr
21574 @opindex mno-jsr
21575 Use only (or not only) @code{JSR} instructions to access functions.
21576 This option can be used when code size exceeds the range of @code{BSR}
21577 instructions. Note that @option{-mno-jsr} does not mean to not use
21578 @code{JSR} but instead means that any type of branch may be used.
21579 @end table
21580
21581 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
21582 has special significance to the RX port when used with the
21583 @code{interrupt} function attribute. This attribute indicates a
21584 function intended to process fast interrupts. GCC ensures
21585 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
21586 and/or @code{r13} and only provided that the normal use of the
21587 corresponding registers have been restricted via the
21588 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
21589 options.
21590
21591 @node S/390 and zSeries Options
21592 @subsection S/390 and zSeries Options
21593 @cindex S/390 and zSeries Options
21594
21595 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
21596
21597 @table @gcctabopt
21598 @item -mhard-float
21599 @itemx -msoft-float
21600 @opindex mhard-float
21601 @opindex msoft-float
21602 Use (do not use) the hardware floating-point instructions and registers
21603 for floating-point operations. When @option{-msoft-float} is specified,
21604 functions in @file{libgcc.a} are used to perform floating-point
21605 operations. When @option{-mhard-float} is specified, the compiler
21606 generates IEEE floating-point instructions. This is the default.
21607
21608 @item -mhard-dfp
21609 @itemx -mno-hard-dfp
21610 @opindex mhard-dfp
21611 @opindex mno-hard-dfp
21612 Use (do not use) the hardware decimal-floating-point instructions for
21613 decimal-floating-point operations. When @option{-mno-hard-dfp} is
21614 specified, functions in @file{libgcc.a} are used to perform
21615 decimal-floating-point operations. When @option{-mhard-dfp} is
21616 specified, the compiler generates decimal-floating-point hardware
21617 instructions. This is the default for @option{-march=z9-ec} or higher.
21618
21619 @item -mlong-double-64
21620 @itemx -mlong-double-128
21621 @opindex mlong-double-64
21622 @opindex mlong-double-128
21623 These switches control the size of @code{long double} type. A size
21624 of 64 bits makes the @code{long double} type equivalent to the @code{double}
21625 type. This is the default.
21626
21627 @item -mbackchain
21628 @itemx -mno-backchain
21629 @opindex mbackchain
21630 @opindex mno-backchain
21631 Store (do not store) the address of the caller's frame as backchain pointer
21632 into the callee's stack frame.
21633 A backchain may be needed to allow debugging using tools that do not understand
21634 DWARF call frame information.
21635 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
21636 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
21637 the backchain is placed into the topmost word of the 96/160 byte register
21638 save area.
21639
21640 In general, code compiled with @option{-mbackchain} is call-compatible with
21641 code compiled with @option{-mmo-backchain}; however, use of the backchain
21642 for debugging purposes usually requires that the whole binary is built with
21643 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
21644 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21645 to build a linux kernel use @option{-msoft-float}.
21646
21647 The default is to not maintain the backchain.
21648
21649 @item -mpacked-stack
21650 @itemx -mno-packed-stack
21651 @opindex mpacked-stack
21652 @opindex mno-packed-stack
21653 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
21654 specified, the compiler uses the all fields of the 96/160 byte register save
21655 area only for their default purpose; unused fields still take up stack space.
21656 When @option{-mpacked-stack} is specified, register save slots are densely
21657 packed at the top of the register save area; unused space is reused for other
21658 purposes, allowing for more efficient use of the available stack space.
21659 However, when @option{-mbackchain} is also in effect, the topmost word of
21660 the save area is always used to store the backchain, and the return address
21661 register is always saved two words below the backchain.
21662
21663 As long as the stack frame backchain is not used, code generated with
21664 @option{-mpacked-stack} is call-compatible with code generated with
21665 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
21666 S/390 or zSeries generated code that uses the stack frame backchain at run
21667 time, not just for debugging purposes. Such code is not call-compatible
21668 with code compiled with @option{-mpacked-stack}. Also, note that the
21669 combination of @option{-mbackchain},
21670 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21671 to build a linux kernel use @option{-msoft-float}.
21672
21673 The default is to not use the packed stack layout.
21674
21675 @item -msmall-exec
21676 @itemx -mno-small-exec
21677 @opindex msmall-exec
21678 @opindex mno-small-exec
21679 Generate (or do not generate) code using the @code{bras} instruction
21680 to do subroutine calls.
21681 This only works reliably if the total executable size does not
21682 exceed 64k. The default is to use the @code{basr} instruction instead,
21683 which does not have this limitation.
21684
21685 @item -m64
21686 @itemx -m31
21687 @opindex m64
21688 @opindex m31
21689 When @option{-m31} is specified, generate code compliant to the
21690 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
21691 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
21692 particular to generate 64-bit instructions. For the @samp{s390}
21693 targets, the default is @option{-m31}, while the @samp{s390x}
21694 targets default to @option{-m64}.
21695
21696 @item -mzarch
21697 @itemx -mesa
21698 @opindex mzarch
21699 @opindex mesa
21700 When @option{-mzarch} is specified, generate code using the
21701 instructions available on z/Architecture.
21702 When @option{-mesa} is specified, generate code using the
21703 instructions available on ESA/390. Note that @option{-mesa} is
21704 not possible with @option{-m64}.
21705 When generating code compliant to the GNU/Linux for S/390 ABI,
21706 the default is @option{-mesa}. When generating code compliant
21707 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
21708
21709 @item -mhtm
21710 @itemx -mno-htm
21711 @opindex mhtm
21712 @opindex mno-htm
21713 The @option{-mhtm} option enables a set of builtins making use of
21714 instructions available with the transactional execution facility
21715 introduced with the IBM zEnterprise EC12 machine generation
21716 @ref{S/390 System z Built-in Functions}.
21717 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
21718
21719 @item -mvx
21720 @itemx -mno-vx
21721 @opindex mvx
21722 @opindex mno-vx
21723 When @option{-mvx} is specified, generate code using the instructions
21724 available with the vector extension facility introduced with the IBM
21725 z13 machine generation.
21726 This option changes the ABI for some vector type values with regard to
21727 alignment and calling conventions. In case vector type values are
21728 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
21729 command will be added to mark the resulting binary with the ABI used.
21730 @option{-mvx} is enabled by default when using @option{-march=z13}.
21731
21732 @item -mzvector
21733 @itemx -mno-zvector
21734 @opindex mzvector
21735 @opindex mno-zvector
21736 The @option{-mzvector} option enables vector language extensions and
21737 builtins using instructions available with the vector extension
21738 facility introduced with the IBM z13 machine generation.
21739 This option adds support for @samp{vector} to be used as a keyword to
21740 define vector type variables and arguments. @samp{vector} is only
21741 available when GNU extensions are enabled. It will not be expanded
21742 when requesting strict standard compliance e.g. with @option{-std=c99}.
21743 In addition to the GCC low-level builtins @option{-mzvector} enables
21744 a set of builtins added for compatibility with AltiVec-style
21745 implementations like Power and Cell. In order to make use of these
21746 builtins the header file @file{vecintrin.h} needs to be included.
21747 @option{-mzvector} is disabled by default.
21748
21749 @item -mmvcle
21750 @itemx -mno-mvcle
21751 @opindex mmvcle
21752 @opindex mno-mvcle
21753 Generate (or do not generate) code using the @code{mvcle} instruction
21754 to perform block moves. When @option{-mno-mvcle} is specified,
21755 use a @code{mvc} loop instead. This is the default unless optimizing for
21756 size.
21757
21758 @item -mdebug
21759 @itemx -mno-debug
21760 @opindex mdebug
21761 @opindex mno-debug
21762 Print (or do not print) additional debug information when compiling.
21763 The default is to not print debug information.
21764
21765 @item -march=@var{cpu-type}
21766 @opindex march
21767 Generate code that runs on @var{cpu-type}, which is the name of a
21768 system representing a certain processor type. Possible values for
21769 @var{cpu-type} are @samp{z900}, @samp{z990}, @samp{z9-109},
21770 @samp{z9-ec}, @samp{z10}, @samp{z196}, @samp{zEC12}, and @samp{z13}.
21771 The default is @option{-march=z900}. @samp{g5} and @samp{g6} are
21772 deprecated and will be removed with future releases.
21773
21774 @item -mtune=@var{cpu-type}
21775 @opindex mtune
21776 Tune to @var{cpu-type} everything applicable about the generated code,
21777 except for the ABI and the set of available instructions.
21778 The list of @var{cpu-type} values is the same as for @option{-march}.
21779 The default is the value used for @option{-march}.
21780
21781 @item -mtpf-trace
21782 @itemx -mno-tpf-trace
21783 @opindex mtpf-trace
21784 @opindex mno-tpf-trace
21785 Generate code that adds (does not add) in TPF OS specific branches to trace
21786 routines in the operating system. This option is off by default, even
21787 when compiling for the TPF OS@.
21788
21789 @item -mfused-madd
21790 @itemx -mno-fused-madd
21791 @opindex mfused-madd
21792 @opindex mno-fused-madd
21793 Generate code that uses (does not use) the floating-point multiply and
21794 accumulate instructions. These instructions are generated by default if
21795 hardware floating point is used.
21796
21797 @item -mwarn-framesize=@var{framesize}
21798 @opindex mwarn-framesize
21799 Emit a warning if the current function exceeds the given frame size. Because
21800 this is a compile-time check it doesn't need to be a real problem when the program
21801 runs. It is intended to identify functions that most probably cause
21802 a stack overflow. It is useful to be used in an environment with limited stack
21803 size e.g.@: the linux kernel.
21804
21805 @item -mwarn-dynamicstack
21806 @opindex mwarn-dynamicstack
21807 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
21808 arrays. This is generally a bad idea with a limited stack size.
21809
21810 @item -mstack-guard=@var{stack-guard}
21811 @itemx -mstack-size=@var{stack-size}
21812 @opindex mstack-guard
21813 @opindex mstack-size
21814 If these options are provided the S/390 back end emits additional instructions in
21815 the function prologue that trigger a trap if the stack size is @var{stack-guard}
21816 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
21817 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
21818 the frame size of the compiled function is chosen.
21819 These options are intended to be used to help debugging stack overflow problems.
21820 The additionally emitted code causes only little overhead and hence can also be
21821 used in production-like systems without greater performance degradation. The given
21822 values have to be exact powers of 2 and @var{stack-size} has to be greater than
21823 @var{stack-guard} without exceeding 64k.
21824 In order to be efficient the extra code makes the assumption that the stack starts
21825 at an address aligned to the value given by @var{stack-size}.
21826 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
21827
21828 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
21829 @opindex mhotpatch
21830 If the hotpatch option is enabled, a ``hot-patching'' function
21831 prologue is generated for all functions in the compilation unit.
21832 The funtion label is prepended with the given number of two-byte
21833 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
21834 the label, 2 * @var{post-halfwords} bytes are appended, using the
21835 largest NOP like instructions the architecture allows (maximum
21836 1000000).
21837
21838 If both arguments are zero, hotpatching is disabled.
21839
21840 This option can be overridden for individual functions with the
21841 @code{hotpatch} attribute.
21842 @end table
21843
21844 @node Score Options
21845 @subsection Score Options
21846 @cindex Score Options
21847
21848 These options are defined for Score implementations:
21849
21850 @table @gcctabopt
21851 @item -meb
21852 @opindex meb
21853 Compile code for big-endian mode. This is the default.
21854
21855 @item -mel
21856 @opindex mel
21857 Compile code for little-endian mode.
21858
21859 @item -mnhwloop
21860 @opindex mnhwloop
21861 Disable generation of @code{bcnz} instructions.
21862
21863 @item -muls
21864 @opindex muls
21865 Enable generation of unaligned load and store instructions.
21866
21867 @item -mmac
21868 @opindex mmac
21869 Enable the use of multiply-accumulate instructions. Disabled by default.
21870
21871 @item -mscore5
21872 @opindex mscore5
21873 Specify the SCORE5 as the target architecture.
21874
21875 @item -mscore5u
21876 @opindex mscore5u
21877 Specify the SCORE5U of the target architecture.
21878
21879 @item -mscore7
21880 @opindex mscore7
21881 Specify the SCORE7 as the target architecture. This is the default.
21882
21883 @item -mscore7d
21884 @opindex mscore7d
21885 Specify the SCORE7D as the target architecture.
21886 @end table
21887
21888 @node SH Options
21889 @subsection SH Options
21890
21891 These @samp{-m} options are defined for the SH implementations:
21892
21893 @table @gcctabopt
21894 @item -m1
21895 @opindex m1
21896 Generate code for the SH1.
21897
21898 @item -m2
21899 @opindex m2
21900 Generate code for the SH2.
21901
21902 @item -m2e
21903 Generate code for the SH2e.
21904
21905 @item -m2a-nofpu
21906 @opindex m2a-nofpu
21907 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
21908 that the floating-point unit is not used.
21909
21910 @item -m2a-single-only
21911 @opindex m2a-single-only
21912 Generate code for the SH2a-FPU, in such a way that no double-precision
21913 floating-point operations are used.
21914
21915 @item -m2a-single
21916 @opindex m2a-single
21917 Generate code for the SH2a-FPU assuming the floating-point unit is in
21918 single-precision mode by default.
21919
21920 @item -m2a
21921 @opindex m2a
21922 Generate code for the SH2a-FPU assuming the floating-point unit is in
21923 double-precision mode by default.
21924
21925 @item -m3
21926 @opindex m3
21927 Generate code for the SH3.
21928
21929 @item -m3e
21930 @opindex m3e
21931 Generate code for the SH3e.
21932
21933 @item -m4-nofpu
21934 @opindex m4-nofpu
21935 Generate code for the SH4 without a floating-point unit.
21936
21937 @item -m4-single-only
21938 @opindex m4-single-only
21939 Generate code for the SH4 with a floating-point unit that only
21940 supports single-precision arithmetic.
21941
21942 @item -m4-single
21943 @opindex m4-single
21944 Generate code for the SH4 assuming the floating-point unit is in
21945 single-precision mode by default.
21946
21947 @item -m4
21948 @opindex m4
21949 Generate code for the SH4.
21950
21951 @item -m4-100
21952 @opindex m4-100
21953 Generate code for SH4-100.
21954
21955 @item -m4-100-nofpu
21956 @opindex m4-100-nofpu
21957 Generate code for SH4-100 in such a way that the
21958 floating-point unit is not used.
21959
21960 @item -m4-100-single
21961 @opindex m4-100-single
21962 Generate code for SH4-100 assuming the floating-point unit is in
21963 single-precision mode by default.
21964
21965 @item -m4-100-single-only
21966 @opindex m4-100-single-only
21967 Generate code for SH4-100 in such a way that no double-precision
21968 floating-point operations are used.
21969
21970 @item -m4-200
21971 @opindex m4-200
21972 Generate code for SH4-200.
21973
21974 @item -m4-200-nofpu
21975 @opindex m4-200-nofpu
21976 Generate code for SH4-200 without in such a way that the
21977 floating-point unit is not used.
21978
21979 @item -m4-200-single
21980 @opindex m4-200-single
21981 Generate code for SH4-200 assuming the floating-point unit is in
21982 single-precision mode by default.
21983
21984 @item -m4-200-single-only
21985 @opindex m4-200-single-only
21986 Generate code for SH4-200 in such a way that no double-precision
21987 floating-point operations are used.
21988
21989 @item -m4-300
21990 @opindex m4-300
21991 Generate code for SH4-300.
21992
21993 @item -m4-300-nofpu
21994 @opindex m4-300-nofpu
21995 Generate code for SH4-300 without in such a way that the
21996 floating-point unit is not used.
21997
21998 @item -m4-300-single
21999 @opindex m4-300-single
22000 Generate code for SH4-300 in such a way that no double-precision
22001 floating-point operations are used.
22002
22003 @item -m4-300-single-only
22004 @opindex m4-300-single-only
22005 Generate code for SH4-300 in such a way that no double-precision
22006 floating-point operations are used.
22007
22008 @item -m4-340
22009 @opindex m4-340
22010 Generate code for SH4-340 (no MMU, no FPU).
22011
22012 @item -m4-500
22013 @opindex m4-500
22014 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
22015 assembler.
22016
22017 @item -m4a-nofpu
22018 @opindex m4a-nofpu
22019 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
22020 floating-point unit is not used.
22021
22022 @item -m4a-single-only
22023 @opindex m4a-single-only
22024 Generate code for the SH4a, in such a way that no double-precision
22025 floating-point operations are used.
22026
22027 @item -m4a-single
22028 @opindex m4a-single
22029 Generate code for the SH4a assuming the floating-point unit is in
22030 single-precision mode by default.
22031
22032 @item -m4a
22033 @opindex m4a
22034 Generate code for the SH4a.
22035
22036 @item -m4al
22037 @opindex m4al
22038 Same as @option{-m4a-nofpu}, except that it implicitly passes
22039 @option{-dsp} to the assembler. GCC doesn't generate any DSP
22040 instructions at the moment.
22041
22042 @item -mb
22043 @opindex mb
22044 Compile code for the processor in big-endian mode.
22045
22046 @item -ml
22047 @opindex ml
22048 Compile code for the processor in little-endian mode.
22049
22050 @item -mdalign
22051 @opindex mdalign
22052 Align doubles at 64-bit boundaries. Note that this changes the calling
22053 conventions, and thus some functions from the standard C library do
22054 not work unless you recompile it first with @option{-mdalign}.
22055
22056 @item -mrelax
22057 @opindex mrelax
22058 Shorten some address references at link time, when possible; uses the
22059 linker option @option{-relax}.
22060
22061 @item -mbigtable
22062 @opindex mbigtable
22063 Use 32-bit offsets in @code{switch} tables. The default is to use
22064 16-bit offsets.
22065
22066 @item -mbitops
22067 @opindex mbitops
22068 Enable the use of bit manipulation instructions on SH2A.
22069
22070 @item -mfmovd
22071 @opindex mfmovd
22072 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
22073 alignment constraints.
22074
22075 @item -mrenesas
22076 @opindex mrenesas
22077 Comply with the calling conventions defined by Renesas.
22078
22079 @item -mno-renesas
22080 @opindex mno-renesas
22081 Comply with the calling conventions defined for GCC before the Renesas
22082 conventions were available. This option is the default for all
22083 targets of the SH toolchain.
22084
22085 @item -mnomacsave
22086 @opindex mnomacsave
22087 Mark the @code{MAC} register as call-clobbered, even if
22088 @option{-mrenesas} is given.
22089
22090 @item -mieee
22091 @itemx -mno-ieee
22092 @opindex mieee
22093 @opindex mno-ieee
22094 Control the IEEE compliance of floating-point comparisons, which affects the
22095 handling of cases where the result of a comparison is unordered. By default
22096 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
22097 enabled @option{-mno-ieee} is implicitly set, which results in faster
22098 floating-point greater-equal and less-equal comparisons. The implicit settings
22099 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
22100
22101 @item -minline-ic_invalidate
22102 @opindex minline-ic_invalidate
22103 Inline code to invalidate instruction cache entries after setting up
22104 nested function trampolines.
22105 This option has no effect if @option{-musermode} is in effect and the selected
22106 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
22107 instruction.
22108 If the selected code generation option does not allow the use of the @code{icbi}
22109 instruction, and @option{-musermode} is not in effect, the inlined code
22110 manipulates the instruction cache address array directly with an associative
22111 write. This not only requires privileged mode at run time, but it also
22112 fails if the cache line had been mapped via the TLB and has become unmapped.
22113
22114 @item -misize
22115 @opindex misize
22116 Dump instruction size and location in the assembly code.
22117
22118 @item -mpadstruct
22119 @opindex mpadstruct
22120 This option is deprecated. It pads structures to multiple of 4 bytes,
22121 which is incompatible with the SH ABI@.
22122
22123 @item -matomic-model=@var{model}
22124 @opindex matomic-model=@var{model}
22125 Sets the model of atomic operations and additional parameters as a comma
22126 separated list. For details on the atomic built-in functions see
22127 @ref{__atomic Builtins}. The following models and parameters are supported:
22128
22129 @table @samp
22130
22131 @item none
22132 Disable compiler generated atomic sequences and emit library calls for atomic
22133 operations. This is the default if the target is not @code{sh*-*-linux*}.
22134
22135 @item soft-gusa
22136 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
22137 built-in functions. The generated atomic sequences require additional support
22138 from the interrupt/exception handling code of the system and are only suitable
22139 for SH3* and SH4* single-core systems. This option is enabled by default when
22140 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
22141 this option also partially utilizes the hardware atomic instructions
22142 @code{movli.l} and @code{movco.l} to create more efficient code, unless
22143 @samp{strict} is specified.
22144
22145 @item soft-tcb
22146 Generate software atomic sequences that use a variable in the thread control
22147 block. This is a variation of the gUSA sequences which can also be used on
22148 SH1* and SH2* targets. The generated atomic sequences require additional
22149 support from the interrupt/exception handling code of the system and are only
22150 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
22151 parameter has to be specified as well.
22152
22153 @item soft-imask
22154 Generate software atomic sequences that temporarily disable interrupts by
22155 setting @code{SR.IMASK = 1111}. This model works only when the program runs
22156 in privileged mode and is only suitable for single-core systems. Additional
22157 support from the interrupt/exception handling code of the system is not
22158 required. This model is enabled by default when the target is
22159 @code{sh*-*-linux*} and SH1* or SH2*.
22160
22161 @item hard-llcs
22162 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
22163 instructions only. This is only available on SH4A and is suitable for
22164 multi-core systems. Since the hardware instructions support only 32 bit atomic
22165 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
22166 Code compiled with this option is also compatible with other software
22167 atomic model interrupt/exception handling systems if executed on an SH4A
22168 system. Additional support from the interrupt/exception handling code of the
22169 system is not required for this model.
22170
22171 @item gbr-offset=
22172 This parameter specifies the offset in bytes of the variable in the thread
22173 control block structure that should be used by the generated atomic sequences
22174 when the @samp{soft-tcb} model has been selected. For other models this
22175 parameter is ignored. The specified value must be an integer multiple of four
22176 and in the range 0-1020.
22177
22178 @item strict
22179 This parameter prevents mixed usage of multiple atomic models, even if they
22180 are compatible, and makes the compiler generate atomic sequences of the
22181 specified model only.
22182
22183 @end table
22184
22185 @item -mtas
22186 @opindex mtas
22187 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
22188 Notice that depending on the particular hardware and software configuration
22189 this can degrade overall performance due to the operand cache line flushes
22190 that are implied by the @code{tas.b} instruction. On multi-core SH4A
22191 processors the @code{tas.b} instruction must be used with caution since it
22192 can result in data corruption for certain cache configurations.
22193
22194 @item -mprefergot
22195 @opindex mprefergot
22196 When generating position-independent code, emit function calls using
22197 the Global Offset Table instead of the Procedure Linkage Table.
22198
22199 @item -musermode
22200 @itemx -mno-usermode
22201 @opindex musermode
22202 @opindex mno-usermode
22203 Don't allow (allow) the compiler generating privileged mode code. Specifying
22204 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
22205 inlined code would not work in user mode. @option{-musermode} is the default
22206 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
22207 @option{-musermode} has no effect, since there is no user mode.
22208
22209 @item -multcost=@var{number}
22210 @opindex multcost=@var{number}
22211 Set the cost to assume for a multiply insn.
22212
22213 @item -mdiv=@var{strategy}
22214 @opindex mdiv=@var{strategy}
22215 Set the division strategy to be used for integer division operations.
22216 @var{strategy} can be one of:
22217
22218 @table @samp
22219
22220 @item call-div1
22221 Calls a library function that uses the single-step division instruction
22222 @code{div1} to perform the operation. Division by zero calculates an
22223 unspecified result and does not trap. This is the default except for SH4,
22224 SH2A and SHcompact.
22225
22226 @item call-fp
22227 Calls a library function that performs the operation in double precision
22228 floating point. Division by zero causes a floating-point exception. This is
22229 the default for SHcompact with FPU. Specifying this for targets that do not
22230 have a double precision FPU defaults to @code{call-div1}.
22231
22232 @item call-table
22233 Calls a library function that uses a lookup table for small divisors and
22234 the @code{div1} instruction with case distinction for larger divisors. Division
22235 by zero calculates an unspecified result and does not trap. This is the default
22236 for SH4. Specifying this for targets that do not have dynamic shift
22237 instructions defaults to @code{call-div1}.
22238
22239 @end table
22240
22241 When a division strategy has not been specified the default strategy is
22242 selected based on the current target. For SH2A the default strategy is to
22243 use the @code{divs} and @code{divu} instructions instead of library function
22244 calls.
22245
22246 @item -maccumulate-outgoing-args
22247 @opindex maccumulate-outgoing-args
22248 Reserve space once for outgoing arguments in the function prologue rather
22249 than around each call. Generally beneficial for performance and size. Also
22250 needed for unwinding to avoid changing the stack frame around conditional code.
22251
22252 @item -mdivsi3_libfunc=@var{name}
22253 @opindex mdivsi3_libfunc=@var{name}
22254 Set the name of the library function used for 32-bit signed division to
22255 @var{name}.
22256 This only affects the name used in the @samp{call} division strategies, and
22257 the compiler still expects the same sets of input/output/clobbered registers as
22258 if this option were not present.
22259
22260 @item -mfixed-range=@var{register-range}
22261 @opindex mfixed-range
22262 Generate code treating the given register range as fixed registers.
22263 A fixed register is one that the register allocator can not use. This is
22264 useful when compiling kernel code. A register range is specified as
22265 two registers separated by a dash. Multiple register ranges can be
22266 specified separated by a comma.
22267
22268 @item -mbranch-cost=@var{num}
22269 @opindex mbranch-cost=@var{num}
22270 Assume @var{num} to be the cost for a branch instruction. Higher numbers
22271 make the compiler try to generate more branch-free code if possible.
22272 If not specified the value is selected depending on the processor type that
22273 is being compiled for.
22274
22275 @item -mzdcbranch
22276 @itemx -mno-zdcbranch
22277 @opindex mzdcbranch
22278 @opindex mno-zdcbranch
22279 Assume (do not assume) that zero displacement conditional branch instructions
22280 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
22281 compiler prefers zero displacement branch code sequences. This is
22282 enabled by default when generating code for SH4 and SH4A. It can be explicitly
22283 disabled by specifying @option{-mno-zdcbranch}.
22284
22285 @item -mcbranch-force-delay-slot
22286 @opindex mcbranch-force-delay-slot
22287 Force the usage of delay slots for conditional branches, which stuffs the delay
22288 slot with a @code{nop} if a suitable instruction can't be found. By default
22289 this option is disabled. It can be enabled to work around hardware bugs as
22290 found in the original SH7055.
22291
22292 @item -mfused-madd
22293 @itemx -mno-fused-madd
22294 @opindex mfused-madd
22295 @opindex mno-fused-madd
22296 Generate code that uses (does not use) the floating-point multiply and
22297 accumulate instructions. These instructions are generated by default
22298 if hardware floating point is used. The machine-dependent
22299 @option{-mfused-madd} option is now mapped to the machine-independent
22300 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22301 mapped to @option{-ffp-contract=off}.
22302
22303 @item -mfsca
22304 @itemx -mno-fsca
22305 @opindex mfsca
22306 @opindex mno-fsca
22307 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
22308 and cosine approximations. The option @option{-mfsca} must be used in
22309 combination with @option{-funsafe-math-optimizations}. It is enabled by default
22310 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
22311 approximations even if @option{-funsafe-math-optimizations} is in effect.
22312
22313 @item -mfsrra
22314 @itemx -mno-fsrra
22315 @opindex mfsrra
22316 @opindex mno-fsrra
22317 Allow or disallow the compiler to emit the @code{fsrra} instruction for
22318 reciprocal square root approximations. The option @option{-mfsrra} must be used
22319 in combination with @option{-funsafe-math-optimizations} and
22320 @option{-ffinite-math-only}. It is enabled by default when generating code for
22321 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
22322 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
22323 in effect.
22324
22325 @item -mpretend-cmove
22326 @opindex mpretend-cmove
22327 Prefer zero-displacement conditional branches for conditional move instruction
22328 patterns. This can result in faster code on the SH4 processor.
22329
22330 @item -mfdpic
22331 @opindex fdpic
22332 Generate code using the FDPIC ABI.
22333
22334 @end table
22335
22336 @node Solaris 2 Options
22337 @subsection Solaris 2 Options
22338 @cindex Solaris 2 options
22339
22340 These @samp{-m} options are supported on Solaris 2:
22341
22342 @table @gcctabopt
22343 @item -mclear-hwcap
22344 @opindex mclear-hwcap
22345 @option{-mclear-hwcap} tells the compiler to remove the hardware
22346 capabilities generated by the Solaris assembler. This is only necessary
22347 when object files use ISA extensions not supported by the current
22348 machine, but check at runtime whether or not to use them.
22349
22350 @item -mimpure-text
22351 @opindex mimpure-text
22352 @option{-mimpure-text}, used in addition to @option{-shared}, tells
22353 the compiler to not pass @option{-z text} to the linker when linking a
22354 shared object. Using this option, you can link position-dependent
22355 code into a shared object.
22356
22357 @option{-mimpure-text} suppresses the ``relocations remain against
22358 allocatable but non-writable sections'' linker error message.
22359 However, the necessary relocations trigger copy-on-write, and the
22360 shared object is not actually shared across processes. Instead of
22361 using @option{-mimpure-text}, you should compile all source code with
22362 @option{-fpic} or @option{-fPIC}.
22363
22364 @end table
22365
22366 These switches are supported in addition to the above on Solaris 2:
22367
22368 @table @gcctabopt
22369 @item -pthreads
22370 @opindex pthreads
22371 Add support for multithreading using the POSIX threads library. This
22372 option sets flags for both the preprocessor and linker. This option does
22373 not affect the thread safety of object code produced by the compiler or
22374 that of libraries supplied with it.
22375
22376 @item -pthread
22377 @opindex pthread
22378 This is a synonym for @option{-pthreads}.
22379 @end table
22380
22381 @node SPARC Options
22382 @subsection SPARC Options
22383 @cindex SPARC options
22384
22385 These @samp{-m} options are supported on the SPARC:
22386
22387 @table @gcctabopt
22388 @item -mno-app-regs
22389 @itemx -mapp-regs
22390 @opindex mno-app-regs
22391 @opindex mapp-regs
22392 Specify @option{-mapp-regs} to generate output using the global registers
22393 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
22394 global register 1, each global register 2 through 4 is then treated as an
22395 allocable register that is clobbered by function calls. This is the default.
22396
22397 To be fully SVR4 ABI-compliant at the cost of some performance loss,
22398 specify @option{-mno-app-regs}. You should compile libraries and system
22399 software with this option.
22400
22401 @item -mflat
22402 @itemx -mno-flat
22403 @opindex mflat
22404 @opindex mno-flat
22405 With @option{-mflat}, the compiler does not generate save/restore instructions
22406 and uses a ``flat'' or single register window model. This model is compatible
22407 with the regular register window model. The local registers and the input
22408 registers (0--5) are still treated as ``call-saved'' registers and are
22409 saved on the stack as needed.
22410
22411 With @option{-mno-flat} (the default), the compiler generates save/restore
22412 instructions (except for leaf functions). This is the normal operating mode.
22413
22414 @item -mfpu
22415 @itemx -mhard-float
22416 @opindex mfpu
22417 @opindex mhard-float
22418 Generate output containing floating-point instructions. This is the
22419 default.
22420
22421 @item -mno-fpu
22422 @itemx -msoft-float
22423 @opindex mno-fpu
22424 @opindex msoft-float
22425 Generate output containing library calls for floating point.
22426 @strong{Warning:} the requisite libraries are not available for all SPARC
22427 targets. Normally the facilities of the machine's usual C compiler are
22428 used, but this cannot be done directly in cross-compilation. You must make
22429 your own arrangements to provide suitable library functions for
22430 cross-compilation. The embedded targets @samp{sparc-*-aout} and
22431 @samp{sparclite-*-*} do provide software floating-point support.
22432
22433 @option{-msoft-float} changes the calling convention in the output file;
22434 therefore, it is only useful if you compile @emph{all} of a program with
22435 this option. In particular, you need to compile @file{libgcc.a}, the
22436 library that comes with GCC, with @option{-msoft-float} in order for
22437 this to work.
22438
22439 @item -mhard-quad-float
22440 @opindex mhard-quad-float
22441 Generate output containing quad-word (long double) floating-point
22442 instructions.
22443
22444 @item -msoft-quad-float
22445 @opindex msoft-quad-float
22446 Generate output containing library calls for quad-word (long double)
22447 floating-point instructions. The functions called are those specified
22448 in the SPARC ABI@. This is the default.
22449
22450 As of this writing, there are no SPARC implementations that have hardware
22451 support for the quad-word floating-point instructions. They all invoke
22452 a trap handler for one of these instructions, and then the trap handler
22453 emulates the effect of the instruction. Because of the trap handler overhead,
22454 this is much slower than calling the ABI library routines. Thus the
22455 @option{-msoft-quad-float} option is the default.
22456
22457 @item -mno-unaligned-doubles
22458 @itemx -munaligned-doubles
22459 @opindex mno-unaligned-doubles
22460 @opindex munaligned-doubles
22461 Assume that doubles have 8-byte alignment. This is the default.
22462
22463 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
22464 alignment only if they are contained in another type, or if they have an
22465 absolute address. Otherwise, it assumes they have 4-byte alignment.
22466 Specifying this option avoids some rare compatibility problems with code
22467 generated by other compilers. It is not the default because it results
22468 in a performance loss, especially for floating-point code.
22469
22470 @item -muser-mode
22471 @itemx -mno-user-mode
22472 @opindex muser-mode
22473 @opindex mno-user-mode
22474 Do not generate code that can only run in supervisor mode. This is relevant
22475 only for the @code{casa} instruction emitted for the LEON3 processor. This
22476 is the default.
22477
22478 @item -mfaster-structs
22479 @itemx -mno-faster-structs
22480 @opindex mfaster-structs
22481 @opindex mno-faster-structs
22482 With @option{-mfaster-structs}, the compiler assumes that structures
22483 should have 8-byte alignment. This enables the use of pairs of
22484 @code{ldd} and @code{std} instructions for copies in structure
22485 assignment, in place of twice as many @code{ld} and @code{st} pairs.
22486 However, the use of this changed alignment directly violates the SPARC
22487 ABI@. Thus, it's intended only for use on targets where the developer
22488 acknowledges that their resulting code is not directly in line with
22489 the rules of the ABI@.
22490
22491 @item -mstd-struct-return
22492 @itemx -mno-std-struct-return
22493 @opindex mstd-struct-return
22494 @opindex mno-std-struct-return
22495 With @option{-mstd-struct-return}, the compiler generates checking code
22496 in functions returning structures or unions to detect size mismatches
22497 between the two sides of function calls, as per the 32-bit ABI@.
22498
22499 The default is @option{-mno-std-struct-return}. This option has no effect
22500 in 64-bit mode.
22501
22502 @item -mcpu=@var{cpu_type}
22503 @opindex mcpu
22504 Set the instruction set, register set, and instruction scheduling parameters
22505 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22506 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
22507 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
22508 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
22509 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
22510 @samp{niagara3}, @samp{niagara4} and @samp{niagara7}.
22511
22512 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
22513 which selects the best architecture option for the host processor.
22514 @option{-mcpu=native} has no effect if GCC does not recognize
22515 the processor.
22516
22517 Default instruction scheduling parameters are used for values that select
22518 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
22519 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
22520
22521 Here is a list of each supported architecture and their supported
22522 implementations.
22523
22524 @table @asis
22525 @item v7
22526 cypress, leon3v7
22527
22528 @item v8
22529 supersparc, hypersparc, leon, leon3
22530
22531 @item sparclite
22532 f930, f934, sparclite86x
22533
22534 @item sparclet
22535 tsc701
22536
22537 @item v9
22538 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7
22539 @end table
22540
22541 By default (unless configured otherwise), GCC generates code for the V7
22542 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
22543 additionally optimizes it for the Cypress CY7C602 chip, as used in the
22544 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
22545 SPARCStation 1, 2, IPX etc.
22546
22547 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
22548 architecture. The only difference from V7 code is that the compiler emits
22549 the integer multiply and integer divide instructions which exist in SPARC-V8
22550 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
22551 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
22552 2000 series.
22553
22554 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
22555 the SPARC architecture. This adds the integer multiply, integer divide step
22556 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
22557 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
22558 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
22559 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
22560 MB86934 chip, which is the more recent SPARClite with FPU@.
22561
22562 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
22563 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
22564 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
22565 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
22566 optimizes it for the TEMIC SPARClet chip.
22567
22568 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
22569 architecture. This adds 64-bit integer and floating-point move instructions,
22570 3 additional floating-point condition code registers and conditional move
22571 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
22572 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
22573 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
22574 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
22575 @option{-mcpu=niagara}, the compiler additionally optimizes it for
22576 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
22577 additionally optimizes it for Sun UltraSPARC T2 chips. With
22578 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
22579 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
22580 additionally optimizes it for Sun UltraSPARC T4 chips. With
22581 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
22582 Oracle SPARC M7 chips.
22583
22584 @item -mtune=@var{cpu_type}
22585 @opindex mtune
22586 Set the instruction scheduling parameters for machine type
22587 @var{cpu_type}, but do not set the instruction set or register set that the
22588 option @option{-mcpu=@var{cpu_type}} does.
22589
22590 The same values for @option{-mcpu=@var{cpu_type}} can be used for
22591 @option{-mtune=@var{cpu_type}}, but the only useful values are those
22592 that select a particular CPU implementation. Those are
22593 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
22594 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
22595 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
22596 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
22597 @samp{niagara4} and @samp{niagara7}. With native Solaris and
22598 GNU/Linux toolchains, @samp{native} can also be used.
22599
22600 @item -mv8plus
22601 @itemx -mno-v8plus
22602 @opindex mv8plus
22603 @opindex mno-v8plus
22604 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
22605 difference from the V8 ABI is that the global and out registers are
22606 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
22607 mode for all SPARC-V9 processors.
22608
22609 @item -mvis
22610 @itemx -mno-vis
22611 @opindex mvis
22612 @opindex mno-vis
22613 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
22614 Visual Instruction Set extensions. The default is @option{-mno-vis}.
22615
22616 @item -mvis2
22617 @itemx -mno-vis2
22618 @opindex mvis2
22619 @opindex mno-vis2
22620 With @option{-mvis2}, GCC generates code that takes advantage of
22621 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
22622 default is @option{-mvis2} when targeting a cpu that supports such
22623 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
22624 also sets @option{-mvis}.
22625
22626 @item -mvis3
22627 @itemx -mno-vis3
22628 @opindex mvis3
22629 @opindex mno-vis3
22630 With @option{-mvis3}, GCC generates code that takes advantage of
22631 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
22632 default is @option{-mvis3} when targeting a cpu that supports such
22633 instructions, such as niagara-3 and later. Setting @option{-mvis3}
22634 also sets @option{-mvis2} and @option{-mvis}.
22635
22636 @item -mvis4
22637 @itemx -mno-vis4
22638 @opindex mvis4
22639 @opindex mno-vis4
22640 With @option{-mvis4}, GCC generates code that takes advantage of
22641 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
22642 default is @option{-mvis4} when targeting a cpu that supports such
22643 instructions, such as niagara-7 and later. Setting @option{-mvis4}
22644 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
22645
22646 @item -mcbcond
22647 @itemx -mno-cbcond
22648 @opindex mcbcond
22649 @opindex mno-cbcond
22650 With @option{-mcbcond}, GCC generates code that takes advantage of
22651 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
22652 The default is @option{-mcbcond} when targeting a cpu that supports such
22653 instructions, such as niagara-4 and later.
22654
22655 @item -mpopc
22656 @itemx -mno-popc
22657 @opindex mpopc
22658 @opindex mno-popc
22659 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
22660 population count instruction. The default is @option{-mpopc}
22661 when targeting a cpu that supports such instructions, such as Niagara-2 and
22662 later.
22663
22664 @item -mfmaf
22665 @itemx -mno-fmaf
22666 @opindex mfmaf
22667 @opindex mno-fmaf
22668 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
22669 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
22670 when targeting a cpu that supports such instructions, such as Niagara-3 and
22671 later.
22672
22673 @item -mfix-at697f
22674 @opindex mfix-at697f
22675 Enable the documented workaround for the single erratum of the Atmel AT697F
22676 processor (which corresponds to erratum #13 of the AT697E processor).
22677
22678 @item -mfix-ut699
22679 @opindex mfix-ut699
22680 Enable the documented workarounds for the floating-point errata and the data
22681 cache nullify errata of the UT699 processor.
22682 @end table
22683
22684 These @samp{-m} options are supported in addition to the above
22685 on SPARC-V9 processors in 64-bit environments:
22686
22687 @table @gcctabopt
22688 @item -m32
22689 @itemx -m64
22690 @opindex m32
22691 @opindex m64
22692 Generate code for a 32-bit or 64-bit environment.
22693 The 32-bit environment sets int, long and pointer to 32 bits.
22694 The 64-bit environment sets int to 32 bits and long and pointer
22695 to 64 bits.
22696
22697 @item -mcmodel=@var{which}
22698 @opindex mcmodel
22699 Set the code model to one of
22700
22701 @table @samp
22702 @item medlow
22703 The Medium/Low code model: 64-bit addresses, programs
22704 must be linked in the low 32 bits of memory. Programs can be statically
22705 or dynamically linked.
22706
22707 @item medmid
22708 The Medium/Middle code model: 64-bit addresses, programs
22709 must be linked in the low 44 bits of memory, the text and data segments must
22710 be less than 2GB in size and the data segment must be located within 2GB of
22711 the text segment.
22712
22713 @item medany
22714 The Medium/Anywhere code model: 64-bit addresses, programs
22715 may be linked anywhere in memory, the text and data segments must be less
22716 than 2GB in size and the data segment must be located within 2GB of the
22717 text segment.
22718
22719 @item embmedany
22720 The Medium/Anywhere code model for embedded systems:
22721 64-bit addresses, the text and data segments must be less than 2GB in
22722 size, both starting anywhere in memory (determined at link time). The
22723 global register %g4 points to the base of the data segment. Programs
22724 are statically linked and PIC is not supported.
22725 @end table
22726
22727 @item -mmemory-model=@var{mem-model}
22728 @opindex mmemory-model
22729 Set the memory model in force on the processor to one of
22730
22731 @table @samp
22732 @item default
22733 The default memory model for the processor and operating system.
22734
22735 @item rmo
22736 Relaxed Memory Order
22737
22738 @item pso
22739 Partial Store Order
22740
22741 @item tso
22742 Total Store Order
22743
22744 @item sc
22745 Sequential Consistency
22746 @end table
22747
22748 These memory models are formally defined in Appendix D of the Sparc V9
22749 architecture manual, as set in the processor's @code{PSTATE.MM} field.
22750
22751 @item -mstack-bias
22752 @itemx -mno-stack-bias
22753 @opindex mstack-bias
22754 @opindex mno-stack-bias
22755 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
22756 frame pointer if present, are offset by @minus{}2047 which must be added back
22757 when making stack frame references. This is the default in 64-bit mode.
22758 Otherwise, assume no such offset is present.
22759 @end table
22760
22761 @node SPU Options
22762 @subsection SPU Options
22763 @cindex SPU options
22764
22765 These @samp{-m} options are supported on the SPU:
22766
22767 @table @gcctabopt
22768 @item -mwarn-reloc
22769 @itemx -merror-reloc
22770 @opindex mwarn-reloc
22771 @opindex merror-reloc
22772
22773 The loader for SPU does not handle dynamic relocations. By default, GCC
22774 gives an error when it generates code that requires a dynamic
22775 relocation. @option{-mno-error-reloc} disables the error,
22776 @option{-mwarn-reloc} generates a warning instead.
22777
22778 @item -msafe-dma
22779 @itemx -munsafe-dma
22780 @opindex msafe-dma
22781 @opindex munsafe-dma
22782
22783 Instructions that initiate or test completion of DMA must not be
22784 reordered with respect to loads and stores of the memory that is being
22785 accessed.
22786 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
22787 memory accesses, but that can lead to inefficient code in places where the
22788 memory is known to not change. Rather than mark the memory as volatile,
22789 you can use @option{-msafe-dma} to tell the compiler to treat
22790 the DMA instructions as potentially affecting all memory.
22791
22792 @item -mbranch-hints
22793 @opindex mbranch-hints
22794
22795 By default, GCC generates a branch hint instruction to avoid
22796 pipeline stalls for always-taken or probably-taken branches. A hint
22797 is not generated closer than 8 instructions away from its branch.
22798 There is little reason to disable them, except for debugging purposes,
22799 or to make an object a little bit smaller.
22800
22801 @item -msmall-mem
22802 @itemx -mlarge-mem
22803 @opindex msmall-mem
22804 @opindex mlarge-mem
22805
22806 By default, GCC generates code assuming that addresses are never larger
22807 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
22808 a full 32-bit address.
22809
22810 @item -mstdmain
22811 @opindex mstdmain
22812
22813 By default, GCC links against startup code that assumes the SPU-style
22814 main function interface (which has an unconventional parameter list).
22815 With @option{-mstdmain}, GCC links your program against startup
22816 code that assumes a C99-style interface to @code{main}, including a
22817 local copy of @code{argv} strings.
22818
22819 @item -mfixed-range=@var{register-range}
22820 @opindex mfixed-range
22821 Generate code treating the given register range as fixed registers.
22822 A fixed register is one that the register allocator cannot use. This is
22823 useful when compiling kernel code. A register range is specified as
22824 two registers separated by a dash. Multiple register ranges can be
22825 specified separated by a comma.
22826
22827 @item -mea32
22828 @itemx -mea64
22829 @opindex mea32
22830 @opindex mea64
22831 Compile code assuming that pointers to the PPU address space accessed
22832 via the @code{__ea} named address space qualifier are either 32 or 64
22833 bits wide. The default is 32 bits. As this is an ABI-changing option,
22834 all object code in an executable must be compiled with the same setting.
22835
22836 @item -maddress-space-conversion
22837 @itemx -mno-address-space-conversion
22838 @opindex maddress-space-conversion
22839 @opindex mno-address-space-conversion
22840 Allow/disallow treating the @code{__ea} address space as superset
22841 of the generic address space. This enables explicit type casts
22842 between @code{__ea} and generic pointer as well as implicit
22843 conversions of generic pointers to @code{__ea} pointers. The
22844 default is to allow address space pointer conversions.
22845
22846 @item -mcache-size=@var{cache-size}
22847 @opindex mcache-size
22848 This option controls the version of libgcc that the compiler links to an
22849 executable and selects a software-managed cache for accessing variables
22850 in the @code{__ea} address space with a particular cache size. Possible
22851 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
22852 and @samp{128}. The default cache size is 64KB.
22853
22854 @item -matomic-updates
22855 @itemx -mno-atomic-updates
22856 @opindex matomic-updates
22857 @opindex mno-atomic-updates
22858 This option controls the version of libgcc that the compiler links to an
22859 executable and selects whether atomic updates to the software-managed
22860 cache of PPU-side variables are used. If you use atomic updates, changes
22861 to a PPU variable from SPU code using the @code{__ea} named address space
22862 qualifier do not interfere with changes to other PPU variables residing
22863 in the same cache line from PPU code. If you do not use atomic updates,
22864 such interference may occur; however, writing back cache lines is
22865 more efficient. The default behavior is to use atomic updates.
22866
22867 @item -mdual-nops
22868 @itemx -mdual-nops=@var{n}
22869 @opindex mdual-nops
22870 By default, GCC inserts NOPs to increase dual issue when it expects
22871 it to increase performance. @var{n} can be a value from 0 to 10. A
22872 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
22873 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
22874
22875 @item -mhint-max-nops=@var{n}
22876 @opindex mhint-max-nops
22877 Maximum number of NOPs to insert for a branch hint. A branch hint must
22878 be at least 8 instructions away from the branch it is affecting. GCC
22879 inserts up to @var{n} NOPs to enforce this, otherwise it does not
22880 generate the branch hint.
22881
22882 @item -mhint-max-distance=@var{n}
22883 @opindex mhint-max-distance
22884 The encoding of the branch hint instruction limits the hint to be within
22885 256 instructions of the branch it is affecting. By default, GCC makes
22886 sure it is within 125.
22887
22888 @item -msafe-hints
22889 @opindex msafe-hints
22890 Work around a hardware bug that causes the SPU to stall indefinitely.
22891 By default, GCC inserts the @code{hbrp} instruction to make sure
22892 this stall won't happen.
22893
22894 @end table
22895
22896 @node System V Options
22897 @subsection Options for System V
22898
22899 These additional options are available on System V Release 4 for
22900 compatibility with other compilers on those systems:
22901
22902 @table @gcctabopt
22903 @item -G
22904 @opindex G
22905 Create a shared object.
22906 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
22907
22908 @item -Qy
22909 @opindex Qy
22910 Identify the versions of each tool used by the compiler, in a
22911 @code{.ident} assembler directive in the output.
22912
22913 @item -Qn
22914 @opindex Qn
22915 Refrain from adding @code{.ident} directives to the output file (this is
22916 the default).
22917
22918 @item -YP,@var{dirs}
22919 @opindex YP
22920 Search the directories @var{dirs}, and no others, for libraries
22921 specified with @option{-l}.
22922
22923 @item -Ym,@var{dir}
22924 @opindex Ym
22925 Look in the directory @var{dir} to find the M4 preprocessor.
22926 The assembler uses this option.
22927 @c This is supposed to go with a -Yd for predefined M4 macro files, but
22928 @c the generic assembler that comes with Solaris takes just -Ym.
22929 @end table
22930
22931 @node TILE-Gx Options
22932 @subsection TILE-Gx Options
22933 @cindex TILE-Gx options
22934
22935 These @samp{-m} options are supported on the TILE-Gx:
22936
22937 @table @gcctabopt
22938 @item -mcmodel=small
22939 @opindex mcmodel=small
22940 Generate code for the small model. The distance for direct calls is
22941 limited to 500M in either direction. PC-relative addresses are 32
22942 bits. Absolute addresses support the full address range.
22943
22944 @item -mcmodel=large
22945 @opindex mcmodel=large
22946 Generate code for the large model. There is no limitation on call
22947 distance, pc-relative addresses, or absolute addresses.
22948
22949 @item -mcpu=@var{name}
22950 @opindex mcpu
22951 Selects the type of CPU to be targeted. Currently the only supported
22952 type is @samp{tilegx}.
22953
22954 @item -m32
22955 @itemx -m64
22956 @opindex m32
22957 @opindex m64
22958 Generate code for a 32-bit or 64-bit environment. The 32-bit
22959 environment sets int, long, and pointer to 32 bits. The 64-bit
22960 environment sets int to 32 bits and long and pointer to 64 bits.
22961
22962 @item -mbig-endian
22963 @itemx -mlittle-endian
22964 @opindex mbig-endian
22965 @opindex mlittle-endian
22966 Generate code in big/little endian mode, respectively.
22967 @end table
22968
22969 @node TILEPro Options
22970 @subsection TILEPro Options
22971 @cindex TILEPro options
22972
22973 These @samp{-m} options are supported on the TILEPro:
22974
22975 @table @gcctabopt
22976 @item -mcpu=@var{name}
22977 @opindex mcpu
22978 Selects the type of CPU to be targeted. Currently the only supported
22979 type is @samp{tilepro}.
22980
22981 @item -m32
22982 @opindex m32
22983 Generate code for a 32-bit environment, which sets int, long, and
22984 pointer to 32 bits. This is the only supported behavior so the flag
22985 is essentially ignored.
22986 @end table
22987
22988 @node V850 Options
22989 @subsection V850 Options
22990 @cindex V850 Options
22991
22992 These @samp{-m} options are defined for V850 implementations:
22993
22994 @table @gcctabopt
22995 @item -mlong-calls
22996 @itemx -mno-long-calls
22997 @opindex mlong-calls
22998 @opindex mno-long-calls
22999 Treat all calls as being far away (near). If calls are assumed to be
23000 far away, the compiler always loads the function's address into a
23001 register, and calls indirect through the pointer.
23002
23003 @item -mno-ep
23004 @itemx -mep
23005 @opindex mno-ep
23006 @opindex mep
23007 Do not optimize (do optimize) basic blocks that use the same index
23008 pointer 4 or more times to copy pointer into the @code{ep} register, and
23009 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
23010 option is on by default if you optimize.
23011
23012 @item -mno-prolog-function
23013 @itemx -mprolog-function
23014 @opindex mno-prolog-function
23015 @opindex mprolog-function
23016 Do not use (do use) external functions to save and restore registers
23017 at the prologue and epilogue of a function. The external functions
23018 are slower, but use less code space if more than one function saves
23019 the same number of registers. The @option{-mprolog-function} option
23020 is on by default if you optimize.
23021
23022 @item -mspace
23023 @opindex mspace
23024 Try to make the code as small as possible. At present, this just turns
23025 on the @option{-mep} and @option{-mprolog-function} options.
23026
23027 @item -mtda=@var{n}
23028 @opindex mtda
23029 Put static or global variables whose size is @var{n} bytes or less into
23030 the tiny data area that register @code{ep} points to. The tiny data
23031 area can hold up to 256 bytes in total (128 bytes for byte references).
23032
23033 @item -msda=@var{n}
23034 @opindex msda
23035 Put static or global variables whose size is @var{n} bytes or less into
23036 the small data area that register @code{gp} points to. The small data
23037 area can hold up to 64 kilobytes.
23038
23039 @item -mzda=@var{n}
23040 @opindex mzda
23041 Put static or global variables whose size is @var{n} bytes or less into
23042 the first 32 kilobytes of memory.
23043
23044 @item -mv850
23045 @opindex mv850
23046 Specify that the target processor is the V850.
23047
23048 @item -mv850e3v5
23049 @opindex mv850e3v5
23050 Specify that the target processor is the V850E3V5. The preprocessor
23051 constant @code{__v850e3v5__} is defined if this option is used.
23052
23053 @item -mv850e2v4
23054 @opindex mv850e2v4
23055 Specify that the target processor is the V850E3V5. This is an alias for
23056 the @option{-mv850e3v5} option.
23057
23058 @item -mv850e2v3
23059 @opindex mv850e2v3
23060 Specify that the target processor is the V850E2V3. The preprocessor
23061 constant @code{__v850e2v3__} is defined if this option is used.
23062
23063 @item -mv850e2
23064 @opindex mv850e2
23065 Specify that the target processor is the V850E2. The preprocessor
23066 constant @code{__v850e2__} is defined if this option is used.
23067
23068 @item -mv850e1
23069 @opindex mv850e1
23070 Specify that the target processor is the V850E1. The preprocessor
23071 constants @code{__v850e1__} and @code{__v850e__} are defined if
23072 this option is used.
23073
23074 @item -mv850es
23075 @opindex mv850es
23076 Specify that the target processor is the V850ES. This is an alias for
23077 the @option{-mv850e1} option.
23078
23079 @item -mv850e
23080 @opindex mv850e
23081 Specify that the target processor is the V850E@. The preprocessor
23082 constant @code{__v850e__} is defined if this option is used.
23083
23084 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
23085 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
23086 are defined then a default target processor is chosen and the
23087 relevant @samp{__v850*__} preprocessor constant is defined.
23088
23089 The preprocessor constants @code{__v850} and @code{__v851__} are always
23090 defined, regardless of which processor variant is the target.
23091
23092 @item -mdisable-callt
23093 @itemx -mno-disable-callt
23094 @opindex mdisable-callt
23095 @opindex mno-disable-callt
23096 This option suppresses generation of the @code{CALLT} instruction for the
23097 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
23098 architecture.
23099
23100 This option is enabled by default when the RH850 ABI is
23101 in use (see @option{-mrh850-abi}), and disabled by default when the
23102 GCC ABI is in use. If @code{CALLT} instructions are being generated
23103 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
23104
23105 @item -mrelax
23106 @itemx -mno-relax
23107 @opindex mrelax
23108 @opindex mno-relax
23109 Pass on (or do not pass on) the @option{-mrelax} command-line option
23110 to the assembler.
23111
23112 @item -mlong-jumps
23113 @itemx -mno-long-jumps
23114 @opindex mlong-jumps
23115 @opindex mno-long-jumps
23116 Disable (or re-enable) the generation of PC-relative jump instructions.
23117
23118 @item -msoft-float
23119 @itemx -mhard-float
23120 @opindex msoft-float
23121 @opindex mhard-float
23122 Disable (or re-enable) the generation of hardware floating point
23123 instructions. This option is only significant when the target
23124 architecture is @samp{V850E2V3} or higher. If hardware floating point
23125 instructions are being generated then the C preprocessor symbol
23126 @code{__FPU_OK__} is defined, otherwise the symbol
23127 @code{__NO_FPU__} is defined.
23128
23129 @item -mloop
23130 @opindex mloop
23131 Enables the use of the e3v5 LOOP instruction. The use of this
23132 instruction is not enabled by default when the e3v5 architecture is
23133 selected because its use is still experimental.
23134
23135 @item -mrh850-abi
23136 @itemx -mghs
23137 @opindex mrh850-abi
23138 @opindex mghs
23139 Enables support for the RH850 version of the V850 ABI. This is the
23140 default. With this version of the ABI the following rules apply:
23141
23142 @itemize
23143 @item
23144 Integer sized structures and unions are returned via a memory pointer
23145 rather than a register.
23146
23147 @item
23148 Large structures and unions (more than 8 bytes in size) are passed by
23149 value.
23150
23151 @item
23152 Functions are aligned to 16-bit boundaries.
23153
23154 @item
23155 The @option{-m8byte-align} command-line option is supported.
23156
23157 @item
23158 The @option{-mdisable-callt} command-line option is enabled by
23159 default. The @option{-mno-disable-callt} command-line option is not
23160 supported.
23161 @end itemize
23162
23163 When this version of the ABI is enabled the C preprocessor symbol
23164 @code{__V850_RH850_ABI__} is defined.
23165
23166 @item -mgcc-abi
23167 @opindex mgcc-abi
23168 Enables support for the old GCC version of the V850 ABI. With this
23169 version of the ABI the following rules apply:
23170
23171 @itemize
23172 @item
23173 Integer sized structures and unions are returned in register @code{r10}.
23174
23175 @item
23176 Large structures and unions (more than 8 bytes in size) are passed by
23177 reference.
23178
23179 @item
23180 Functions are aligned to 32-bit boundaries, unless optimizing for
23181 size.
23182
23183 @item
23184 The @option{-m8byte-align} command-line option is not supported.
23185
23186 @item
23187 The @option{-mdisable-callt} command-line option is supported but not
23188 enabled by default.
23189 @end itemize
23190
23191 When this version of the ABI is enabled the C preprocessor symbol
23192 @code{__V850_GCC_ABI__} is defined.
23193
23194 @item -m8byte-align
23195 @itemx -mno-8byte-align
23196 @opindex m8byte-align
23197 @opindex mno-8byte-align
23198 Enables support for @code{double} and @code{long long} types to be
23199 aligned on 8-byte boundaries. The default is to restrict the
23200 alignment of all objects to at most 4-bytes. When
23201 @option{-m8byte-align} is in effect the C preprocessor symbol
23202 @code{__V850_8BYTE_ALIGN__} is defined.
23203
23204 @item -mbig-switch
23205 @opindex mbig-switch
23206 Generate code suitable for big switch tables. Use this option only if
23207 the assembler/linker complain about out of range branches within a switch
23208 table.
23209
23210 @item -mapp-regs
23211 @opindex mapp-regs
23212 This option causes r2 and r5 to be used in the code generated by
23213 the compiler. This setting is the default.
23214
23215 @item -mno-app-regs
23216 @opindex mno-app-regs
23217 This option causes r2 and r5 to be treated as fixed registers.
23218
23219 @end table
23220
23221 @node VAX Options
23222 @subsection VAX Options
23223 @cindex VAX options
23224
23225 These @samp{-m} options are defined for the VAX:
23226
23227 @table @gcctabopt
23228 @item -munix
23229 @opindex munix
23230 Do not output certain jump instructions (@code{aobleq} and so on)
23231 that the Unix assembler for the VAX cannot handle across long
23232 ranges.
23233
23234 @item -mgnu
23235 @opindex mgnu
23236 Do output those jump instructions, on the assumption that the
23237 GNU assembler is being used.
23238
23239 @item -mg
23240 @opindex mg
23241 Output code for G-format floating-point numbers instead of D-format.
23242 @end table
23243
23244 @node Visium Options
23245 @subsection Visium Options
23246 @cindex Visium options
23247
23248 @table @gcctabopt
23249
23250 @item -mdebug
23251 @opindex mdebug
23252 A program which performs file I/O and is destined to run on an MCM target
23253 should be linked with this option. It causes the libraries libc.a and
23254 libdebug.a to be linked. The program should be run on the target under
23255 the control of the GDB remote debugging stub.
23256
23257 @item -msim
23258 @opindex msim
23259 A program which performs file I/O and is destined to run on the simulator
23260 should be linked with option. This causes libraries libc.a and libsim.a to
23261 be linked.
23262
23263 @item -mfpu
23264 @itemx -mhard-float
23265 @opindex mfpu
23266 @opindex mhard-float
23267 Generate code containing floating-point instructions. This is the
23268 default.
23269
23270 @item -mno-fpu
23271 @itemx -msoft-float
23272 @opindex mno-fpu
23273 @opindex msoft-float
23274 Generate code containing library calls for floating-point.
23275
23276 @option{-msoft-float} changes the calling convention in the output file;
23277 therefore, it is only useful if you compile @emph{all} of a program with
23278 this option. In particular, you need to compile @file{libgcc.a}, the
23279 library that comes with GCC, with @option{-msoft-float} in order for
23280 this to work.
23281
23282 @item -mcpu=@var{cpu_type}
23283 @opindex mcpu
23284 Set the instruction set, register set, and instruction scheduling parameters
23285 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
23286 @samp{mcm}, @samp{gr5} and @samp{gr6}.
23287
23288 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
23289
23290 By default (unless configured otherwise), GCC generates code for the GR5
23291 variant of the Visium architecture.
23292
23293 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
23294 architecture. The only difference from GR5 code is that the compiler will
23295 generate block move instructions.
23296
23297 @item -mtune=@var{cpu_type}
23298 @opindex mtune
23299 Set the instruction scheduling parameters for machine type @var{cpu_type},
23300 but do not set the instruction set or register set that the option
23301 @option{-mcpu=@var{cpu_type}} would.
23302
23303 @item -msv-mode
23304 @opindex msv-mode
23305 Generate code for the supervisor mode, where there are no restrictions on
23306 the access to general registers. This is the default.
23307
23308 @item -muser-mode
23309 @opindex muser-mode
23310 Generate code for the user mode, where the access to some general registers
23311 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
23312 mode; on the GR6, only registers r29 to r31 are affected.
23313 @end table
23314
23315 @node VMS Options
23316 @subsection VMS Options
23317
23318 These @samp{-m} options are defined for the VMS implementations:
23319
23320 @table @gcctabopt
23321 @item -mvms-return-codes
23322 @opindex mvms-return-codes
23323 Return VMS condition codes from @code{main}. The default is to return POSIX-style
23324 condition (e.g.@ error) codes.
23325
23326 @item -mdebug-main=@var{prefix}
23327 @opindex mdebug-main=@var{prefix}
23328 Flag the first routine whose name starts with @var{prefix} as the main
23329 routine for the debugger.
23330
23331 @item -mmalloc64
23332 @opindex mmalloc64
23333 Default to 64-bit memory allocation routines.
23334
23335 @item -mpointer-size=@var{size}
23336 @opindex mpointer-size=@var{size}
23337 Set the default size of pointers. Possible options for @var{size} are
23338 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
23339 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
23340 The later option disables @code{pragma pointer_size}.
23341 @end table
23342
23343 @node VxWorks Options
23344 @subsection VxWorks Options
23345 @cindex VxWorks Options
23346
23347 The options in this section are defined for all VxWorks targets.
23348 Options specific to the target hardware are listed with the other
23349 options for that target.
23350
23351 @table @gcctabopt
23352 @item -mrtp
23353 @opindex mrtp
23354 GCC can generate code for both VxWorks kernels and real time processes
23355 (RTPs). This option switches from the former to the latter. It also
23356 defines the preprocessor macro @code{__RTP__}.
23357
23358 @item -non-static
23359 @opindex non-static
23360 Link an RTP executable against shared libraries rather than static
23361 libraries. The options @option{-static} and @option{-shared} can
23362 also be used for RTPs (@pxref{Link Options}); @option{-static}
23363 is the default.
23364
23365 @item -Bstatic
23366 @itemx -Bdynamic
23367 @opindex Bstatic
23368 @opindex Bdynamic
23369 These options are passed down to the linker. They are defined for
23370 compatibility with Diab.
23371
23372 @item -Xbind-lazy
23373 @opindex Xbind-lazy
23374 Enable lazy binding of function calls. This option is equivalent to
23375 @option{-Wl,-z,now} and is defined for compatibility with Diab.
23376
23377 @item -Xbind-now
23378 @opindex Xbind-now
23379 Disable lazy binding of function calls. This option is the default and
23380 is defined for compatibility with Diab.
23381 @end table
23382
23383 @node x86 Options
23384 @subsection x86 Options
23385 @cindex x86 Options
23386
23387 These @samp{-m} options are defined for the x86 family of computers.
23388
23389 @table @gcctabopt
23390
23391 @item -march=@var{cpu-type}
23392 @opindex march
23393 Generate instructions for the machine type @var{cpu-type}. In contrast to
23394 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
23395 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
23396 to generate code that may not run at all on processors other than the one
23397 indicated. Specifying @option{-march=@var{cpu-type}} implies
23398 @option{-mtune=@var{cpu-type}}.
23399
23400 The choices for @var{cpu-type} are:
23401
23402 @table @samp
23403 @item native
23404 This selects the CPU to generate code for at compilation time by determining
23405 the processor type of the compiling machine. Using @option{-march=native}
23406 enables all instruction subsets supported by the local machine (hence
23407 the result might not run on different machines). Using @option{-mtune=native}
23408 produces code optimized for the local machine under the constraints
23409 of the selected instruction set.
23410
23411 @item i386
23412 Original Intel i386 CPU@.
23413
23414 @item i486
23415 Intel i486 CPU@. (No scheduling is implemented for this chip.)
23416
23417 @item i586
23418 @itemx pentium
23419 Intel Pentium CPU with no MMX support.
23420
23421 @item lakemont
23422 Intel Lakemont MCU, based on Intel Pentium CPU.
23423
23424 @item pentium-mmx
23425 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
23426
23427 @item pentiumpro
23428 Intel Pentium Pro CPU@.
23429
23430 @item i686
23431 When used with @option{-march}, the Pentium Pro
23432 instruction set is used, so the code runs on all i686 family chips.
23433 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
23434
23435 @item pentium2
23436 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
23437 support.
23438
23439 @item pentium3
23440 @itemx pentium3m
23441 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
23442 set support.
23443
23444 @item pentium-m
23445 Intel Pentium M; low-power version of Intel Pentium III CPU
23446 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
23447
23448 @item pentium4
23449 @itemx pentium4m
23450 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
23451
23452 @item prescott
23453 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
23454 set support.
23455
23456 @item nocona
23457 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
23458 SSE2 and SSE3 instruction set support.
23459
23460 @item core2
23461 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
23462 instruction set support.
23463
23464 @item nehalem
23465 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23466 SSE4.1, SSE4.2 and POPCNT instruction set support.
23467
23468 @item westmere
23469 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23470 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
23471
23472 @item sandybridge
23473 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23474 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
23475
23476 @item ivybridge
23477 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23478 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
23479 instruction set support.
23480
23481 @item haswell
23482 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23483 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23484 BMI, BMI2 and F16C instruction set support.
23485
23486 @item broadwell
23487 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23488 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23489 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
23490
23491 @item skylake
23492 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23493 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23494 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
23495 XSAVES instruction set support.
23496
23497 @item bonnell
23498 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
23499 instruction set support.
23500
23501 @item silvermont
23502 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23503 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
23504
23505 @item knl
23506 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23507 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23508 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
23509 AVX512CD instruction set support.
23510
23511 @item skylake-avx512
23512 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23513 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23514 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
23515 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
23516
23517 @item k6
23518 AMD K6 CPU with MMX instruction set support.
23519
23520 @item k6-2
23521 @itemx k6-3
23522 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
23523
23524 @item athlon
23525 @itemx athlon-tbird
23526 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
23527 support.
23528
23529 @item athlon-4
23530 @itemx athlon-xp
23531 @itemx athlon-mp
23532 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
23533 instruction set support.
23534
23535 @item k8
23536 @itemx opteron
23537 @itemx athlon64
23538 @itemx athlon-fx
23539 Processors based on the AMD K8 core with x86-64 instruction set support,
23540 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
23541 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
23542 instruction set extensions.)
23543
23544 @item k8-sse3
23545 @itemx opteron-sse3
23546 @itemx athlon64-sse3
23547 Improved versions of AMD K8 cores with SSE3 instruction set support.
23548
23549 @item amdfam10
23550 @itemx barcelona
23551 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
23552 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
23553 instruction set extensions.)
23554
23555 @item bdver1
23556 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
23557 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
23558 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
23559 @item bdver2
23560 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23561 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
23562 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
23563 extensions.)
23564 @item bdver3
23565 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23566 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
23567 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
23568 64-bit instruction set extensions.
23569 @item bdver4
23570 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23571 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
23572 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
23573 SSE4.2, ABM and 64-bit instruction set extensions.
23574
23575 @item znver1
23576 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
23577 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
23578 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
23579 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
23580 instruction set extensions.
23581
23582 @item btver1
23583 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
23584 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
23585 instruction set extensions.)
23586
23587 @item btver2
23588 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
23589 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
23590 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
23591
23592 @item winchip-c6
23593 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
23594 set support.
23595
23596 @item winchip2
23597 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
23598 instruction set support.
23599
23600 @item c3
23601 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
23602 (No scheduling is implemented for this chip.)
23603
23604 @item c3-2
23605 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
23606 (No scheduling is implemented for this chip.)
23607
23608 @item c7
23609 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
23610 (No scheduling is implemented for this chip.)
23611
23612 @item samuel-2
23613 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
23614 (No scheduling is implemented for this chip.)
23615
23616 @item nehemiah
23617 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
23618 (No scheduling is implemented for this chip.)
23619
23620 @item esther
23621 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
23622 (No scheduling is implemented for this chip.)
23623
23624 @item eden-x2
23625 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
23626 (No scheduling is implemented for this chip.)
23627
23628 @item eden-x4
23629 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
23630 AVX and AVX2 instruction set support.
23631 (No scheduling is implemented for this chip.)
23632
23633 @item nano
23634 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23635 instruction set support.
23636 (No scheduling is implemented for this chip.)
23637
23638 @item nano-1000
23639 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23640 instruction set support.
23641 (No scheduling is implemented for this chip.)
23642
23643 @item nano-2000
23644 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23645 instruction set support.
23646 (No scheduling is implemented for this chip.)
23647
23648 @item nano-3000
23649 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23650 instruction set support.
23651 (No scheduling is implemented for this chip.)
23652
23653 @item nano-x2
23654 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23655 instruction set support.
23656 (No scheduling is implemented for this chip.)
23657
23658 @item nano-x4
23659 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
23660 instruction set support.
23661 (No scheduling is implemented for this chip.)
23662
23663 @item geode
23664 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
23665 @end table
23666
23667 @item -mtune=@var{cpu-type}
23668 @opindex mtune
23669 Tune to @var{cpu-type} everything applicable about the generated code, except
23670 for the ABI and the set of available instructions.
23671 While picking a specific @var{cpu-type} schedules things appropriately
23672 for that particular chip, the compiler does not generate any code that
23673 cannot run on the default machine type unless you use a
23674 @option{-march=@var{cpu-type}} option.
23675 For example, if GCC is configured for i686-pc-linux-gnu
23676 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
23677 but still runs on i686 machines.
23678
23679 The choices for @var{cpu-type} are the same as for @option{-march}.
23680 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
23681
23682 @table @samp
23683 @item generic
23684 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
23685 If you know the CPU on which your code will run, then you should use
23686 the corresponding @option{-mtune} or @option{-march} option instead of
23687 @option{-mtune=generic}. But, if you do not know exactly what CPU users
23688 of your application will have, then you should use this option.
23689
23690 As new processors are deployed in the marketplace, the behavior of this
23691 option will change. Therefore, if you upgrade to a newer version of
23692 GCC, code generation controlled by this option will change to reflect
23693 the processors
23694 that are most common at the time that version of GCC is released.
23695
23696 There is no @option{-march=generic} option because @option{-march}
23697 indicates the instruction set the compiler can use, and there is no
23698 generic instruction set applicable to all processors. In contrast,
23699 @option{-mtune} indicates the processor (or, in this case, collection of
23700 processors) for which the code is optimized.
23701
23702 @item intel
23703 Produce code optimized for the most current Intel processors, which are
23704 Haswell and Silvermont for this version of GCC. If you know the CPU
23705 on which your code will run, then you should use the corresponding
23706 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
23707 But, if you want your application performs better on both Haswell and
23708 Silvermont, then you should use this option.
23709
23710 As new Intel processors are deployed in the marketplace, the behavior of
23711 this option will change. Therefore, if you upgrade to a newer version of
23712 GCC, code generation controlled by this option will change to reflect
23713 the most current Intel processors at the time that version of GCC is
23714 released.
23715
23716 There is no @option{-march=intel} option because @option{-march} indicates
23717 the instruction set the compiler can use, and there is no common
23718 instruction set applicable to all processors. In contrast,
23719 @option{-mtune} indicates the processor (or, in this case, collection of
23720 processors) for which the code is optimized.
23721 @end table
23722
23723 @item -mcpu=@var{cpu-type}
23724 @opindex mcpu
23725 A deprecated synonym for @option{-mtune}.
23726
23727 @item -mfpmath=@var{unit}
23728 @opindex mfpmath
23729 Generate floating-point arithmetic for selected unit @var{unit}. The choices
23730 for @var{unit} are:
23731
23732 @table @samp
23733 @item 387
23734 Use the standard 387 floating-point coprocessor present on the majority of chips and
23735 emulated otherwise. Code compiled with this option runs almost everywhere.
23736 The temporary results are computed in 80-bit precision instead of the precision
23737 specified by the type, resulting in slightly different results compared to most
23738 of other chips. See @option{-ffloat-store} for more detailed description.
23739
23740 This is the default choice for x86-32 targets.
23741
23742 @item sse
23743 Use scalar floating-point instructions present in the SSE instruction set.
23744 This instruction set is supported by Pentium III and newer chips,
23745 and in the AMD line
23746 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
23747 instruction set supports only single-precision arithmetic, thus the double and
23748 extended-precision arithmetic are still done using 387. A later version, present
23749 only in Pentium 4 and AMD x86-64 chips, supports double-precision
23750 arithmetic too.
23751
23752 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
23753 or @option{-msse2} switches to enable SSE extensions and make this option
23754 effective. For the x86-64 compiler, these extensions are enabled by default.
23755
23756 The resulting code should be considerably faster in the majority of cases and avoid
23757 the numerical instability problems of 387 code, but may break some existing
23758 code that expects temporaries to be 80 bits.
23759
23760 This is the default choice for the x86-64 compiler.
23761
23762 @item sse,387
23763 @itemx sse+387
23764 @itemx both
23765 Attempt to utilize both instruction sets at once. This effectively doubles the
23766 amount of available registers, and on chips with separate execution units for
23767 387 and SSE the execution resources too. Use this option with care, as it is
23768 still experimental, because the GCC register allocator does not model separate
23769 functional units well, resulting in unstable performance.
23770 @end table
23771
23772 @item -masm=@var{dialect}
23773 @opindex masm=@var{dialect}
23774 Output assembly instructions using selected @var{dialect}. Also affects
23775 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
23776 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
23777 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
23778 not support @samp{intel}.
23779
23780 @item -mieee-fp
23781 @itemx -mno-ieee-fp
23782 @opindex mieee-fp
23783 @opindex mno-ieee-fp
23784 Control whether or not the compiler uses IEEE floating-point
23785 comparisons. These correctly handle the case where the result of a
23786 comparison is unordered.
23787
23788 @item -m80387
23789 @item -mhard-float
23790 @opindex 80387
23791 @opindex mhard-float
23792 Generate output containing 80387 instructions for floating point.
23793
23794 @item -mno-80387
23795 @item -msoft-float
23796 @opindex no-80387
23797 @opindex msoft-float
23798 Generate output containing library calls for floating point.
23799
23800 @strong{Warning:} the requisite libraries are not part of GCC@.
23801 Normally the facilities of the machine's usual C compiler are used, but
23802 this can't be done directly in cross-compilation. You must make your
23803 own arrangements to provide suitable library functions for
23804 cross-compilation.
23805
23806 On machines where a function returns floating-point results in the 80387
23807 register stack, some floating-point opcodes may be emitted even if
23808 @option{-msoft-float} is used.
23809
23810 @item -mno-fp-ret-in-387
23811 @opindex mno-fp-ret-in-387
23812 Do not use the FPU registers for return values of functions.
23813
23814 The usual calling convention has functions return values of types
23815 @code{float} and @code{double} in an FPU register, even if there
23816 is no FPU@. The idea is that the operating system should emulate
23817 an FPU@.
23818
23819 The option @option{-mno-fp-ret-in-387} causes such values to be returned
23820 in ordinary CPU registers instead.
23821
23822 @item -mno-fancy-math-387
23823 @opindex mno-fancy-math-387
23824 Some 387 emulators do not support the @code{sin}, @code{cos} and
23825 @code{sqrt} instructions for the 387. Specify this option to avoid
23826 generating those instructions. This option is the default on
23827 OpenBSD and NetBSD@. This option is overridden when @option{-march}
23828 indicates that the target CPU always has an FPU and so the
23829 instruction does not need emulation. These
23830 instructions are not generated unless you also use the
23831 @option{-funsafe-math-optimizations} switch.
23832
23833 @item -malign-double
23834 @itemx -mno-align-double
23835 @opindex malign-double
23836 @opindex mno-align-double
23837 Control whether GCC aligns @code{double}, @code{long double}, and
23838 @code{long long} variables on a two-word boundary or a one-word
23839 boundary. Aligning @code{double} variables on a two-word boundary
23840 produces code that runs somewhat faster on a Pentium at the
23841 expense of more memory.
23842
23843 On x86-64, @option{-malign-double} is enabled by default.
23844
23845 @strong{Warning:} if you use the @option{-malign-double} switch,
23846 structures containing the above types are aligned differently than
23847 the published application binary interface specifications for the x86-32
23848 and are not binary compatible with structures in code compiled
23849 without that switch.
23850
23851 @item -m96bit-long-double
23852 @itemx -m128bit-long-double
23853 @opindex m96bit-long-double
23854 @opindex m128bit-long-double
23855 These switches control the size of @code{long double} type. The x86-32
23856 application binary interface specifies the size to be 96 bits,
23857 so @option{-m96bit-long-double} is the default in 32-bit mode.
23858
23859 Modern architectures (Pentium and newer) prefer @code{long double}
23860 to be aligned to an 8- or 16-byte boundary. In arrays or structures
23861 conforming to the ABI, this is not possible. So specifying
23862 @option{-m128bit-long-double} aligns @code{long double}
23863 to a 16-byte boundary by padding the @code{long double} with an additional
23864 32-bit zero.
23865
23866 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
23867 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
23868
23869 Notice that neither of these options enable any extra precision over the x87
23870 standard of 80 bits for a @code{long double}.
23871
23872 @strong{Warning:} if you override the default value for your target ABI, this
23873 changes the size of
23874 structures and arrays containing @code{long double} variables,
23875 as well as modifying the function calling convention for functions taking
23876 @code{long double}. Hence they are not binary-compatible
23877 with code compiled without that switch.
23878
23879 @item -mlong-double-64
23880 @itemx -mlong-double-80
23881 @itemx -mlong-double-128
23882 @opindex mlong-double-64
23883 @opindex mlong-double-80
23884 @opindex mlong-double-128
23885 These switches control the size of @code{long double} type. A size
23886 of 64 bits makes the @code{long double} type equivalent to the @code{double}
23887 type. This is the default for 32-bit Bionic C library. A size
23888 of 128 bits makes the @code{long double} type equivalent to the
23889 @code{__float128} type. This is the default for 64-bit Bionic C library.
23890
23891 @strong{Warning:} if you override the default value for your target ABI, this
23892 changes the size of
23893 structures and arrays containing @code{long double} variables,
23894 as well as modifying the function calling convention for functions taking
23895 @code{long double}. Hence they are not binary-compatible
23896 with code compiled without that switch.
23897
23898 @item -malign-data=@var{type}
23899 @opindex malign-data
23900 Control how GCC aligns variables. Supported values for @var{type} are
23901 @samp{compat} uses increased alignment value compatible uses GCC 4.8
23902 and earlier, @samp{abi} uses alignment value as specified by the
23903 psABI, and @samp{cacheline} uses increased alignment value to match
23904 the cache line size. @samp{compat} is the default.
23905
23906 @item -mlarge-data-threshold=@var{threshold}
23907 @opindex mlarge-data-threshold
23908 When @option{-mcmodel=medium} is specified, data objects larger than
23909 @var{threshold} are placed in the large data section. This value must be the
23910 same across all objects linked into the binary, and defaults to 65535.
23911
23912 @item -mrtd
23913 @opindex mrtd
23914 Use a different function-calling convention, in which functions that
23915 take a fixed number of arguments return with the @code{ret @var{num}}
23916 instruction, which pops their arguments while returning. This saves one
23917 instruction in the caller since there is no need to pop the arguments
23918 there.
23919
23920 You can specify that an individual function is called with this calling
23921 sequence with the function attribute @code{stdcall}. You can also
23922 override the @option{-mrtd} option by using the function attribute
23923 @code{cdecl}. @xref{Function Attributes}.
23924
23925 @strong{Warning:} this calling convention is incompatible with the one
23926 normally used on Unix, so you cannot use it if you need to call
23927 libraries compiled with the Unix compiler.
23928
23929 Also, you must provide function prototypes for all functions that
23930 take variable numbers of arguments (including @code{printf});
23931 otherwise incorrect code is generated for calls to those
23932 functions.
23933
23934 In addition, seriously incorrect code results if you call a
23935 function with too many arguments. (Normally, extra arguments are
23936 harmlessly ignored.)
23937
23938 @item -mregparm=@var{num}
23939 @opindex mregparm
23940 Control how many registers are used to pass integer arguments. By
23941 default, no registers are used to pass arguments, and at most 3
23942 registers can be used. You can control this behavior for a specific
23943 function by using the function attribute @code{regparm}.
23944 @xref{Function Attributes}.
23945
23946 @strong{Warning:} if you use this switch, and
23947 @var{num} is nonzero, then you must build all modules with the same
23948 value, including any libraries. This includes the system libraries and
23949 startup modules.
23950
23951 @item -msseregparm
23952 @opindex msseregparm
23953 Use SSE register passing conventions for float and double arguments
23954 and return values. You can control this behavior for a specific
23955 function by using the function attribute @code{sseregparm}.
23956 @xref{Function Attributes}.
23957
23958 @strong{Warning:} if you use this switch then you must build all
23959 modules with the same value, including any libraries. This includes
23960 the system libraries and startup modules.
23961
23962 @item -mvect8-ret-in-mem
23963 @opindex mvect8-ret-in-mem
23964 Return 8-byte vectors in memory instead of MMX registers. This is the
23965 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
23966 Studio compilers until version 12. Later compiler versions (starting
23967 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
23968 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
23969 you need to remain compatible with existing code produced by those
23970 previous compiler versions or older versions of GCC@.
23971
23972 @item -mpc32
23973 @itemx -mpc64
23974 @itemx -mpc80
23975 @opindex mpc32
23976 @opindex mpc64
23977 @opindex mpc80
23978
23979 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
23980 is specified, the significands of results of floating-point operations are
23981 rounded to 24 bits (single precision); @option{-mpc64} rounds the
23982 significands of results of floating-point operations to 53 bits (double
23983 precision) and @option{-mpc80} rounds the significands of results of
23984 floating-point operations to 64 bits (extended double precision), which is
23985 the default. When this option is used, floating-point operations in higher
23986 precisions are not available to the programmer without setting the FPU
23987 control word explicitly.
23988
23989 Setting the rounding of floating-point operations to less than the default
23990 80 bits can speed some programs by 2% or more. Note that some mathematical
23991 libraries assume that extended-precision (80-bit) floating-point operations
23992 are enabled by default; routines in such libraries could suffer significant
23993 loss of accuracy, typically through so-called ``catastrophic cancellation'',
23994 when this option is used to set the precision to less than extended precision.
23995
23996 @item -mstackrealign
23997 @opindex mstackrealign
23998 Realign the stack at entry. On the x86, the @option{-mstackrealign}
23999 option generates an alternate prologue and epilogue that realigns the
24000 run-time stack if necessary. This supports mixing legacy codes that keep
24001 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
24002 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
24003 applicable to individual functions.
24004
24005 @item -mpreferred-stack-boundary=@var{num}
24006 @opindex mpreferred-stack-boundary
24007 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24008 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24009 the default is 4 (16 bytes or 128 bits).
24010
24011 @strong{Warning:} When generating code for the x86-64 architecture with
24012 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
24013 used to keep the stack boundary aligned to 8 byte boundary. Since
24014 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
24015 intended to be used in controlled environment where stack space is
24016 important limitation. This option leads to wrong code when functions
24017 compiled with 16 byte stack alignment (such as functions from a standard
24018 library) are called with misaligned stack. In this case, SSE
24019 instructions may lead to misaligned memory access traps. In addition,
24020 variable arguments are handled incorrectly for 16 byte aligned
24021 objects (including x87 long double and __int128), leading to wrong
24022 results. You must build all modules with
24023 @option{-mpreferred-stack-boundary=3}, including any libraries. This
24024 includes the system libraries and startup modules.
24025
24026 @item -mincoming-stack-boundary=@var{num}
24027 @opindex mincoming-stack-boundary
24028 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
24029 boundary. If @option{-mincoming-stack-boundary} is not specified,
24030 the one specified by @option{-mpreferred-stack-boundary} is used.
24031
24032 On Pentium and Pentium Pro, @code{double} and @code{long double} values
24033 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
24034 suffer significant run time performance penalties. On Pentium III, the
24035 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
24036 properly if it is not 16-byte aligned.
24037
24038 To ensure proper alignment of this values on the stack, the stack boundary
24039 must be as aligned as that required by any value stored on the stack.
24040 Further, every function must be generated such that it keeps the stack
24041 aligned. Thus calling a function compiled with a higher preferred
24042 stack boundary from a function compiled with a lower preferred stack
24043 boundary most likely misaligns the stack. It is recommended that
24044 libraries that use callbacks always use the default setting.
24045
24046 This extra alignment does consume extra stack space, and generally
24047 increases code size. Code that is sensitive to stack space usage, such
24048 as embedded systems and operating system kernels, may want to reduce the
24049 preferred alignment to @option{-mpreferred-stack-boundary=2}.
24050
24051 @need 200
24052 @item -mmmx
24053 @opindex mmmx
24054 @need 200
24055 @itemx -msse
24056 @opindex msse
24057 @need 200
24058 @itemx -msse2
24059 @opindex msse2
24060 @need 200
24061 @itemx -msse3
24062 @opindex msse3
24063 @need 200
24064 @itemx -mssse3
24065 @opindex mssse3
24066 @need 200
24067 @itemx -msse4
24068 @opindex msse4
24069 @need 200
24070 @itemx -msse4a
24071 @opindex msse4a
24072 @need 200
24073 @itemx -msse4.1
24074 @opindex msse4.1
24075 @need 200
24076 @itemx -msse4.2
24077 @opindex msse4.2
24078 @need 200
24079 @itemx -mavx
24080 @opindex mavx
24081 @need 200
24082 @itemx -mavx2
24083 @opindex mavx2
24084 @need 200
24085 @itemx -mavx512f
24086 @opindex mavx512f
24087 @need 200
24088 @itemx -mavx512pf
24089 @opindex mavx512pf
24090 @need 200
24091 @itemx -mavx512er
24092 @opindex mavx512er
24093 @need 200
24094 @itemx -mavx512cd
24095 @opindex mavx512cd
24096 @need 200
24097 @itemx -mavx512vl
24098 @opindex mavx512vl
24099 @need 200
24100 @itemx -mavx512bw
24101 @opindex mavx512bw
24102 @need 200
24103 @itemx -mavx512dq
24104 @opindex mavx512dq
24105 @need 200
24106 @itemx -mavx512ifma
24107 @opindex mavx512ifma
24108 @need 200
24109 @itemx -mavx512vbmi
24110 @opindex mavx512vbmi
24111 @need 200
24112 @itemx -msha
24113 @opindex msha
24114 @need 200
24115 @itemx -maes
24116 @opindex maes
24117 @need 200
24118 @itemx -mpclmul
24119 @opindex mpclmul
24120 @need 200
24121 @itemx -mclfushopt
24122 @opindex mclfushopt
24123 @need 200
24124 @itemx -mfsgsbase
24125 @opindex mfsgsbase
24126 @need 200
24127 @itemx -mrdrnd
24128 @opindex mrdrnd
24129 @need 200
24130 @itemx -mf16c
24131 @opindex mf16c
24132 @need 200
24133 @itemx -mfma
24134 @opindex mfma
24135 @need 200
24136 @itemx -mfma4
24137 @opindex mfma4
24138 @need 200
24139 @itemx -mprefetchwt1
24140 @opindex mprefetchwt1
24141 @need 200
24142 @itemx -mxop
24143 @opindex mxop
24144 @need 200
24145 @itemx -mlwp
24146 @opindex mlwp
24147 @need 200
24148 @itemx -m3dnow
24149 @opindex m3dnow
24150 @need 200
24151 @itemx -mpopcnt
24152 @opindex mpopcnt
24153 @need 200
24154 @itemx -mabm
24155 @opindex mabm
24156 @need 200
24157 @itemx -mbmi
24158 @opindex mbmi
24159 @need 200
24160 @itemx -mbmi2
24161 @need 200
24162 @itemx -mlzcnt
24163 @opindex mlzcnt
24164 @need 200
24165 @itemx -mfxsr
24166 @opindex mfxsr
24167 @need 200
24168 @itemx -mxsave
24169 @opindex mxsave
24170 @need 200
24171 @itemx -mxsaveopt
24172 @opindex mxsaveopt
24173 @need 200
24174 @itemx -mxsavec
24175 @opindex mxsavec
24176 @need 200
24177 @itemx -mxsaves
24178 @opindex mxsaves
24179 @need 200
24180 @itemx -mrtm
24181 @opindex mrtm
24182 @need 200
24183 @itemx -mtbm
24184 @opindex mtbm
24185 @need 200
24186 @itemx -mmpx
24187 @opindex mmpx
24188 @need 200
24189 @itemx -mmwaitx
24190 @opindex mmwaitx
24191 @need 200
24192 @itemx -mclzero
24193 @opindex mclzero
24194 @itemx -mpku
24195 @opindex mpku
24196 These switches enable the use of instructions in the MMX, SSE,
24197 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
24198 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
24199 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
24200 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU or 3DNow!@:
24201 extended instruction sets. Each has a corresponding @option{-mno-} option
24202 to disable use of these instructions.
24203
24204 These extensions are also available as built-in functions: see
24205 @ref{x86 Built-in Functions}, for details of the functions enabled and
24206 disabled by these switches.
24207
24208 To generate SSE/SSE2 instructions automatically from floating-point
24209 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
24210
24211 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
24212 generates new AVX instructions or AVX equivalence for all SSEx instructions
24213 when needed.
24214
24215 These options enable GCC to use these extended instructions in
24216 generated code, even without @option{-mfpmath=sse}. Applications that
24217 perform run-time CPU detection must compile separate files for each
24218 supported architecture, using the appropriate flags. In particular,
24219 the file containing the CPU detection code should be compiled without
24220 these options.
24221
24222 @item -mdump-tune-features
24223 @opindex mdump-tune-features
24224 This option instructs GCC to dump the names of the x86 performance
24225 tuning features and default settings. The names can be used in
24226 @option{-mtune-ctrl=@var{feature-list}}.
24227
24228 @item -mtune-ctrl=@var{feature-list}
24229 @opindex mtune-ctrl=@var{feature-list}
24230 This option is used to do fine grain control of x86 code generation features.
24231 @var{feature-list} is a comma separated list of @var{feature} names. See also
24232 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
24233 on if it is not preceded with @samp{^}, otherwise, it is turned off.
24234 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
24235 developers. Using it may lead to code paths not covered by testing and can
24236 potentially result in compiler ICEs or runtime errors.
24237
24238 @item -mno-default
24239 @opindex mno-default
24240 This option instructs GCC to turn off all tunable features. See also
24241 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
24242
24243 @item -mcld
24244 @opindex mcld
24245 This option instructs GCC to emit a @code{cld} instruction in the prologue
24246 of functions that use string instructions. String instructions depend on
24247 the DF flag to select between autoincrement or autodecrement mode. While the
24248 ABI specifies the DF flag to be cleared on function entry, some operating
24249 systems violate this specification by not clearing the DF flag in their
24250 exception dispatchers. The exception handler can be invoked with the DF flag
24251 set, which leads to wrong direction mode when string instructions are used.
24252 This option can be enabled by default on 32-bit x86 targets by configuring
24253 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
24254 instructions can be suppressed with the @option{-mno-cld} compiler option
24255 in this case.
24256
24257 @item -mvzeroupper
24258 @opindex mvzeroupper
24259 This option instructs GCC to emit a @code{vzeroupper} instruction
24260 before a transfer of control flow out of the function to minimize
24261 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
24262 intrinsics.
24263
24264 @item -mprefer-avx128
24265 @opindex mprefer-avx128
24266 This option instructs GCC to use 128-bit AVX instructions instead of
24267 256-bit AVX instructions in the auto-vectorizer.
24268
24269 @item -mcx16
24270 @opindex mcx16
24271 This option enables GCC to generate @code{CMPXCHG16B} instructions.
24272 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
24273 (or oword) data types.
24274 This is useful for high-resolution counters that can be updated
24275 by multiple processors (or cores). This instruction is generated as part of
24276 atomic built-in functions: see @ref{__sync Builtins} or
24277 @ref{__atomic Builtins} for details.
24278
24279 @item -msahf
24280 @opindex msahf
24281 This option enables generation of @code{SAHF} instructions in 64-bit code.
24282 Early Intel Pentium 4 CPUs with Intel 64 support,
24283 prior to the introduction of Pentium 4 G1 step in December 2005,
24284 lacked the @code{LAHF} and @code{SAHF} instructions
24285 which are supported by AMD64.
24286 These are load and store instructions, respectively, for certain status flags.
24287 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
24288 @code{drem}, and @code{remainder} built-in functions;
24289 see @ref{Other Builtins} for details.
24290
24291 @item -mmovbe
24292 @opindex mmovbe
24293 This option enables use of the @code{movbe} instruction to implement
24294 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
24295
24296 @item -mcrc32
24297 @opindex mcrc32
24298 This option enables built-in functions @code{__builtin_ia32_crc32qi},
24299 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
24300 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
24301
24302 @item -mrecip
24303 @opindex mrecip
24304 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
24305 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
24306 with an additional Newton-Raphson step
24307 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
24308 (and their vectorized
24309 variants) for single-precision floating-point arguments. These instructions
24310 are generated only when @option{-funsafe-math-optimizations} is enabled
24311 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
24312 Note that while the throughput of the sequence is higher than the throughput
24313 of the non-reciprocal instruction, the precision of the sequence can be
24314 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
24315
24316 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
24317 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
24318 combination), and doesn't need @option{-mrecip}.
24319
24320 Also note that GCC emits the above sequence with additional Newton-Raphson step
24321 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
24322 already with @option{-ffast-math} (or the above option combination), and
24323 doesn't need @option{-mrecip}.
24324
24325 @item -mrecip=@var{opt}
24326 @opindex mrecip=opt
24327 This option controls which reciprocal estimate instructions
24328 may be used. @var{opt} is a comma-separated list of options, which may
24329 be preceded by a @samp{!} to invert the option:
24330
24331 @table @samp
24332 @item all
24333 Enable all estimate instructions.
24334
24335 @item default
24336 Enable the default instructions, equivalent to @option{-mrecip}.
24337
24338 @item none
24339 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24340
24341 @item div
24342 Enable the approximation for scalar division.
24343
24344 @item vec-div
24345 Enable the approximation for vectorized division.
24346
24347 @item sqrt
24348 Enable the approximation for scalar square root.
24349
24350 @item vec-sqrt
24351 Enable the approximation for vectorized square root.
24352 @end table
24353
24354 So, for example, @option{-mrecip=all,!sqrt} enables
24355 all of the reciprocal approximations, except for square root.
24356
24357 @item -mveclibabi=@var{type}
24358 @opindex mveclibabi
24359 Specifies the ABI type to use for vectorizing intrinsics using an
24360 external library. Supported values for @var{type} are @samp{svml}
24361 for the Intel short
24362 vector math library and @samp{acml} for the AMD math core library.
24363 To use this option, both @option{-ftree-vectorize} and
24364 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
24365 ABI-compatible library must be specified at link time.
24366
24367 GCC currently emits calls to @code{vmldExp2},
24368 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
24369 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
24370 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
24371 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
24372 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
24373 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
24374 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
24375 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
24376 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
24377 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
24378 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
24379 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
24380 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
24381 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
24382 when @option{-mveclibabi=acml} is used.
24383
24384 @item -mabi=@var{name}
24385 @opindex mabi
24386 Generate code for the specified calling convention. Permissible values
24387 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
24388 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
24389 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
24390 You can control this behavior for specific functions by
24391 using the function attributes @code{ms_abi} and @code{sysv_abi}.
24392 @xref{Function Attributes}.
24393
24394 @item -mtls-dialect=@var{type}
24395 @opindex mtls-dialect
24396 Generate code to access thread-local storage using the @samp{gnu} or
24397 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
24398 @samp{gnu2} is more efficient, but it may add compile- and run-time
24399 requirements that cannot be satisfied on all systems.
24400
24401 @item -mpush-args
24402 @itemx -mno-push-args
24403 @opindex mpush-args
24404 @opindex mno-push-args
24405 Use PUSH operations to store outgoing parameters. This method is shorter
24406 and usually equally fast as method using SUB/MOV operations and is enabled
24407 by default. In some cases disabling it may improve performance because of
24408 improved scheduling and reduced dependencies.
24409
24410 @item -maccumulate-outgoing-args
24411 @opindex maccumulate-outgoing-args
24412 If enabled, the maximum amount of space required for outgoing arguments is
24413 computed in the function prologue. This is faster on most modern CPUs
24414 because of reduced dependencies, improved scheduling and reduced stack usage
24415 when the preferred stack boundary is not equal to 2. The drawback is a notable
24416 increase in code size. This switch implies @option{-mno-push-args}.
24417
24418 @item -mthreads
24419 @opindex mthreads
24420 Support thread-safe exception handling on MinGW. Programs that rely
24421 on thread-safe exception handling must compile and link all code with the
24422 @option{-mthreads} option. When compiling, @option{-mthreads} defines
24423 @option{-D_MT}; when linking, it links in a special thread helper library
24424 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
24425
24426 @item -mms-bitfields
24427 @itemx -mno-ms-bitfields
24428 @opindex mms-bitfields
24429 @opindex mno-ms-bitfields
24430
24431 Enable/disable bit-field layout compatible with the native Microsoft
24432 Windows compiler.
24433
24434 If @code{packed} is used on a structure, or if bit-fields are used,
24435 it may be that the Microsoft ABI lays out the structure differently
24436 than the way GCC normally does. Particularly when moving packed
24437 data between functions compiled with GCC and the native Microsoft compiler
24438 (either via function call or as data in a file), it may be necessary to access
24439 either format.
24440
24441 This option is enabled by default for Microsoft Windows
24442 targets. This behavior can also be controlled locally by use of variable
24443 or type attributes. For more information, see @ref{x86 Variable Attributes}
24444 and @ref{x86 Type Attributes}.
24445
24446 The Microsoft structure layout algorithm is fairly simple with the exception
24447 of the bit-field packing.
24448 The padding and alignment of members of structures and whether a bit-field
24449 can straddle a storage-unit boundary are determine by these rules:
24450
24451 @enumerate
24452 @item Structure members are stored sequentially in the order in which they are
24453 declared: the first member has the lowest memory address and the last member
24454 the highest.
24455
24456 @item Every data object has an alignment requirement. The alignment requirement
24457 for all data except structures, unions, and arrays is either the size of the
24458 object or the current packing size (specified with either the
24459 @code{aligned} attribute or the @code{pack} pragma),
24460 whichever is less. For structures, unions, and arrays,
24461 the alignment requirement is the largest alignment requirement of its members.
24462 Every object is allocated an offset so that:
24463
24464 @smallexample
24465 offset % alignment_requirement == 0
24466 @end smallexample
24467
24468 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
24469 unit if the integral types are the same size and if the next bit-field fits
24470 into the current allocation unit without crossing the boundary imposed by the
24471 common alignment requirements of the bit-fields.
24472 @end enumerate
24473
24474 MSVC interprets zero-length bit-fields in the following ways:
24475
24476 @enumerate
24477 @item If a zero-length bit-field is inserted between two bit-fields that
24478 are normally coalesced, the bit-fields are not coalesced.
24479
24480 For example:
24481
24482 @smallexample
24483 struct
24484 @{
24485 unsigned long bf_1 : 12;
24486 unsigned long : 0;
24487 unsigned long bf_2 : 12;
24488 @} t1;
24489 @end smallexample
24490
24491 @noindent
24492 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
24493 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
24494
24495 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
24496 alignment of the zero-length bit-field is greater than the member that follows it,
24497 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
24498
24499 For example:
24500
24501 @smallexample
24502 struct
24503 @{
24504 char foo : 4;
24505 short : 0;
24506 char bar;
24507 @} t2;
24508
24509 struct
24510 @{
24511 char foo : 4;
24512 short : 0;
24513 double bar;
24514 @} t3;
24515 @end smallexample
24516
24517 @noindent
24518 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
24519 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
24520 bit-field does not affect the alignment of @code{bar} or, as a result, the size
24521 of the structure.
24522
24523 Taking this into account, it is important to note the following:
24524
24525 @enumerate
24526 @item If a zero-length bit-field follows a normal bit-field, the type of the
24527 zero-length bit-field may affect the alignment of the structure as whole. For
24528 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
24529 normal bit-field, and is of type short.
24530
24531 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
24532 still affect the alignment of the structure:
24533
24534 @smallexample
24535 struct
24536 @{
24537 char foo : 6;
24538 long : 0;
24539 @} t4;
24540 @end smallexample
24541
24542 @noindent
24543 Here, @code{t4} takes up 4 bytes.
24544 @end enumerate
24545
24546 @item Zero-length bit-fields following non-bit-field members are ignored:
24547
24548 @smallexample
24549 struct
24550 @{
24551 char foo;
24552 long : 0;
24553 char bar;
24554 @} t5;
24555 @end smallexample
24556
24557 @noindent
24558 Here, @code{t5} takes up 2 bytes.
24559 @end enumerate
24560
24561
24562 @item -mno-align-stringops
24563 @opindex mno-align-stringops
24564 Do not align the destination of inlined string operations. This switch reduces
24565 code size and improves performance in case the destination is already aligned,
24566 but GCC doesn't know about it.
24567
24568 @item -minline-all-stringops
24569 @opindex minline-all-stringops
24570 By default GCC inlines string operations only when the destination is
24571 known to be aligned to least a 4-byte boundary.
24572 This enables more inlining and increases code
24573 size, but may improve performance of code that depends on fast
24574 @code{memcpy}, @code{strlen},
24575 and @code{memset} for short lengths.
24576
24577 @item -minline-stringops-dynamically
24578 @opindex minline-stringops-dynamically
24579 For string operations of unknown size, use run-time checks with
24580 inline code for small blocks and a library call for large blocks.
24581
24582 @item -mstringop-strategy=@var{alg}
24583 @opindex mstringop-strategy=@var{alg}
24584 Override the internal decision heuristic for the particular algorithm to use
24585 for inlining string operations. The allowed values for @var{alg} are:
24586
24587 @table @samp
24588 @item rep_byte
24589 @itemx rep_4byte
24590 @itemx rep_8byte
24591 Expand using i386 @code{rep} prefix of the specified size.
24592
24593 @item byte_loop
24594 @itemx loop
24595 @itemx unrolled_loop
24596 Expand into an inline loop.
24597
24598 @item libcall
24599 Always use a library call.
24600 @end table
24601
24602 @item -mmemcpy-strategy=@var{strategy}
24603 @opindex mmemcpy-strategy=@var{strategy}
24604 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
24605 should be inlined and what inline algorithm to use when the expected size
24606 of the copy operation is known. @var{strategy}
24607 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
24608 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
24609 the max byte size with which inline algorithm @var{alg} is allowed. For the last
24610 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
24611 in the list must be specified in increasing order. The minimal byte size for
24612 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
24613 preceding range.
24614
24615 @item -mmemset-strategy=@var{strategy}
24616 @opindex mmemset-strategy=@var{strategy}
24617 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
24618 @code{__builtin_memset} expansion.
24619
24620 @item -momit-leaf-frame-pointer
24621 @opindex momit-leaf-frame-pointer
24622 Don't keep the frame pointer in a register for leaf functions. This
24623 avoids the instructions to save, set up, and restore frame pointers and
24624 makes an extra register available in leaf functions. The option
24625 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
24626 which might make debugging harder.
24627
24628 @item -mtls-direct-seg-refs
24629 @itemx -mno-tls-direct-seg-refs
24630 @opindex mtls-direct-seg-refs
24631 Controls whether TLS variables may be accessed with offsets from the
24632 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
24633 or whether the thread base pointer must be added. Whether or not this
24634 is valid depends on the operating system, and whether it maps the
24635 segment to cover the entire TLS area.
24636
24637 For systems that use the GNU C Library, the default is on.
24638
24639 @item -msse2avx
24640 @itemx -mno-sse2avx
24641 @opindex msse2avx
24642 Specify that the assembler should encode SSE instructions with VEX
24643 prefix. The option @option{-mavx} turns this on by default.
24644
24645 @item -mfentry
24646 @itemx -mno-fentry
24647 @opindex mfentry
24648 If profiling is active (@option{-pg}), put the profiling
24649 counter call before the prologue.
24650 Note: On x86 architectures the attribute @code{ms_hook_prologue}
24651 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
24652
24653 @item -mrecord-mcount
24654 @itemx -mno-record-mcount
24655 @opindex mrecord-mcount
24656 If profiling is active (@option{-pg}), generate a __mcount_loc section
24657 that contains pointers to each profiling call. This is useful for
24658 automatically patching and out calls.
24659
24660 @item -mnop-mcount
24661 @itemx -mno-nop-mcount
24662 @opindex mnop-mcount
24663 If profiling is active (@option{-pg}), generate the calls to
24664 the profiling functions as NOPs. This is useful when they
24665 should be patched in later dynamically. This is likely only
24666 useful together with @option{-mrecord-mcount}.
24667
24668 @item -mskip-rax-setup
24669 @itemx -mno-skip-rax-setup
24670 @opindex mskip-rax-setup
24671 When generating code for the x86-64 architecture with SSE extensions
24672 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
24673 register when there are no variable arguments passed in vector registers.
24674
24675 @strong{Warning:} Since RAX register is used to avoid unnecessarily
24676 saving vector registers on stack when passing variable arguments, the
24677 impacts of this option are callees may waste some stack space,
24678 misbehave or jump to a random location. GCC 4.4 or newer don't have
24679 those issues, regardless the RAX register value.
24680
24681 @item -m8bit-idiv
24682 @itemx -mno-8bit-idiv
24683 @opindex m8bit-idiv
24684 On some processors, like Intel Atom, 8-bit unsigned integer divide is
24685 much faster than 32-bit/64-bit integer divide. This option generates a
24686 run-time check. If both dividend and divisor are within range of 0
24687 to 255, 8-bit unsigned integer divide is used instead of
24688 32-bit/64-bit integer divide.
24689
24690 @item -mavx256-split-unaligned-load
24691 @itemx -mavx256-split-unaligned-store
24692 @opindex mavx256-split-unaligned-load
24693 @opindex mavx256-split-unaligned-store
24694 Split 32-byte AVX unaligned load and store.
24695
24696 @item -mstack-protector-guard=@var{guard}
24697 @opindex mstack-protector-guard=@var{guard}
24698 Generate stack protection code using canary at @var{guard}. Supported
24699 locations are @samp{global} for global canary or @samp{tls} for per-thread
24700 canary in the TLS block (the default). This option has effect only when
24701 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
24702
24703 @item -mmitigate-rop
24704 @opindex mmitigate-rop
24705 Try to avoid generating code sequences that contain unintended return
24706 opcodes, to mitigate against certain forms of attack. At the moment,
24707 this option is limited in what it can do and should not be relied
24708 on to provide serious protection.
24709
24710 @item -mgeneral-regs-only
24711 @opindex mgeneral-regs-only
24712 Generate code that uses only the general-purpose registers. This
24713 prevents the compiler from using floating-point, vector, mask and bound
24714 registers.
24715
24716 @end table
24717
24718 These @samp{-m} switches are supported in addition to the above
24719 on x86-64 processors in 64-bit environments.
24720
24721 @table @gcctabopt
24722 @item -m32
24723 @itemx -m64
24724 @itemx -mx32
24725 @itemx -m16
24726 @itemx -miamcu
24727 @opindex m32
24728 @opindex m64
24729 @opindex mx32
24730 @opindex m16
24731 @opindex miamcu
24732 Generate code for a 16-bit, 32-bit or 64-bit environment.
24733 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
24734 to 32 bits, and
24735 generates code that runs on any i386 system.
24736
24737 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
24738 types to 64 bits, and generates code for the x86-64 architecture.
24739 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
24740 and @option{-mdynamic-no-pic} options.
24741
24742 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
24743 to 32 bits, and
24744 generates code for the x86-64 architecture.
24745
24746 The @option{-m16} option is the same as @option{-m32}, except for that
24747 it outputs the @code{.code16gcc} assembly directive at the beginning of
24748 the assembly output so that the binary can run in 16-bit mode.
24749
24750 The @option{-miamcu} option generates code which conforms to Intel MCU
24751 psABI. It requires the @option{-m32} option to be turned on.
24752
24753 @item -mno-red-zone
24754 @opindex mno-red-zone
24755 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
24756 by the x86-64 ABI; it is a 128-byte area beyond the location of the
24757 stack pointer that is not modified by signal or interrupt handlers
24758 and therefore can be used for temporary data without adjusting the stack
24759 pointer. The flag @option{-mno-red-zone} disables this red zone.
24760
24761 @item -mcmodel=small
24762 @opindex mcmodel=small
24763 Generate code for the small code model: the program and its symbols must
24764 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
24765 Programs can be statically or dynamically linked. This is the default
24766 code model.
24767
24768 @item -mcmodel=kernel
24769 @opindex mcmodel=kernel
24770 Generate code for the kernel code model. The kernel runs in the
24771 negative 2 GB of the address space.
24772 This model has to be used for Linux kernel code.
24773
24774 @item -mcmodel=medium
24775 @opindex mcmodel=medium
24776 Generate code for the medium model: the program is linked in the lower 2
24777 GB of the address space. Small symbols are also placed there. Symbols
24778 with sizes larger than @option{-mlarge-data-threshold} are put into
24779 large data or BSS sections and can be located above 2GB. Programs can
24780 be statically or dynamically linked.
24781
24782 @item -mcmodel=large
24783 @opindex mcmodel=large
24784 Generate code for the large model. This model makes no assumptions
24785 about addresses and sizes of sections.
24786
24787 @item -maddress-mode=long
24788 @opindex maddress-mode=long
24789 Generate code for long address mode. This is only supported for 64-bit
24790 and x32 environments. It is the default address mode for 64-bit
24791 environments.
24792
24793 @item -maddress-mode=short
24794 @opindex maddress-mode=short
24795 Generate code for short address mode. This is only supported for 32-bit
24796 and x32 environments. It is the default address mode for 32-bit and
24797 x32 environments.
24798 @end table
24799
24800 @node x86 Windows Options
24801 @subsection x86 Windows Options
24802 @cindex x86 Windows Options
24803 @cindex Windows Options for x86
24804
24805 These additional options are available for Microsoft Windows targets:
24806
24807 @table @gcctabopt
24808 @item -mconsole
24809 @opindex mconsole
24810 This option
24811 specifies that a console application is to be generated, by
24812 instructing the linker to set the PE header subsystem type
24813 required for console applications.
24814 This option is available for Cygwin and MinGW targets and is
24815 enabled by default on those targets.
24816
24817 @item -mdll
24818 @opindex mdll
24819 This option is available for Cygwin and MinGW targets. It
24820 specifies that a DLL---a dynamic link library---is to be
24821 generated, enabling the selection of the required runtime
24822 startup object and entry point.
24823
24824 @item -mnop-fun-dllimport
24825 @opindex mnop-fun-dllimport
24826 This option is available for Cygwin and MinGW targets. It
24827 specifies that the @code{dllimport} attribute should be ignored.
24828
24829 @item -mthread
24830 @opindex mthread
24831 This option is available for MinGW targets. It specifies
24832 that MinGW-specific thread support is to be used.
24833
24834 @item -municode
24835 @opindex municode
24836 This option is available for MinGW-w64 targets. It causes
24837 the @code{UNICODE} preprocessor macro to be predefined, and
24838 chooses Unicode-capable runtime startup code.
24839
24840 @item -mwin32
24841 @opindex mwin32
24842 This option is available for Cygwin and MinGW targets. It
24843 specifies that the typical Microsoft Windows predefined macros are to
24844 be set in the pre-processor, but does not influence the choice
24845 of runtime library/startup code.
24846
24847 @item -mwindows
24848 @opindex mwindows
24849 This option is available for Cygwin and MinGW targets. It
24850 specifies that a GUI application is to be generated by
24851 instructing the linker to set the PE header subsystem type
24852 appropriately.
24853
24854 @item -fno-set-stack-executable
24855 @opindex fno-set-stack-executable
24856 This option is available for MinGW targets. It specifies that
24857 the executable flag for the stack used by nested functions isn't
24858 set. This is necessary for binaries running in kernel mode of
24859 Microsoft Windows, as there the User32 API, which is used to set executable
24860 privileges, isn't available.
24861
24862 @item -fwritable-relocated-rdata
24863 @opindex fno-writable-relocated-rdata
24864 This option is available for MinGW and Cygwin targets. It specifies
24865 that relocated-data in read-only section is put into the @code{.data}
24866 section. This is a necessary for older runtimes not supporting
24867 modification of @code{.rdata} sections for pseudo-relocation.
24868
24869 @item -mpe-aligned-commons
24870 @opindex mpe-aligned-commons
24871 This option is available for Cygwin and MinGW targets. It
24872 specifies that the GNU extension to the PE file format that
24873 permits the correct alignment of COMMON variables should be
24874 used when generating code. It is enabled by default if
24875 GCC detects that the target assembler found during configuration
24876 supports the feature.
24877 @end table
24878
24879 See also under @ref{x86 Options} for standard options.
24880
24881 @node Xstormy16 Options
24882 @subsection Xstormy16 Options
24883 @cindex Xstormy16 Options
24884
24885 These options are defined for Xstormy16:
24886
24887 @table @gcctabopt
24888 @item -msim
24889 @opindex msim
24890 Choose startup files and linker script suitable for the simulator.
24891 @end table
24892
24893 @node Xtensa Options
24894 @subsection Xtensa Options
24895 @cindex Xtensa Options
24896
24897 These options are supported for Xtensa targets:
24898
24899 @table @gcctabopt
24900 @item -mconst16
24901 @itemx -mno-const16
24902 @opindex mconst16
24903 @opindex mno-const16
24904 Enable or disable use of @code{CONST16} instructions for loading
24905 constant values. The @code{CONST16} instruction is currently not a
24906 standard option from Tensilica. When enabled, @code{CONST16}
24907 instructions are always used in place of the standard @code{L32R}
24908 instructions. The use of @code{CONST16} is enabled by default only if
24909 the @code{L32R} instruction is not available.
24910
24911 @item -mfused-madd
24912 @itemx -mno-fused-madd
24913 @opindex mfused-madd
24914 @opindex mno-fused-madd
24915 Enable or disable use of fused multiply/add and multiply/subtract
24916 instructions in the floating-point option. This has no effect if the
24917 floating-point option is not also enabled. Disabling fused multiply/add
24918 and multiply/subtract instructions forces the compiler to use separate
24919 instructions for the multiply and add/subtract operations. This may be
24920 desirable in some cases where strict IEEE 754-compliant results are
24921 required: the fused multiply add/subtract instructions do not round the
24922 intermediate result, thereby producing results with @emph{more} bits of
24923 precision than specified by the IEEE standard. Disabling fused multiply
24924 add/subtract instructions also ensures that the program output is not
24925 sensitive to the compiler's ability to combine multiply and add/subtract
24926 operations.
24927
24928 @item -mserialize-volatile
24929 @itemx -mno-serialize-volatile
24930 @opindex mserialize-volatile
24931 @opindex mno-serialize-volatile
24932 When this option is enabled, GCC inserts @code{MEMW} instructions before
24933 @code{volatile} memory references to guarantee sequential consistency.
24934 The default is @option{-mserialize-volatile}. Use
24935 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
24936
24937 @item -mforce-no-pic
24938 @opindex mforce-no-pic
24939 For targets, like GNU/Linux, where all user-mode Xtensa code must be
24940 position-independent code (PIC), this option disables PIC for compiling
24941 kernel code.
24942
24943 @item -mtext-section-literals
24944 @itemx -mno-text-section-literals
24945 @opindex mtext-section-literals
24946 @opindex mno-text-section-literals
24947 These options control the treatment of literal pools. The default is
24948 @option{-mno-text-section-literals}, which places literals in a separate
24949 section in the output file. This allows the literal pool to be placed
24950 in a data RAM/ROM, and it also allows the linker to combine literal
24951 pools from separate object files to remove redundant literals and
24952 improve code size. With @option{-mtext-section-literals}, the literals
24953 are interspersed in the text section in order to keep them as close as
24954 possible to their references. This may be necessary for large assembly
24955 files. Literals for each function are placed right before that function.
24956
24957 @item -mauto-litpools
24958 @itemx -mno-auto-litpools
24959 @opindex mauto-litpools
24960 @opindex mno-auto-litpools
24961 These options control the treatment of literal pools. The default is
24962 @option{-mno-auto-litpools}, which places literals in a separate
24963 section in the output file unless @option{-mtext-section-literals} is
24964 used. With @option{-mauto-litpools} the literals are interspersed in
24965 the text section by the assembler. Compiler does not produce explicit
24966 @code{.literal} directives and loads literals into registers with
24967 @code{MOVI} instructions instead of @code{L32R} to let the assembler
24968 do relaxation and place literals as necessary. This option allows
24969 assembler to create several literal pools per function and assemble
24970 very big functions, which may not be possible with
24971 @option{-mtext-section-literals}.
24972
24973 @item -mtarget-align
24974 @itemx -mno-target-align
24975 @opindex mtarget-align
24976 @opindex mno-target-align
24977 When this option is enabled, GCC instructs the assembler to
24978 automatically align instructions to reduce branch penalties at the
24979 expense of some code density. The assembler attempts to widen density
24980 instructions to align branch targets and the instructions following call
24981 instructions. If there are not enough preceding safe density
24982 instructions to align a target, no widening is performed. The
24983 default is @option{-mtarget-align}. These options do not affect the
24984 treatment of auto-aligned instructions like @code{LOOP}, which the
24985 assembler always aligns, either by widening density instructions or
24986 by inserting NOP instructions.
24987
24988 @item -mlongcalls
24989 @itemx -mno-longcalls
24990 @opindex mlongcalls
24991 @opindex mno-longcalls
24992 When this option is enabled, GCC instructs the assembler to translate
24993 direct calls to indirect calls unless it can determine that the target
24994 of a direct call is in the range allowed by the call instruction. This
24995 translation typically occurs for calls to functions in other source
24996 files. Specifically, the assembler translates a direct @code{CALL}
24997 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
24998 The default is @option{-mno-longcalls}. This option should be used in
24999 programs where the call target can potentially be out of range. This
25000 option is implemented in the assembler, not the compiler, so the
25001 assembly code generated by GCC still shows direct call
25002 instructions---look at the disassembled object code to see the actual
25003 instructions. Note that the assembler uses an indirect call for
25004 every cross-file call, not just those that really are out of range.
25005 @end table
25006
25007 @node zSeries Options
25008 @subsection zSeries Options
25009 @cindex zSeries options
25010
25011 These are listed under @xref{S/390 and zSeries Options}.
25012
25013
25014 @c man end
25015
25016 @node Spec Files
25017 @section Specifying Subprocesses and the Switches to Pass to Them
25018 @cindex Spec Files
25019
25020 @command{gcc} is a driver program. It performs its job by invoking a
25021 sequence of other programs to do the work of compiling, assembling and
25022 linking. GCC interprets its command-line parameters and uses these to
25023 deduce which programs it should invoke, and which command-line options
25024 it ought to place on their command lines. This behavior is controlled
25025 by @dfn{spec strings}. In most cases there is one spec string for each
25026 program that GCC can invoke, but a few programs have multiple spec
25027 strings to control their behavior. The spec strings built into GCC can
25028 be overridden by using the @option{-specs=} command-line switch to specify
25029 a spec file.
25030
25031 @dfn{Spec files} are plain-text files that are used to construct spec
25032 strings. They consist of a sequence of directives separated by blank
25033 lines. The type of directive is determined by the first non-whitespace
25034 character on the line, which can be one of the following:
25035
25036 @table @code
25037 @item %@var{command}
25038 Issues a @var{command} to the spec file processor. The commands that can
25039 appear here are:
25040
25041 @table @code
25042 @item %include <@var{file}>
25043 @cindex @code{%include}
25044 Search for @var{file} and insert its text at the current point in the
25045 specs file.
25046
25047 @item %include_noerr <@var{file}>
25048 @cindex @code{%include_noerr}
25049 Just like @samp{%include}, but do not generate an error message if the include
25050 file cannot be found.
25051
25052 @item %rename @var{old_name} @var{new_name}
25053 @cindex @code{%rename}
25054 Rename the spec string @var{old_name} to @var{new_name}.
25055
25056 @end table
25057
25058 @item *[@var{spec_name}]:
25059 This tells the compiler to create, override or delete the named spec
25060 string. All lines after this directive up to the next directive or
25061 blank line are considered to be the text for the spec string. If this
25062 results in an empty string then the spec is deleted. (Or, if the
25063 spec did not exist, then nothing happens.) Otherwise, if the spec
25064 does not currently exist a new spec is created. If the spec does
25065 exist then its contents are overridden by the text of this
25066 directive, unless the first character of that text is the @samp{+}
25067 character, in which case the text is appended to the spec.
25068
25069 @item [@var{suffix}]:
25070 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
25071 and up to the next directive or blank line are considered to make up the
25072 spec string for the indicated suffix. When the compiler encounters an
25073 input file with the named suffix, it processes the spec string in
25074 order to work out how to compile that file. For example:
25075
25076 @smallexample
25077 .ZZ:
25078 z-compile -input %i
25079 @end smallexample
25080
25081 This says that any input file whose name ends in @samp{.ZZ} should be
25082 passed to the program @samp{z-compile}, which should be invoked with the
25083 command-line switch @option{-input} and with the result of performing the
25084 @samp{%i} substitution. (See below.)
25085
25086 As an alternative to providing a spec string, the text following a
25087 suffix directive can be one of the following:
25088
25089 @table @code
25090 @item @@@var{language}
25091 This says that the suffix is an alias for a known @var{language}. This is
25092 similar to using the @option{-x} command-line switch to GCC to specify a
25093 language explicitly. For example:
25094
25095 @smallexample
25096 .ZZ:
25097 @@c++
25098 @end smallexample
25099
25100 Says that .ZZ files are, in fact, C++ source files.
25101
25102 @item #@var{name}
25103 This causes an error messages saying:
25104
25105 @smallexample
25106 @var{name} compiler not installed on this system.
25107 @end smallexample
25108 @end table
25109
25110 GCC already has an extensive list of suffixes built into it.
25111 This directive adds an entry to the end of the list of suffixes, but
25112 since the list is searched from the end backwards, it is effectively
25113 possible to override earlier entries using this technique.
25114
25115 @end table
25116
25117 GCC has the following spec strings built into it. Spec files can
25118 override these strings or create their own. Note that individual
25119 targets can also add their own spec strings to this list.
25120
25121 @smallexample
25122 asm Options to pass to the assembler
25123 asm_final Options to pass to the assembler post-processor
25124 cpp Options to pass to the C preprocessor
25125 cc1 Options to pass to the C compiler
25126 cc1plus Options to pass to the C++ compiler
25127 endfile Object files to include at the end of the link
25128 link Options to pass to the linker
25129 lib Libraries to include on the command line to the linker
25130 libgcc Decides which GCC support library to pass to the linker
25131 linker Sets the name of the linker
25132 predefines Defines to be passed to the C preprocessor
25133 signed_char Defines to pass to CPP to say whether @code{char} is signed
25134 by default
25135 startfile Object files to include at the start of the link
25136 @end smallexample
25137
25138 Here is a small example of a spec file:
25139
25140 @smallexample
25141 %rename lib old_lib
25142
25143 *lib:
25144 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
25145 @end smallexample
25146
25147 This example renames the spec called @samp{lib} to @samp{old_lib} and
25148 then overrides the previous definition of @samp{lib} with a new one.
25149 The new definition adds in some extra command-line options before
25150 including the text of the old definition.
25151
25152 @dfn{Spec strings} are a list of command-line options to be passed to their
25153 corresponding program. In addition, the spec strings can contain
25154 @samp{%}-prefixed sequences to substitute variable text or to
25155 conditionally insert text into the command line. Using these constructs
25156 it is possible to generate quite complex command lines.
25157
25158 Here is a table of all defined @samp{%}-sequences for spec
25159 strings. Note that spaces are not generated automatically around the
25160 results of expanding these sequences. Therefore you can concatenate them
25161 together or combine them with constant text in a single argument.
25162
25163 @table @code
25164 @item %%
25165 Substitute one @samp{%} into the program name or argument.
25166
25167 @item %i
25168 Substitute the name of the input file being processed.
25169
25170 @item %b
25171 Substitute the basename of the input file being processed.
25172 This is the substring up to (and not including) the last period
25173 and not including the directory.
25174
25175 @item %B
25176 This is the same as @samp{%b}, but include the file suffix (text after
25177 the last period).
25178
25179 @item %d
25180 Marks the argument containing or following the @samp{%d} as a
25181 temporary file name, so that that file is deleted if GCC exits
25182 successfully. Unlike @samp{%g}, this contributes no text to the
25183 argument.
25184
25185 @item %g@var{suffix}
25186 Substitute a file name that has suffix @var{suffix} and is chosen
25187 once per compilation, and mark the argument in the same way as
25188 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
25189 name is now chosen in a way that is hard to predict even when previously
25190 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
25191 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
25192 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
25193 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
25194 was simply substituted with a file name chosen once per compilation,
25195 without regard to any appended suffix (which was therefore treated
25196 just like ordinary text), making such attacks more likely to succeed.
25197
25198 @item %u@var{suffix}
25199 Like @samp{%g}, but generates a new temporary file name
25200 each time it appears instead of once per compilation.
25201
25202 @item %U@var{suffix}
25203 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
25204 new one if there is no such last file name. In the absence of any
25205 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
25206 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
25207 involves the generation of two distinct file names, one
25208 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
25209 simply substituted with a file name chosen for the previous @samp{%u},
25210 without regard to any appended suffix.
25211
25212 @item %j@var{suffix}
25213 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
25214 writable, and if @option{-save-temps} is not used;
25215 otherwise, substitute the name
25216 of a temporary file, just like @samp{%u}. This temporary file is not
25217 meant for communication between processes, but rather as a junk
25218 disposal mechanism.
25219
25220 @item %|@var{suffix}
25221 @itemx %m@var{suffix}
25222 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
25223 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
25224 all. These are the two most common ways to instruct a program that it
25225 should read from standard input or write to standard output. If you
25226 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
25227 construct: see for example @file{f/lang-specs.h}.
25228
25229 @item %.@var{SUFFIX}
25230 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
25231 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
25232 terminated by the next space or %.
25233
25234 @item %w
25235 Marks the argument containing or following the @samp{%w} as the
25236 designated output file of this compilation. This puts the argument
25237 into the sequence of arguments that @samp{%o} substitutes.
25238
25239 @item %o
25240 Substitutes the names of all the output files, with spaces
25241 automatically placed around them. You should write spaces
25242 around the @samp{%o} as well or the results are undefined.
25243 @samp{%o} is for use in the specs for running the linker.
25244 Input files whose names have no recognized suffix are not compiled
25245 at all, but they are included among the output files, so they are
25246 linked.
25247
25248 @item %O
25249 Substitutes the suffix for object files. Note that this is
25250 handled specially when it immediately follows @samp{%g, %u, or %U},
25251 because of the need for those to form complete file names. The
25252 handling is such that @samp{%O} is treated exactly as if it had already
25253 been substituted, except that @samp{%g, %u, and %U} do not currently
25254 support additional @var{suffix} characters following @samp{%O} as they do
25255 following, for example, @samp{.o}.
25256
25257 @item %p
25258 Substitutes the standard macro predefinitions for the
25259 current target machine. Use this when running @command{cpp}.
25260
25261 @item %P
25262 Like @samp{%p}, but puts @samp{__} before and after the name of each
25263 predefined macro, except for macros that start with @samp{__} or with
25264 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
25265 C@.
25266
25267 @item %I
25268 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
25269 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
25270 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
25271 and @option{-imultilib} as necessary.
25272
25273 @item %s
25274 Current argument is the name of a library or startup file of some sort.
25275 Search for that file in a standard list of directories and substitute
25276 the full name found. The current working directory is included in the
25277 list of directories scanned.
25278
25279 @item %T
25280 Current argument is the name of a linker script. Search for that file
25281 in the current list of directories to scan for libraries. If the file
25282 is located insert a @option{--script} option into the command line
25283 followed by the full path name found. If the file is not found then
25284 generate an error message. Note: the current working directory is not
25285 searched.
25286
25287 @item %e@var{str}
25288 Print @var{str} as an error message. @var{str} is terminated by a newline.
25289 Use this when inconsistent options are detected.
25290
25291 @item %(@var{name})
25292 Substitute the contents of spec string @var{name} at this point.
25293
25294 @item %x@{@var{option}@}
25295 Accumulate an option for @samp{%X}.
25296
25297 @item %X
25298 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
25299 spec string.
25300
25301 @item %Y
25302 Output the accumulated assembler options specified by @option{-Wa}.
25303
25304 @item %Z
25305 Output the accumulated preprocessor options specified by @option{-Wp}.
25306
25307 @item %a
25308 Process the @code{asm} spec. This is used to compute the
25309 switches to be passed to the assembler.
25310
25311 @item %A
25312 Process the @code{asm_final} spec. This is a spec string for
25313 passing switches to an assembler post-processor, if such a program is
25314 needed.
25315
25316 @item %l
25317 Process the @code{link} spec. This is the spec for computing the
25318 command line passed to the linker. Typically it makes use of the
25319 @samp{%L %G %S %D and %E} sequences.
25320
25321 @item %D
25322 Dump out a @option{-L} option for each directory that GCC believes might
25323 contain startup files. If the target supports multilibs then the
25324 current multilib directory is prepended to each of these paths.
25325
25326 @item %L
25327 Process the @code{lib} spec. This is a spec string for deciding which
25328 libraries are included on the command line to the linker.
25329
25330 @item %G
25331 Process the @code{libgcc} spec. This is a spec string for deciding
25332 which GCC support library is included on the command line to the linker.
25333
25334 @item %S
25335 Process the @code{startfile} spec. This is a spec for deciding which
25336 object files are the first ones passed to the linker. Typically
25337 this might be a file named @file{crt0.o}.
25338
25339 @item %E
25340 Process the @code{endfile} spec. This is a spec string that specifies
25341 the last object files that are passed to the linker.
25342
25343 @item %C
25344 Process the @code{cpp} spec. This is used to construct the arguments
25345 to be passed to the C preprocessor.
25346
25347 @item %1
25348 Process the @code{cc1} spec. This is used to construct the options to be
25349 passed to the actual C compiler (@command{cc1}).
25350
25351 @item %2
25352 Process the @code{cc1plus} spec. This is used to construct the options to be
25353 passed to the actual C++ compiler (@command{cc1plus}).
25354
25355 @item %*
25356 Substitute the variable part of a matched option. See below.
25357 Note that each comma in the substituted string is replaced by
25358 a single space.
25359
25360 @item %<@code{S}
25361 Remove all occurrences of @code{-S} from the command line. Note---this
25362 command is position dependent. @samp{%} commands in the spec string
25363 before this one see @code{-S}, @samp{%} commands in the spec string
25364 after this one do not.
25365
25366 @item %:@var{function}(@var{args})
25367 Call the named function @var{function}, passing it @var{args}.
25368 @var{args} is first processed as a nested spec string, then split
25369 into an argument vector in the usual fashion. The function returns
25370 a string which is processed as if it had appeared literally as part
25371 of the current spec.
25372
25373 The following built-in spec functions are provided:
25374
25375 @table @code
25376 @item @code{getenv}
25377 The @code{getenv} spec function takes two arguments: an environment
25378 variable name and a string. If the environment variable is not
25379 defined, a fatal error is issued. Otherwise, the return value is the
25380 value of the environment variable concatenated with the string. For
25381 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
25382
25383 @smallexample
25384 %:getenv(TOPDIR /include)
25385 @end smallexample
25386
25387 expands to @file{/path/to/top/include}.
25388
25389 @item @code{if-exists}
25390 The @code{if-exists} spec function takes one argument, an absolute
25391 pathname to a file. If the file exists, @code{if-exists} returns the
25392 pathname. Here is a small example of its usage:
25393
25394 @smallexample
25395 *startfile:
25396 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
25397 @end smallexample
25398
25399 @item @code{if-exists-else}
25400 The @code{if-exists-else} spec function is similar to the @code{if-exists}
25401 spec function, except that it takes two arguments. The first argument is
25402 an absolute pathname to a file. If the file exists, @code{if-exists-else}
25403 returns the pathname. If it does not exist, it returns the second argument.
25404 This way, @code{if-exists-else} can be used to select one file or another,
25405 based on the existence of the first. Here is a small example of its usage:
25406
25407 @smallexample
25408 *startfile:
25409 crt0%O%s %:if-exists(crti%O%s) \
25410 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
25411 @end smallexample
25412
25413 @item @code{replace-outfile}
25414 The @code{replace-outfile} spec function takes two arguments. It looks for the
25415 first argument in the outfiles array and replaces it with the second argument. Here
25416 is a small example of its usage:
25417
25418 @smallexample
25419 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
25420 @end smallexample
25421
25422 @item @code{remove-outfile}
25423 The @code{remove-outfile} spec function takes one argument. It looks for the
25424 first argument in the outfiles array and removes it. Here is a small example
25425 its usage:
25426
25427 @smallexample
25428 %:remove-outfile(-lm)
25429 @end smallexample
25430
25431 @item @code{pass-through-libs}
25432 The @code{pass-through-libs} spec function takes any number of arguments. It
25433 finds any @option{-l} options and any non-options ending in @file{.a} (which it
25434 assumes are the names of linker input library archive files) and returns a
25435 result containing all the found arguments each prepended by
25436 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
25437 intended to be passed to the LTO linker plugin.
25438
25439 @smallexample
25440 %:pass-through-libs(%G %L %G)
25441 @end smallexample
25442
25443 @item @code{print-asm-header}
25444 The @code{print-asm-header} function takes no arguments and simply
25445 prints a banner like:
25446
25447 @smallexample
25448 Assembler options
25449 =================
25450
25451 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
25452 @end smallexample
25453
25454 It is used to separate compiler options from assembler options
25455 in the @option{--target-help} output.
25456 @end table
25457
25458 @item %@{@code{S}@}
25459 Substitutes the @code{-S} switch, if that switch is given to GCC@.
25460 If that switch is not specified, this substitutes nothing. Note that
25461 the leading dash is omitted when specifying this option, and it is
25462 automatically inserted if the substitution is performed. Thus the spec
25463 string @samp{%@{foo@}} matches the command-line option @option{-foo}
25464 and outputs the command-line option @option{-foo}.
25465
25466 @item %W@{@code{S}@}
25467 Like %@{@code{S}@} but mark last argument supplied within as a file to be
25468 deleted on failure.
25469
25470 @item %@{@code{S}*@}
25471 Substitutes all the switches specified to GCC whose names start
25472 with @code{-S}, but which also take an argument. This is used for
25473 switches like @option{-o}, @option{-D}, @option{-I}, etc.
25474 GCC considers @option{-o foo} as being
25475 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
25476 text, including the space. Thus two arguments are generated.
25477
25478 @item %@{@code{S}*&@code{T}*@}
25479 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
25480 (the order of @code{S} and @code{T} in the spec is not significant).
25481 There can be any number of ampersand-separated variables; for each the
25482 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
25483
25484 @item %@{@code{S}:@code{X}@}
25485 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
25486
25487 @item %@{!@code{S}:@code{X}@}
25488 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
25489
25490 @item %@{@code{S}*:@code{X}@}
25491 Substitutes @code{X} if one or more switches whose names start with
25492 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
25493 once, no matter how many such switches appeared. However, if @code{%*}
25494 appears somewhere in @code{X}, then @code{X} is substituted once
25495 for each matching switch, with the @code{%*} replaced by the part of
25496 that switch matching the @code{*}.
25497
25498 If @code{%*} appears as the last part of a spec sequence then a space
25499 is added after the end of the last substitution. If there is more
25500 text in the sequence, however, then a space is not generated. This
25501 allows the @code{%*} substitution to be used as part of a larger
25502 string. For example, a spec string like this:
25503
25504 @smallexample
25505 %@{mcu=*:--script=%*/memory.ld@}
25506 @end smallexample
25507
25508 @noindent
25509 when matching an option like @option{-mcu=newchip} produces:
25510
25511 @smallexample
25512 --script=newchip/memory.ld
25513 @end smallexample
25514
25515 @item %@{.@code{S}:@code{X}@}
25516 Substitutes @code{X}, if processing a file with suffix @code{S}.
25517
25518 @item %@{!.@code{S}:@code{X}@}
25519 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
25520
25521 @item %@{,@code{S}:@code{X}@}
25522 Substitutes @code{X}, if processing a file for language @code{S}.
25523
25524 @item %@{!,@code{S}:@code{X}@}
25525 Substitutes @code{X}, if not processing a file for language @code{S}.
25526
25527 @item %@{@code{S}|@code{P}:@code{X}@}
25528 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
25529 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
25530 @code{*} sequences as well, although they have a stronger binding than
25531 the @samp{|}. If @code{%*} appears in @code{X}, all of the
25532 alternatives must be starred, and only the first matching alternative
25533 is substituted.
25534
25535 For example, a spec string like this:
25536
25537 @smallexample
25538 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
25539 @end smallexample
25540
25541 @noindent
25542 outputs the following command-line options from the following input
25543 command-line options:
25544
25545 @smallexample
25546 fred.c -foo -baz
25547 jim.d -bar -boggle
25548 -d fred.c -foo -baz -boggle
25549 -d jim.d -bar -baz -boggle
25550 @end smallexample
25551
25552 @item %@{S:X; T:Y; :D@}
25553
25554 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
25555 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
25556 be as many clauses as you need. This may be combined with @code{.},
25557 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
25558
25559
25560 @end table
25561
25562 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
25563 construct may contain other nested @samp{%} constructs or spaces, or
25564 even newlines. They are processed as usual, as described above.
25565 Trailing white space in @code{X} is ignored. White space may also
25566 appear anywhere on the left side of the colon in these constructs,
25567 except between @code{.} or @code{*} and the corresponding word.
25568
25569 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
25570 handled specifically in these constructs. If another value of
25571 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
25572 @option{-W} switch is found later in the command line, the earlier
25573 switch value is ignored, except with @{@code{S}*@} where @code{S} is
25574 just one letter, which passes all matching options.
25575
25576 The character @samp{|} at the beginning of the predicate text is used to
25577 indicate that a command should be piped to the following command, but
25578 only if @option{-pipe} is specified.
25579
25580 It is built into GCC which switches take arguments and which do not.
25581 (You might think it would be useful to generalize this to allow each
25582 compiler's spec to say which switches take arguments. But this cannot
25583 be done in a consistent fashion. GCC cannot even decide which input
25584 files have been specified without knowing which switches take arguments,
25585 and it must know which input files to compile in order to tell which
25586 compilers to run).
25587
25588 GCC also knows implicitly that arguments starting in @option{-l} are to be
25589 treated as compiler output files, and passed to the linker in their
25590 proper position among the other output files.
25591
25592 @node Environment Variables
25593 @section Environment Variables Affecting GCC
25594 @cindex environment variables
25595
25596 @c man begin ENVIRONMENT
25597 This section describes several environment variables that affect how GCC
25598 operates. Some of them work by specifying directories or prefixes to use
25599 when searching for various kinds of files. Some are used to specify other
25600 aspects of the compilation environment.
25601
25602 Note that you can also specify places to search using options such as
25603 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
25604 take precedence over places specified using environment variables, which
25605 in turn take precedence over those specified by the configuration of GCC@.
25606 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
25607 GNU Compiler Collection (GCC) Internals}.
25608
25609 @table @env
25610 @item LANG
25611 @itemx LC_CTYPE
25612 @c @itemx LC_COLLATE
25613 @itemx LC_MESSAGES
25614 @c @itemx LC_MONETARY
25615 @c @itemx LC_NUMERIC
25616 @c @itemx LC_TIME
25617 @itemx LC_ALL
25618 @findex LANG
25619 @findex LC_CTYPE
25620 @c @findex LC_COLLATE
25621 @findex LC_MESSAGES
25622 @c @findex LC_MONETARY
25623 @c @findex LC_NUMERIC
25624 @c @findex LC_TIME
25625 @findex LC_ALL
25626 @cindex locale
25627 These environment variables control the way that GCC uses
25628 localization information which allows GCC to work with different
25629 national conventions. GCC inspects the locale categories
25630 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
25631 so. These locale categories can be set to any value supported by your
25632 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
25633 Kingdom encoded in UTF-8.
25634
25635 The @env{LC_CTYPE} environment variable specifies character
25636 classification. GCC uses it to determine the character boundaries in
25637 a string; this is needed for some multibyte encodings that contain quote
25638 and escape characters that are otherwise interpreted as a string
25639 end or escape.
25640
25641 The @env{LC_MESSAGES} environment variable specifies the language to
25642 use in diagnostic messages.
25643
25644 If the @env{LC_ALL} environment variable is set, it overrides the value
25645 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
25646 and @env{LC_MESSAGES} default to the value of the @env{LANG}
25647 environment variable. If none of these variables are set, GCC
25648 defaults to traditional C English behavior.
25649
25650 @item TMPDIR
25651 @findex TMPDIR
25652 If @env{TMPDIR} is set, it specifies the directory to use for temporary
25653 files. GCC uses temporary files to hold the output of one stage of
25654 compilation which is to be used as input to the next stage: for example,
25655 the output of the preprocessor, which is the input to the compiler
25656 proper.
25657
25658 @item GCC_COMPARE_DEBUG
25659 @findex GCC_COMPARE_DEBUG
25660 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
25661 @option{-fcompare-debug} to the compiler driver. See the documentation
25662 of this option for more details.
25663
25664 @item GCC_EXEC_PREFIX
25665 @findex GCC_EXEC_PREFIX
25666 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
25667 names of the subprograms executed by the compiler. No slash is added
25668 when this prefix is combined with the name of a subprogram, but you can
25669 specify a prefix that ends with a slash if you wish.
25670
25671 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
25672 an appropriate prefix to use based on the pathname it is invoked with.
25673
25674 If GCC cannot find the subprogram using the specified prefix, it
25675 tries looking in the usual places for the subprogram.
25676
25677 The default value of @env{GCC_EXEC_PREFIX} is
25678 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
25679 the installed compiler. In many cases @var{prefix} is the value
25680 of @code{prefix} when you ran the @file{configure} script.
25681
25682 Other prefixes specified with @option{-B} take precedence over this prefix.
25683
25684 This prefix is also used for finding files such as @file{crt0.o} that are
25685 used for linking.
25686
25687 In addition, the prefix is used in an unusual way in finding the
25688 directories to search for header files. For each of the standard
25689 directories whose name normally begins with @samp{/usr/local/lib/gcc}
25690 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
25691 replacing that beginning with the specified prefix to produce an
25692 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
25693 @file{foo/bar} just before it searches the standard directory
25694 @file{/usr/local/lib/bar}.
25695 If a standard directory begins with the configured
25696 @var{prefix} then the value of @var{prefix} is replaced by
25697 @env{GCC_EXEC_PREFIX} when looking for header files.
25698
25699 @item COMPILER_PATH
25700 @findex COMPILER_PATH
25701 The value of @env{COMPILER_PATH} is a colon-separated list of
25702 directories, much like @env{PATH}. GCC tries the directories thus
25703 specified when searching for subprograms, if it can't find the
25704 subprograms using @env{GCC_EXEC_PREFIX}.
25705
25706 @item LIBRARY_PATH
25707 @findex LIBRARY_PATH
25708 The value of @env{LIBRARY_PATH} is a colon-separated list of
25709 directories, much like @env{PATH}. When configured as a native compiler,
25710 GCC tries the directories thus specified when searching for special
25711 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
25712 using GCC also uses these directories when searching for ordinary
25713 libraries for the @option{-l} option (but directories specified with
25714 @option{-L} come first).
25715
25716 @item LANG
25717 @findex LANG
25718 @cindex locale definition
25719 This variable is used to pass locale information to the compiler. One way in
25720 which this information is used is to determine the character set to be used
25721 when character literals, string literals and comments are parsed in C and C++.
25722 When the compiler is configured to allow multibyte characters,
25723 the following values for @env{LANG} are recognized:
25724
25725 @table @samp
25726 @item C-JIS
25727 Recognize JIS characters.
25728 @item C-SJIS
25729 Recognize SJIS characters.
25730 @item C-EUCJP
25731 Recognize EUCJP characters.
25732 @end table
25733
25734 If @env{LANG} is not defined, or if it has some other value, then the
25735 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
25736 recognize and translate multibyte characters.
25737 @end table
25738
25739 @noindent
25740 Some additional environment variables affect the behavior of the
25741 preprocessor.
25742
25743 @include cppenv.texi
25744
25745 @c man end
25746
25747 @node Precompiled Headers
25748 @section Using Precompiled Headers
25749 @cindex precompiled headers
25750 @cindex speed of compilation
25751
25752 Often large projects have many header files that are included in every
25753 source file. The time the compiler takes to process these header files
25754 over and over again can account for nearly all of the time required to
25755 build the project. To make builds faster, GCC allows you to
25756 @dfn{precompile} a header file.
25757
25758 To create a precompiled header file, simply compile it as you would any
25759 other file, if necessary using the @option{-x} option to make the driver
25760 treat it as a C or C++ header file. You may want to use a
25761 tool like @command{make} to keep the precompiled header up-to-date when
25762 the headers it contains change.
25763
25764 A precompiled header file is searched for when @code{#include} is
25765 seen in the compilation. As it searches for the included file
25766 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
25767 compiler looks for a precompiled header in each directory just before it
25768 looks for the include file in that directory. The name searched for is
25769 the name specified in the @code{#include} with @samp{.gch} appended. If
25770 the precompiled header file can't be used, it is ignored.
25771
25772 For instance, if you have @code{#include "all.h"}, and you have
25773 @file{all.h.gch} in the same directory as @file{all.h}, then the
25774 precompiled header file is used if possible, and the original
25775 header is used otherwise.
25776
25777 Alternatively, you might decide to put the precompiled header file in a
25778 directory and use @option{-I} to ensure that directory is searched
25779 before (or instead of) the directory containing the original header.
25780 Then, if you want to check that the precompiled header file is always
25781 used, you can put a file of the same name as the original header in this
25782 directory containing an @code{#error} command.
25783
25784 This also works with @option{-include}. So yet another way to use
25785 precompiled headers, good for projects not designed with precompiled
25786 header files in mind, is to simply take most of the header files used by
25787 a project, include them from another header file, precompile that header
25788 file, and @option{-include} the precompiled header. If the header files
25789 have guards against multiple inclusion, they are skipped because
25790 they've already been included (in the precompiled header).
25791
25792 If you need to precompile the same header file for different
25793 languages, targets, or compiler options, you can instead make a
25794 @emph{directory} named like @file{all.h.gch}, and put each precompiled
25795 header in the directory, perhaps using @option{-o}. It doesn't matter
25796 what you call the files in the directory; every precompiled header in
25797 the directory is considered. The first precompiled header
25798 encountered in the directory that is valid for this compilation is
25799 used; they're searched in no particular order.
25800
25801 There are many other possibilities, limited only by your imagination,
25802 good sense, and the constraints of your build system.
25803
25804 A precompiled header file can be used only when these conditions apply:
25805
25806 @itemize
25807 @item
25808 Only one precompiled header can be used in a particular compilation.
25809
25810 @item
25811 A precompiled header can't be used once the first C token is seen. You
25812 can have preprocessor directives before a precompiled header; you cannot
25813 include a precompiled header from inside another header.
25814
25815 @item
25816 The precompiled header file must be produced for the same language as
25817 the current compilation. You can't use a C precompiled header for a C++
25818 compilation.
25819
25820 @item
25821 The precompiled header file must have been produced by the same compiler
25822 binary as the current compilation is using.
25823
25824 @item
25825 Any macros defined before the precompiled header is included must
25826 either be defined in the same way as when the precompiled header was
25827 generated, or must not affect the precompiled header, which usually
25828 means that they don't appear in the precompiled header at all.
25829
25830 The @option{-D} option is one way to define a macro before a
25831 precompiled header is included; using a @code{#define} can also do it.
25832 There are also some options that define macros implicitly, like
25833 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
25834 defined this way.
25835
25836 @item If debugging information is output when using the precompiled
25837 header, using @option{-g} or similar, the same kind of debugging information
25838 must have been output when building the precompiled header. However,
25839 a precompiled header built using @option{-g} can be used in a compilation
25840 when no debugging information is being output.
25841
25842 @item The same @option{-m} options must generally be used when building
25843 and using the precompiled header. @xref{Submodel Options},
25844 for any cases where this rule is relaxed.
25845
25846 @item Each of the following options must be the same when building and using
25847 the precompiled header:
25848
25849 @gccoptlist{-fexceptions}
25850
25851 @item
25852 Some other command-line options starting with @option{-f},
25853 @option{-p}, or @option{-O} must be defined in the same way as when
25854 the precompiled header was generated. At present, it's not clear
25855 which options are safe to change and which are not; the safest choice
25856 is to use exactly the same options when generating and using the
25857 precompiled header. The following are known to be safe:
25858
25859 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
25860 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
25861 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
25862 -pedantic-errors}
25863
25864 @end itemize
25865
25866 For all of these except the last, the compiler automatically
25867 ignores the precompiled header if the conditions aren't met. If you
25868 find an option combination that doesn't work and doesn't cause the
25869 precompiled header to be ignored, please consider filing a bug report,
25870 see @ref{Bugs}.
25871
25872 If you do use differing options when generating and using the
25873 precompiled header, the actual behavior is a mixture of the
25874 behavior for the options. For instance, if you use @option{-g} to
25875 generate the precompiled header but not when using it, you may or may
25876 not get debugging information for routines in the precompiled header.